website-utilities 1.0.353 → 1.0.354
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +16 -16
- package/readme.md +1 -1
- package/type.d.ts +1 -1
package/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ import { DefaultOptions, Options, TrackingItem } from './type';
|
|
|
62
62
|
* @property _defaultOptions.scrollToTop.button.showAnimationOptions -
|
|
63
63
|
* Configures show animation.
|
|
64
64
|
* @property _defaultOptions.scrollToTop.options - Scrolling animation options.
|
|
65
|
-
* @property _defaultOptions.
|
|
65
|
+
* @property _defaultOptions.startUpAnimationElementDelayInMilliseconds - Delay
|
|
66
66
|
* between two startup animated dom nodes in order.
|
|
67
67
|
* @property _defaultOptions.startUpHide - Options for initially hiding dom
|
|
68
68
|
* nodes showing on startup later.
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";if("undefined"!=typeof module&&null!==module&&"undefined"!==eval("typeof require")&&null!==eval("require")&&"main"in eval("require")&&"undefined"!==eval("typeof require.main")&&null!==eval("require.main")){var ORIGINAL_MAIN_MODULE=module;module!==eval("require.main")&&"paths"in module&&"paths"in eval("require.main")&&"undefined"!=typeof __dirname&&null!==__dirname&&(module.paths=eval("require.main.paths").concat(module.paths.filter((function(path){return eval("require.main.paths").includes(path)}))))}if(null==window)var window="undefined"==typeof global||null===global?{}:global;!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/inheritsLoose"),require("@babel/runtime/regenerator"),require("clientnode"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/asyncToGenerator","@babel/runtime/helpers/extends","@babel/runtime/helpers/inheritsLoose","@babel/runtime/regenerator","clientnode"],e);else{var n="object"==typeof exports?e(require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/inheritsLoose"),require("@babel/runtime/regenerator"),require("clientnode")):e(t["@babel/runtime/helpers/asyncToGenerator"],t["@babel/runtime/helpers/extends"],t["@babel/runtime/helpers/inheritsLoose"],t["@babel/runtime/regenerator"],t.clientnode);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(function(t,e,n,o,i){return function(){var r=[,,,function(e){e.exports=t},function(t){t.exports=e},function(t){t.exports=n},function(t){t.exports=o},function(t){t.exports=i}],a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var n=a[t]={exports:{}};return r[t](n,n.exports,s),n.exports}s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var l={};return function(){s.r(l),s.d(l,{WebsiteUtilities:function(){return b},default:function(){return y}});var t=s(3),e=s.n(t),n=s(4),o=s.n(n),i=s(5),r=s.n(i),a=s(6),d=s.n(a),c=s(7),u=function(){return u=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},u.apply(this,arguments)},p={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",fadeColor:"transparent",animation:"spinner-line-fade-default",rotate:0,direction:1,speed:1,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:"0 0 1px transparent",position:"absolute"},h=function(){function t(t){void 0===t&&(t={}),this.opts=u(u({},p),t)}return t.prototype.spin=function(t){return this.stop(),this.el=document.createElement("div"),this.el.className=this.opts.className,this.el.setAttribute("role","progressbar"),this.el.style.position=this.opts.position,this.el.style.width="0",this.el.style.zIndex=this.opts.zIndex.toString(),this.el.style.left=this.opts.left,this.el.style.top=this.opts.top,this.el.style.transform="scale(".concat(this.opts.scale,")"),t&&t.insertBefore(this.el,t.firstChild||null),function(t,e){var n=Math.round(e.corners*e.width*500)/1e3+"px",o="none";!0===e.shadow?o="0 2px 4px #000":"string"==typeof e.shadow&&(o=e.shadow);for(var i=function(t){for(var e=/^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/,n=[],o=0,i=t.split(",");o<i.length;o++){var r=i[o].match(e);if(null!==r){var a=+r[2],s=+r[5],l=r[4],d=r[7];0!==a||l||(l=d),0!==s||d||(d=l),l===d&&n.push({prefix:r[1]||"",x:a,y:s,xUnits:l,yUnits:d,end:r[8]})}}return n}(o),r=0;r<e.lines;r++){var a=~~(360/e.lines*r+e.rotate),s=document.createElement("div");s.style.position="absolute",s.style.top="".concat(-e.width/2,"px"),s.style.width=e.length+e.width+"px",s.style.height=e.width+"px",s.style.background=m(e.fadeColor,r),s.style.borderRadius=n,s.style.transformOrigin="left",s.style.transform="rotate(".concat(a,"deg) translateX(").concat(e.radius,"px)");var l=r*e.direction/e.lines/e.speed;l-=1/e.speed;var d=document.createElement("div");d.style.width="100%",d.style.height="100%",d.style.background=m(e.color,r),d.style.borderRadius=n,d.style.boxShadow=f(i,a),d.style.animation="".concat(1/e.speed,"s linear ").concat(l,"s infinite ").concat(e.animation),s.appendChild(d),t.appendChild(s)}}(this.el,this.opts),this},t.prototype.stop=function(){return this.el&&(this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=void 0),this},t}();function m(t,e){return"string"==typeof t?t:t[e%t.length]}function f(t,e){for(var n=[],o=0,i=t;o<i.length;o++){var r=i[o],a=g(r.x,r.y,e);n.push(r.prefix+a[0]+r.xUnits+" "+a[1]+r.yUnits+r.end)}return n.join(", ")}function g(t,e,n){var o=n*Math.PI/180,i=Math.sin(o),r=Math.cos(o);return[Math.round(1e3*(t*r+e*i))/1e3,Math.round(1e3*(-t*i+e*r))/1e3]}function w(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return v(t,e);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)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}var b=function(t){function n(){for(var e,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))||this).options=null,e.$domNodes=null,e.currentMediaQueryMode="",e.currentSectionName="home",e.languageHandler=null,e.startUpAnimationIsComplete=!1,e.viewportIsOnTop=!1,e.windowLoaded=!1,e.windowLoadingSpinner=null,e._onViewportMovesToTop=(0,c.debounce)((function(){"hidden"===e.$domNodes.scrollToTopButton.css("visibility")?e.$domNodes.scrollToTopButton.css("opacity",0):(e.options.scrollToTop.button.hideAnimationOptions.always=function(){return e.$domNodes.scrollToTopButton.css({bottom:"-="+String(e.options.scrollToTop.button.slideDistanceInPixel),display:"none"})},e.$domNodes.scrollToTopButton.finish().animate({bottom:"+="+String(e.options.scrollToTop.button.slideDistanceInPixel),opacity:0},e.options.scrollToTop.button.hideAnimationOptions))})),e._onViewportMovesAwayFromTop=(0,c.debounce)((function(){"hidden"===e.$domNodes.scrollToTopButton.css("visibility")?e.$domNodes.scrollToTopButton.css("opacity",1):e.$domNodes.scrollToTopButton.finish().css({bottom:"+="+String(e.options.scrollToTop.button.slideDistanceInPixel),display:"block",opacity:0}).animate({bottom:"-="+String(e.options.scrollToTop.button.slideDistanceInPixel),queue:!1,opacity:1},e.options.scrollToTop.button.showAnimationOptions)})),e}r()(n,t);var i=n.prototype;return i.initialize=function(e){var o=this;return void 0===e&&(e={}),t.prototype.initialize.call(this,(0,c.extend)(!0,{},n._defaultOptions,e)),this.$domNodes=this.grabDomNodes(this.options.domNodes),this.disableScrolling(),new Promise((function(t){var e;o.$domNodes.windowLoadingSpinner.length&&(o.windowLoadingSpinner=new h(o.options.windowLoadingSpinner),o.windowLoadingSpinner.spin(o.$domNodes.windowLoadingSpinner[0])),o._bindScrollEvents(),null==(e=o.$domNodes.parent)||e.show();var n=function(){o.windowLoaded||(o.windowLoaded=!0,o._removeLoadingCover().then((function(){o._performStartUpEffects(),t(o)})))};(0,c.$)((function(){(0,c.timeout)(n,o.options.windowLoadedTimeoutAfterDocLoadedInMSec)})),o.on(o.$domNodes.window,"load",n),o._bindClickTracking(),o.options.language.logging||(o.options.language.logging=o.options.logging),o.options.activateLanguageSupport&&!o.languageHandler&&(0,c.$)(o.$domNodes.parent).Internationalisation(o.options.language).then((function(t){o.languageHandler=t.data("Internationalisation")})),o._bindNavigationEvents(),o._bindMediaQueryChangeEvents(),o._triggerWindowResizeEvents()}))},i.scrollToTop=function(){return c.globalContext.document&&(0,c.$)("html, body").stop().animate({scrollTop:0},this.options.scrollToTop.options),this},i.disableScrolling=function(){var t;return null==(t=this.$domNodes.parent)||t.addClass("disable-scrolling").on("touchmove",(function(t){t.preventDefault()})),this},i.enableScrolling=function(){return this.$domNodes.parent&&(this.$domNodes.parent.removeClass(["disable-scrolling","touchmove"]),this.off(this.$domNodes.parent)),this},i.track=function(t){var e;if(null!=(e=c.globalContext.window)&&e.location&&this.options.tracking){var n=o()({context:c.globalContext.window.location.pathname+"#"+this.currentSectionName},t);(isNaN(n.value)||"number"!=typeof n.value)&&(n.value=1),this.debug('Run tracking code: "event" with arguments:'),this.debug(n);try{this.options.tracking.track(n)}catch(t){this.warn('Problem in tracking "'+(0,c.represent)(n)+'": '+(0,c.represent)(t))}}return this},i._onChangeMediaQueryMode=function(t,e){},i._onChangeToLargeMode=function(t,e){},i._onChangeToMediumMode=function(t,e){},i._onChangeToSmallMode=function(t,e){},i._onChangeToExtraSmallMode=function(t,e){},i._onSwitchSection=function(t){var e;if(Object.prototype.hasOwnProperty.call(c.globalContext.window,"location")&&null!=(e=this.options.tracking)&&e.sectionSwitch&&this.currentSectionName!==t){this.currentSectionName=t,this.debug('Run section switch tracking on section "'+this.currentSectionName+'".');try{this.options.tracking.sectionSwitch.call(this,this.currentSectionName)}catch(t){this.warn('Problem due to track section switch to "'+this.currentSectionName+'": '+(0,c.represent)(t))}}},i._onStartUpAnimationComplete=function(){this.startUpAnimationIsComplete=!0},i._bindMediaQueryChangeEvents=function(){this.on(this.$domNodes.window,"resize",this._triggerWindowResizeEvents.bind(this))},i._triggerWindowResizeEvents=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var o,i=w(this.options.mediaQueryClassNameIndicator);!(o=i()).done;){var r=o.value;this.$domNodes.parent&&this.$domNodes.mediaQueryIndicator.prependTo(this.$domNodes.parent).addClass("hidden-"+r[1]),this.$domNodes.mediaQueryIndicator.is(":hidden")&&r[0]!==this.currentMediaQueryMode&&(this.fireEvent.apply(this,["changeMediaQueryMode",!1,this,this.currentMediaQueryMode,r[0]].concat(e)),this.fireEvent.apply(this,["changeTo"+(0,c.capitalize)(r[0])+"Mode",!1,this,this.currentMediaQueryMode,r[0]].concat(e)),this.currentMediaQueryMode=r[0]),this.$domNodes.mediaQueryIndicator.removeClass("hidden-"+r[1])}},i._bindScrollEvents=function(){for(var t,e=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var r=(0,c.$)("body, html"),a=this.$domNodes.window?r.add(this.$domNodes.window):r;a.on(this.options.knownScrollEventNames.join(" "),(function(t){e.options.switchToManualScrollingIndicator(t)&&a.stop(!0)})),this.on(this.$domNodes.window,"scroll",(function(){var t;null!=(t=e.$domNodes.window)&&t.scrollTop()?e.viewportIsOnTop&&(e.viewportIsOnTop=!1,e.fireEvent.apply(e,["viewportMovesAwayFromTop",!1,e].concat(o))):e.viewportIsOnTop||(e.viewportIsOnTop=!0,e.fireEvent.apply(e,["viewportMovesToTop",!1,e].concat(o)))})),null!=(t=this.$domNodes.window)&&t.scrollTop()?(this.viewportIsOnTop=!1,this.fireEvent.apply(this,["viewportMovesAwayFromTop",!1,this].concat(o))):(this.viewportIsOnTop=!0,this.fireEvent.apply(this,["viewportMovesToTop",!1,this].concat(o)))},i._removeLoadingCover=function(){var t=e()(d().mark((function t(){var e=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.timeout)(this.options.additionalPageLoadingTimeInMilliseconds);case 2:return(0,c.$)((0,c.format)('[class^="{1}"], [class*=" {1}"]',this.sliceDomNodeSelectorPrefix(this.options.domNodes.startUpAnimationClassPrefix).substring(1))).css(this.options.startUpHide),t.next=5,new Promise((function(t){e.$domNodes.windowLoadingCover.length?(e.enableScrolling(),e.$domNodes.windowLoadingCover.animate(e.options.windowLoadingCoverHideAnimation,{always:function(){t()}})):t()}));case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),i._performStartUpEffects=function(){var t=e()(d().mark((function t(e){var n,o=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e=1),this.$domNodes.windowLoadingCover.hide(),this.windowLoadingSpinner&&this.windowLoadingSpinner.stop(),!(0,c.$)((0,c.format)('[class^="{1}"], [class*=" {1}"]',this.sliceDomNodeSelectorPrefix(this.options.domNodes.startUpAnimationClassPrefix).substring(1))).length){t.next=17;break}return t.next=6,(0,c.timeout)(this.options.startUpAnimationElementDelayInMiliseconds);case 6:if(n=!1,(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+String(e)).animate(this.options.startUpShowAnimation,{always:function(){n&&o.fireEvent("startUpAnimationComplete")}}),!(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+String(e+1)).length){t.next=14;break}return t.next=12,this._performStartUpEffects(e+1);case 12:t.next=15;break;case 14:n=!0;case 15:t.next=18;break;case 17:this.fireEvent("startUpAnimationComplete");case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),i._bindNavigationEvents=function(){var t,e=this;null==(t=c.globalContext.window)||t.addEventListener("hashchange",(function(t){e.startUpAnimationIsComplete&&e.fireEvent("switchSection",!1,e,location.hash.substring(1),t)}),!1),this._bindScrollToTopButton()},i._bindScrollToTopButton=function(){var t=this;this.on(this.$domNodes.scrollToTopButton,"click",(function(e){e.preventDefault(),t.scrollToTop()}))},i._bindClickTracking=function(){var t,e,n=this;this.options.tracking&&(this.options.tracking.linkClick&&this.on(null==(t=this.$domNodes.parent)?void 0:t.find("a"),"click",(function(t){var e;null==(e=n.options.tracking)||null==(e=e.linkClick)||e.call(n,(0,c.$)(t.target),t)})),this.options.tracking.buttonClick&&this.on(null==(e=this.$domNodes.parent)?void 0:e.find("button"),"click",(function(t){var e;null==(e=n.options.tracking)||null==(e=e.buttonClick)||e.call(n,(0,c.$)(t.target),t)})))},n}(c.Tools);b._defaultOptions={activateLanguageSupport:!0,additionalPageLoadingTimeInMilliseconds:0,domain:"auto",domNodes:{mediaQueryIndicator:'<div class="wu-media-query-indicator">',scrollToTopButton:'a[href="#top"]',startUpAnimationClassPrefix:".wu-start-up-animation-number-",top:"header",windowLoadingCover:".window-loading-cover, .wu-window-loading-cover",windowLoadingSpinner:".window-loading-cover > div, .wu-window-loading-cover > div"},domNodeSelectorInfix:"wu",domNodeSelectorPrefix:"body.{1}",initialSectionName:"home",knownScrollEventNames:["DOMMouseScroll","keyup","mousedown","mousewheel","scroll","touchmove","wheel"],language:{},mediaQueryClassNameIndicator:[["extraSmall","xs"],["small","sm"],["medium","md"],["large","lg"]],name:"WebsiteUtilities",onChangeMediaQueryMode:c.NOOP,onChangeToExtraSmallMode:c.NOOP,onChangeToLargeMode:c.NOOP,onChangeToMediumMode:c.NOOP,onChangeToSmallMode:c.NOOP,onViewportMovesAwayFromTop:c.NOOP,onViewportMovesToTop:c.NOOP,onSwitchSection:c.NOOP,onStartUpAnimationComplete:c.NOOP,scrollToTop:{button:{hideAnimationOptions:{},showAnimationOptions:{},slideDistanceInPixel:30},options:{duration:"fast"}},startUpAnimationElementDelayInMiliseconds:100,startUpHide:{opacity:0},startUpShowAnimation:{opacity:1},switchToManualScrollingIndicator:function(t){return"number"==typeof t.which&&t.which>0||"mousedown"===t.type||"mousewheel"===t.type||"touchmove"===t.type},tracking:{buttonClick:function(t){this.track({event:"buttonClick",eventType:"click",label:t.text(),reference:t.attr("action")||t.attr("target")||t.attr("type")||t.text(),subject:"button",value:parseInt(t.attr("website-analytics-value")),userInteraction:!0})},linkClick:function(t){this.track({event:"linkClick",eventType:"click",label:t.text(),reference:t.attr("href")||t.attr("action")||t.attr("target")||t.attr("type")||t.text(),subject:"link",value:parseInt(t.attr("website-analytics-value")),userInteraction:!0})},sectionSwitch:function(t){var e;null!=(e=c.globalContext.window)&&e.location&&this.track({event:"sectionSwitch",eventType:"sectionSwitch",label:t,reference:c.globalContext.window.location.pathname+"#"+t,subject:"url",userInteraction:!1})},track:function(t){var e;null==(e=c.globalContext.dataLayer)||e.push(t)}},windowLoadingCoverHideAnimation:{opacity:0},windowLoadingSpinner:{animation:"spinner-line-fade-quick",className:"spinner",color:"#000",corners:1,direction:1,fadeColor:"transparent",left:"auto",length:23,lines:9,position:"absolute",radius:40,rotate:0,scale:1,shadow:!1,speed:1.1,top:"auto",width:11,zIndex:2e9},windowLoadedTimeoutAfterDocLoadedInMSec:2e3};var y=b;c.$.WebsiteUtilities=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return c.Tools.controller(b,e)},c.$.WebsiteUtilities.class=b}(),l}()}));
|
|
1
|
+
"use strict";if("undefined"!=typeof module&&null!==module&&"undefined"!==eval("typeof require")&&null!==eval("require")&&"main"in eval("require")&&"undefined"!==eval("typeof require.main")&&null!==eval("require.main")){var ORIGINAL_MAIN_MODULE=module;module!==eval("require.main")&&"paths"in module&&"paths"in eval("require.main")&&"undefined"!=typeof __dirname&&null!==__dirname&&(module.paths=eval("require.main.paths").concat(module.paths.filter((function(path){return eval("require.main.paths").includes(path)}))))}if(null==window)var window="undefined"==typeof global||null===global?{}:global;!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/inheritsLoose"),require("@babel/runtime/regenerator"),require("clientnode"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/asyncToGenerator","@babel/runtime/helpers/extends","@babel/runtime/helpers/inheritsLoose","@babel/runtime/regenerator","clientnode"],e);else{var n="object"==typeof exports?e(require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/inheritsLoose"),require("@babel/runtime/regenerator"),require("clientnode")):e(t["@babel/runtime/helpers/asyncToGenerator"],t["@babel/runtime/helpers/extends"],t["@babel/runtime/helpers/inheritsLoose"],t["@babel/runtime/regenerator"],t.clientnode);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(function(t,e,n,o,i){return function(){var r=[,,,function(e){e.exports=t},function(t){t.exports=e},function(t){t.exports=n},function(t){t.exports=o},function(t){t.exports=i}],a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var n=a[t]={exports:{}};return r[t](n,n.exports,s),n.exports}s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var l={};return function(){s.r(l),s.d(l,{WebsiteUtilities:function(){return b},default:function(){return y}});var t=s(3),e=s.n(t),n=s(4),o=s.n(n),i=s(5),r=s.n(i),a=s(6),d=s.n(a),c=s(7),u=function(){return u=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},u.apply(this,arguments)},p={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",fadeColor:"transparent",animation:"spinner-line-fade-default",rotate:0,direction:1,speed:1,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:"0 0 1px transparent",position:"absolute"},h=function(){function t(t){void 0===t&&(t={}),this.opts=u(u({},p),t)}return t.prototype.spin=function(t){return this.stop(),this.el=document.createElement("div"),this.el.className=this.opts.className,this.el.setAttribute("role","progressbar"),this.el.style.position=this.opts.position,this.el.style.width="0",this.el.style.zIndex=this.opts.zIndex.toString(),this.el.style.left=this.opts.left,this.el.style.top=this.opts.top,this.el.style.transform="scale(".concat(this.opts.scale,")"),t&&t.insertBefore(this.el,t.firstChild||null),function(t,e){var n=Math.round(e.corners*e.width*500)/1e3+"px",o="none";!0===e.shadow?o="0 2px 4px #000":"string"==typeof e.shadow&&(o=e.shadow);for(var i=function(t){for(var e=/^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/,n=[],o=0,i=t.split(",");o<i.length;o++){var r=i[o].match(e);if(null!==r){var a=+r[2],s=+r[5],l=r[4],d=r[7];0!==a||l||(l=d),0!==s||d||(d=l),l===d&&n.push({prefix:r[1]||"",x:a,y:s,xUnits:l,yUnits:d,end:r[8]})}}return n}(o),r=0;r<e.lines;r++){var a=~~(360/e.lines*r+e.rotate),s=document.createElement("div");s.style.position="absolute",s.style.top="".concat(-e.width/2,"px"),s.style.width=e.length+e.width+"px",s.style.height=e.width+"px",s.style.background=m(e.fadeColor,r),s.style.borderRadius=n,s.style.transformOrigin="left",s.style.transform="rotate(".concat(a,"deg) translateX(").concat(e.radius,"px)");var l=r*e.direction/e.lines/e.speed;l-=1/e.speed;var d=document.createElement("div");d.style.width="100%",d.style.height="100%",d.style.background=m(e.color,r),d.style.borderRadius=n,d.style.boxShadow=f(i,a),d.style.animation="".concat(1/e.speed,"s linear ").concat(l,"s infinite ").concat(e.animation),s.appendChild(d),t.appendChild(s)}}(this.el,this.opts),this},t.prototype.stop=function(){return this.el&&(this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=void 0),this},t}();function m(t,e){return"string"==typeof t?t:t[e%t.length]}function f(t,e){for(var n=[],o=0,i=t;o<i.length;o++){var r=i[o],a=g(r.x,r.y,e);n.push(r.prefix+a[0]+r.xUnits+" "+a[1]+r.yUnits+r.end)}return n.join(", ")}function g(t,e,n){var o=n*Math.PI/180,i=Math.sin(o),r=Math.cos(o);return[Math.round(1e3*(t*r+e*i))/1e3,Math.round(1e3*(-t*i+e*r))/1e3]}function w(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return v(t,e);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)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}var b=function(t){function n(){for(var e,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))||this).options=null,e.$domNodes=null,e.currentMediaQueryMode="",e.currentSectionName="home",e.languageHandler=null,e.startUpAnimationIsComplete=!1,e.viewportIsOnTop=!1,e.windowLoaded=!1,e.windowLoadingSpinner=null,e._onViewportMovesToTop=(0,c.debounce)((function(){"hidden"===e.$domNodes.scrollToTopButton.css("visibility")?e.$domNodes.scrollToTopButton.css("opacity",0):(e.options.scrollToTop.button.hideAnimationOptions.always=function(){return e.$domNodes.scrollToTopButton.css({bottom:"-="+String(e.options.scrollToTop.button.slideDistanceInPixel),display:"none"})},e.$domNodes.scrollToTopButton.finish().animate({bottom:"+="+String(e.options.scrollToTop.button.slideDistanceInPixel),opacity:0},e.options.scrollToTop.button.hideAnimationOptions))})),e._onViewportMovesAwayFromTop=(0,c.debounce)((function(){"hidden"===e.$domNodes.scrollToTopButton.css("visibility")?e.$domNodes.scrollToTopButton.css("opacity",1):e.$domNodes.scrollToTopButton.finish().css({bottom:"+="+String(e.options.scrollToTop.button.slideDistanceInPixel),display:"block",opacity:0}).animate({bottom:"-="+String(e.options.scrollToTop.button.slideDistanceInPixel),queue:!1,opacity:1},e.options.scrollToTop.button.showAnimationOptions)})),e}r()(n,t);var i=n.prototype;return i.initialize=function(e){var o=this;return void 0===e&&(e={}),t.prototype.initialize.call(this,(0,c.extend)(!0,{},n._defaultOptions,e)),this.$domNodes=this.grabDomNodes(this.options.domNodes),this.disableScrolling(),new Promise((function(t){var e;o.$domNodes.windowLoadingSpinner.length&&(o.windowLoadingSpinner=new h(o.options.windowLoadingSpinner),o.windowLoadingSpinner.spin(o.$domNodes.windowLoadingSpinner[0])),o._bindScrollEvents(),null==(e=o.$domNodes.parent)||e.show();var n=function(){o.windowLoaded||(o.windowLoaded=!0,o._removeLoadingCover().then((function(){o._performStartUpEffects(),t(o)})))};(0,c.$)((function(){(0,c.timeout)(n,o.options.windowLoadedTimeoutAfterDocLoadedInMSec)})),o.on(o.$domNodes.window,"load",n),o._bindClickTracking(),o.options.language.logging||(o.options.language.logging=o.options.logging),o.options.activateLanguageSupport&&!o.languageHandler&&(0,c.$)(o.$domNodes.parent).Internationalisation(o.options.language).then((function(t){o.languageHandler=t.data("Internationalisation")})),o._bindNavigationEvents(),o._bindMediaQueryChangeEvents(),o._triggerWindowResizeEvents()}))},i.scrollToTop=function(){return c.globalContext.document&&(0,c.$)("html, body").stop().animate({scrollTop:0},this.options.scrollToTop.options),this},i.disableScrolling=function(){var t;return null==(t=this.$domNodes.parent)||t.addClass("disable-scrolling").on("touchmove",(function(t){t.preventDefault()})),this},i.enableScrolling=function(){return this.$domNodes.parent&&(this.$domNodes.parent.removeClass(["disable-scrolling","touchmove"]),this.off(this.$domNodes.parent)),this},i.track=function(t){var e;if(null!=(e=c.globalContext.window)&&e.location&&this.options.tracking){var n=o()({context:c.globalContext.window.location.pathname+"#"+this.currentSectionName},t);(isNaN(n.value)||"number"!=typeof n.value)&&(n.value=1),this.debug('Run tracking code: "event" with arguments:'),this.debug(n);try{this.options.tracking.track(n)}catch(t){this.warn('Problem in tracking "'+(0,c.represent)(n)+'": '+(0,c.represent)(t))}}return this},i._onChangeMediaQueryMode=function(t,e){},i._onChangeToLargeMode=function(t,e){},i._onChangeToMediumMode=function(t,e){},i._onChangeToSmallMode=function(t,e){},i._onChangeToExtraSmallMode=function(t,e){},i._onSwitchSection=function(t){var e;if(Object.prototype.hasOwnProperty.call(c.globalContext.window,"location")&&null!=(e=this.options.tracking)&&e.sectionSwitch&&this.currentSectionName!==t){this.currentSectionName=t,this.debug('Run section switch tracking on section "'+this.currentSectionName+'".');try{this.options.tracking.sectionSwitch.call(this,this.currentSectionName)}catch(t){this.warn('Problem due to track section switch to "'+this.currentSectionName+'": '+(0,c.represent)(t))}}},i._onStartUpAnimationComplete=function(){this.startUpAnimationIsComplete=!0},i._bindMediaQueryChangeEvents=function(){this.on(this.$domNodes.window,"resize",this._triggerWindowResizeEvents.bind(this))},i._triggerWindowResizeEvents=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var o,i=w(this.options.mediaQueryClassNameIndicator);!(o=i()).done;){var r=o.value;this.$domNodes.parent&&this.$domNodes.mediaQueryIndicator.prependTo(this.$domNodes.parent).addClass("hidden-"+r[1]),this.$domNodes.mediaQueryIndicator.is(":hidden")&&r[0]!==this.currentMediaQueryMode&&(this.fireEvent.apply(this,["changeMediaQueryMode",!1,this,this.currentMediaQueryMode,r[0]].concat(e)),this.fireEvent.apply(this,["changeTo"+(0,c.capitalize)(r[0])+"Mode",!1,this,this.currentMediaQueryMode,r[0]].concat(e)),this.currentMediaQueryMode=r[0]),this.$domNodes.mediaQueryIndicator.removeClass("hidden-"+r[1])}},i._bindScrollEvents=function(){for(var t,e=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var r=(0,c.$)("body, html"),a=this.$domNodes.window?r.add(this.$domNodes.window):r;a.on(this.options.knownScrollEventNames.join(" "),(function(t){e.options.switchToManualScrollingIndicator(t)&&a.stop(!0)})),this.on(this.$domNodes.window,"scroll",(function(){var t;null!=(t=e.$domNodes.window)&&t.scrollTop()?e.viewportIsOnTop&&(e.viewportIsOnTop=!1,e.fireEvent.apply(e,["viewportMovesAwayFromTop",!1,e].concat(o))):e.viewportIsOnTop||(e.viewportIsOnTop=!0,e.fireEvent.apply(e,["viewportMovesToTop",!1,e].concat(o)))})),null!=(t=this.$domNodes.window)&&t.scrollTop()?(this.viewportIsOnTop=!1,this.fireEvent.apply(this,["viewportMovesAwayFromTop",!1,this].concat(o))):(this.viewportIsOnTop=!0,this.fireEvent.apply(this,["viewportMovesToTop",!1,this].concat(o)))},i._removeLoadingCover=function(){var t=e()(d().mark((function t(){var e=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.timeout)(this.options.additionalPageLoadingTimeInMilliseconds);case 2:return(0,c.$)((0,c.format)('[class^="{1}"], [class*=" {1}"]',this.sliceDomNodeSelectorPrefix(this.options.domNodes.startUpAnimationClassPrefix).substring(1))).css(this.options.startUpHide),t.next=5,new Promise((function(t){e.$domNodes.windowLoadingCover.length?(e.enableScrolling(),e.$domNodes.windowLoadingCover.animate(e.options.windowLoadingCoverHideAnimation,{always:function(){t()}})):t()}));case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),i._performStartUpEffects=function(){var t=e()(d().mark((function t(e){var n,o=this;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e=1),this.$domNodes.windowLoadingCover.hide(),this.windowLoadingSpinner&&this.windowLoadingSpinner.stop(),!(0,c.$)((0,c.format)('[class^="{1}"], [class*=" {1}"]',this.sliceDomNodeSelectorPrefix(this.options.domNodes.startUpAnimationClassPrefix).substring(1))).length){t.next=17;break}return t.next=6,(0,c.timeout)(this.options.startUpAnimationElementDelayInMilliseconds);case 6:if(n=!1,(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+String(e)).animate(this.options.startUpShowAnimation,{always:function(){n&&o.fireEvent("startUpAnimationComplete")}}),!(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+String(e+1)).length){t.next=14;break}return t.next=12,this._performStartUpEffects(e+1);case 12:t.next=15;break;case 14:n=!0;case 15:t.next=18;break;case 17:this.fireEvent("startUpAnimationComplete");case 18:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),i._bindNavigationEvents=function(){var t,e=this;null==(t=c.globalContext.window)||t.addEventListener("hashchange",(function(t){e.startUpAnimationIsComplete&&e.fireEvent("switchSection",!1,e,location.hash.substring(1),t)}),!1),this._bindScrollToTopButton()},i._bindScrollToTopButton=function(){var t=this;this.on(this.$domNodes.scrollToTopButton,"click",(function(e){e.preventDefault(),t.scrollToTop()}))},i._bindClickTracking=function(){var t,e,n=this;this.options.tracking&&(this.options.tracking.linkClick&&this.on(null==(t=this.$domNodes.parent)?void 0:t.find("a"),"click",(function(t){var e;null==(e=n.options.tracking)||null==(e=e.linkClick)||e.call(n,(0,c.$)(t.target),t)})),this.options.tracking.buttonClick&&this.on(null==(e=this.$domNodes.parent)?void 0:e.find("button"),"click",(function(t){var e;null==(e=n.options.tracking)||null==(e=e.buttonClick)||e.call(n,(0,c.$)(t.target),t)})))},n}(c.Tools);b._defaultOptions={activateLanguageSupport:!0,additionalPageLoadingTimeInMilliseconds:0,domain:"auto",domNodes:{mediaQueryIndicator:'<div class="wu-media-query-indicator">',scrollToTopButton:'a[href="#top"]',startUpAnimationClassPrefix:".wu-start-up-animation-number-",top:"header",windowLoadingCover:".window-loading-cover, .wu-window-loading-cover",windowLoadingSpinner:".window-loading-cover > div, .wu-window-loading-cover > div"},domNodeSelectorInfix:"wu",domNodeSelectorPrefix:"body.{1}",initialSectionName:"home",knownScrollEventNames:["DOMMouseScroll","keyup","mousedown","mousewheel","scroll","touchmove","wheel"],language:{},mediaQueryClassNameIndicator:[["extraSmall","xs"],["small","sm"],["medium","md"],["large","lg"]],name:"WebsiteUtilities",onChangeMediaQueryMode:c.NOOP,onChangeToExtraSmallMode:c.NOOP,onChangeToLargeMode:c.NOOP,onChangeToMediumMode:c.NOOP,onChangeToSmallMode:c.NOOP,onViewportMovesAwayFromTop:c.NOOP,onViewportMovesToTop:c.NOOP,onSwitchSection:c.NOOP,onStartUpAnimationComplete:c.NOOP,scrollToTop:{button:{hideAnimationOptions:{},showAnimationOptions:{},slideDistanceInPixel:30},options:{duration:"fast"}},startUpAnimationElementDelayInMilliseconds:100,startUpHide:{opacity:0},startUpShowAnimation:{opacity:1},switchToManualScrollingIndicator:function(t){return"number"==typeof t.which&&t.which>0||"mousedown"===t.type||"mousewheel"===t.type||"touchmove"===t.type},tracking:{buttonClick:function(t){this.track({event:"buttonClick",eventType:"click",label:t.text(),reference:t.attr("action")||t.attr("target")||t.attr("type")||t.text(),subject:"button",value:parseInt(t.attr("website-analytics-value")),userInteraction:!0})},linkClick:function(t){this.track({event:"linkClick",eventType:"click",label:t.text(),reference:t.attr("href")||t.attr("action")||t.attr("target")||t.attr("type")||t.text(),subject:"link",value:parseInt(t.attr("website-analytics-value")),userInteraction:!0})},sectionSwitch:function(t){var e;null!=(e=c.globalContext.window)&&e.location&&this.track({event:"sectionSwitch",eventType:"sectionSwitch",label:t,reference:c.globalContext.window.location.pathname+"#"+t,subject:"url",userInteraction:!1})},track:function(t){var e;null==(e=c.globalContext.dataLayer)||e.push(t)}},windowLoadingCoverHideAnimation:{opacity:0},windowLoadingSpinner:{animation:"spinner-line-fade-quick",className:"spinner",color:"#000",corners:1,direction:1,fadeColor:"transparent",left:"auto",length:23,lines:9,position:"absolute",radius:40,rotate:0,scale:1,shadow:!1,speed:1.1,top:"auto",width:11,zIndex:2e9},windowLoadedTimeoutAfterDocLoadedInMSec:2e3};var y=b;c.$.WebsiteUtilities=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return c.Tools.controller(b,e)},c.$.WebsiteUtilities.class=b}(),l}()}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "website-utilities",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.354",
|
|
4
4
|
"description": "extend your web app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jquery",
|
|
@@ -62,25 +62,25 @@
|
|
|
62
62
|
"watch": "weboptimizer build --watch"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@babel/eslint-parser": "^7.25.
|
|
65
|
+
"@babel/eslint-parser": "^7.25.8",
|
|
66
66
|
"@babel/plugin-transform-proto-to-assign": "^7.25.7",
|
|
67
67
|
"@babel/runtime": "^7.25.7",
|
|
68
|
-
"@stylistic/eslint-plugin-ts": "^2.
|
|
68
|
+
"@stylistic/eslint-plugin-ts": "^2.9.0",
|
|
69
69
|
"@types/ejs": "^3.1.5",
|
|
70
70
|
"@types/html-minifier": "^4.0.5",
|
|
71
71
|
"@types/jquery": "^3.5.31",
|
|
72
72
|
"@types/jsdom": "^21.1.7",
|
|
73
|
-
"@types/node": "^22.7.
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
75
|
-
"@typescript-eslint/parser": "^8.
|
|
76
|
-
"clientnode": "^3.0.
|
|
73
|
+
"@types/node": "^22.7.5",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
|
75
|
+
"@typescript-eslint/parser": "^8.9.0",
|
|
76
|
+
"clientnode": "^3.0.1205",
|
|
77
77
|
"css-loader": "^7.1.2",
|
|
78
78
|
"cssnano": "^7.0.6",
|
|
79
|
-
"documentation-website": "^1.0.
|
|
80
|
-
"eslint": "^9.
|
|
79
|
+
"documentation-website": "^1.0.335",
|
|
80
|
+
"eslint": "^9.12.0",
|
|
81
81
|
"eslint-config-google": "^0.14.0",
|
|
82
|
-
"eslint-plugin-jsdoc": "^50.
|
|
83
|
-
"internationalisation": "^1.0.
|
|
82
|
+
"eslint-plugin-jsdoc": "^50.4.1",
|
|
83
|
+
"internationalisation": "^1.0.324",
|
|
84
84
|
"jest": "^29.7.0",
|
|
85
85
|
"jquery": "^3.7.1",
|
|
86
86
|
"jsdoc": "^4.0.3",
|
|
@@ -89,18 +89,18 @@
|
|
|
89
89
|
"postcss-fontpath": "^1.0.0",
|
|
90
90
|
"postcss-import": "^16.1.0",
|
|
91
91
|
"postcss-loader": "^8.1.1",
|
|
92
|
-
"postcss-preset-env": "^10.0.
|
|
92
|
+
"postcss-preset-env": "^10.0.7",
|
|
93
93
|
"postcss-scss": "^4.0.9",
|
|
94
94
|
"postcss-sprites": "^4.2.1",
|
|
95
95
|
"postcss-url": "^10.1.3",
|
|
96
|
-
"sass": "^1.79.
|
|
96
|
+
"sass": "^1.79.5",
|
|
97
97
|
"sass-loader": "^16.0.2",
|
|
98
98
|
"spin.js": "^4.1.2",
|
|
99
99
|
"style-loader": "^4.0.0",
|
|
100
|
-
"stylelint": "^16.
|
|
100
|
+
"stylelint": "^16.10.0",
|
|
101
101
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
102
|
-
"typescript-eslint": "^8.
|
|
103
|
-
"weboptimizer": "^2.0.
|
|
102
|
+
"typescript-eslint": "^8.9.0",
|
|
103
|
+
"weboptimizer": "^2.0.1522",
|
|
104
104
|
"webpack-dev-server": "^5.1.0"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
package/readme.md
CHANGED
|
@@ -242,7 +242,7 @@ Here you can see the initialisation with all available plugin options:
|
|
|
242
242
|
onChangeMediaQueryMode: $.noop(),
|
|
243
243
|
onSwitchSection: $.noop(),
|
|
244
244
|
onStartUpAnimationComplete: $.noop(),
|
|
245
|
-
|
|
245
|
+
startUpAnimationElementDelayInMilliseconds: 100,
|
|
246
246
|
startUpShowAnimation: [{opacity: 1}, {}],
|
|
247
247
|
startUpHide: {opacity: 0},
|
|
248
248
|
switchToManualScrollingIndicator: (event:Object):boolean => (
|
package/type.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface DefaultOptions {
|
|
|
48
48
|
};
|
|
49
49
|
options: JQuery.EffectsOptions<HTMLElement>;
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
startUpAnimationElementDelayInMilliseconds: number;
|
|
52
52
|
startUpHide: Mapping<number | string>;
|
|
53
53
|
startUpShowAnimation: FirstParameter<$T['animate']>;
|
|
54
54
|
switchToManualScrollingIndicator: (event: JQuery.Event) => boolean;
|