Plugin Directory

Changeset 3149663


Ignore:
Timestamp:
09/10/2024 09:54:54 PM (18 months ago)
Author:
wildoperation
Message:

Update to version 1.1.7 from GitHub

Location:
ad-commander
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ad-commander/tags/1.1.7/ad-commander.php

    r3139166 r3149663  
    44 * Plugin URI:      https://github.com/wildoperation/Ad-Commander
    55 * Description:     Insert, schedule and track custom advertising banners or script ads from AdSense, Amazon, and other affiliate networks into your site.
    6  * Version:         1.1.6
     6 * Version:         1.1.7
    77 * Author:          Wild Operation
    88 * Author URI:      https://wildoperation.com
     
    1414 * @subpackage Ad Commander - Banner & Ad Manager
    1515 * @since 1.0.0
    16  * @version 1.1.6
     16 * @version 1.1.7
    1717 */
    1818
  • ad-commander/tags/1.1.7/dist/js/rotate.js

    r3101435 r3149663  
    1 (()=>{function t(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){s=!0,o=t},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}!function(){var e="undefined"!=typeof window?window:this,r=e.WORotate=function(t,e){var r=this;if(t._worotate)return t._worotate;r.ele=t,r.ele._worotate=r,r.opt=Object.assign({},{interval:5e3,heightMode:"fixed"},e),r.init()},n=r.prototype;n.getTrackingAdId=function(t){var e=this;if(e.tracker&&void 0!==e.tracker.getTrackingAdId)return e.tracker.getTrackingAdId(t)},n.bindTrackClick=function(t){var e=this;e.tracker&&void 0!==e.tracker.bindTrackClick&&e.tracker.bindTrackClick(t)},n.trackImpression=function(t){var e=this;e.tracker&&void 0!==e.tracker.trackImpressionByElement&&e.tracker.trackImpressionByElement(t)},n.setActive=function(t){var e=this;e.active=t,Array.from(e.slides).forEach((function(t,r){e.active!==r&&t.classList.remove("woactive")})),e.slides[e.active].classList.add("woactive"),e.trackImpression(e.slides[e.active])},n.next=function(){var t=this;t.setActive(t.active<t.slides.length-1?t.active+1:0),t.startInterval()},n.startInterval=function(){var t=this;t.timeout=setTimeout(t.next.bind(t),t.opt.interval)},n.outerHeight=function(t){if(void 0===window.getComputedStyle)return 0;var e=t.offsetHeight,r=window.getComputedStyle(t);return["top","bottom"].map((function(t){return parseInt(r["margin-".concat(t)])})).reduce((function(t,e){return t+e}),e)},n.init=function(){var t=this,e=0;if(t.ele.classList.add("worotate"),t.slides=t.ele.children,t.slides.length<=0)return!1;t.tracker="undefined"!=typeof WOTrack?new WOTrack:null,Array.from(t.slides).forEach((function(r,n){if(t.slides[n].trackId=t.getTrackingAdId(r),t.bindTrackClick(r),"fixed"===t.opt.heightMode){var i=t.outerHeight(r);i>e&&(e=i)}}));var r=Array.from(t.slides).findIndex((function(t){return t.classList.contains("woactive")}));(!r||r<0)&&(r=0),t.setActive(r),t.ele.classList.add("woloaded"),t.slides.length>1&&("fixed"===t.opt.heightMode&&e>0&&(t.ele.style.minHeight=e+"px"),t.startInterval())};e.WORotateInit=function(e){if(e&&void 0!==e&&e.length>0){var n,i=t(e);try{for(i.s();!(n=i.n()).done;){var a=n.value,o=parseInt(a.getAttribute("data-interval"),10);(!o||void 0===o||o<1e3)&&(o=5e3),new r(a,{interval:o})}}catch(t){i.e(t)}finally{i.f()}}}}()})();
     1(()=>{function t(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){s=!0,o=t},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}!function(){var e="undefined"!=typeof window?window:this,r=e.WORotate=function(t,e){var r=this;if(t._worotate)return t._worotate;r.ele=t,r.ele._worotate=r,r.opt=Object.assign({},{interval:5e3,heightMode:"fixed",stopTrack:0},e),r.init()},n=r.prototype;n.getTrackingAdId=function(t){var e=this;if(e.tracker&&void 0!==e.tracker.getTrackingAdId)return e.tracker.getTrackingAdId(t)},n.bindTrackClick=function(t){var e=this;e.tracker&&void 0!==e.tracker.bindTrackClick&&e.tracker.bindTrackClick(t)},n.trackImpression=function(t){var e=this;e.tracker&&void 0!==e.tracker.trackImpressionByElement&&(e.opt.stopTrack<=0||Date.now()-e.initTimestamp<=e.opt.stopTrack)&&e.tracker.trackImpressionByElement(t)},n.setActive=function(t){var e=this;e.active=t,Array.from(e.slides).forEach((function(t,r){e.active!==r&&t.classList.remove("woactive")})),e.slides[e.active].classList.add("woactive"),e.trackImpression(e.slides[e.active])},n.next=function(){var t=this;t.setActive(t.active<t.slides.length-1?t.active+1:0),t.startInterval()},n.startInterval=function(){var t=this;t.timeout=setTimeout(t.next.bind(t),t.opt.interval)},n.outerHeight=function(t){if(void 0===window.getComputedStyle)return 0;var e=t.offsetHeight,r=window.getComputedStyle(t);return["top","bottom"].map((function(t){return parseInt(r["margin-".concat(t)])})).reduce((function(t,e){return t+e}),e)},n.init=function(){var t=this,e=0;if(t.ele.classList.add("worotate"),t.slides=t.ele.children,t.slides.length<=0)return!1;t.initTimestamp=Date.now(),t.tracker="undefined"!=typeof WOTrack?new WOTrack:null,Array.from(t.slides).forEach((function(r,n){if(t.slides[n].trackId=t.getTrackingAdId(r),t.bindTrackClick(r),"fixed"===t.opt.heightMode){var i=t.outerHeight(r);i>e&&(e=i)}}));var r=Array.from(t.slides).findIndex((function(t){return t.classList.contains("woactive")}));(!r||r<0)&&(r=0),t.setActive(r),t.ele.classList.add("woloaded"),t.slides.length>1&&("fixed"===t.opt.heightMode&&e>0&&(t.ele.style.minHeight=e+"px"),t.startInterval())};e.WORotateInit=function(e){if(e&&void 0!==e&&e.length>0){var n,i=t(e);try{for(i.s();!(n=i.n()).done;){var a=n.value,o=parseInt(a.getAttribute("data-interval"),10);(!o||void 0===o||o<1e3)&&(o=5e3);var c=parseInt(a.getAttribute("data-stoptrack"),10);(void 0===c||c<0||isNaN(c))&&(c=0),new r(a,{interval:o,stopTrack:c})}}catch(t){i.e(t)}finally{i.f()}}}}()})();
  • ad-commander/tags/1.1.7/dist/js/rotate.js.map

    r3101424 r3149663  
    1 {"version":3,"file":"/dist/js/rotate.js","mappings":";;;;;;;;AAAA,CAAC,YAAY;EACZ,IAAMA,OAAO,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAG,IAAI;;EAE7D;AACD;AACA;EACC,IAAMC,QAAQ,GAAIF,OAAO,CAACE,QAAQ,GAAG,UAAUC,OAAO,EAAEC,QAAQ,EAAE;IACjE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3B,MAAM,GAAG,CAAC,EAAE;MAAA,IAAA4B,SAAA,GAAAC,0BAAA,CACjDF,QAAQ;QAAAG,KAAA;MAAA;QAA9B,KAAAF,SAAA,CAAAG,CAAA,MAAAD,KAAA,GAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,GAAgC;UAAA,IAArBhE,OAAO,GAAA6D,KAAA,CAAAI,KAAA;UACjB;AACJ;AACA;UACI,IAAIC,OAAO,GAAGvB,QAAQ,CAAC3C,OAAO,CAACmE,YAAY,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;UAEjE,IAAI,CAACD,OAAO,IAAIA,OAAO,KAAKE,SAAS,IAAIF,OAAO,GAAG,IAAI,EAAE;YACxDA,OAAO,GAAG,IAAI;UACf;UAEA,IAAInE,QAAQ,CAACC,OAAO,EAAE;YAAEQ,QAAQ,EAAE0D;UAAQ,CAAC,CAAC;QAC7C;MAAC,SAAAG,GAAA;QAAAV,SAAA,CAAAL,CAAA,CAAAe,GAAA;MAAA;QAAAV,SAAA,CAAAW,CAAA;MAAA;IACF;EACD,CAAE;AACH,CAAC,EAAE,CAAC,C","sources":["webpack://wo/./src/js/front/rotate.js"],"sourcesContent":["(function () {\n\tconst _window = typeof window !== \"undefined\" ? window : this;\n\n\t/**\n\t * WORotate instance\n\t */\n\tconst WORotate = (_window.WORotate = function (element, settings) {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Avoid initializing twice on the same element.\n\t\t */\n\t\tif (element._worotate) {\n\t\t\treturn element._worotate;\n\t\t}\n\n\t\t_.ele = element;\n\t\t_.ele._worotate = _;\n\n\t\t/**\n\t\t * Merge settings with defaults.\n\t\t */\n\t\t_.opt = Object.assign(\n\t\t\t{},\n\t\t\t{ interval: 5000, heightMode: \"fixed\" },\n\t\t\tsettings\n\t\t);\n\n\t\t/**\n\t\t * Iniit\n\t\t */\n\t\t_.init();\n\t});\n\n\t/**\n\t * Prototype functions\n\t */\n\tconst WORotatePrototype = WORotate.prototype;\n\n\t/**\n\t * Interface with WOTrack if it is present.\n\t */\n\tWORotatePrototype.getTrackingAdId = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.getTrackingAdId !== \"undefined\") {\n\t\t\treturn _.tracker.getTrackingAdId(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.bindTrackClick = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.bindTrackClick !== \"undefined\") {\n\t\t\t// click binding will be blocked by tracker if disabled.\n\t\t\t_.tracker.bindTrackClick(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.trackImpression = function (element) {\n\t\tconst _ = this;\n\n\t\tif (\n\t\t\t_.tracker &&\n\t\t\ttypeof _.tracker.trackImpressionByElement !== \"undefined\"\n\t\t) {\n\t\t\t// impression tracking will be blocked by tracker if disabled.\n\t\t\t_.tracker.trackImpressionByElement(element);\n\t\t}\n\t};\n\n\t/**\n\t * Set slide to active\n\t */\n\tWORotatePrototype.setActive = function (idx) {\n\t\tconst _ = this;\n\t\t_.active = idx;\n\n\t\t/**\n\t\t * Remove active class from slides\n\t\t */\n\t\tArray.from(_.slides).forEach((el, i) => {\n\t\t\tif (_.active !== i) {\n\t\t\t\tel.classList.remove(\"woactive\");\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Add active class to slide\n\t\t */\n\t\t_.slides[_.active].classList.add(\"woactive\");\n\n\t\t/**\n\t\t * Track impression\n\t\t */\n\t\t_.trackImpression(_.slides[_.active]);\n\t};\n\n\tWORotatePrototype.next = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Change active slide and start the timeout.\n\t\t */\n\t\t_.setActive(_.active < _.slides.length - 1 ? _.active + 1 : 0);\n\t\t_.startInterval();\n\t};\n\n\tWORotatePrototype.startInterval = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Set a new timeout, bound to this instance\n\t\t */\n\t\t_.timeout = setTimeout(_.next.bind(_), _.opt.interval);\n\t};\n\n\tWORotatePrototype.outerHeight = function (element) {\n\t\tif (typeof window.getComputedStyle === \"undefined\") {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst height = element.offsetHeight,\n\t\t\tstyle = window.getComputedStyle(element);\n\n\t\treturn [\"top\", \"bottom\"]\n\t\t\t.map((side) => parseInt(style[`margin-${side}`]))\n\t\t\t.reduce((total, side) => total + side, height);\n\t};\n\n\tWORotatePrototype.init = function () {\n\t\tconst _ = this;\n\t\tlet slideHeight = 0;\n\n\t\t/**\n\t\t * Add class to container.\n\t\t */\n\t\t_.ele.classList.add(\"worotate\");\n\n\t\t/**\n\t\t * Add all children as slides.\n\t\t */\n\t\t_.slides = _.ele.children;\n\n\t\t/**\n\t\t * No slides? Stop init.\n\t\t */\n\t\tif (_.slides.length <= 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Initiate tracker\n\t\t */\n\t\t_.tracker = typeof WOTrack !== \"undefined\" ? new WOTrack() : null;\n\n\t\t/**\n\t\t * Store tracking ID so DOM can't be manipulated later.\n\t\t * Also grab the slide height if needed.\n\t\t */\n\t\tArray.from(_.slides).forEach((slide, idx) => {\n\t\t\t_.slides[idx].trackId = _.getTrackingAdId(slide);\n\t\t\t_.bindTrackClick(slide);\n\n\t\t\tif (_.opt.heightMode === \"fixed\") {\n\t\t\t\tconst thisH = _.outerHeight(slide);\n\n\t\t\t\tif (thisH > slideHeight) {\n\t\t\t\t\tslideHeight = thisH;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Determine if we have an active slide from the slide markup.\n\t\t */\n\t\tlet active = Array.from(_.slides).findIndex((e) => {\n\t\t\treturn e.classList.contains(\"woactive\");\n\t\t});\n\n\t\tif (!active || active < 0) {\n\t\t\tactive = 0;\n\t\t}\n\n\t\t/**\n\t\t * Set the active slide.\n\t\t */\n\t\t_.setActive(active);\n\t\t_.ele.classList.add(\"woloaded\");\n\n\t\t/**\n\t\t * If we have more than 1 slide, start the rotation interval.\n\t\t */\n\t\tif (_.slides.length > 1) {\n\t\t\t/**\n\t\t\t * Maybe set a min-height.\n\t\t\t */\n\t\t\tif (_.opt.heightMode === \"fixed\" && slideHeight > 0) {\n\t\t\t\t_.ele.style.minHeight = slideHeight + \"px\";\n\t\t\t}\n\n\t\t\t_.startInterval();\n\t\t}\n\t};\n\n\tconst WORotateInit = (_window.WORotateInit = function (elements) {\n\t\t/**\n\t\t * Loop through all rotating ad groups on the page and initialize a WORotate instance.\n\t\t */\n\t\tif (elements && typeof elements !== \"undefined\" && elements.length > 0) {\n\t\t\tfor (const element of elements) {\n\t\t\t\t/**\n\t\t\t\t * Get timeout from data attribute, if one exists.\n\t\t\t\t */\n\t\t\t\tlet refresh = parseInt(element.getAttribute(\"data-interval\"), 10);\n\n\t\t\t\tif (!refresh || refresh === undefined || refresh < 1000) {\n\t\t\t\t\trefresh = 5000;\n\t\t\t\t}\n\n\t\t\t\tnew WORotate(element, { interval: refresh });\n\t\t\t}\n\t\t}\n\t});\n})();\n"],"names":["_window","window","WORotate","element","settings","_","_worotate","ele","opt","Object","assign","interval","heightMode","init","WORotatePrototype","prototype","getTrackingAdId","tracker","bindTrackClick","trackImpression","trackImpressionByElement","setActive","idx","active","Array","from","slides","forEach","el","i","classList","remove","add","next","length","startInterval","timeout","setTimeout","bind","outerHeight","getComputedStyle","height","offsetHeight","style","map","side","parseInt","concat","reduce","total","slideHeight","children","WOTrack","slide","trackId","thisH","findIndex","e","contains","minHeight","WORotateInit","elements","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","refresh","getAttribute","undefined","err","f"],"sourceRoot":""}
     1{"version":3,"file":"/dist/js/rotate.js","mappings":";;;;;;;;AAAA,CAAC,YAAY;EACZ,IAAMA,OAAO,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAG,IAAI;;EAE7D;AACD;AACA;EACC,IAAMC,QAAQ,GAAIF,OAAO,CAACE,QAAQ,GAAG,UAAUC,OAAO,EAAEC,QAAQ,EAAE;IACjE,IAAMC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A,CAAAa,CAAA;MAAA;IACF;EACD,CAAE;AACH,CAAC,EAAE,CAAC,C","sources":["webpack://wo/./src/js/front/rotate.js"],"sourcesContent":["(function () {\n\tconst _window = typeof window !== \"undefined\" ? window : this;\n\n\t/**\n\t * WORotate instance\n\t */\n\tconst WORotate = (_window.WORotate = function (element, settings) {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Avoid initializing twice on the same element.\n\t\t */\n\t\tif (element._worotate) {\n\t\t\treturn element._worotate;\n\t\t}\n\n\t\t_.ele = element;\n\t\t_.ele._worotate = _;\n\n\t\t/**\n\t\t * Merge settings with defaults.\n\t\t */\n\t\t_.opt = Object.assign(\n\t\t\t{},\n\t\t\t{ interval: 5000, heightMode: \"fixed\", stopTrack: 0 },\n\t\t\tsettings\n\t\t);\n\n\t\t/**\n\t\t * Iniit\n\t\t */\n\t\t_.init();\n\t});\n\n\t/**\n\t * Prototype functions\n\t */\n\tconst WORotatePrototype = WORotate.prototype;\n\n\t/**\n\t * Interface with WOTrack if it is present.\n\t */\n\tWORotatePrototype.getTrackingAdId = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.getTrackingAdId !== \"undefined\") {\n\t\t\treturn _.tracker.getTrackingAdId(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.bindTrackClick = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.bindTrackClick !== \"undefined\") {\n\t\t\t// click binding will be blocked by tracker if disabled.\n\t\t\t_.tracker.bindTrackClick(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.trackImpression = function (element) {\n\t\tconst _ = this;\n\n\t\tif (\n\t\t\t_.tracker &&\n\t\t\ttypeof _.tracker.trackImpressionByElement !== \"undefined\"\n\t\t) {\n\t\t\t// impression tracking will be blocked by tracker if disabled.\n\n\t\t\tconsole.log(_.opt.stopTrack);\n\t\t\tif (\n\t\t\t\t_.opt.stopTrack <= 0 ||\n\t\t\t\tDate.now() - _.initTimestamp <= _.opt.stopTrack\n\t\t\t) {\n\t\t\t\t_.tracker.trackImpressionByElement(element);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Set slide to active\n\t */\n\tWORotatePrototype.setActive = function (idx) {\n\t\tconst _ = this;\n\t\t_.active = idx;\n\n\t\t/**\n\t\t * Remove active class from slides\n\t\t */\n\t\tArray.from(_.slides).forEach((el, i) => {\n\t\t\tif (_.active !== i) {\n\t\t\t\tel.classList.remove(\"woactive\");\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Add active class to slide\n\t\t */\n\t\t_.slides[_.active].classList.add(\"woactive\");\n\n\t\t/**\n\t\t * Track impression\n\t\t */\n\t\t_.trackImpression(_.slides[_.active]);\n\t};\n\n\tWORotatePrototype.next = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Change active slide and start the timeout.\n\t\t */\n\t\t_.setActive(_.active < _.slides.length - 1 ? _.active + 1 : 0);\n\t\t_.startInterval();\n\t};\n\n\tWORotatePrototype.startInterval = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Set a new timeout, bound to this instance\n\t\t */\n\t\t_.timeout = setTimeout(_.next.bind(_), _.opt.interval);\n\t};\n\n\tWORotatePrototype.outerHeight = function (element) {\n\t\tif (typeof window.getComputedStyle === \"undefined\") {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst height = element.offsetHeight,\n\t\t\tstyle = window.getComputedStyle(element);\n\n\t\treturn [\"top\", \"bottom\"]\n\t\t\t.map((side) => parseInt(style[`margin-${side}`]))\n\t\t\t.reduce((total, side) => total + side, height);\n\t};\n\n\tWORotatePrototype.init = function () {\n\t\tconst _ = this;\n\t\tlet slideHeight = 0;\n\n\t\t/**\n\t\t * Add class to container.\n\t\t */\n\t\t_.ele.classList.add(\"worotate\");\n\n\t\t/**\n\t\t * Add all children as slides.\n\t\t */\n\t\t_.slides = _.ele.children;\n\n\t\t/**\n\t\t * No slides? Stop init.\n\t\t */\n\t\tif (_.slides.length <= 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Initiate tracker\n\t\t */\n\t\t_.initTimestamp = Date.now();\n\n\t\t_.tracker = typeof WOTrack !== \"undefined\" ? new WOTrack() : null;\n\n\t\t/**\n\t\t * Store tracking ID so DOM can't be manipulated later.\n\t\t * Also grab the slide height if needed.\n\t\t */\n\t\tArray.from(_.slides).forEach((slide, idx) => {\n\t\t\t_.slides[idx].trackId = _.getTrackingAdId(slide);\n\t\t\t_.bindTrackClick(slide);\n\n\t\t\tif (_.opt.heightMode === \"fixed\") {\n\t\t\t\tconst thisH = _.outerHeight(slide);\n\n\t\t\t\tif (thisH > slideHeight) {\n\t\t\t\t\tslideHeight = thisH;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Determine if we have an active slide from the slide markup.\n\t\t */\n\t\tlet active = Array.from(_.slides).findIndex((e) => {\n\t\t\treturn e.classList.contains(\"woactive\");\n\t\t});\n\n\t\tif (!active || active < 0) {\n\t\t\tactive = 0;\n\t\t}\n\n\t\t/**\n\t\t * Set the active slide.\n\t\t */\n\t\t_.setActive(active);\n\t\t_.ele.classList.add(\"woloaded\");\n\n\t\t/**\n\t\t * If we have more than 1 slide, start the rotation interval.\n\t\t */\n\t\tif (_.slides.length > 1) {\n\t\t\t/**\n\t\t\t * Maybe set a min-height.\n\t\t\t */\n\t\t\tif (_.opt.heightMode === \"fixed\" && slideHeight > 0) {\n\t\t\t\t_.ele.style.minHeight = slideHeight + \"px\";\n\t\t\t}\n\n\t\t\t_.startInterval();\n\t\t}\n\t};\n\n\tconst WORotateInit = (_window.WORotateInit = function (elements) {\n\t\t/**\n\t\t * Loop through all rotating ad groups on the page and initialize a WORotate instance.\n\t\t */\n\t\tif (elements && typeof elements !== \"undefined\" && elements.length > 0) {\n\t\t\tfor (const element of elements) {\n\t\t\t\t/**\n\t\t\t\t * Get timeout from data attribute, if one exists.\n\t\t\t\t */\n\t\t\t\tlet refresh = parseInt(element.getAttribute(\"data-interval\"), 10);\n\n\t\t\t\tif (!refresh || refresh === undefined || refresh < 1000) {\n\t\t\t\t\trefresh = 5000;\n\t\t\t\t}\n\n\t\t\t\tlet stopTracking = parseInt(element.getAttribute(\"data-stoptrack\"), 10);\n\n\t\t\t\tif (\n\t\t\t\t\ttypeof stopTracking === \"undefined\" ||\n\t\t\t\t\tstopTracking < 0 ||\n\t\t\t\t\tisNaN(stopTracking)\n\t\t\t\t) {\n\t\t\t\t\tstopTracking = 0;\n\t\t\t\t}\n\n\t\t\t\tnew WORotate(element, { interval: refresh, stopTrack: stopTracking });\n\t\t\t}\n\t\t}\n\t});\n})();\n"],"names":["_window","window","WORotate","element","settings","_","_worotate","ele","opt","Object","assign","interval","heightMode","stopTrack","init","WORotatePrototype","prototype","getTrackingAdId","tracker","bindTrackClick","trackImpression","trackImpressionByElement","console","log","Date","now","initTimestamp","setActive","idx","active","Array","from","slides","forEach","el","i","classList","remove","add","next","length","startInterval","timeout","setTimeout","bind","outerHeight","getComputedStyle","height","offsetHeight","style","map","side","parseInt","concat","reduce","total","slideHeight","children","WOTrack","slide","trackId","thisH","findIndex","e","contains","minHeight","WORotateInit","elements","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","refresh","getAttribute","undefined","stopTracking","isNaN","err","f"],"sourceRoot":""}
  • ad-commander/tags/1.1.7/includes/AdCommander.php

    r3139166 r3149663  
    1313     */
    1414    public static function version() {
    15         return '1.1.6';
     15        return '1.1.7';
    1616    }
    1717
  • ad-commander/tags/1.1.7/includes/AdminGroupTermMeta.php

    r3115166 r3149663  
    676676
    677677        /**
     678         * Refresh
     679         */
     680        $this->wo_meta->term_meta_row(
     681            $this->wo_meta->label( 'stop_tracking_i', __( 'Stop Tracking', 'ad-commander' ), array( 'display' => false ) ), // th
     682            $this->wo_meta->input( 'stop_tracking_i', $this->wo_meta->get_value( $this->current_meta, 'stop_tracking_i', 0 ), 'number', array( 'display' => false ) ),
     683            array(
     684                'classes' => array( Util::ns( 'mode-restrict' ), Util::ns( 'mode-restrict--rotate' ) ),
     685                'message' => __( 'Stop tracking impressions after X seconds of rotating. 0 to track until visitor closes page.', 'ad-commander' ),
     686            )
     687        );
     688
     689        /**
    678690         * Ad Order
    679691         */
  • ad-commander/tags/1.1.7/includes/Group.php

    r3139166 r3149663  
    439439     */
    440440    private function group_data_attributes() {
    441         $data_attributes = '';
    442 
    443         if ( $this->mode() === 'rotate' ) {
    444             $interval = absint( $this->wo_meta->get_value( $this->term_meta(), 'refresh', 5 ) );
    445 
    446             if ( ! $interval || $interval === 0 ) {
    447                 $interval = 5;
    448             }
    449 
    450             $interval = $interval * 1000;
    451 
    452             $data_attributes = ' data-interval="' . esc_attr( $interval ) . '"';
    453         }
    454 
    455         return $data_attributes;
     441        return '';
     442    }
     443
     444    /**
     445     * HTML data attributes for the rotate wrapper.
     446     *
     447     * @return string
     448     */
     449    private function rotate_data_attributes() {
     450        $data_attributes = array();
     451
     452        $interval = absint( $this->wo_meta->get_value( $this->term_meta(), 'refresh', 5 ) );
     453
     454        if ( ! $interval || $interval === 0 ) {
     455            $interval = 5;
     456        }
     457
     458        $interval = $interval * 1000;
     459
     460        $stop_tracking = absint( $this->wo_meta->get_value( $this->term_meta(), 'stop_tracking_i', 0 ) ) * 1000;
     461
     462        return 'data-interval="' . esc_attr( $interval ) . '" data-stoptrack="' . esc_attr( $stop_tracking ) . '"';
    456463    }
    457464
     
    491498     */
    492499    private function rotate_wrapper() {
    493         return '<div class="' . esc_attr( Util::prefixed( 'rotate' ) ) . '">';
     500        return '<div class="' . esc_attr( Util::prefixed( 'rotate' ) ) . '" ' . $this->rotate_data_attributes() . '>';
    494501    }
    495502
  • ad-commander/tags/1.1.7/includes/GroupTermMeta.php

    r3115166 r3149663  
    4141                    'default'  => 5,
    4242                    'minimum'  => 1,
     43                    'required' => array( 'mode' => 'rotate' ),
     44                ),
     45                'stop_tracking_i'    => array(
     46                    'type'     => 'int',
     47                    'default'  => 0,
    4348                    'required' => array( 'mode' => 'rotate' ),
    4449                ),
  • ad-commander/tags/1.1.7/readme.txt

    r3144672 r3149663  
    44Requires at least: 6.2
    55Tested up to: 6.6
    6 Stable tag: 1.1.6
     6Stable tag: 1.1.7
    77Requires PHP: 7.4
    88License: GPLv3
     
    100100
    101101== Changelog ==
     102= 1.1.7 =
     103* Bug fix: Fixes refresh interval on rotating ad groups
     104* Feature: Ability to set a 'stop tracking impressions' interval on rotating ad groups
     105
    102106= 1.1.6 =
    103107* Bug fix: Blank report chart when filtered by date only
     
    189193
    190194== Upgrade Notice ==
     195= 1.1.7 =
     196* Bug fix: Fixes refresh interval on rotating ad groups
     197* Feature: Ability to set a 'stop tracking impressions' interval on rotating ad groups
     198
    191199= 1.1.6 =
    192200* Bug fix: Blank report chart when filtered by date only
  • ad-commander/tags/1.1.7/src/js/front/rotate.js

    r3101424 r3149663  
    2323        _.opt = Object.assign(
    2424            {},
    25             { interval: 5000, heightMode: "fixed" },
     25            { interval: 5000, heightMode: "fixed", stopTrack: 0 },
    2626            settings
    2727        );
     
    6666        ) {
    6767            // impression tracking will be blocked by tracker if disabled.
    68             _.tracker.trackImpressionByElement(element);
     68            if (
     69                _.opt.stopTrack <= 0 ||
     70                Date.now() - _.initTimestamp <= _.opt.stopTrack
     71            ) {
     72                _.tracker.trackImpressionByElement(element);
     73            }
    6974        }
    7075    };
     
    153158         * Initiate tracker
    154159         */
     160        _.initTimestamp = Date.now();
     161
    155162        _.tracker = typeof WOTrack !== "undefined" ? new WOTrack() : null;
    156163
     
    219226                }
    220227
    221                 new WORotate(element, { interval: refresh });
     228                let stopTracking = parseInt(element.getAttribute("data-stoptrack"), 10);
     229
     230                if (
     231                    typeof stopTracking === "undefined" ||
     232                    stopTracking < 0 ||
     233                    isNaN(stopTracking)
     234                ) {
     235                    stopTracking = 0;
     236                }
     237
     238                new WORotate(element, { interval: refresh, stopTrack: stopTracking });
    222239            }
    223240        }
  • ad-commander/trunk/ad-commander.php

    r3139166 r3149663  
    44 * Plugin URI:      https://github.com/wildoperation/Ad-Commander
    55 * Description:     Insert, schedule and track custom advertising banners or script ads from AdSense, Amazon, and other affiliate networks into your site.
    6  * Version:         1.1.6
     6 * Version:         1.1.7
    77 * Author:          Wild Operation
    88 * Author URI:      https://wildoperation.com
     
    1414 * @subpackage Ad Commander - Banner & Ad Manager
    1515 * @since 1.0.0
    16  * @version 1.1.6
     16 * @version 1.1.7
    1717 */
    1818
  • ad-commander/trunk/dist/js/rotate.js

    r3101435 r3149663  
    1 (()=>{function t(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){s=!0,o=t},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}!function(){var e="undefined"!=typeof window?window:this,r=e.WORotate=function(t,e){var r=this;if(t._worotate)return t._worotate;r.ele=t,r.ele._worotate=r,r.opt=Object.assign({},{interval:5e3,heightMode:"fixed"},e),r.init()},n=r.prototype;n.getTrackingAdId=function(t){var e=this;if(e.tracker&&void 0!==e.tracker.getTrackingAdId)return e.tracker.getTrackingAdId(t)},n.bindTrackClick=function(t){var e=this;e.tracker&&void 0!==e.tracker.bindTrackClick&&e.tracker.bindTrackClick(t)},n.trackImpression=function(t){var e=this;e.tracker&&void 0!==e.tracker.trackImpressionByElement&&e.tracker.trackImpressionByElement(t)},n.setActive=function(t){var e=this;e.active=t,Array.from(e.slides).forEach((function(t,r){e.active!==r&&t.classList.remove("woactive")})),e.slides[e.active].classList.add("woactive"),e.trackImpression(e.slides[e.active])},n.next=function(){var t=this;t.setActive(t.active<t.slides.length-1?t.active+1:0),t.startInterval()},n.startInterval=function(){var t=this;t.timeout=setTimeout(t.next.bind(t),t.opt.interval)},n.outerHeight=function(t){if(void 0===window.getComputedStyle)return 0;var e=t.offsetHeight,r=window.getComputedStyle(t);return["top","bottom"].map((function(t){return parseInt(r["margin-".concat(t)])})).reduce((function(t,e){return t+e}),e)},n.init=function(){var t=this,e=0;if(t.ele.classList.add("worotate"),t.slides=t.ele.children,t.slides.length<=0)return!1;t.tracker="undefined"!=typeof WOTrack?new WOTrack:null,Array.from(t.slides).forEach((function(r,n){if(t.slides[n].trackId=t.getTrackingAdId(r),t.bindTrackClick(r),"fixed"===t.opt.heightMode){var i=t.outerHeight(r);i>e&&(e=i)}}));var r=Array.from(t.slides).findIndex((function(t){return t.classList.contains("woactive")}));(!r||r<0)&&(r=0),t.setActive(r),t.ele.classList.add("woloaded"),t.slides.length>1&&("fixed"===t.opt.heightMode&&e>0&&(t.ele.style.minHeight=e+"px"),t.startInterval())};e.WORotateInit=function(e){if(e&&void 0!==e&&e.length>0){var n,i=t(e);try{for(i.s();!(n=i.n()).done;){var a=n.value,o=parseInt(a.getAttribute("data-interval"),10);(!o||void 0===o||o<1e3)&&(o=5e3),new r(a,{interval:o})}}catch(t){i.e(t)}finally{i.f()}}}}()})();
     1(()=>{function t(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){s=!0,o=t},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}!function(){var e="undefined"!=typeof window?window:this,r=e.WORotate=function(t,e){var r=this;if(t._worotate)return t._worotate;r.ele=t,r.ele._worotate=r,r.opt=Object.assign({},{interval:5e3,heightMode:"fixed",stopTrack:0},e),r.init()},n=r.prototype;n.getTrackingAdId=function(t){var e=this;if(e.tracker&&void 0!==e.tracker.getTrackingAdId)return e.tracker.getTrackingAdId(t)},n.bindTrackClick=function(t){var e=this;e.tracker&&void 0!==e.tracker.bindTrackClick&&e.tracker.bindTrackClick(t)},n.trackImpression=function(t){var e=this;e.tracker&&void 0!==e.tracker.trackImpressionByElement&&(e.opt.stopTrack<=0||Date.now()-e.initTimestamp<=e.opt.stopTrack)&&e.tracker.trackImpressionByElement(t)},n.setActive=function(t){var e=this;e.active=t,Array.from(e.slides).forEach((function(t,r){e.active!==r&&t.classList.remove("woactive")})),e.slides[e.active].classList.add("woactive"),e.trackImpression(e.slides[e.active])},n.next=function(){var t=this;t.setActive(t.active<t.slides.length-1?t.active+1:0),t.startInterval()},n.startInterval=function(){var t=this;t.timeout=setTimeout(t.next.bind(t),t.opt.interval)},n.outerHeight=function(t){if(void 0===window.getComputedStyle)return 0;var e=t.offsetHeight,r=window.getComputedStyle(t);return["top","bottom"].map((function(t){return parseInt(r["margin-".concat(t)])})).reduce((function(t,e){return t+e}),e)},n.init=function(){var t=this,e=0;if(t.ele.classList.add("worotate"),t.slides=t.ele.children,t.slides.length<=0)return!1;t.initTimestamp=Date.now(),t.tracker="undefined"!=typeof WOTrack?new WOTrack:null,Array.from(t.slides).forEach((function(r,n){if(t.slides[n].trackId=t.getTrackingAdId(r),t.bindTrackClick(r),"fixed"===t.opt.heightMode){var i=t.outerHeight(r);i>e&&(e=i)}}));var r=Array.from(t.slides).findIndex((function(t){return t.classList.contains("woactive")}));(!r||r<0)&&(r=0),t.setActive(r),t.ele.classList.add("woloaded"),t.slides.length>1&&("fixed"===t.opt.heightMode&&e>0&&(t.ele.style.minHeight=e+"px"),t.startInterval())};e.WORotateInit=function(e){if(e&&void 0!==e&&e.length>0){var n,i=t(e);try{for(i.s();!(n=i.n()).done;){var a=n.value,o=parseInt(a.getAttribute("data-interval"),10);(!o||void 0===o||o<1e3)&&(o=5e3);var c=parseInt(a.getAttribute("data-stoptrack"),10);(void 0===c||c<0||isNaN(c))&&(c=0),new r(a,{interval:o,stopTrack:c})}}catch(t){i.e(t)}finally{i.f()}}}}()})();
  • ad-commander/trunk/dist/js/rotate.js.map

    r3101424 r3149663  
    1 {"version":3,"file":"/dist/js/rotate.js","mappings":";;;;;;;;AAAA,CAAC,YAAY;EACZ,IAAMA,OAAO,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAG,IAAI;;EAE7D;AACD;AACA;EACC,IAAMC,QAAQ,GAAIF,OAAO,CAACE,QAAQ,GAAG,UAAUC,OAAO,EAAEC,QAAQ,EAAE;IACjE,IAAMC,CAAC,GAAG,IAAI;;IAEd;AACF;AACA;IACE,IAAIF,OAAO,CAACG,SAAS,EAAE;MACtB,OAAOH,OAAO,CAACG,SAAS;IACzB;IAEAD,CAAC,CAACE,GAAG,GAAGJ,OAAO;IACfE,CAAC,CAACE,GAAG,CAACD,SAAS,GAAGD,CAAC;;IAEnB;AACF;AACA;IACEA,CA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KAAA;UACjB;AACJ;AACA;UACI,IAAIC,OAAO,GAAGvB,QAAQ,CAAC3C,OAAO,CAACmE,YAAY,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;UAEjE,IAAI,CAACD,OAAO,IAAIA,OAAO,KAAKE,SAAS,IAAIF,OAAO,GAAG,IAAI,EAAE;YACxDA,OAAO,GAAG,IAAI;UACf;UAEA,IAAInE,QAAQ,CAACC,OAAO,EAAE;YAAEQ,QAAQ,EAAE0D;UAAQ,CAAC,CAAC;QAC7C;MAAC,SAAAG,GAAA;QAAAV,SAAA,CAAAL,CAAA,CAAAe,GAAA;MAAA;QAAAV,SAAA,CAAAW,CAAA;MAAA;IACF;EACD,CAAE;AACH,CAAC,EAAE,CAAC,C","sources":["webpack://wo/./src/js/front/rotate.js"],"sourcesContent":["(function () {\n\tconst _window = typeof window !== \"undefined\" ? window : this;\n\n\t/**\n\t * WORotate instance\n\t */\n\tconst WORotate = (_window.WORotate = function (element, settings) {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Avoid initializing twice on the same element.\n\t\t */\n\t\tif (element._worotate) {\n\t\t\treturn element._worotate;\n\t\t}\n\n\t\t_.ele = element;\n\t\t_.ele._worotate = _;\n\n\t\t/**\n\t\t * Merge settings with defaults.\n\t\t */\n\t\t_.opt = Object.assign(\n\t\t\t{},\n\t\t\t{ interval: 5000, heightMode: \"fixed\" },\n\t\t\tsettings\n\t\t);\n\n\t\t/**\n\t\t * Iniit\n\t\t */\n\t\t_.init();\n\t});\n\n\t/**\n\t * Prototype functions\n\t */\n\tconst WORotatePrototype = WORotate.prototype;\n\n\t/**\n\t * Interface with WOTrack if it is present.\n\t */\n\tWORotatePrototype.getTrackingAdId = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.getTrackingAdId !== \"undefined\") {\n\t\t\treturn _.tracker.getTrackingAdId(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.bindTrackClick = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.bindTrackClick !== \"undefined\") {\n\t\t\t// click binding will be blocked by tracker if disabled.\n\t\t\t_.tracker.bindTrackClick(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.trackImpression = function (element) {\n\t\tconst _ = this;\n\n\t\tif (\n\t\t\t_.tracker &&\n\t\t\ttypeof _.tracker.trackImpressionByElement !== \"undefined\"\n\t\t) {\n\t\t\t// impression tracking will be blocked by tracker if disabled.\n\t\t\t_.tracker.trackImpressionByElement(element);\n\t\t}\n\t};\n\n\t/**\n\t * Set slide to active\n\t */\n\tWORotatePrototype.setActive = function (idx) {\n\t\tconst _ = this;\n\t\t_.active = idx;\n\n\t\t/**\n\t\t * Remove active class from slides\n\t\t */\n\t\tArray.from(_.slides).forEach((el, i) => {\n\t\t\tif (_.active !== i) {\n\t\t\t\tel.classList.remove(\"woactive\");\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Add active class to slide\n\t\t */\n\t\t_.slides[_.active].classList.add(\"woactive\");\n\n\t\t/**\n\t\t * Track impression\n\t\t */\n\t\t_.trackImpression(_.slides[_.active]);\n\t};\n\n\tWORotatePrototype.next = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Change active slide and start the timeout.\n\t\t */\n\t\t_.setActive(_.active < _.slides.length - 1 ? _.active + 1 : 0);\n\t\t_.startInterval();\n\t};\n\n\tWORotatePrototype.startInterval = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Set a new timeout, bound to this instance\n\t\t */\n\t\t_.timeout = setTimeout(_.next.bind(_), _.opt.interval);\n\t};\n\n\tWORotatePrototype.outerHeight = function (element) {\n\t\tif (typeof window.getComputedStyle === \"undefined\") {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst height = element.offsetHeight,\n\t\t\tstyle = window.getComputedStyle(element);\n\n\t\treturn [\"top\", \"bottom\"]\n\t\t\t.map((side) => parseInt(style[`margin-${side}`]))\n\t\t\t.reduce((total, side) => total + side, height);\n\t};\n\n\tWORotatePrototype.init = function () {\n\t\tconst _ = this;\n\t\tlet slideHeight = 0;\n\n\t\t/**\n\t\t * Add class to container.\n\t\t */\n\t\t_.ele.classList.add(\"worotate\");\n\n\t\t/**\n\t\t * Add all children as slides.\n\t\t */\n\t\t_.slides = _.ele.children;\n\n\t\t/**\n\t\t * No slides? Stop init.\n\t\t */\n\t\tif (_.slides.length <= 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Initiate tracker\n\t\t */\n\t\t_.tracker = typeof WOTrack !== \"undefined\" ? new WOTrack() : null;\n\n\t\t/**\n\t\t * Store tracking ID so DOM can't be manipulated later.\n\t\t * Also grab the slide height if needed.\n\t\t */\n\t\tArray.from(_.slides).forEach((slide, idx) => {\n\t\t\t_.slides[idx].trackId = _.getTrackingAdId(slide);\n\t\t\t_.bindTrackClick(slide);\n\n\t\t\tif (_.opt.heightMode === \"fixed\") {\n\t\t\t\tconst thisH = _.outerHeight(slide);\n\n\t\t\t\tif (thisH > slideHeight) {\n\t\t\t\t\tslideHeight = thisH;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Determine if we have an active slide from the slide markup.\n\t\t */\n\t\tlet active = Array.from(_.slides).findIndex((e) => {\n\t\t\treturn e.classList.contains(\"woactive\");\n\t\t});\n\n\t\tif (!active || active < 0) {\n\t\t\tactive = 0;\n\t\t}\n\n\t\t/**\n\t\t * Set the active slide.\n\t\t */\n\t\t_.setActive(active);\n\t\t_.ele.classList.add(\"woloaded\");\n\n\t\t/**\n\t\t * If we have more than 1 slide, start the rotation interval.\n\t\t */\n\t\tif (_.slides.length > 1) {\n\t\t\t/**\n\t\t\t * Maybe set a min-height.\n\t\t\t */\n\t\t\tif (_.opt.heightMode === \"fixed\" && slideHeight > 0) {\n\t\t\t\t_.ele.style.minHeight = slideHeight + \"px\";\n\t\t\t}\n\n\t\t\t_.startInterval();\n\t\t}\n\t};\n\n\tconst WORotateInit = (_window.WORotateInit = function (elements) {\n\t\t/**\n\t\t * Loop through all rotating ad groups on the page and initialize a WORotate instance.\n\t\t */\n\t\tif (elements && typeof elements !== \"undefined\" && elements.length > 0) {\n\t\t\tfor (const element of elements) {\n\t\t\t\t/**\n\t\t\t\t * Get timeout from data attribute, if one exists.\n\t\t\t\t */\n\t\t\t\tlet refresh = parseInt(element.getAttribute(\"data-interval\"), 10);\n\n\t\t\t\tif (!refresh || refresh === undefined || refresh < 1000) {\n\t\t\t\t\trefresh = 5000;\n\t\t\t\t}\n\n\t\t\t\tnew WORotate(element, { interval: refresh });\n\t\t\t}\n\t\t}\n\t});\n})();\n"],"names":["_window","window","WORotate","element","settings","_","_worotate","ele","opt","Object","assign","interval","heightMode","init","WORotatePrototype","prototype","getTrackingAdId","tracker","bindTrackClick","trackImpression","trackImpressionByElement","setActive","idx","active","Array","from","slides","forEach","el","i","classList","remove","add","next","length","startInterval","timeout","setTimeout","bind","outerHeight","getComputedStyle","height","offsetHeight","style","map","side","parseInt","concat","reduce","total","slideHeight","children","WOTrack","slide","trackId","thisH","findIndex","e","contains","minHeight","WORotateInit","elements","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","refresh","getAttribute","undefined","err","f"],"sourceRoot":""}
     1{"version":3,"file":"/dist/js/rotate.js","mappings":";;;;;;;;AAAA,CAAC,YAAY;EACZ,IAAMA,OAAO,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAG,IAAI;;EAE7D;AACD;AACA;EACC,IAAMC,QAAQ,GAAIF,OAAO,CAACE,QAAQ,GAAG,UAAUC,OAAO,EAAEC,QAAQ,EAAE;IACjE,IAAMC,CAAC,GAAG,IAAI;;IAEd;AACF;AACA;IACE,IAAIF,OAAO,CAACG,SAAS,EAAE;MACtB,OAAOH,OAAO,CAACG,SAAS;IACzB;IAEAD,CAAC,CAACE,GAAG,GAAGJ,OAAO;IACfE,CAAC,CAACE,GAAG,CAACD,SAAS,GAAGD,CAAC;;IAEnB;AACF;AACA;IACEA,CAAC,CAAC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G,UAAUC,QAAQ,EAAE;IAChE;AACF;AACA;IACE,IAAIA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,WAAW,IAAIA,QAAQ,CAAC3B,MAAM,GAAG,CAAC,EAAE;MAAA,IAAA4B,SAAA,GAAAC,0BAAA,CACjDF,QAAQ;QAAAG,KAAA;MAAA;QAA9B,KAAAF,SAAA,CAAAG,CAAA,MAAAD,KAAA,GAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,GAAgC;UAAA,IAArBtE,OAAO,GAAAmE,KAAA,CAAAI,KAAA;UACjB;AACJ;AACA;UACI,IAAIC,OAAO,GAAGvB,QAAQ,CAACjD,OAAO,CAACyE,YAAY,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;UAEjE,IAAI,CAACD,OAAO,IAAIA,OAAO,KAAKE,SAAS,IAAIF,OAAO,GAAG,IAAI,EAAE;YACxDA,OAAO,GAAG,IAAI;UACf;UAEA,IAAIG,YAAY,GAAG1B,QAAQ,CAACjD,OAAO,CAACyE,YAAY,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;UAEvE,IACC,OAAOE,YAAY,KAAK,WAAW,IACnCA,YAAY,GAAG,CAAC,IAChBC,KAAK,CAACD,YAAY,CAAC,EAClB;YACDA,YAAY,GAAG,CAAC;UACjB;UAEA,IAAI5E,QAAQ,CAACC,OAAO,EAAE;YAAEQ,QAAQ,EAAEgE,OAAO;YAAE9D,SAAS,EAAEiE;UAAa,CAAC,CAAC;QACtE;MAAC,SAAAE,GAAA;QAAAZ,SAAA,CAAAL,CAAA,CAAAiB,GAAA;MAAA;QAAAZ,SAAA,CAAAa,CAAA;MAAA;IACF;EACD,CAAE;AACH,CAAC,EAAE,CAAC,C","sources":["webpack://wo/./src/js/front/rotate.js"],"sourcesContent":["(function () {\n\tconst _window = typeof window !== \"undefined\" ? window : this;\n\n\t/**\n\t * WORotate instance\n\t */\n\tconst WORotate = (_window.WORotate = function (element, settings) {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Avoid initializing twice on the same element.\n\t\t */\n\t\tif (element._worotate) {\n\t\t\treturn element._worotate;\n\t\t}\n\n\t\t_.ele = element;\n\t\t_.ele._worotate = _;\n\n\t\t/**\n\t\t * Merge settings with defaults.\n\t\t */\n\t\t_.opt = Object.assign(\n\t\t\t{},\n\t\t\t{ interval: 5000, heightMode: \"fixed\", stopTrack: 0 },\n\t\t\tsettings\n\t\t);\n\n\t\t/**\n\t\t * Iniit\n\t\t */\n\t\t_.init();\n\t});\n\n\t/**\n\t * Prototype functions\n\t */\n\tconst WORotatePrototype = WORotate.prototype;\n\n\t/**\n\t * Interface with WOTrack if it is present.\n\t */\n\tWORotatePrototype.getTrackingAdId = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.getTrackingAdId !== \"undefined\") {\n\t\t\treturn _.tracker.getTrackingAdId(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.bindTrackClick = function (element) {\n\t\tconst _ = this;\n\n\t\tif (_.tracker && typeof _.tracker.bindTrackClick !== \"undefined\") {\n\t\t\t// click binding will be blocked by tracker if disabled.\n\t\t\t_.tracker.bindTrackClick(element);\n\t\t}\n\t};\n\n\tWORotatePrototype.trackImpression = function (element) {\n\t\tconst _ = this;\n\n\t\tif (\n\t\t\t_.tracker &&\n\t\t\ttypeof _.tracker.trackImpressionByElement !== \"undefined\"\n\t\t) {\n\t\t\t// impression tracking will be blocked by tracker if disabled.\n\n\t\t\tconsole.log(_.opt.stopTrack);\n\t\t\tif (\n\t\t\t\t_.opt.stopTrack <= 0 ||\n\t\t\t\tDate.now() - _.initTimestamp <= _.opt.stopTrack\n\t\t\t) {\n\t\t\t\t_.tracker.trackImpressionByElement(element);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Set slide to active\n\t */\n\tWORotatePrototype.setActive = function (idx) {\n\t\tconst _ = this;\n\t\t_.active = idx;\n\n\t\t/**\n\t\t * Remove active class from slides\n\t\t */\n\t\tArray.from(_.slides).forEach((el, i) => {\n\t\t\tif (_.active !== i) {\n\t\t\t\tel.classList.remove(\"woactive\");\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Add active class to slide\n\t\t */\n\t\t_.slides[_.active].classList.add(\"woactive\");\n\n\t\t/**\n\t\t * Track impression\n\t\t */\n\t\t_.trackImpression(_.slides[_.active]);\n\t};\n\n\tWORotatePrototype.next = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Change active slide and start the timeout.\n\t\t */\n\t\t_.setActive(_.active < _.slides.length - 1 ? _.active + 1 : 0);\n\t\t_.startInterval();\n\t};\n\n\tWORotatePrototype.startInterval = function () {\n\t\tconst _ = this;\n\n\t\t/**\n\t\t * Set a new timeout, bound to this instance\n\t\t */\n\t\t_.timeout = setTimeout(_.next.bind(_), _.opt.interval);\n\t};\n\n\tWORotatePrototype.outerHeight = function (element) {\n\t\tif (typeof window.getComputedStyle === \"undefined\") {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst height = element.offsetHeight,\n\t\t\tstyle = window.getComputedStyle(element);\n\n\t\treturn [\"top\", \"bottom\"]\n\t\t\t.map((side) => parseInt(style[`margin-${side}`]))\n\t\t\t.reduce((total, side) => total + side, height);\n\t};\n\n\tWORotatePrototype.init = function () {\n\t\tconst _ = this;\n\t\tlet slideHeight = 0;\n\n\t\t/**\n\t\t * Add class to container.\n\t\t */\n\t\t_.ele.classList.add(\"worotate\");\n\n\t\t/**\n\t\t * Add all children as slides.\n\t\t */\n\t\t_.slides = _.ele.children;\n\n\t\t/**\n\t\t * No slides? Stop init.\n\t\t */\n\t\tif (_.slides.length <= 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Initiate tracker\n\t\t */\n\t\t_.initTimestamp = Date.now();\n\n\t\t_.tracker = typeof WOTrack !== \"undefined\" ? new WOTrack() : null;\n\n\t\t/**\n\t\t * Store tracking ID so DOM can't be manipulated later.\n\t\t * Also grab the slide height if needed.\n\t\t */\n\t\tArray.from(_.slides).forEach((slide, idx) => {\n\t\t\t_.slides[idx].trackId = _.getTrackingAdId(slide);\n\t\t\t_.bindTrackClick(slide);\n\n\t\t\tif (_.opt.heightMode === \"fixed\") {\n\t\t\t\tconst thisH = _.outerHeight(slide);\n\n\t\t\t\tif (thisH > slideHeight) {\n\t\t\t\t\tslideHeight = thisH;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Determine if we have an active slide from the slide markup.\n\t\t */\n\t\tlet active = Array.from(_.slides).findIndex((e) => {\n\t\t\treturn e.classList.contains(\"woactive\");\n\t\t});\n\n\t\tif (!active || active < 0) {\n\t\t\tactive = 0;\n\t\t}\n\n\t\t/**\n\t\t * Set the active slide.\n\t\t */\n\t\t_.setActive(active);\n\t\t_.ele.classList.add(\"woloaded\");\n\n\t\t/**\n\t\t * If we have more than 1 slide, start the rotation interval.\n\t\t */\n\t\tif (_.slides.length > 1) {\n\t\t\t/**\n\t\t\t * Maybe set a min-height.\n\t\t\t */\n\t\t\tif (_.opt.heightMode === \"fixed\" && slideHeight > 0) {\n\t\t\t\t_.ele.style.minHeight = slideHeight + \"px\";\n\t\t\t}\n\n\t\t\t_.startInterval();\n\t\t}\n\t};\n\n\tconst WORotateInit = (_window.WORotateInit = function (elements) {\n\t\t/**\n\t\t * Loop through all rotating ad groups on the page and initialize a WORotate instance.\n\t\t */\n\t\tif (elements && typeof elements !== \"undefined\" && elements.length > 0) {\n\t\t\tfor (const element of elements) {\n\t\t\t\t/**\n\t\t\t\t * Get timeout from data attribute, if one exists.\n\t\t\t\t */\n\t\t\t\tlet refresh = parseInt(element.getAttribute(\"data-interval\"), 10);\n\n\t\t\t\tif (!refresh || refresh === undefined || refresh < 1000) {\n\t\t\t\t\trefresh = 5000;\n\t\t\t\t}\n\n\t\t\t\tlet stopTracking = parseInt(element.getAttribute(\"data-stoptrack\"), 10);\n\n\t\t\t\tif (\n\t\t\t\t\ttypeof stopTracking === \"undefined\" ||\n\t\t\t\t\tstopTracking < 0 ||\n\t\t\t\t\tisNaN(stopTracking)\n\t\t\t\t) {\n\t\t\t\t\tstopTracking = 0;\n\t\t\t\t}\n\n\t\t\t\tnew WORotate(element, { interval: refresh, stopTrack: stopTracking });\n\t\t\t}\n\t\t}\n\t});\n})();\n"],"names":["_window","window","WORotate","element","settings","_","_worotate","ele","opt","Object","assign","interval","heightMode","stopTrack","init","WORotatePrototype","prototype","getTrackingAdId","tracker","bindTrackClick","trackImpression","trackImpressionByElement","console","log","Date","now","initTimestamp","setActive","idx","active","Array","from","slides","forEach","el","i","classList","remove","add","next","length","startInterval","timeout","setTimeout","bind","outerHeight","getComputedStyle","height","offsetHeight","style","map","side","parseInt","concat","reduce","total","slideHeight","children","WOTrack","slide","trackId","thisH","findIndex","e","contains","minHeight","WORotateInit","elements","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","refresh","getAttribute","undefined","stopTracking","isNaN","err","f"],"sourceRoot":""}
  • ad-commander/trunk/includes/AdCommander.php

    r3139166 r3149663  
    1313     */
    1414    public static function version() {
    15         return '1.1.6';
     15        return '1.1.7';
    1616    }
    1717
  • ad-commander/trunk/includes/AdminGroupTermMeta.php

    r3115166 r3149663  
    676676
    677677        /**
     678         * Refresh
     679         */
     680        $this->wo_meta->term_meta_row(
     681            $this->wo_meta->label( 'stop_tracking_i', __( 'Stop Tracking', 'ad-commander' ), array( 'display' => false ) ), // th
     682            $this->wo_meta->input( 'stop_tracking_i', $this->wo_meta->get_value( $this->current_meta, 'stop_tracking_i', 0 ), 'number', array( 'display' => false ) ),
     683            array(
     684                'classes' => array( Util::ns( 'mode-restrict' ), Util::ns( 'mode-restrict--rotate' ) ),
     685                'message' => __( 'Stop tracking impressions after X seconds of rotating. 0 to track until visitor closes page.', 'ad-commander' ),
     686            )
     687        );
     688
     689        /**
    678690         * Ad Order
    679691         */
  • ad-commander/trunk/includes/Group.php

    r3139166 r3149663  
    439439     */
    440440    private function group_data_attributes() {
    441         $data_attributes = '';
    442 
    443         if ( $this->mode() === 'rotate' ) {
    444             $interval = absint( $this->wo_meta->get_value( $this->term_meta(), 'refresh', 5 ) );
    445 
    446             if ( ! $interval || $interval === 0 ) {
    447                 $interval = 5;
    448             }
    449 
    450             $interval = $interval * 1000;
    451 
    452             $data_attributes = ' data-interval="' . esc_attr( $interval ) . '"';
    453         }
    454 
    455         return $data_attributes;
     441        return '';
     442    }
     443
     444    /**
     445     * HTML data attributes for the rotate wrapper.
     446     *
     447     * @return string
     448     */
     449    private function rotate_data_attributes() {
     450        $data_attributes = array();
     451
     452        $interval = absint( $this->wo_meta->get_value( $this->term_meta(), 'refresh', 5 ) );
     453
     454        if ( ! $interval || $interval === 0 ) {
     455            $interval = 5;
     456        }
     457
     458        $interval = $interval * 1000;
     459
     460        $stop_tracking = absint( $this->wo_meta->get_value( $this->term_meta(), 'stop_tracking_i', 0 ) ) * 1000;
     461
     462        return 'data-interval="' . esc_attr( $interval ) . '" data-stoptrack="' . esc_attr( $stop_tracking ) . '"';
    456463    }
    457464
     
    491498     */
    492499    private function rotate_wrapper() {
    493         return '<div class="' . esc_attr( Util::prefixed( 'rotate' ) ) . '">';
     500        return '<div class="' . esc_attr( Util::prefixed( 'rotate' ) ) . '" ' . $this->rotate_data_attributes() . '>';
    494501    }
    495502
  • ad-commander/trunk/includes/GroupTermMeta.php

    r3115166 r3149663  
    4141                    'default'  => 5,
    4242                    'minimum'  => 1,
     43                    'required' => array( 'mode' => 'rotate' ),
     44                ),
     45                'stop_tracking_i'    => array(
     46                    'type'     => 'int',
     47                    'default'  => 0,
    4348                    'required' => array( 'mode' => 'rotate' ),
    4449                ),
  • ad-commander/trunk/readme.txt

    r3144672 r3149663  
    44Requires at least: 6.2
    55Tested up to: 6.6
    6 Stable tag: 1.1.6
     6Stable tag: 1.1.7
    77Requires PHP: 7.4
    88License: GPLv3
     
    100100
    101101== Changelog ==
     102= 1.1.7 =
     103* Bug fix: Fixes refresh interval on rotating ad groups
     104* Feature: Ability to set a 'stop tracking impressions' interval on rotating ad groups
     105
    102106= 1.1.6 =
    103107* Bug fix: Blank report chart when filtered by date only
     
    189193
    190194== Upgrade Notice ==
     195= 1.1.7 =
     196* Bug fix: Fixes refresh interval on rotating ad groups
     197* Feature: Ability to set a 'stop tracking impressions' interval on rotating ad groups
     198
    191199= 1.1.6 =
    192200* Bug fix: Blank report chart when filtered by date only
  • ad-commander/trunk/src/js/front/rotate.js

    r3101424 r3149663  
    2323        _.opt = Object.assign(
    2424            {},
    25             { interval: 5000, heightMode: "fixed" },
     25            { interval: 5000, heightMode: "fixed", stopTrack: 0 },
    2626            settings
    2727        );
     
    6666        ) {
    6767            // impression tracking will be blocked by tracker if disabled.
    68             _.tracker.trackImpressionByElement(element);
     68            if (
     69                _.opt.stopTrack <= 0 ||
     70                Date.now() - _.initTimestamp <= _.opt.stopTrack
     71            ) {
     72                _.tracker.trackImpressionByElement(element);
     73            }
    6974        }
    7075    };
     
    153158         * Initiate tracker
    154159         */
     160        _.initTimestamp = Date.now();
     161
    155162        _.tracker = typeof WOTrack !== "undefined" ? new WOTrack() : null;
    156163
     
    219226                }
    220227
    221                 new WORotate(element, { interval: refresh });
     228                let stopTracking = parseInt(element.getAttribute("data-stoptrack"), 10);
     229
     230                if (
     231                    typeof stopTracking === "undefined" ||
     232                    stopTracking < 0 ||
     233                    isNaN(stopTracking)
     234                ) {
     235                    stopTracking = 0;
     236                }
     237
     238                new WORotate(element, { interval: refresh, stopTrack: stopTracking });
    222239            }
    223240        }
Note: See TracChangeset for help on using the changeset viewer.