浏览代码

Missing some var declarations

Nicolas Rosset 4 年之前
父节点
当前提交
eab1e02e4c
共有 2 个文件被更改,包括 14 次插入10 次删除
  1. 12 10
      tarteaucitron.js
  2. 2 0
      tarteaucitron.services.js

+ 12 - 10
tarteaucitron.js

@@ -293,7 +293,7 @@ var tarteaucitron = {
                     }
                     }
                     document.getElementsByTagName('head')[0].appendChild(customThemePopup);
                     document.getElementsByTagName('head')[0].appendChild(customThemePopup);
                 }
                 }
-                
+
                 var body = document.body,
                 var body = document.body,
                     div = document.createElement('div'),
                     div = document.createElement('div'),
                     html = '',
                     html = '',
@@ -660,7 +660,7 @@ var tarteaucitron = {
 
 
                 // add a little timeout to be sure everything is accessible
                 // add a little timeout to be sure everything is accessible
                 setTimeout(function () {
                 setTimeout(function () {
-                    
+
                     // Setup events
                     // Setup events
                     tarteaucitron.addClickEventToId("tarteaucitronCloseCross", function () {
                     tarteaucitron.addClickEventToId("tarteaucitronCloseCross", function () {
                         tarteaucitron.userInterface.closeAlert();
                         tarteaucitron.userInterface.closeAlert();
@@ -710,7 +710,8 @@ var tarteaucitron = {
                     tarteaucitron.addClickEventToId("tarteaucitronCTAButton", function () {
                     tarteaucitron.addClickEventToId("tarteaucitronCTAButton", function () {
                         location.reload();
                         location.reload();
                     });
                     });
-                    var toggleBtns = document.getElementsByClassName("catToggleBtn"), i;
+                    var i,
+                        toggleBtns = document.getElementsByClassName("catToggleBtn"), i;
                     for (i = 0; i < toggleBtns.length; i++) {
                     for (i = 0; i < toggleBtns.length; i++) {
                         toggleBtns[i].dataset.index = i;
                         toggleBtns[i].dataset.index = i;
                         tarteaucitron.addClickEventToElement(toggleBtns[i], function () {
                         tarteaucitron.addClickEventToElement(toggleBtns[i], function () {
@@ -735,7 +736,7 @@ var tarteaucitron = {
                         tarteaucitron.events.load();
                         tarteaucitron.events.load();
                     }
                     }
                 }, 500);
                 }, 500);
-                
+
             });
             });
         });
         });
     },
     },
@@ -908,12 +909,12 @@ var tarteaucitron = {
                 } else {
                 } else {
 
 
                     document.getElementById(id).style[property] = value;
                     document.getElementById(id).style[property] = value;
-                    
+
                     if (property == "display" && value == "block" && (id == "tarteaucitron" || id == "tarteaucitronAlertBig")) {
                     if (property == "display" && value == "block" && (id == "tarteaucitron" || id == "tarteaucitronAlertBig")) {
                         document.getElementById(id).style["opacity"] = "0";
                         document.getElementById(id).style["opacity"] = "0";
                         setTimeout(function() {document.getElementById(id).style["opacity"] = "1";}, 1);
                         setTimeout(function() {document.getElementById(id).style["opacity"] = "1";}, 1);
                     }
                     }
-                    
+
                     if (property == "display" && value == "block" && id == "tarteaucitronBack") {
                     if (property == "display" && value == "block" && id == "tarteaucitronBack") {
                         document.getElementById(id).style["opacity"] = "0";
                         document.getElementById(id).style["opacity"] = "0";
                         setTimeout(function() {document.getElementById(id).style["opacity"] = "0.7";}, 1);
                         setTimeout(function() {document.getElementById(id).style["opacity"] = "0.7";}, 1);
@@ -1110,10 +1111,10 @@ var tarteaucitron = {
                     groupallowed = 0;
                     groupallowed = 0;
                 for (var ii = 0; ii < doc.children.length; ii++) {
                 for (var ii = 0; ii < doc.children.length; ii++) {
                     if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsDenied") {
                     if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsDenied") {
-                        groupdenied++;                        
+                        groupdenied++;
                     }
                     }
                     if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsAllowed") {
                     if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsAllowed") {
-                        groupallowed++;                        
+                        groupallowed++;
                     }
                     }
                 }
                 }
                 if (total === groupallowed) {
                 if (total === groupallowed) {
@@ -1128,8 +1129,8 @@ var tarteaucitron = {
                     tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
                     tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
                     tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
                     tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
                 }
                 }
-                groupdenied = 0;   
-                groupallowed = 0; 
+                groupdenied = 0;
+                groupallowed = 0;
             });
             });
 
 
         },
         },
@@ -1931,6 +1932,7 @@ var tarteaucitron = {
         /**
         /**
          Utility function to Add or update the fields of obj1 with the ones in obj2
          Utility function to Add or update the fields of obj1 with the ones in obj2
          */
          */
+        var key;
         for(key in custom){
         for(key in custom){
             if(custom[key] instanceof Object){
             if(custom[key] instanceof Object){
                 source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
                 source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);

+ 2 - 0
tarteaucitron.services.js

@@ -1807,6 +1807,7 @@ tarteaucitron.services.googlemaps = {
                 return '<div id="' + uniqId + '" zoom="' + x.getAttribute('zoom') + '" latitude="' + x.getAttribute('latitude') + '" longitude="' + x.getAttribute('longitude') + '" style="width:' + x.offsetWidth + 'px;height:' + x.offsetHeight + 'px"></div>';
                 return '<div id="' + uniqId + '" zoom="' + x.getAttribute('zoom') + '" latitude="' + x.getAttribute('latitude') + '" longitude="' + x.getAttribute('longitude') + '" style="width:' + x.offsetWidth + 'px;height:' + x.offsetHeight + 'px"></div>';
             });
             });
 
 
+            var i;
             for (i = 0; i < uniqIds.length; i += 1) {
             for (i = 0; i < uniqIds.length; i += 1) {
                 mapOptions = {
                 mapOptions = {
                     zoom: parseInt(document.getElementById(uniqIds[i]).getAttribute('zoom'), 10),
                     zoom: parseInt(document.getElementById(uniqIds[i]).getAttribute('zoom'), 10),
@@ -2782,6 +2783,7 @@ tarteaucitron.services.twitterembed = {
         });
         });
 
 
         tarteaucitron.addScript('//platform.twitter.com/widgets.js', 'twitter-wjs', function () {
         tarteaucitron.addScript('//platform.twitter.com/widgets.js', 'twitter-wjs', function () {
+            var i;
             for (i = 0; i < uniqIds.length; i += 1) {
             for (i = 0; i < uniqIds.length; i += 1) {
                 e = document.getElementById(uniqIds[i]);
                 e = document.getElementById(uniqIds[i]);
                 twttr.widgets.createTweet(
                 twttr.widgets.createTweet(