app/views/evercookie/evercookie/get.js.erb in evercookie-0.0.3 vs app/views/evercookie/evercookie/get.js.erb in evercookie-0.0.4
- old
+ new
@@ -1,2 +1,12 @@
-var ec = new <%= Evercookie.js_class %>();
-ec.get('<%= @data[:key] -%>');
+(function(){
+ function getCookie(){
+ var ec = new <%= Evercookie.js_class %>();
+ ec.get('<%= @data[:key] -%>');
+ };
+ if(typeof jQuery != 'undefined') {
+ jQuery(document).ready(getCookie);
+ }
+ else {
+ getCookie();
+ };
+})();
\ No newline at end of file