Explorar el Código

Add generic iframe service

Amauri CHAMPEAUX hace 7 años
padre
commit
8f7523b710
Se han modificado 1 ficheros con 29 adiciones y 0 borrados
  1. 29 0
      tarteaucitron.services.js

+ 29 - 0
tarteaucitron.services.js

@@ -1,6 +1,35 @@
 /*global tarteaucitron, ga, Shareaholic, stLight, clicky, top, google, Typekit, FB, ferankReady, IN, stButtons, twttr, PCWidget*/
 /*jslint regexp: true, nomen: true*/
 
+// generic iframe
+tarteaucitron.services.iframe = {
+    "key": "iframe",
+    "type": "other",
+    "name": "Web content",
+    "uri": "",
+    "needConsent": true,
+    "cookies": [],
+    "js": function () {
+        "use strict";
+        tarteaucitron.fallback(['tac_iframe'], function (x) {
+            var width = x.getAttribute("width"),
+                height = x.getAttribute("height"),
+                url = x.getAttribute("url");
+            
+            return '<iframe src="' + url + '" width="' + width + '" height="' + height + '" frameborder="0" scrolling="no" allowtransparency allowfullscreen></iframe>';
+        });
+    },
+    "fallback": function () {
+        "use strict";
+        var id = 'iframe';
+        tarteaucitron.fallback(['tac_iframe'], function (elem) {
+            elem.style.width = elem.getAttribute('width') + 'px';
+            elem.style.height = elem.getAttribute('height') + 'px';
+            return tarteaucitron.engage(id);
+        });
+    }
+};
+
 // addthis
 tarteaucitron.services.addthis = {
     "key": "addthis",