]> _ Git - fluidbook-html5.git/commitdiff
wait #3839 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Aug 2020 14:46:26 +0000 (16:46 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Aug 2020 14:46:26 +0000 (16:46 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.stats.js

index 02adc0cb923ee1686facf1621ab74e92ebffe572..5b6e4ac0fa07a5171607d6c2e7ee06fdae9474e3 100644 (file)
@@ -391,6 +391,8 @@ Fluidbook.prototype = {
             }
         }
 
+        $(this).trigger('fluidbook.hashchange',[args.slice()]);
+
         if (args[1] === 'closeview') {
             return this.setCurrentPage(this.currentPage);
         } else if (args[1] === 'page') {
index 37d244bbe3f7d1168896fad8e45b987ebd085f49..934a7421293acaf8785b2bf6eb3034d4aeac7802 100644 (file)
@@ -25,7 +25,7 @@ function FluidbookStats(fluidbook) {
         var e = this.fluidbook.settings.relay_url_params.split(',');\r
         var p = [];\r
         $.each(e, function (k, v) {\r
-            v=v.trim();\r
+            v = v.trim();\r
             if ($_GET[v] !== undefined && $_GET[v] !== null) {\r
                 p.push(v + '=' + encodeURIComponent($_GET[v]));\r
             }\r
@@ -43,6 +43,23 @@ FluidbookStats.prototype = {
             $this.track(6, 0, $(this).attr('data-track'));\r
             return true;\r
         });\r
+\r
+        if (this.fluidbook.settings.tagcommander_id) {\r
+            this.initTagCommander();\r
+        }\r
+    },\r
+\r
+    initTagCommander: function () {\r
+        var $this = this;\r
+        $(this.fluidbook).on('fluidbook.hashchange', function (e, data) {\r
+            data.shift();\r
+            var hash = data.join('/');\r
+            if ($this.fluidbook.settings.tagcommander_plan[hash]) {\r
+                window.tc_vars = {};\r
+                $.extend(window.tc_vars, $this.fluidbook.settings.tagcommander_default_vars, $this.fluidbook.settings.tagcommander_plan[hash]);\r
+                tC.container.reload({events: {page: [{}, {}]}});\r
+            }\r
+        });\r
     },\r
 \r
     track: function (type, page, extra) {\r