]> _ Git - fluidbook-html5.git/commitdiff
wip #2208 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Sep 2018 13:13:32 +0000 (15:13 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Sep 2018 13:13:32 +0000 (15:13 +0200)
js/libs/cookie.min.js [new file with mode: 0644]
js/libs/fluidbook/forms/fluidbook.form.avery.js

diff --git a/js/libs/cookie.min.js b/js/libs/cookie.min.js
new file mode 100644 (file)
index 0000000..f33389e
--- /dev/null
@@ -0,0 +1,8 @@
+/**
+ * Minified by jsDelivr using UglifyJS v3.4.2.
+ * Original file: /npm/js-cookie@2.2.0/src/js.cookie.js
+ *
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
+ */
+!function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function g(){for(var e=0,n={};e<arguments.length;e++){var o=arguments[e];for(var t in o)n[t]=o[t]}return n}return function e(l){function C(e,n,o){var t;if("undefined"!=typeof document){if(1<arguments.length){if("number"==typeof(o=g({path:"/"},C.defaults,o)).expires){var r=new Date;r.setMilliseconds(r.getMilliseconds()+864e5*o.expires),o.expires=r}o.expires=o.expires?o.expires.toUTCString():"";try{t=JSON.stringify(n),/^[\{\[]/.test(t)&&(n=t)}catch(e){}n=l.write?l.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var i="";for(var c in o)o[c]&&(i+="; "+c,!0!==o[c]&&(i+="="+o[c]));return document.cookie=e+"="+n+i}e||(t={});for(var a=document.cookie?document.cookie.split("; "):[],s=/(%[0-9A-Z]{2})+/g,f=0;f<a.length;f++){var p=a[f].split("="),d=p.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var u=p[0].replace(s,decodeURIComponent);if(d=l.read?l.read(d,u):l(d,u)||d.replace(s,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(e){}if(e===u){t=d;break}e||(t[u]=d)}catch(e){}}return t}}return(C.set=C).get=function(e){return C.call(C,e)},C.getJSON=function(){return C.apply({json:!0},[].slice.call(arguments))},C.defaults={},C.remove=function(e,n){C(e,"",g(n,{expires:-1}))},C.withConverter=e,C}(function(){})});
+//# sourceMappingURL=/sm/31d5cd1b58ce5e6231e4ea03a69b2801a53e76e98152bc29dc82a494ed0a1ee6.map
\ No newline at end of file
index 20dd5b11da65f3d84271531636823096772b9840..08950ecd76412e949ab81e8971c17c11c770c75d 100644 (file)
@@ -65,10 +65,17 @@ FluidbookAveryForm.prototype = {
             return false;
         });
 
+        $(document).on('click', '.mview[data-form="avery"] a.close-avery', function () {
+            Cookies.set('form', '0', {expires: 365});
+            return false;
+        });
+
         $(this.fluidbook).on('fluidbook.splash.hide', function () {
-            $this.openForm('', '', function () {
+            if (Cookies.get('form') === undefined) {
+                $this.openForm('', '', function () {
 
-            });
+                });
+            }
         });
 
 
@@ -79,7 +86,7 @@ FluidbookAveryForm.prototype = {
         var view = '<div class="caption">' + $this.fluidbook.menu.closeButton() + '<h2>' + $this.locale.title + '</h2></div>';
         view += '<div class="content">';
         view += '<form class="avery-form" action="https://workshop.fluidbook.com/services/subscribe" method="post">';
-        view += '<div><input type="hidden" value="avery" name="form">';
+        view += '<div><input type="hidden" value="avery" name="form"><input type="hidden" value="' + this.fluidbook.l10n.lang + '" name="locale">';
         view += '<h3>' + this.locale.subtitle + '</h3>';
         view += '<div class="line">';
         view += '<label>' + $this.locale.company;
@@ -118,7 +125,7 @@ FluidbookAveryForm.prototype = {
         view += '</div>';
         view += '</div>';
         view += '</div>';
-        view += '<div class="fonctions"><a href="#/closeview" class="button back">' + $this.locale.nothanks + '</a><a href="#/submit" class="submit">' + $this.locale.submit + '</a></div>';
+        view += '<div class="fonctions"><a href="#" class="close-avery">' + $this.locale.nothanks + '</a><a href="#" class="submit">' + $this.locale.submit + '</a></div>';
         view += '</form>';
         view += '</div>';
 
@@ -150,6 +157,7 @@ FluidbookAveryForm.prototype = {
                     $this.fluidbook.menu.closeView(function () {
                     }, true, true);
                     $this.fluidbook.hideLoader();
+                    Cookies.set('form', '1', {expires: 365});
                 }, 1000);
             }
         });