website-utilities 1.0.348 → 1.0.349
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 +5 -5
- package/index.js +1 -1
- package/package.json +20 -19
- package/type.d.ts +2 -2
package/index.d.ts
CHANGED
|
@@ -120,27 +120,27 @@ export declare class WebsiteUtilities extends Tools {
|
|
|
120
120
|
* Scrolls to top of page. Runs the given function after viewport arrives.
|
|
121
121
|
* @returns Returns the current instance.
|
|
122
122
|
*/
|
|
123
|
-
scrollToTop():
|
|
123
|
+
scrollToTop(): this;
|
|
124
124
|
/**
|
|
125
125
|
* This method disables scrolling on the given web view.
|
|
126
126
|
* @returns Returns the current instance.
|
|
127
127
|
*/
|
|
128
|
-
disableScrolling():
|
|
128
|
+
disableScrolling(): this;
|
|
129
129
|
/**
|
|
130
130
|
* This method disables scrolling on the given web view.
|
|
131
131
|
* @returns Returns the current instance.
|
|
132
132
|
*/
|
|
133
|
-
enableScrolling():
|
|
133
|
+
enableScrolling(): this;
|
|
134
134
|
/**
|
|
135
135
|
* Triggers an analytics event. All given arguments are forwarded to
|
|
136
136
|
* configured analytics event code to defined their environment variables.
|
|
137
|
-
* @param properties - Event tracking
|
|
137
|
+
* @param properties - Event tracking information.
|
|
138
138
|
* @returns Returns the current instance.
|
|
139
139
|
*/
|
|
140
140
|
track(properties: Omit<TrackingItem, 'context' | 'value'> & {
|
|
141
141
|
context?: string;
|
|
142
142
|
value?: number;
|
|
143
|
-
}):
|
|
143
|
+
}): this;
|
|
144
144
|
/**
|
|
145
145
|
* This method triggers if the viewport moves to top.
|
|
146
146
|
* @returns Nothing.
|
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 o="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 n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,(function(t,e,o,n,i){return function(){var r=[,,,function(e){e.exports=t},function(t){t.exports=e},function(t){t.exports=o},function(t){t.exports=n},function(t){t.exports=i}],a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var o=a[t]={exports:{}};return r[t](o,o.exports,s),o.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 o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},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),o=s(4),n=s.n(o),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,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])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 o=Math.round(e.corners*e.width*500)/1e3+"px",n="none";!0===e.shadow?n="0 2px 4px #000":"string"==typeof e.shadow&&(n=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]*)(.*)$/,o=[],n=0,i=t.split(",");n<i.length;n++){var r=i[n].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&&o.push({prefix:r[1]||"",x:a,y:s,xUnits:l,yUnits:d,end:r[8]})}}return o}(n),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=o,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=o,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 o=[],n=0,i=t;n<i.length;n++){var r=i[n],a=g(r.x,r.y,e);o.push(r.prefix+a[0]+r.xUnits+" "+a[1]+r.yUnits+r.end)}return o.join(", ")}function g(t,e,o){var n=o*Math.PI/180,i=Math.sin(n),r=Math.cos(n);return[Math.round(1e3*(t*r+e*i))/1e3,Math.round(1e3*(-t*i+e*r))/1e3]}function w(t,e){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=function(t,e){if(t){if("string"==typeof t)return v(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){o&&(t=o);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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 o=0,n=Array(e);o<e;o++)n[o]=t[o];return n}var b=function(t){function o(){for(var e,o=arguments.length,n=new Array(o),i=0;i<o;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||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:"-="+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()(o,t);var i=o.prototype;return i.initialize=function(e){var n=this;return void 0===e&&(e={}),t.prototype.initialize.call(this,(0,c.extend)(!0,{},o._defaultOptions,e)),this.$domNodes=this.grabDomNodes(this.options.domNodes),this.disableScrolling(),new Promise((function(t){n.$domNodes.windowLoadingSpinner.length&&(n.windowLoadingSpinner=new h(n.options.windowLoadingSpinner),n.windowLoadingSpinner.spin(n.$domNodes.windowLoadingSpinner[0])),n._bindScrollEvents(),n.$domNodes.parent.show();var e=function(){n.windowLoaded||(n.windowLoaded=!0,n._removeLoadingCover().then((function(){n._performStartUpEffects(),t(n)})))};(0,c.$)((function(){(0,c.timeout)(e,n.options.windowLoadedTimeoutAfterDocLoadedInMSec)})),n.on(n.$domNodes.window,"load",e),n._bindClickTracking(),n.options.language.logging||(n.options.language.logging=n.options.logging),n.options.activateLanguageSupport&&!n.languageHandler&&(0,c.$)(n.$domNodes.parent).Internationalisation(n.options.language).then((function(t){n.languageHandler=t.data("Internationalisation")})),n._bindNavigationEvents(),n._bindMediaQueryChangeEvents(),n._triggerWindowResizeEvents()}))},i.scrollToTop=function(){return c.globalContext.document&&(0,c.$)("html, body").stop().animate({scrollTop:0},this.options.scrollToTop.options),this},i.disableScrolling=function(){return this.$domNodes.parent.addClass("disable-scrolling").on("touchmove",(function(t){return t.preventDefault()})),this},i.enableScrolling=function(){return this.$domNodes.parent.removeClass(["disable-scrolling","touchmove"]),this.off(this.$domNodes.parent),this},i.track=function(t){if(c.globalContext.window.location&&this.options.tracking){var e=n()({context:c.globalContext.window.location.pathname+"#"+this.currentSectionName},t);(isNaN(e.value)||"number"!=typeof e.value)&&(e.value=1),this.debug('Run tracking code: "event" with arguments:'),this.debug(e);try{this.options.tracking.track(e)}catch(t){this.warn('Problem in tracking "'+(0,c.represent)(e)+'": '+(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(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),o=0;o<t;o++)e[o]=arguments[o];for(var n,i=w(this.options.mediaQueryClassNameIndicator);!(n=i()).done;){var r=n.value;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=this,e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];var i=(0,c.$)("body, html").add(this.$domNodes.window);i.on(this.options.knownScrollEventNames.join(" "),(function(e){t.options.switchToManualScrollingIndicator(e)&&i.stop(!0)})),this.on(this.$domNodes.window,"scroll",(function(){t.$domNodes.window.scrollTop()?t.viewportIsOnTop&&(t.viewportIsOnTop=!1,t.fireEvent.apply(t,["viewportMovesAwayFromTop",!1,t].concat(o))):t.viewportIsOnTop||(t.viewportIsOnTop=!0,t.fireEvent.apply(t,["viewportMovesToTop",!1,t].concat(o)))})),this.$domNodes.window.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).substr(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(){return 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 o,n=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).substr(1))).length){t.next=17;break}return t.next=6,(0,c.timeout)(this.options.startUpAnimationElementDelayInMiliseconds);case 6:if(o=!1,(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+""+e).animate(this.options.startUpShowAnimation,{always:function(){o&&n.fireEvent("startUpAnimationComplete")}}),!(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+""+(e+1)).length){t.next=14;break}return t.next=12,this._performStartUpEffects(e+1);case 12:t.next=15;break;case 14:o=!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=this;c.globalContext.window.addEventListener("hashchange",(function(e){t.startUpAnimationIsComplete&&t.fireEvent("switchSection",!1,t,location.hash.substring(1),e)}),!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=this;this.options.tracking&&(this.options.tracking.linkClick&&this.on(this.$domNodes.parent.find("a"),"click",(function(e){return t.options.tracking.linkClick.call(t,(0,c.$)(e.target),e)})),this.options.tracking.buttonClick&&this.on(this.$domNodes.parent.find("button"),"click",(function(e){return t.options.tracking.buttonClick.call(t,(0,c.$)(e.target),e)})))},o}(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,e){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,e){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){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),o=0;o<t;o++)e[o]=arguments[o];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 o="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 n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,(function(t,e,o,n,i){return function(){var r=[,,,function(e){e.exports=t},function(t){t.exports=e},function(t){t.exports=o},function(t){t.exports=n},function(t){t.exports=i}],a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var o=a[t]={exports:{}};return r[t](o,o.exports,s),o.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 o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},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),o=s(4),n=s.n(o),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,o=1,n=arguments.length;o<n;o++)for(var i in e=arguments[o])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 o=Math.round(e.corners*e.width*500)/1e3+"px",n="none";!0===e.shadow?n="0 2px 4px #000":"string"==typeof e.shadow&&(n=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]*)(.*)$/,o=[],n=0,i=t.split(",");n<i.length;n++){var r=i[n].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&&o.push({prefix:r[1]||"",x:a,y:s,xUnits:l,yUnits:d,end:r[8]})}}return o}(n),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=o,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=o,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 o=[],n=0,i=t;n<i.length;n++){var r=i[n],a=g(r.x,r.y,e);o.push(r.prefix+a[0]+r.xUnits+" "+a[1]+r.yUnits+r.end)}return o.join(", ")}function g(t,e,o){var n=o*Math.PI/180,i=Math.sin(n),r=Math.cos(n);return[Math.round(1e3*(t*r+e*i))/1e3,Math.round(1e3*(-t*i+e*r))/1e3]}function w(t,e){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=function(t,e){if(t){if("string"==typeof t)return v(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){o&&(t=o);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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 o=0,n=Array(e);o<e;o++)n[o]=t[o];return n}var b=function(t){function o(){for(var e,o=arguments.length,n=new Array(o),i=0;i<o;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||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()(o,t);var i=o.prototype;return i.initialize=function(e){var n=this;return void 0===e&&(e={}),t.prototype.initialize.call(this,(0,c.extend)(!0,{},o._defaultOptions,e)),this.$domNodes=this.grabDomNodes(this.options.domNodes),this.disableScrolling(),new Promise((function(t){var e;n.$domNodes.windowLoadingSpinner.length&&(n.windowLoadingSpinner=new h(n.options.windowLoadingSpinner),n.windowLoadingSpinner.spin(n.$domNodes.windowLoadingSpinner[0])),n._bindScrollEvents(),null==(e=n.$domNodes.parent)||e.show();var o=function(){n.windowLoaded||(n.windowLoaded=!0,n._removeLoadingCover().then((function(){n._performStartUpEffects(),t(n)})))};(0,c.$)((function(){(0,c.timeout)(o,n.options.windowLoadedTimeoutAfterDocLoadedInMSec)})),n.on(n.$domNodes.window,"load",o),n._bindClickTracking(),n.options.language.logging||(n.options.language.logging=n.options.logging),n.options.activateLanguageSupport&&!n.languageHandler&&(0,c.$)(n.$domNodes.parent).Internationalisation(n.options.language).then((function(t){n.languageHandler=t.data("Internationalisation")})),n._bindNavigationEvents(),n._bindMediaQueryChangeEvents(),n._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){if(Object.prototype.hasOwnProperty.call(c.globalContext.window,"location")&&this.options.tracking){var e=n()({context:c.globalContext.window.location.pathname+"#"+this.currentSectionName},t);(isNaN(e.value)||"number"!=typeof e.value)&&(e.value=1),this.debug('Run tracking code: "event" with arguments:'),this.debug(e);try{this.options.tracking.track(e)}catch(t){this.warn('Problem in tracking "'+(0,c.represent)(e)+'": '+(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),o=0;o<t;o++)e[o]=arguments[o];for(var n,i=w(this.options.mediaQueryClassNameIndicator);!(n=i()).done;){var r=n.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,o=arguments.length,n=new Array(o),i=0;i<o;i++)n[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(n))):e.viewportIsOnTop||(e.viewportIsOnTop=!0,e.fireEvent.apply(e,["viewportMovesToTop",!1,e].concat(n)))})),null!=(t=this.$domNodes.window)&&t.scrollTop()?(this.viewportIsOnTop=!1,this.fireEvent.apply(this,["viewportMovesAwayFromTop",!1,this].concat(n))):(this.viewportIsOnTop=!0,this.fireEvent.apply(this,["viewportMovesToTop",!1,this].concat(n)))},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).substr(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 o,n=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(o=!1,(0,c.$)(this.options.domNodes.startUpAnimationClassPrefix+String(e)).animate(this.options.startUpShowAnimation,{always:function(){o&&n.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:o=!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=this;c.globalContext.window.addEventListener("hashchange",(function(e){t.startUpAnimationIsComplete&&t.fireEvent("switchSection",!1,t,location.hash.substring(1),e)}),!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,o=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=o.options.tracking)||null==(e=e.linkClick)||e.call(o,(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=o.options.tracking)||null==(e=e.buttonClick)||e.call(o,(0,c.$)(t.target),t)})))},o}(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){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),o=0;o<t;o++)e[o]=arguments[o];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.349",
|
|
4
4
|
"description": "extend your web app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jquery",
|
|
@@ -62,44 +62,45 @@
|
|
|
62
62
|
"watch": "weboptimizer build --watch"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@babel/eslint-parser": "^7.
|
|
65
|
+
"@babel/eslint-parser": "^7.25.1",
|
|
66
66
|
"@babel/plugin-transform-proto-to-assign": "^7.24.7",
|
|
67
|
-
"@babel/runtime": "^7.
|
|
67
|
+
"@babel/runtime": "^7.25.0",
|
|
68
|
+
"@stylistic/eslint-plugin": "^2.6.4",
|
|
68
69
|
"@types/ejs": "^3.1.5",
|
|
69
70
|
"@types/html-minifier": "^4.0.5",
|
|
70
71
|
"@types/jquery": "^3.5.30",
|
|
71
72
|
"@types/jsdom": "^21.1.7",
|
|
72
|
-
"@types/node": "^
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
74
|
-
"@typescript-eslint/parser": "^
|
|
75
|
-
"clientnode": "^3.0.
|
|
73
|
+
"@types/node": "^22.4.1",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
|
75
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
76
|
+
"clientnode": "^3.0.1178",
|
|
76
77
|
"css-loader": "^7.1.2",
|
|
77
|
-
"cssnano": "^7.0.
|
|
78
|
-
"documentation-website": "^1.0.
|
|
79
|
-
"eslint": "^9.
|
|
78
|
+
"cssnano": "^7.0.5",
|
|
79
|
+
"documentation-website": "^1.0.330",
|
|
80
|
+
"eslint": "^9.9.0",
|
|
80
81
|
"eslint-config-google": "^0.14.0",
|
|
81
|
-
"eslint-plugin-jsdoc": "^
|
|
82
|
-
"internationalisation": "^1.0.
|
|
82
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
|
83
|
+
"internationalisation": "^1.0.319",
|
|
83
84
|
"jest": "^29.7.0",
|
|
84
85
|
"jquery": "^3.7.1",
|
|
85
86
|
"jsdoc": "^4.0.3",
|
|
86
|
-
"mini-css-extract-plugin": "^2.9.
|
|
87
|
-
"postcss": "^8.4.
|
|
87
|
+
"mini-css-extract-plugin": "^2.9.1",
|
|
88
|
+
"postcss": "^8.4.41",
|
|
88
89
|
"postcss-fontpath": "^1.0.0",
|
|
89
90
|
"postcss-import": "^16.1.0",
|
|
90
91
|
"postcss-loader": "^8.1.1",
|
|
91
|
-
"postcss-preset-env": "^
|
|
92
|
+
"postcss-preset-env": "^10.0.2",
|
|
92
93
|
"postcss-scss": "^4.0.9",
|
|
93
94
|
"postcss-sprites": "^4.2.1",
|
|
94
95
|
"postcss-url": "^10.1.3",
|
|
95
96
|
"sass": "^1.77.8",
|
|
96
|
-
"sass-loader": "^
|
|
97
|
+
"sass-loader": "^16.0.1",
|
|
97
98
|
"spin.js": "^4.1.2",
|
|
98
99
|
"style-loader": "^4.0.0",
|
|
99
|
-
"stylelint": "^16.
|
|
100
|
+
"stylelint": "^16.8.2",
|
|
100
101
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
101
|
-
"typescript-eslint": "^
|
|
102
|
-
"weboptimizer": "^2.0.
|
|
102
|
+
"typescript-eslint": "^8.2.0",
|
|
103
|
+
"weboptimizer": "^2.0.1498",
|
|
103
104
|
"webpack-dev-server": "^5.0.4"
|
|
104
105
|
},
|
|
105
106
|
"peerDependencies": {
|
package/type.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface DefaultOptions {
|
|
|
63
63
|
windowLoadedTimeoutAfterDocLoadedInMSec: number;
|
|
64
64
|
}
|
|
65
65
|
export type Options = BaseOptions & DefaultOptions;
|
|
66
|
-
export
|
|
66
|
+
export interface TrackingItem {
|
|
67
67
|
context: string;
|
|
68
68
|
event: string;
|
|
69
69
|
eventType: string;
|
|
@@ -73,4 +73,4 @@ export type TrackingItem = {
|
|
|
73
73
|
subject: string;
|
|
74
74
|
value: number;
|
|
75
75
|
userInteraction: boolean;
|
|
76
|
-
}
|
|
76
|
+
}
|