1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

Remove jquery on hook

This commit is contained in:
kbparagua 2016-03-01 19:18:36 +08:00
parent e9cf4e9aff
commit 8ac945ce96

View file

@ -1,6 +1,6 @@
<% id = "#{Time.now.to_i}#{(rand * 1000).ceil}" %>
<div class="js-paloma-hook" data-id="<%= id %>">
<div class="js-paloma-hook" data-palomaid="<%= id %>">
<script type="text/javascript">
(function(){
// Do not continue if Paloma not found.
@ -11,7 +11,10 @@
Paloma.env = '<%= Rails.env %>';
// Remove any callback details if any
$('.js-paloma-hook[data-id!=' + <%= id %> + ']').remove();
var hook =
document.querySelector("[data-palomaid='" + <%= id %> + "']")[0];
if (hook) hook.parentNode.removeChild(hook);
var request = <%= request.to_json.html_safe %>;