sp-supermarquee
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -899,2 +899,3 @@ (function (factory) { | ||
this.elems.container.style.visibility = 'visible'; | ||
this.onIntoView(); | ||
}, 100 ); | ||
@@ -1104,3 +1105,3 @@ | ||
Core.prototype.VERSION = "1.2"; | ||
Core.prototype.VERSION = "1.3"; | ||
@@ -1107,0 +1108,0 @@ Core.prototype.play = function() |
@@ -105,2 +105,2 @@ !function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";const a=document.createElement("template"),p=document.createElement("template");function u(e={}){this._gappedScrollingEnabled=!1,this.easingValue=.025,this._currentSpeed=0,this.setSpeed=function(e){this.type===u.TYPE_HORIZONTAL?-1<Object.keys(u.SPEED_HORIZONTAL).indexOf(e)?this.speed=+u.SPEED_HORIZONTAL[e]:this.speed=0<+e?+e:+u.SPEED_HORIZONTAL[u.DEFAULT.speed]:-1<Object.keys(u.SPEED_VERTICAL).indexOf(e)?this.speed=+u.SPEED_VERTICAL[e]:this.speed=0<+e?+e:+u.SPEED_VERTICAL[u.DEFAULT.speed]},this.hasLicense=function(){return null!==this.license&&void 0!==this.license},this.getSpeedNoEasing=function(){return this.speed}.bind(this),this.getSpeedWithEasing=function(){return this.easingValue<1&&(this._currentSpeed=(1-this.easingValue)*this._currentSpeed+this.easingValue*this.speed),this._currentSpeed}.bind(this),this.getSpeed=this.getSpeedNoEasing,this.setContent=function(e){e&&0<e.length?this.content=e:this.content="SuperMarquee by SuperPlug.in !!!",this.content=this.content.replaceAll("> ","> "),this.content=this.content.replaceAll(" <"," <"),u.MODE_PINGPONG===this.mode&&u.TYPE_HORIZONTAL===this.type&&(this.content=this.spacer+this.content),this.content+=this.spacer},this.setPerspective=function(e=null){var t=Object.keys(u.PERSPECTIVE_DEFAULT);let i={};if(e)try{i=JSON.parse(e)}catch(e){i={}}for(let e=0;e<t.length;e++)i.hasOwnProperty(t[e])?this.perspective[t[e]]=i[t[e]]:this.perspective[t[e]]=u.PERSPECTIVE_DEFAULT[t[e]]},this.setPosition=function(e){-1<u.POSITIONS.indexOf(e)?this.position=e:this.position=u.DEFAULT.position},this.setPauseOnHover=function(e){this.pauseonhover=!(!e||"true"!==e&&"1"!==e)};var t=e.hasOwnProperty("system")?e.system:null;-1<u.SYSTEMS.indexOf(t)?this.system=t:this.system=u.DEFAULT.system;t=e.hasOwnProperty("license")?e.license:null;this.license=null,t&&4<=t.length&&(this.license=e.license);t=e.hasOwnProperty("type")?e.type:null;-1<u.TYPES.indexOf(t)?this.type=t:this.type=u.DEFAULT.type,this.spacer=e.hasOwnProperty("spacer")?e.spacer:null,this.spacer||(this.type===u.TYPE_HORIZONTAL?this.spacer=" ":this.spacer="<br />");t=e.hasOwnProperty("direction")?e.direction:null;-1<u.DIRECTIONS.indexOf(t)?this.direction=t:this.direction=u.DEFAULT.direction;t=e.hasOwnProperty("mode")?e.mode:null;-1<u.MODES.indexOf(t)?this.mode=t:this.mode=u.MODE_CONTINOUS,this.pingPongDelay=e.hasOwnProperty("pingpongdelay")?+e.pingpongdelay:u.PINGPONG_DELAY_DEFAULT;t=e.hasOwnProperty("position")?e.position:null;this.setPosition(t),this.perspective={},this.setPerspective(e.hasOwnProperty("perspective")?e.perspective:null);t=e.hasOwnProperty("speed")?e.speed:null;this.setSpeed(t),this._currentSpeed=this.speed,this.setContent(e.hasOwnProperty("content")?e.content:null);t=e.hasOwnProperty("pauseonhover")?e.pauseonhover:null;this.setPauseOnHover(t);t=e.hasOwnProperty("autostart")?e.autostart:null;this.autostart=!t||"false"!==t&&"0"!==t;e=e.hasOwnProperty("easing")?e.easing:null;!e||"true"!==e&&"1"!==e&&!0!==e?(this.easing=!1,this.getSpeed=this.getSpeedNoEasing):(this.easing=!0,this.getSpeed=this.getSpeedWithEasing)}function g(e){const t=e;this.getInstance=function(){return t}}a.innerHTML=` | ||
</div> | ||
`,u.SYSTEM_WEBCOMPONENT="webcomponent",u.SYSTEM_JQUERY="jquery",u.SYSTEM_VANILLA="vanilla",u.SYSTEMS=[u.SYSTEM_WEBCOMPONENT,u.SYSTEM_JQUERY,u.SYSTEM_VANILLA],u.TYPE_HORIZONTAL="horizontal",u.TYPE_VERTICAL="vertical",u.TYPES=[u.TYPE_HORIZONTAL,u.TYPE_VERTICAL],u.DIRECTION_LTR="ltr",u.DIRECTION_RTL="rtl",u.DIRECTION_BTT="btt",u.DIRECTION_TTB="ttb",u.DIRECTIONS=[u.DIRECTION_LTR,u.DIRECTION_RTL,u.DIRECTION_BTT,u.DIRECTION_TTB],u.POSITION_CUSTOM="custom",u.POSITION_FIXEDTOP="fixedTop",u.POSITION_FIXEDBOTTOM="fixedBottom",u.POSITIONS=[u.POSITION_CUSTOM,u.POSITION_FIXEDTOP,u.POSITION_FIXEDBOTTOM],u.MODE_CONTINOUS="continuous",u.MODE_GAPPED="gapped",u.MODE_PINGPONG="pingpong",u.MODES=[u.MODE_CONTINOUS,u.MODE_GAPPED,u.MODE_PINGPONG],u.SPEED_SUPERSLOW="superslow",u.SPEED_SLOW="slow",u.SPEED_MEDIUM="medium",u.SPEED_FAST="fast",u.SPEED_SUPERFAST="superfast",u.SPEED_HORIZONTAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.SPEED_VERTICAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.PERSPECTIVE_DEFAULT={z:"none",originX:50,originY:50,rotateX:0,rotateY:0,rotateZ:0},u.PINGPONG_DELAY_DEFAULT=2e3,u.DEFAULT={license:null,system:u.SYSTEM_VANILLA,type:u.TYPE_HORIZONTAL,speed:u.SPEED_MEDIUM,direction:u.DIRECTION_LTR,mode:u.MODE_CONTINOUS,position:u.POSITION_CUSTOM,perspective:u.PERSPECTIVE_DEFAULT,pauseonhover:!1,autostart:!0,easing:!1,content:"SuperMarquee By SuperPlug.in Is Super !!!",pingPongDelay:u.PINGPONG_DELAY_DEFAULT,spacer:null},g.prototype.triggerInit=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("init"))},g.prototype.triggerStart=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("start"))},g.prototype.triggerLoop=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("loop"))},g.prototype.triggerPause=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("pause"))};const m={fnNoScroll:function(e){},fnHorizontalLtrPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos+this.dimensions.visibleWidth>this.dimensions.totalScrollItemWidth&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<=0&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtlPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<0&&(this._currentXPos=0,this._pingPongCurrentDirection=0,m._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalTtbPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalBttPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalLtr:function(e){this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtl:function(e){this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth+this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+(this._currentXPos-this.dimensions.totalScrollItemWidth)+"px,0,0)"},fnVerticalBtt:function(e){this._currentYPos+=e*this.config.getSpeed(),this._currentYPos>this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight-this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+this._currentYPos+"px,0)"},fnVerticalTtb:function(e){this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight+this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+(this._currentYPos-this.dimensions.totalScrollItemHeight)+"px,0)"}};let d=!(g.prototype.triggerResume=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("resume"))});function o(e,t){const n=this,i=new g(this);let s=m.fnNoScroll.bind(this);this.elems={rootElement:e,shadowRoot:null,container:null,outerWrapper:null,innerContainer:null,scrollItem:null,scrollItemClone:null},this.config=t,this.dimensions={},this._time=Date.now(),this._rafId=null,this._shouldPlay=!1,this._wasPlaying=!1,this._isInView=!0,this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight};const o=()=>{if(this.elems.rootElement.offsetWidth===this._previousDimensions.width&&this.elems.rootElement.offsetHeight===this._previousDimensions.height)return!1;let e=!(this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight});this._rafId&&(e=!0,window.cancelAnimationFrame(this._rafId),this._rafId=null),this.init(),e&&this.tick()},r=()=>{!0===document.hidden?this.onOutOfView():this.onIntoView()},l=()=>{!0===this.config.pauseonhover&&this.pause()},h=()=>{!0===this.config.pauseonhover&&this.play()},c=new IntersectionObserver((e,t)=>{e=e.length?e[0]:null;e&&(!0===e.isIntersecting?this.onIntoView():this.onOutOfView())},{rootMargin:"0px 0px 20px 0px"});!function(){switch(n.config.system){case u.SYSTEM_JQUERY:case u.SYSTEM_VANILLA:case u.SYSTEM_WEBCOMPONENT:n.elems.shadowRoot=n.elems.rootElement.attachShadow({mode:"open"}),n.config.type===u.TYPE_VERTICAL?n.elems.shadowRoot.appendChild(p.content.cloneNode(!0)):n.elems.shadowRoot.appendChild(a.content.cloneNode(!0)),n.elems.container=n.elems.shadowRoot.querySelector("div.supermarquee-container"),n.elems.perspective=n.elems.shadowRoot.querySelector("div.supermarquee-perspective:first-child"),n.elems.outerWrapper=n.elems.shadowRoot.querySelector("div.supermarquee-outer-wrapper:first-child"),n.elems.innerContainer=n.elems.shadowRoot.querySelector("div.supermarquee-inner-container:first-child")}n.elems.scrollItem=n.elems.innerContainer.querySelector("div.supermarquee-item:first-child"),n.elems.scrollItemClone=n.elems.innerContainer.querySelector("div.supermarquee-item-clone"),window.addEventListener("resize",o),document.addEventListener("visibilitychange",r),n.elems.container.addEventListener("mouseenter",l),n.elems.container.addEventListener("mouseleave",h),c.observe(n.elems.container)}(),this.init=function(){this.elems.container.style.visibility="hidden";var t=this.elems.rootElement.style.position;this.elems.rootElement.style.position="initial",this.elems.scrollItem.innerHTML="",this.elems.scrollItemClone.innerHTML="";var i=this.config.content;if(u.TYPE_HORIZONTAL===this.config.type){let e;switch(this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerWidth:this.elems.container.clientWidth,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientWidth;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingLeft=this.elems.container.clientWidth+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerWidth:this.elems.container.clientWidth;e>this.elems.scrollItem.clientWidth;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}else{0<=this.elems.scrollItem.getBoundingClientRect().height&&(this.elems.scrollItem.innerHTML=" ");let e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;switch(this.elems.outerWrapper.style.maxHeight=e+"px",this.elems.scrollItem.innerHTML="",this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerHeight:this.elems.container.clientHeight,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientHeight;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingTop=this.elems.container.clientHeight+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;e>this.elems.scrollItem.clientHeight;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}this.updatePerspective(),setTimeout(()=>{this.updateDimensions(),this.updateTickLogic(),this.elems.container.style.visibility="visible"},100),this._currentXPos=0,this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,this._time=Date.now(),this.elems.rootElement.style.position=t,!1===this.config.hasLicense()&&window.console&&!1===d&&(d=!0,console.log("%c»SuperMarquee« by SuperPlug.in. Unlicensed version for non commercial use only.","font-family: monospace sans-serif; background-color: #8089ff; color: white;"))}.bind(this),this.updatePerspective=function(){this.elems.perspective.style.perspective=this.config.perspective.z+"px",this.elems.perspective.style.perspectiveOrigin=this.config.perspective.originX+"% "+this.config.perspective.originY+"%",this.elems.outerWrapper.style.transform="rotateX("+this.config.perspective.rotateX+"deg) rotateY("+this.config.perspective.rotateY+"deg) rotateZ("+this.config.perspective.rotateZ+"deg)"}.bind(this),this.updateTickLogic=function(){if(u.MODE_PINGPONG===n.config.mode)if(!1===n.config._gappedScrollingEnabled)s=m.fnNoScroll.bind(n);else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalRtlPingPong.bind(n);break;default:case u.DIRECTION_LTR:this._currentXPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalLtrPingPong.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalTtbPingPong.bind(n);break;case u.DIRECTION_BTT:this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalBttPingPong.bind(n)}else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:s=m.fnHorizontalRtl.bind(n);break;default:case u.DIRECTION_LTR:s=m.fnHorizontalLtr.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:s=m.fnVerticalTtb.bind(n);break;default:case u.DIRECTION_BTT:s=m.fnVerticalBtt.bind(n)}}.bind(this),this.updateDimensions=function(){this.dimensions.visibleWidth=this.elems.container.clientWidth,this.dimensions.visibleHeight=this.elems.container.clientHeight,this.dimensions.totalScrollItemWidth=this.elems.scrollItem.offsetWidth,this.dimensions.totalScrollItemHeight=this.elems.scrollItem.offsetHeight}.bind(this),this.tick=function(){var e=Date.now(),t=e-this._time;this._time=e,s(t),this._rafId=window.requestAnimationFrame(this.tick)}.bind(this),this.getRootElement=function(){return this.elems.rootElement}.bind(this),this.getEvents=function(){return i},this.destroy=function(){this._rafId&&(window.cancelAnimationFrame(this._rafId),this._rafId=null),window.removeEventListener("resize",o),document.removeEventListener("visibilitychange",r),this.elems.container.removeEventListener("mouseenter",l),this.elems.container.removeEventListener("mouseleave",h),c.unobserve(this.elems.container)},this.getScrollContent=function(){return this.config.content}}function e(e,t={}){if(!e||!1==e instanceof HTMLElement)throw new Error("Missing/invalid rootElement: ",e);const i=JSON.parse(JSON.stringify(u.DEFAULT));var n,s;for(s in i)t.hasOwnProperty(s)?i[s]=t[s]:e.hasAttribute("data-"+s)&&(i[s]=e.getAttribute("data-"+s));return i.system=u.SYSTEM_VANILLA,n=new u(i),this._core=new o(e,n),this._core.init(),setTimeout(()=>{this._core.config.autostart&&this._core.tick()},150),this}function n(e,t){this.el=e,this.$el=s(e),this.options=s.extend({},s.fn[r].defaults,t),this.options.system="jquery",this.init(this.options)}var s,r;o.prototype.VERSION="1.2",o.prototype.play=function(){!(this._shouldPlay=!0)!==this._isInView&&(this._rafId||(this._time=Date.now(),this.tick(),this._wasPlaying=!0))},o.prototype.pause=function(){this._shouldPlay=!1,this._rafId?(window.cancelAnimationFrame(this._rafId),this._rafId=null,this._wasPlaying=!0):this._wasPlaying=!1},o.prototype.setScrollContent=function(e){this.config.setContent(e),this.init()},o.prototype.setScrollSpeed=function(e){this.config.setSpeed(e)},o.prototype.setPosition=function(e){switch(this.config.setPosition(e),this.config.position){case u.POSITION_FIXEDTOP:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.top=0,this.elems.rootElement.style.left=0;break;case u.POSITION_FIXEDBOTTOM:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.bottom=0,this.elems.rootElement.style.left=0;break;default:case u.POSITION_CUSTOM:this.elems.rootElement.style.removeProperty("position"),this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom")}this.init()},o.prototype.setPauseOnHover=function(e){this.config.setPauseOnHover(e)},o.prototype.setPerspective=function(e){this.config.setPerspective(e),this.updatePerspective()},o.prototype.onIntoView=function(){this._isInView=!0,this.play()},o.prototype.onOutOfView=function(){this._isInView=!1,this.pause()},o.prototype.destroy=function(){},o.prototype.Log=function(e,t="info"){console[t](e)},e.getDefaultConfiguration=function(){return JSON.parse(JSON.stringify(u.DEFAULT))},e.prototype.play=function(){this._core.play()},e.prototype.pause=function(){this._core.pause()},e.prototype.setScrollContent=function(e){this._core.setScrollContent(e)},e.prototype.setScrollSpeed=function(e){this._core.setScrollSpeed(e)},e.prototype.setPosition=function(e){this._core.setPosition(e)},e.prototype.setPauseOnHover=function(e){this._core.setPauseOnHover(e)},e.prototype.setPerspective=function(e){this._core.setPerspective(e)},e.prototype.destroy=function(){this._core.destroy()},s=jQuery,r="supermarquee",n.prototype={init:function(){this.ssInstance=new e(this.el,this.options)},play:function(){this.ssInstance.play()},pause:function(){this.ssInstance.pause()},setScrollContent:function(e){this.ssInstance.setScrollContent(e)},setScrollSpeed:function(e){this.ssInstance.setScrollSpeed(e)},setPosition:function(e){this.ssInstance.setPosition(e)},setPauseOnHover:function(e){this.ssInstance.setPauseOnHover(e)},setPerspective:function(e){this.ssInstance.setPerspective(e)},destroy:function(){this.ssInstance.destroy()}},s.fn[r]=function(t){var i=arguments;if(void 0===t||"object"==typeof t)return this.each(function(){s.data(this,"plugin_"+r)||s.data(this,"plugin_"+r,new n(this,t))});if("string"==typeof t&&"_"!==t[0]&&"init"!==t){if(0!=Array.prototype.slice.call(i,1).length||-1==s.inArray(t,s.fn[r].getters))return this.each(function(){var e=s.data(this,"plugin_"+r);e instanceof n&&"function"==typeof e[t]&&e[t].apply(e,Array.prototype.slice.call(i,1))});var e=s.data(this[0],"plugin_"+r);return e[t].apply(e,Array.prototype.slice.call(i,1))}},s.fn[r].getters=[],s.fn[r].defaults=e.getDefaultConfiguration()}); | ||
`,u.SYSTEM_WEBCOMPONENT="webcomponent",u.SYSTEM_JQUERY="jquery",u.SYSTEM_VANILLA="vanilla",u.SYSTEMS=[u.SYSTEM_WEBCOMPONENT,u.SYSTEM_JQUERY,u.SYSTEM_VANILLA],u.TYPE_HORIZONTAL="horizontal",u.TYPE_VERTICAL="vertical",u.TYPES=[u.TYPE_HORIZONTAL,u.TYPE_VERTICAL],u.DIRECTION_LTR="ltr",u.DIRECTION_RTL="rtl",u.DIRECTION_BTT="btt",u.DIRECTION_TTB="ttb",u.DIRECTIONS=[u.DIRECTION_LTR,u.DIRECTION_RTL,u.DIRECTION_BTT,u.DIRECTION_TTB],u.POSITION_CUSTOM="custom",u.POSITION_FIXEDTOP="fixedTop",u.POSITION_FIXEDBOTTOM="fixedBottom",u.POSITIONS=[u.POSITION_CUSTOM,u.POSITION_FIXEDTOP,u.POSITION_FIXEDBOTTOM],u.MODE_CONTINOUS="continuous",u.MODE_GAPPED="gapped",u.MODE_PINGPONG="pingpong",u.MODES=[u.MODE_CONTINOUS,u.MODE_GAPPED,u.MODE_PINGPONG],u.SPEED_SUPERSLOW="superslow",u.SPEED_SLOW="slow",u.SPEED_MEDIUM="medium",u.SPEED_FAST="fast",u.SPEED_SUPERFAST="superfast",u.SPEED_HORIZONTAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.SPEED_VERTICAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.PERSPECTIVE_DEFAULT={z:"none",originX:50,originY:50,rotateX:0,rotateY:0,rotateZ:0},u.PINGPONG_DELAY_DEFAULT=2e3,u.DEFAULT={license:null,system:u.SYSTEM_VANILLA,type:u.TYPE_HORIZONTAL,speed:u.SPEED_MEDIUM,direction:u.DIRECTION_LTR,mode:u.MODE_CONTINOUS,position:u.POSITION_CUSTOM,perspective:u.PERSPECTIVE_DEFAULT,pauseonhover:!1,autostart:!0,easing:!1,content:"SuperMarquee By SuperPlug.in Is Super !!!",pingPongDelay:u.PINGPONG_DELAY_DEFAULT,spacer:null},g.prototype.triggerInit=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("init"))},g.prototype.triggerStart=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("start"))},g.prototype.triggerLoop=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("loop"))},g.prototype.triggerPause=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("pause"))};const m={fnNoScroll:function(e){},fnHorizontalLtrPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos+this.dimensions.visibleWidth>this.dimensions.totalScrollItemWidth&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<=0&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtlPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<0&&(this._currentXPos=0,this._pingPongCurrentDirection=0,m._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalTtbPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalBttPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalLtr:function(e){this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtl:function(e){this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth+this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+(this._currentXPos-this.dimensions.totalScrollItemWidth)+"px,0,0)"},fnVerticalBtt:function(e){this._currentYPos+=e*this.config.getSpeed(),this._currentYPos>this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight-this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+this._currentYPos+"px,0)"},fnVerticalTtb:function(e){this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight+this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+(this._currentYPos-this.dimensions.totalScrollItemHeight)+"px,0)"}};let d=!(g.prototype.triggerResume=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new g("resume"))});function o(e,t){const n=this,i=new g(this);let s=m.fnNoScroll.bind(this);this.elems={rootElement:e,shadowRoot:null,container:null,outerWrapper:null,innerContainer:null,scrollItem:null,scrollItemClone:null},this.config=t,this.dimensions={},this._time=Date.now(),this._rafId=null,this._shouldPlay=!1,this._wasPlaying=!1,this._isInView=!0,this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight};const o=()=>{if(this.elems.rootElement.offsetWidth===this._previousDimensions.width&&this.elems.rootElement.offsetHeight===this._previousDimensions.height)return!1;let e=!(this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight});this._rafId&&(e=!0,window.cancelAnimationFrame(this._rafId),this._rafId=null),this.init(),e&&this.tick()},r=()=>{!0===document.hidden?this.onOutOfView():this.onIntoView()},l=()=>{!0===this.config.pauseonhover&&this.pause()},h=()=>{!0===this.config.pauseonhover&&this.play()},c=new IntersectionObserver((e,t)=>{e=e.length?e[0]:null;e&&(!0===e.isIntersecting?this.onIntoView():this.onOutOfView())},{rootMargin:"0px 0px 20px 0px"});!function(){switch(n.config.system){case u.SYSTEM_JQUERY:case u.SYSTEM_VANILLA:case u.SYSTEM_WEBCOMPONENT:n.elems.shadowRoot=n.elems.rootElement.attachShadow({mode:"open"}),n.config.type===u.TYPE_VERTICAL?n.elems.shadowRoot.appendChild(p.content.cloneNode(!0)):n.elems.shadowRoot.appendChild(a.content.cloneNode(!0)),n.elems.container=n.elems.shadowRoot.querySelector("div.supermarquee-container"),n.elems.perspective=n.elems.shadowRoot.querySelector("div.supermarquee-perspective:first-child"),n.elems.outerWrapper=n.elems.shadowRoot.querySelector("div.supermarquee-outer-wrapper:first-child"),n.elems.innerContainer=n.elems.shadowRoot.querySelector("div.supermarquee-inner-container:first-child")}n.elems.scrollItem=n.elems.innerContainer.querySelector("div.supermarquee-item:first-child"),n.elems.scrollItemClone=n.elems.innerContainer.querySelector("div.supermarquee-item-clone"),window.addEventListener("resize",o),document.addEventListener("visibilitychange",r),n.elems.container.addEventListener("mouseenter",l),n.elems.container.addEventListener("mouseleave",h),c.observe(n.elems.container)}(),this.init=function(){this.elems.container.style.visibility="hidden";var t=this.elems.rootElement.style.position;this.elems.rootElement.style.position="initial",this.elems.scrollItem.innerHTML="",this.elems.scrollItemClone.innerHTML="";var i=this.config.content;if(u.TYPE_HORIZONTAL===this.config.type){let e;switch(this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerWidth:this.elems.container.clientWidth,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientWidth;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingLeft=this.elems.container.clientWidth+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerWidth:this.elems.container.clientWidth;e>this.elems.scrollItem.clientWidth;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}else{0<=this.elems.scrollItem.getBoundingClientRect().height&&(this.elems.scrollItem.innerHTML=" ");let e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;switch(this.elems.outerWrapper.style.maxHeight=e+"px",this.elems.scrollItem.innerHTML="",this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerHeight:this.elems.container.clientHeight,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientHeight;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingTop=this.elems.container.clientHeight+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;e>this.elems.scrollItem.clientHeight;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}this.updatePerspective(),setTimeout(()=>{this.updateDimensions(),this.updateTickLogic(),this.elems.container.style.visibility="visible",this.onIntoView()},100),this._currentXPos=0,this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,this._time=Date.now(),this.elems.rootElement.style.position=t,!1===this.config.hasLicense()&&window.console&&!1===d&&(d=!0,console.log("%c»SuperMarquee« by SuperPlug.in. Unlicensed version for non commercial use only.","font-family: monospace sans-serif; background-color: #8089ff; color: white;"))}.bind(this),this.updatePerspective=function(){this.elems.perspective.style.perspective=this.config.perspective.z+"px",this.elems.perspective.style.perspectiveOrigin=this.config.perspective.originX+"% "+this.config.perspective.originY+"%",this.elems.outerWrapper.style.transform="rotateX("+this.config.perspective.rotateX+"deg) rotateY("+this.config.perspective.rotateY+"deg) rotateZ("+this.config.perspective.rotateZ+"deg)"}.bind(this),this.updateTickLogic=function(){if(u.MODE_PINGPONG===n.config.mode)if(!1===n.config._gappedScrollingEnabled)s=m.fnNoScroll.bind(n);else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalRtlPingPong.bind(n);break;default:case u.DIRECTION_LTR:this._currentXPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalLtrPingPong.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalTtbPingPong.bind(n);break;case u.DIRECTION_BTT:this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=m.fnHorizontalBttPingPong.bind(n)}else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:s=m.fnHorizontalRtl.bind(n);break;default:case u.DIRECTION_LTR:s=m.fnHorizontalLtr.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:s=m.fnVerticalTtb.bind(n);break;default:case u.DIRECTION_BTT:s=m.fnVerticalBtt.bind(n)}}.bind(this),this.updateDimensions=function(){this.dimensions.visibleWidth=this.elems.container.clientWidth,this.dimensions.visibleHeight=this.elems.container.clientHeight,this.dimensions.totalScrollItemWidth=this.elems.scrollItem.offsetWidth,this.dimensions.totalScrollItemHeight=this.elems.scrollItem.offsetHeight}.bind(this),this.tick=function(){var e=Date.now(),t=e-this._time;this._time=e,s(t),this._rafId=window.requestAnimationFrame(this.tick)}.bind(this),this.getRootElement=function(){return this.elems.rootElement}.bind(this),this.getEvents=function(){return i},this.destroy=function(){this._rafId&&(window.cancelAnimationFrame(this._rafId),this._rafId=null),window.removeEventListener("resize",o),document.removeEventListener("visibilitychange",r),this.elems.container.removeEventListener("mouseenter",l),this.elems.container.removeEventListener("mouseleave",h),c.unobserve(this.elems.container)},this.getScrollContent=function(){return this.config.content}}function e(e,t={}){if(!e||!1==e instanceof HTMLElement)throw new Error("Missing/invalid rootElement: ",e);const i=JSON.parse(JSON.stringify(u.DEFAULT));var n,s;for(s in i)t.hasOwnProperty(s)?i[s]=t[s]:e.hasAttribute("data-"+s)&&(i[s]=e.getAttribute("data-"+s));return i.system=u.SYSTEM_VANILLA,n=new u(i),this._core=new o(e,n),this._core.init(),setTimeout(()=>{this._core.config.autostart&&this._core.tick()},150),this}function n(e,t){this.el=e,this.$el=s(e),this.options=s.extend({},s.fn[r].defaults,t),this.options.system="jquery",this.init(this.options)}var s,r;o.prototype.VERSION="1.3",o.prototype.play=function(){!(this._shouldPlay=!0)!==this._isInView&&(this._rafId||(this._time=Date.now(),this.tick(),this._wasPlaying=!0))},o.prototype.pause=function(){this._shouldPlay=!1,this._rafId?(window.cancelAnimationFrame(this._rafId),this._rafId=null,this._wasPlaying=!0):this._wasPlaying=!1},o.prototype.setScrollContent=function(e){this.config.setContent(e),this.init()},o.prototype.setScrollSpeed=function(e){this.config.setSpeed(e)},o.prototype.setPosition=function(e){switch(this.config.setPosition(e),this.config.position){case u.POSITION_FIXEDTOP:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.top=0,this.elems.rootElement.style.left=0;break;case u.POSITION_FIXEDBOTTOM:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.bottom=0,this.elems.rootElement.style.left=0;break;default:case u.POSITION_CUSTOM:this.elems.rootElement.style.removeProperty("position"),this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom")}this.init()},o.prototype.setPauseOnHover=function(e){this.config.setPauseOnHover(e)},o.prototype.setPerspective=function(e){this.config.setPerspective(e),this.updatePerspective()},o.prototype.onIntoView=function(){this._isInView=!0,this.play()},o.prototype.onOutOfView=function(){this._isInView=!1,this.pause()},o.prototype.destroy=function(){},o.prototype.Log=function(e,t="info"){console[t](e)},e.getDefaultConfiguration=function(){return JSON.parse(JSON.stringify(u.DEFAULT))},e.prototype.play=function(){this._core.play()},e.prototype.pause=function(){this._core.pause()},e.prototype.setScrollContent=function(e){this._core.setScrollContent(e)},e.prototype.setScrollSpeed=function(e){this._core.setScrollSpeed(e)},e.prototype.setPosition=function(e){this._core.setPosition(e)},e.prototype.setPauseOnHover=function(e){this._core.setPauseOnHover(e)},e.prototype.setPerspective=function(e){this._core.setPerspective(e)},e.prototype.destroy=function(){this._core.destroy()},s=jQuery,r="supermarquee",n.prototype={init:function(){this.ssInstance=new e(this.el,this.options)},play:function(){this.ssInstance.play()},pause:function(){this.ssInstance.pause()},setScrollContent:function(e){this.ssInstance.setScrollContent(e)},setScrollSpeed:function(e){this.ssInstance.setScrollSpeed(e)},setPosition:function(e){this.ssInstance.setPosition(e)},setPauseOnHover:function(e){this.ssInstance.setPauseOnHover(e)},setPerspective:function(e){this.ssInstance.setPerspective(e)},destroy:function(){this.ssInstance.destroy()}},s.fn[r]=function(t){var i=arguments;if(void 0===t||"object"==typeof t)return this.each(function(){s.data(this,"plugin_"+r)||s.data(this,"plugin_"+r,new n(this,t))});if("string"==typeof t&&"_"!==t[0]&&"init"!==t){if(0!=Array.prototype.slice.call(i,1).length||-1==s.inArray(t,s.fn[r].getters))return this.each(function(){var e=s.data(this,"plugin_"+r);e instanceof n&&"function"==typeof e[t]&&e[t].apply(e,Array.prototype.slice.call(i,1))});var e=s.data(this[0],"plugin_"+r);return e[t].apply(e,Array.prototype.slice.call(i,1))}},s.fn[r].getters=[],s.fn[r].defaults=e.getDefaultConfiguration()}); |
@@ -900,2 +900,3 @@ (function (global, factory) { | ||
this.elems.container.style.visibility = 'visible'; | ||
this.onIntoView(); | ||
}, 100 ); | ||
@@ -1105,3 +1106,3 @@ | ||
Core.prototype.VERSION = "1.2"; | ||
Core.prototype.VERSION = "1.3"; | ||
@@ -1108,0 +1109,0 @@ Core.prototype.play = function() |
@@ -105,2 +105,2 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SuperMarquee=t()}(this,function(){"use strict";const a=document.createElement("template"),p=document.createElement("template");function u(e={}){this._gappedScrollingEnabled=!1,this.easingValue=.025,this._currentSpeed=0,this.setSpeed=function(e){this.type===u.TYPE_HORIZONTAL?-1<Object.keys(u.SPEED_HORIZONTAL).indexOf(e)?this.speed=+u.SPEED_HORIZONTAL[e]:this.speed=0<+e?+e:+u.SPEED_HORIZONTAL[u.DEFAULT.speed]:-1<Object.keys(u.SPEED_VERTICAL).indexOf(e)?this.speed=+u.SPEED_VERTICAL[e]:this.speed=0<+e?+e:+u.SPEED_VERTICAL[u.DEFAULT.speed]},this.hasLicense=function(){return null!==this.license&&void 0!==this.license},this.getSpeedNoEasing=function(){return this.speed}.bind(this),this.getSpeedWithEasing=function(){return this.easingValue<1&&(this._currentSpeed=(1-this.easingValue)*this._currentSpeed+this.easingValue*this.speed),this._currentSpeed}.bind(this),this.getSpeed=this.getSpeedNoEasing,this.setContent=function(e){e&&0<e.length?this.content=e:this.content="SuperMarquee by SuperPlug.in !!!",this.content=this.content.replaceAll("> ","> "),this.content=this.content.replaceAll(" <"," <"),u.MODE_PINGPONG===this.mode&&u.TYPE_HORIZONTAL===this.type&&(this.content=this.spacer+this.content),this.content+=this.spacer},this.setPerspective=function(e=null){var t=Object.keys(u.PERSPECTIVE_DEFAULT);let i={};if(e)try{i=JSON.parse(e)}catch(e){i={}}for(let e=0;e<t.length;e++)i.hasOwnProperty(t[e])?this.perspective[t[e]]=i[t[e]]:this.perspective[t[e]]=u.PERSPECTIVE_DEFAULT[t[e]]},this.setPosition=function(e){-1<u.POSITIONS.indexOf(e)?this.position=e:this.position=u.DEFAULT.position},this.setPauseOnHover=function(e){this.pauseonhover=!(!e||"true"!==e&&"1"!==e)};var t=e.hasOwnProperty("system")?e.system:null;-1<u.SYSTEMS.indexOf(t)?this.system=t:this.system=u.DEFAULT.system;t=e.hasOwnProperty("license")?e.license:null;this.license=null,t&&4<=t.length&&(this.license=e.license);t=e.hasOwnProperty("type")?e.type:null;-1<u.TYPES.indexOf(t)?this.type=t:this.type=u.DEFAULT.type,this.spacer=e.hasOwnProperty("spacer")?e.spacer:null,this.spacer||(this.type===u.TYPE_HORIZONTAL?this.spacer=" ":this.spacer="<br />");t=e.hasOwnProperty("direction")?e.direction:null;-1<u.DIRECTIONS.indexOf(t)?this.direction=t:this.direction=u.DEFAULT.direction;t=e.hasOwnProperty("mode")?e.mode:null;-1<u.MODES.indexOf(t)?this.mode=t:this.mode=u.MODE_CONTINOUS,this.pingPongDelay=e.hasOwnProperty("pingpongdelay")?+e.pingpongdelay:u.PINGPONG_DELAY_DEFAULT;t=e.hasOwnProperty("position")?e.position:null;this.setPosition(t),this.perspective={},this.setPerspective(e.hasOwnProperty("perspective")?e.perspective:null);t=e.hasOwnProperty("speed")?e.speed:null;this.setSpeed(t),this._currentSpeed=this.speed,this.setContent(e.hasOwnProperty("content")?e.content:null);t=e.hasOwnProperty("pauseonhover")?e.pauseonhover:null;this.setPauseOnHover(t);t=e.hasOwnProperty("autostart")?e.autostart:null;this.autostart=!t||"false"!==t&&"0"!==t;e=e.hasOwnProperty("easing")?e.easing:null;!e||"true"!==e&&"1"!==e&&!0!==e?(this.easing=!1,this.getSpeed=this.getSpeedNoEasing):(this.easing=!0,this.getSpeed=this.getSpeedWithEasing)}function m(e){const t=e;this.getInstance=function(){return t}}a.innerHTML=` | ||
</div> | ||
`,u.SYSTEM_WEBCOMPONENT="webcomponent",u.SYSTEM_JQUERY="jquery",u.SYSTEM_VANILLA="vanilla",u.SYSTEMS=[u.SYSTEM_WEBCOMPONENT,u.SYSTEM_JQUERY,u.SYSTEM_VANILLA],u.TYPE_HORIZONTAL="horizontal",u.TYPE_VERTICAL="vertical",u.TYPES=[u.TYPE_HORIZONTAL,u.TYPE_VERTICAL],u.DIRECTION_LTR="ltr",u.DIRECTION_RTL="rtl",u.DIRECTION_BTT="btt",u.DIRECTION_TTB="ttb",u.DIRECTIONS=[u.DIRECTION_LTR,u.DIRECTION_RTL,u.DIRECTION_BTT,u.DIRECTION_TTB],u.POSITION_CUSTOM="custom",u.POSITION_FIXEDTOP="fixedTop",u.POSITION_FIXEDBOTTOM="fixedBottom",u.POSITIONS=[u.POSITION_CUSTOM,u.POSITION_FIXEDTOP,u.POSITION_FIXEDBOTTOM],u.MODE_CONTINOUS="continuous",u.MODE_GAPPED="gapped",u.MODE_PINGPONG="pingpong",u.MODES=[u.MODE_CONTINOUS,u.MODE_GAPPED,u.MODE_PINGPONG],u.SPEED_SUPERSLOW="superslow",u.SPEED_SLOW="slow",u.SPEED_MEDIUM="medium",u.SPEED_FAST="fast",u.SPEED_SUPERFAST="superfast",u.SPEED_HORIZONTAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.SPEED_VERTICAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.PERSPECTIVE_DEFAULT={z:"none",originX:50,originY:50,rotateX:0,rotateY:0,rotateZ:0},u.PINGPONG_DELAY_DEFAULT=2e3,u.DEFAULT={license:null,system:u.SYSTEM_VANILLA,type:u.TYPE_HORIZONTAL,speed:u.SPEED_MEDIUM,direction:u.DIRECTION_LTR,mode:u.MODE_CONTINOUS,position:u.POSITION_CUSTOM,perspective:u.PERSPECTIVE_DEFAULT,pauseonhover:!1,autostart:!0,easing:!1,content:"SuperMarquee By SuperPlug.in Is Super !!!",pingPongDelay:u.PINGPONG_DELAY_DEFAULT,spacer:null},m.prototype.triggerInit=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("init"))},m.prototype.triggerStart=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("start"))},m.prototype.triggerLoop=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("loop"))},m.prototype.triggerPause=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("pause"))};const g={fnNoScroll:function(e){},fnHorizontalLtrPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos+this.dimensions.visibleWidth>this.dimensions.totalScrollItemWidth&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<=0&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtlPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<0&&(this._currentXPos=0,this._pingPongCurrentDirection=0,g._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalTtbPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalBttPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalLtr:function(e){this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtl:function(e){this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth+this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+(this._currentXPos-this.dimensions.totalScrollItemWidth)+"px,0,0)"},fnVerticalBtt:function(e){this._currentYPos+=e*this.config.getSpeed(),this._currentYPos>this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight-this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+this._currentYPos+"px,0)"},fnVerticalTtb:function(e){this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight+this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+(this._currentYPos-this.dimensions.totalScrollItemHeight)+"px,0)"}};let d=!(m.prototype.triggerResume=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("resume"))});function o(e,t){const n=this,i=new m(this);let s=g.fnNoScroll.bind(this);this.elems={rootElement:e,shadowRoot:null,container:null,outerWrapper:null,innerContainer:null,scrollItem:null,scrollItemClone:null},this.config=t,this.dimensions={},this._time=Date.now(),this._rafId=null,this._shouldPlay=!1,this._wasPlaying=!1,this._isInView=!0,this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight};const o=()=>{if(this.elems.rootElement.offsetWidth===this._previousDimensions.width&&this.elems.rootElement.offsetHeight===this._previousDimensions.height)return!1;let e=!(this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight});this._rafId&&(e=!0,window.cancelAnimationFrame(this._rafId),this._rafId=null),this.init(),e&&this.tick()},r=()=>{!0===document.hidden?this.onOutOfView():this.onIntoView()},l=()=>{!0===this.config.pauseonhover&&this.pause()},h=()=>{!0===this.config.pauseonhover&&this.play()},c=new IntersectionObserver((e,t)=>{e=e.length?e[0]:null;e&&(!0===e.isIntersecting?this.onIntoView():this.onOutOfView())},{rootMargin:"0px 0px 20px 0px"});!function(){switch(n.config.system){case u.SYSTEM_JQUERY:case u.SYSTEM_VANILLA:case u.SYSTEM_WEBCOMPONENT:n.elems.shadowRoot=n.elems.rootElement.attachShadow({mode:"open"}),n.config.type===u.TYPE_VERTICAL?n.elems.shadowRoot.appendChild(p.content.cloneNode(!0)):n.elems.shadowRoot.appendChild(a.content.cloneNode(!0)),n.elems.container=n.elems.shadowRoot.querySelector("div.supermarquee-container"),n.elems.perspective=n.elems.shadowRoot.querySelector("div.supermarquee-perspective:first-child"),n.elems.outerWrapper=n.elems.shadowRoot.querySelector("div.supermarquee-outer-wrapper:first-child"),n.elems.innerContainer=n.elems.shadowRoot.querySelector("div.supermarquee-inner-container:first-child")}n.elems.scrollItem=n.elems.innerContainer.querySelector("div.supermarquee-item:first-child"),n.elems.scrollItemClone=n.elems.innerContainer.querySelector("div.supermarquee-item-clone"),window.addEventListener("resize",o),document.addEventListener("visibilitychange",r),n.elems.container.addEventListener("mouseenter",l),n.elems.container.addEventListener("mouseleave",h),c.observe(n.elems.container)}(),this.init=function(){this.elems.container.style.visibility="hidden";var t=this.elems.rootElement.style.position;this.elems.rootElement.style.position="initial",this.elems.scrollItem.innerHTML="",this.elems.scrollItemClone.innerHTML="";var i=this.config.content;if(u.TYPE_HORIZONTAL===this.config.type){let e;switch(this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerWidth:this.elems.container.clientWidth,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientWidth;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingLeft=this.elems.container.clientWidth+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerWidth:this.elems.container.clientWidth;e>this.elems.scrollItem.clientWidth;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}else{0<=this.elems.scrollItem.getBoundingClientRect().height&&(this.elems.scrollItem.innerHTML=" ");let e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;switch(this.elems.outerWrapper.style.maxHeight=e+"px",this.elems.scrollItem.innerHTML="",this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerHeight:this.elems.container.clientHeight,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientHeight;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingTop=this.elems.container.clientHeight+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;e>this.elems.scrollItem.clientHeight;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}this.updatePerspective(),setTimeout(()=>{this.updateDimensions(),this.updateTickLogic(),this.elems.container.style.visibility="visible"},100),this._currentXPos=0,this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,this._time=Date.now(),this.elems.rootElement.style.position=t,!1===this.config.hasLicense()&&window.console&&!1===d&&(d=!0,console.log("%c»SuperMarquee« by SuperPlug.in. Unlicensed version for non commercial use only.","font-family: monospace sans-serif; background-color: #8089ff; color: white;"))}.bind(this),this.updatePerspective=function(){this.elems.perspective.style.perspective=this.config.perspective.z+"px",this.elems.perspective.style.perspectiveOrigin=this.config.perspective.originX+"% "+this.config.perspective.originY+"%",this.elems.outerWrapper.style.transform="rotateX("+this.config.perspective.rotateX+"deg) rotateY("+this.config.perspective.rotateY+"deg) rotateZ("+this.config.perspective.rotateZ+"deg)"}.bind(this),this.updateTickLogic=function(){if(u.MODE_PINGPONG===n.config.mode)if(!1===n.config._gappedScrollingEnabled)s=g.fnNoScroll.bind(n);else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalRtlPingPong.bind(n);break;default:case u.DIRECTION_LTR:this._currentXPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalLtrPingPong.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalTtbPingPong.bind(n);break;case u.DIRECTION_BTT:this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalBttPingPong.bind(n)}else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:s=g.fnHorizontalRtl.bind(n);break;default:case u.DIRECTION_LTR:s=g.fnHorizontalLtr.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:s=g.fnVerticalTtb.bind(n);break;default:case u.DIRECTION_BTT:s=g.fnVerticalBtt.bind(n)}}.bind(this),this.updateDimensions=function(){this.dimensions.visibleWidth=this.elems.container.clientWidth,this.dimensions.visibleHeight=this.elems.container.clientHeight,this.dimensions.totalScrollItemWidth=this.elems.scrollItem.offsetWidth,this.dimensions.totalScrollItemHeight=this.elems.scrollItem.offsetHeight}.bind(this),this.tick=function(){var e=Date.now(),t=e-this._time;this._time=e,s(t),this._rafId=window.requestAnimationFrame(this.tick)}.bind(this),this.getRootElement=function(){return this.elems.rootElement}.bind(this),this.getEvents=function(){return i},this.destroy=function(){this._rafId&&(window.cancelAnimationFrame(this._rafId),this._rafId=null),window.removeEventListener("resize",o),document.removeEventListener("visibilitychange",r),this.elems.container.removeEventListener("mouseenter",l),this.elems.container.removeEventListener("mouseleave",h),c.unobserve(this.elems.container)},this.getScrollContent=function(){return this.config.content}}function e(e,t={}){if(!e||!1==e instanceof HTMLElement)throw new Error("Missing/invalid rootElement: ",e);const i=JSON.parse(JSON.stringify(u.DEFAULT));var n,s;for(s in i)t.hasOwnProperty(s)?i[s]=t[s]:e.hasAttribute("data-"+s)&&(i[s]=e.getAttribute("data-"+s));return i.system=u.SYSTEM_VANILLA,n=new u(i),this._core=new o(e,n),this._core.init(),setTimeout(()=>{this._core.config.autostart&&this._core.tick()},150),this}return o.prototype.VERSION="1.2",o.prototype.play=function(){!(this._shouldPlay=!0)!==this._isInView&&(this._rafId||(this._time=Date.now(),this.tick(),this._wasPlaying=!0))},o.prototype.pause=function(){this._shouldPlay=!1,this._rafId?(window.cancelAnimationFrame(this._rafId),this._rafId=null,this._wasPlaying=!0):this._wasPlaying=!1},o.prototype.setScrollContent=function(e){this.config.setContent(e),this.init()},o.prototype.setScrollSpeed=function(e){this.config.setSpeed(e)},o.prototype.setPosition=function(e){switch(this.config.setPosition(e),this.config.position){case u.POSITION_FIXEDTOP:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.top=0,this.elems.rootElement.style.left=0;break;case u.POSITION_FIXEDBOTTOM:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.bottom=0,this.elems.rootElement.style.left=0;break;default:case u.POSITION_CUSTOM:this.elems.rootElement.style.removeProperty("position"),this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom")}this.init()},o.prototype.setPauseOnHover=function(e){this.config.setPauseOnHover(e)},o.prototype.setPerspective=function(e){this.config.setPerspective(e),this.updatePerspective()},o.prototype.onIntoView=function(){this._isInView=!0,this.play()},o.prototype.onOutOfView=function(){this._isInView=!1,this.pause()},o.prototype.destroy=function(){},o.prototype.Log=function(e,t="info"){console[t](e)},e.getDefaultConfiguration=function(){return JSON.parse(JSON.stringify(u.DEFAULT))},e.prototype.play=function(){this._core.play()},e.prototype.pause=function(){this._core.pause()},e.prototype.setScrollContent=function(e){this._core.setScrollContent(e)},e.prototype.setScrollSpeed=function(e){this._core.setScrollSpeed(e)},e.prototype.setPosition=function(e){this._core.setPosition(e)},e.prototype.setPauseOnHover=function(e){this._core.setPauseOnHover(e)},e.prototype.setPerspective=function(e){this._core.setPerspective(e)},e.prototype.destroy=function(){this._core.destroy()},e}); | ||
`,u.SYSTEM_WEBCOMPONENT="webcomponent",u.SYSTEM_JQUERY="jquery",u.SYSTEM_VANILLA="vanilla",u.SYSTEMS=[u.SYSTEM_WEBCOMPONENT,u.SYSTEM_JQUERY,u.SYSTEM_VANILLA],u.TYPE_HORIZONTAL="horizontal",u.TYPE_VERTICAL="vertical",u.TYPES=[u.TYPE_HORIZONTAL,u.TYPE_VERTICAL],u.DIRECTION_LTR="ltr",u.DIRECTION_RTL="rtl",u.DIRECTION_BTT="btt",u.DIRECTION_TTB="ttb",u.DIRECTIONS=[u.DIRECTION_LTR,u.DIRECTION_RTL,u.DIRECTION_BTT,u.DIRECTION_TTB],u.POSITION_CUSTOM="custom",u.POSITION_FIXEDTOP="fixedTop",u.POSITION_FIXEDBOTTOM="fixedBottom",u.POSITIONS=[u.POSITION_CUSTOM,u.POSITION_FIXEDTOP,u.POSITION_FIXEDBOTTOM],u.MODE_CONTINOUS="continuous",u.MODE_GAPPED="gapped",u.MODE_PINGPONG="pingpong",u.MODES=[u.MODE_CONTINOUS,u.MODE_GAPPED,u.MODE_PINGPONG],u.SPEED_SUPERSLOW="superslow",u.SPEED_SLOW="slow",u.SPEED_MEDIUM="medium",u.SPEED_FAST="fast",u.SPEED_SUPERFAST="superfast",u.SPEED_HORIZONTAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.SPEED_VERTICAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.PERSPECTIVE_DEFAULT={z:"none",originX:50,originY:50,rotateX:0,rotateY:0,rotateZ:0},u.PINGPONG_DELAY_DEFAULT=2e3,u.DEFAULT={license:null,system:u.SYSTEM_VANILLA,type:u.TYPE_HORIZONTAL,speed:u.SPEED_MEDIUM,direction:u.DIRECTION_LTR,mode:u.MODE_CONTINOUS,position:u.POSITION_CUSTOM,perspective:u.PERSPECTIVE_DEFAULT,pauseonhover:!1,autostart:!0,easing:!1,content:"SuperMarquee By SuperPlug.in Is Super !!!",pingPongDelay:u.PINGPONG_DELAY_DEFAULT,spacer:null},m.prototype.triggerInit=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("init"))},m.prototype.triggerStart=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("start"))},m.prototype.triggerLoop=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("loop"))},m.prototype.triggerPause=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("pause"))};const g={fnNoScroll:function(e){},fnHorizontalLtrPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos+this.dimensions.visibleWidth>this.dimensions.totalScrollItemWidth&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<=0&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtlPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<0&&(this._currentXPos=0,this._pingPongCurrentDirection=0,g._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalTtbPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalBttPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalLtr:function(e){this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtl:function(e){this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth+this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+(this._currentXPos-this.dimensions.totalScrollItemWidth)+"px,0,0)"},fnVerticalBtt:function(e){this._currentYPos+=e*this.config.getSpeed(),this._currentYPos>this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight-this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+this._currentYPos+"px,0)"},fnVerticalTtb:function(e){this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight+this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+(this._currentYPos-this.dimensions.totalScrollItemHeight)+"px,0)"}};let d=!(m.prototype.triggerResume=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("resume"))});function o(e,t){const n=this,i=new m(this);let s=g.fnNoScroll.bind(this);this.elems={rootElement:e,shadowRoot:null,container:null,outerWrapper:null,innerContainer:null,scrollItem:null,scrollItemClone:null},this.config=t,this.dimensions={},this._time=Date.now(),this._rafId=null,this._shouldPlay=!1,this._wasPlaying=!1,this._isInView=!0,this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight};const o=()=>{if(this.elems.rootElement.offsetWidth===this._previousDimensions.width&&this.elems.rootElement.offsetHeight===this._previousDimensions.height)return!1;let e=!(this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight});this._rafId&&(e=!0,window.cancelAnimationFrame(this._rafId),this._rafId=null),this.init(),e&&this.tick()},r=()=>{!0===document.hidden?this.onOutOfView():this.onIntoView()},l=()=>{!0===this.config.pauseonhover&&this.pause()},h=()=>{!0===this.config.pauseonhover&&this.play()},c=new IntersectionObserver((e,t)=>{e=e.length?e[0]:null;e&&(!0===e.isIntersecting?this.onIntoView():this.onOutOfView())},{rootMargin:"0px 0px 20px 0px"});!function(){switch(n.config.system){case u.SYSTEM_JQUERY:case u.SYSTEM_VANILLA:case u.SYSTEM_WEBCOMPONENT:n.elems.shadowRoot=n.elems.rootElement.attachShadow({mode:"open"}),n.config.type===u.TYPE_VERTICAL?n.elems.shadowRoot.appendChild(p.content.cloneNode(!0)):n.elems.shadowRoot.appendChild(a.content.cloneNode(!0)),n.elems.container=n.elems.shadowRoot.querySelector("div.supermarquee-container"),n.elems.perspective=n.elems.shadowRoot.querySelector("div.supermarquee-perspective:first-child"),n.elems.outerWrapper=n.elems.shadowRoot.querySelector("div.supermarquee-outer-wrapper:first-child"),n.elems.innerContainer=n.elems.shadowRoot.querySelector("div.supermarquee-inner-container:first-child")}n.elems.scrollItem=n.elems.innerContainer.querySelector("div.supermarquee-item:first-child"),n.elems.scrollItemClone=n.elems.innerContainer.querySelector("div.supermarquee-item-clone"),window.addEventListener("resize",o),document.addEventListener("visibilitychange",r),n.elems.container.addEventListener("mouseenter",l),n.elems.container.addEventListener("mouseleave",h),c.observe(n.elems.container)}(),this.init=function(){this.elems.container.style.visibility="hidden";var t=this.elems.rootElement.style.position;this.elems.rootElement.style.position="initial",this.elems.scrollItem.innerHTML="",this.elems.scrollItemClone.innerHTML="";var i=this.config.content;if(u.TYPE_HORIZONTAL===this.config.type){let e;switch(this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerWidth:this.elems.container.clientWidth,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientWidth;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingLeft=this.elems.container.clientWidth+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerWidth:this.elems.container.clientWidth;e>this.elems.scrollItem.clientWidth;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}else{0<=this.elems.scrollItem.getBoundingClientRect().height&&(this.elems.scrollItem.innerHTML=" ");let e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;switch(this.elems.outerWrapper.style.maxHeight=e+"px",this.elems.scrollItem.innerHTML="",this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerHeight:this.elems.container.clientHeight,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientHeight;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingTop=this.elems.container.clientHeight+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;e>this.elems.scrollItem.clientHeight;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}this.updatePerspective(),setTimeout(()=>{this.updateDimensions(),this.updateTickLogic(),this.elems.container.style.visibility="visible",this.onIntoView()},100),this._currentXPos=0,this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,this._time=Date.now(),this.elems.rootElement.style.position=t,!1===this.config.hasLicense()&&window.console&&!1===d&&(d=!0,console.log("%c»SuperMarquee« by SuperPlug.in. Unlicensed version for non commercial use only.","font-family: monospace sans-serif; background-color: #8089ff; color: white;"))}.bind(this),this.updatePerspective=function(){this.elems.perspective.style.perspective=this.config.perspective.z+"px",this.elems.perspective.style.perspectiveOrigin=this.config.perspective.originX+"% "+this.config.perspective.originY+"%",this.elems.outerWrapper.style.transform="rotateX("+this.config.perspective.rotateX+"deg) rotateY("+this.config.perspective.rotateY+"deg) rotateZ("+this.config.perspective.rotateZ+"deg)"}.bind(this),this.updateTickLogic=function(){if(u.MODE_PINGPONG===n.config.mode)if(!1===n.config._gappedScrollingEnabled)s=g.fnNoScroll.bind(n);else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalRtlPingPong.bind(n);break;default:case u.DIRECTION_LTR:this._currentXPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalLtrPingPong.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalTtbPingPong.bind(n);break;case u.DIRECTION_BTT:this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=n.config.pingPongDelay,s=g.fnHorizontalBttPingPong.bind(n)}else if(u.TYPE_HORIZONTAL===n.config.type)switch(n.config.direction){case u.DIRECTION_RTL:s=g.fnHorizontalRtl.bind(n);break;default:case u.DIRECTION_LTR:s=g.fnHorizontalLtr.bind(n)}else switch(n.config.direction){case u.DIRECTION_TTB:s=g.fnVerticalTtb.bind(n);break;default:case u.DIRECTION_BTT:s=g.fnVerticalBtt.bind(n)}}.bind(this),this.updateDimensions=function(){this.dimensions.visibleWidth=this.elems.container.clientWidth,this.dimensions.visibleHeight=this.elems.container.clientHeight,this.dimensions.totalScrollItemWidth=this.elems.scrollItem.offsetWidth,this.dimensions.totalScrollItemHeight=this.elems.scrollItem.offsetHeight}.bind(this),this.tick=function(){var e=Date.now(),t=e-this._time;this._time=e,s(t),this._rafId=window.requestAnimationFrame(this.tick)}.bind(this),this.getRootElement=function(){return this.elems.rootElement}.bind(this),this.getEvents=function(){return i},this.destroy=function(){this._rafId&&(window.cancelAnimationFrame(this._rafId),this._rafId=null),window.removeEventListener("resize",o),document.removeEventListener("visibilitychange",r),this.elems.container.removeEventListener("mouseenter",l),this.elems.container.removeEventListener("mouseleave",h),c.unobserve(this.elems.container)},this.getScrollContent=function(){return this.config.content}}function e(e,t={}){if(!e||!1==e instanceof HTMLElement)throw new Error("Missing/invalid rootElement: ",e);const i=JSON.parse(JSON.stringify(u.DEFAULT));var n,s;for(s in i)t.hasOwnProperty(s)?i[s]=t[s]:e.hasAttribute("data-"+s)&&(i[s]=e.getAttribute("data-"+s));return i.system=u.SYSTEM_VANILLA,n=new u(i),this._core=new o(e,n),this._core.init(),setTimeout(()=>{this._core.config.autostart&&this._core.tick()},150),this}return o.prototype.VERSION="1.3",o.prototype.play=function(){!(this._shouldPlay=!0)!==this._isInView&&(this._rafId||(this._time=Date.now(),this.tick(),this._wasPlaying=!0))},o.prototype.pause=function(){this._shouldPlay=!1,this._rafId?(window.cancelAnimationFrame(this._rafId),this._rafId=null,this._wasPlaying=!0):this._wasPlaying=!1},o.prototype.setScrollContent=function(e){this.config.setContent(e),this.init()},o.prototype.setScrollSpeed=function(e){this.config.setSpeed(e)},o.prototype.setPosition=function(e){switch(this.config.setPosition(e),this.config.position){case u.POSITION_FIXEDTOP:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.top=0,this.elems.rootElement.style.left=0;break;case u.POSITION_FIXEDBOTTOM:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.bottom=0,this.elems.rootElement.style.left=0;break;default:case u.POSITION_CUSTOM:this.elems.rootElement.style.removeProperty("position"),this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom")}this.init()},o.prototype.setPauseOnHover=function(e){this.config.setPauseOnHover(e)},o.prototype.setPerspective=function(e){this.config.setPerspective(e),this.updatePerspective()},o.prototype.onIntoView=function(){this._isInView=!0,this.play()},o.prototype.onOutOfView=function(){this._isInView=!1,this.pause()},o.prototype.destroy=function(){},o.prototype.Log=function(e,t="info"){console[t](e)},e.getDefaultConfiguration=function(){return JSON.parse(JSON.stringify(u.DEFAULT))},e.prototype.play=function(){this._core.play()},e.prototype.pause=function(){this._core.pause()},e.prototype.setScrollContent=function(e){this._core.setScrollContent(e)},e.prototype.setScrollSpeed=function(e){this._core.setScrollSpeed(e)},e.prototype.setPosition=function(e){this._core.setPosition(e)},e.prototype.setPauseOnHover=function(e){this._core.setPauseOnHover(e)},e.prototype.setPerspective=function(e){this._core.setPerspective(e)},e.prototype.destroy=function(){this._core.destroy()},e}); |
@@ -897,2 +897,3 @@ (function () { | ||
this.elems.container.style.visibility = 'visible'; | ||
this.onIntoView(); | ||
}, 100 ); | ||
@@ -1102,3 +1103,3 @@ | ||
Core.prototype.VERSION = "1.2"; | ||
Core.prototype.VERSION = "1.3"; | ||
@@ -1105,0 +1106,0 @@ Core.prototype.play = function() |
@@ -105,2 +105,2 @@ !function(){"use strict";const a=document.createElement("template"),p=document.createElement("template");function u(e={}){this._gappedScrollingEnabled=!1,this.easingValue=.025,this._currentSpeed=0,this.setSpeed=function(e){this.type===u.TYPE_HORIZONTAL?-1<Object.keys(u.SPEED_HORIZONTAL).indexOf(e)?this.speed=+u.SPEED_HORIZONTAL[e]:this.speed=0<+e?+e:+u.SPEED_HORIZONTAL[u.DEFAULT.speed]:-1<Object.keys(u.SPEED_VERTICAL).indexOf(e)?this.speed=+u.SPEED_VERTICAL[e]:this.speed=0<+e?+e:+u.SPEED_VERTICAL[u.DEFAULT.speed]},this.hasLicense=function(){return null!==this.license&&void 0!==this.license},this.getSpeedNoEasing=function(){return this.speed}.bind(this),this.getSpeedWithEasing=function(){return this.easingValue<1&&(this._currentSpeed=(1-this.easingValue)*this._currentSpeed+this.easingValue*this.speed),this._currentSpeed}.bind(this),this.getSpeed=this.getSpeedNoEasing,this.setContent=function(e){e&&0<e.length?this.content=e:this.content="SuperMarquee by SuperPlug.in !!!",this.content=this.content.replaceAll("> ","> "),this.content=this.content.replaceAll(" <"," <"),u.MODE_PINGPONG===this.mode&&u.TYPE_HORIZONTAL===this.type&&(this.content=this.spacer+this.content),this.content+=this.spacer},this.setPerspective=function(e=null){var t=Object.keys(u.PERSPECTIVE_DEFAULT);let i={};if(e)try{i=JSON.parse(e)}catch(e){i={}}for(let e=0;e<t.length;e++)i.hasOwnProperty(t[e])?this.perspective[t[e]]=i[t[e]]:this.perspective[t[e]]=u.PERSPECTIVE_DEFAULT[t[e]]},this.setPosition=function(e){-1<u.POSITIONS.indexOf(e)?this.position=e:this.position=u.DEFAULT.position},this.setPauseOnHover=function(e){this.pauseonhover=!(!e||"true"!==e&&"1"!==e)};var t=e.hasOwnProperty("system")?e.system:null;-1<u.SYSTEMS.indexOf(t)?this.system=t:this.system=u.DEFAULT.system;t=e.hasOwnProperty("license")?e.license:null;this.license=null,t&&4<=t.length&&(this.license=e.license);t=e.hasOwnProperty("type")?e.type:null;-1<u.TYPES.indexOf(t)?this.type=t:this.type=u.DEFAULT.type,this.spacer=e.hasOwnProperty("spacer")?e.spacer:null,this.spacer||(this.type===u.TYPE_HORIZONTAL?this.spacer=" ":this.spacer="<br />");t=e.hasOwnProperty("direction")?e.direction:null;-1<u.DIRECTIONS.indexOf(t)?this.direction=t:this.direction=u.DEFAULT.direction;t=e.hasOwnProperty("mode")?e.mode:null;-1<u.MODES.indexOf(t)?this.mode=t:this.mode=u.MODE_CONTINOUS,this.pingPongDelay=e.hasOwnProperty("pingpongdelay")?+e.pingpongdelay:u.PINGPONG_DELAY_DEFAULT;t=e.hasOwnProperty("position")?e.position:null;this.setPosition(t),this.perspective={},this.setPerspective(e.hasOwnProperty("perspective")?e.perspective:null);t=e.hasOwnProperty("speed")?e.speed:null;this.setSpeed(t),this._currentSpeed=this.speed,this.setContent(e.hasOwnProperty("content")?e.content:null);t=e.hasOwnProperty("pauseonhover")?e.pauseonhover:null;this.setPauseOnHover(t);t=e.hasOwnProperty("autostart")?e.autostart:null;this.autostart=!t||"false"!==t&&"0"!==t;e=e.hasOwnProperty("easing")?e.easing:null;!e||"true"!==e&&"1"!==e&&!0!==e?(this.easing=!1,this.getSpeed=this.getSpeedNoEasing):(this.easing=!0,this.getSpeed=this.getSpeedWithEasing)}function m(e){const t=e;this.getInstance=function(){return t}}a.innerHTML=` | ||
</div> | ||
`,u.SYSTEM_WEBCOMPONENT="webcomponent",u.SYSTEM_JQUERY="jquery",u.SYSTEM_VANILLA="vanilla",u.SYSTEMS=[u.SYSTEM_WEBCOMPONENT,u.SYSTEM_JQUERY,u.SYSTEM_VANILLA],u.TYPE_HORIZONTAL="horizontal",u.TYPE_VERTICAL="vertical",u.TYPES=[u.TYPE_HORIZONTAL,u.TYPE_VERTICAL],u.DIRECTION_LTR="ltr",u.DIRECTION_RTL="rtl",u.DIRECTION_BTT="btt",u.DIRECTION_TTB="ttb",u.DIRECTIONS=[u.DIRECTION_LTR,u.DIRECTION_RTL,u.DIRECTION_BTT,u.DIRECTION_TTB],u.POSITION_CUSTOM="custom",u.POSITION_FIXEDTOP="fixedTop",u.POSITION_FIXEDBOTTOM="fixedBottom",u.POSITIONS=[u.POSITION_CUSTOM,u.POSITION_FIXEDTOP,u.POSITION_FIXEDBOTTOM],u.MODE_CONTINOUS="continuous",u.MODE_GAPPED="gapped",u.MODE_PINGPONG="pingpong",u.MODES=[u.MODE_CONTINOUS,u.MODE_GAPPED,u.MODE_PINGPONG],u.SPEED_SUPERSLOW="superslow",u.SPEED_SLOW="slow",u.SPEED_MEDIUM="medium",u.SPEED_FAST="fast",u.SPEED_SUPERFAST="superfast",u.SPEED_HORIZONTAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.SPEED_VERTICAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.PERSPECTIVE_DEFAULT={z:"none",originX:50,originY:50,rotateX:0,rotateY:0,rotateZ:0},u.PINGPONG_DELAY_DEFAULT=2e3,u.DEFAULT={license:null,system:u.SYSTEM_VANILLA,type:u.TYPE_HORIZONTAL,speed:u.SPEED_MEDIUM,direction:u.DIRECTION_LTR,mode:u.MODE_CONTINOUS,position:u.POSITION_CUSTOM,perspective:u.PERSPECTIVE_DEFAULT,pauseonhover:!1,autostart:!0,easing:!1,content:"SuperMarquee By SuperPlug.in Is Super !!!",pingPongDelay:u.PINGPONG_DELAY_DEFAULT,spacer:null},m.prototype.triggerInit=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("init"))},m.prototype.triggerStart=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("start"))},m.prototype.triggerLoop=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("loop"))},m.prototype.triggerPause=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("pause"))};const g={fnNoScroll:function(e){},fnHorizontalLtrPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos+this.dimensions.visibleWidth>this.dimensions.totalScrollItemWidth&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<=0&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtlPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<0&&(this._currentXPos=0,this._pingPongCurrentDirection=0,g._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalTtbPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalBttPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalLtr:function(e){this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtl:function(e){this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth+this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+(this._currentXPos-this.dimensions.totalScrollItemWidth)+"px,0,0)"},fnVerticalBtt:function(e){this._currentYPos+=e*this.config.getSpeed(),this._currentYPos>this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight-this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+this._currentYPos+"px,0)"},fnVerticalTtb:function(e){this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight+this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+(this._currentYPos-this.dimensions.totalScrollItemHeight)+"px,0)"}};let d=!(m.prototype.triggerResume=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("resume"))});function s(e,t){const s=this,i=new m(this);let n=g.fnNoScroll.bind(this);this.elems={rootElement:e,shadowRoot:null,container:null,outerWrapper:null,innerContainer:null,scrollItem:null,scrollItemClone:null},this.config=t,this.dimensions={},this._time=Date.now(),this._rafId=null,this._shouldPlay=!1,this._wasPlaying=!1,this._isInView=!0,this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight};const o=()=>{if(this.elems.rootElement.offsetWidth===this._previousDimensions.width&&this.elems.rootElement.offsetHeight===this._previousDimensions.height)return!1;let e=!(this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight});this._rafId&&(e=!0,window.cancelAnimationFrame(this._rafId),this._rafId=null),this.init(),e&&this.tick()},r=()=>{!0===document.hidden?this.onOutOfView():this.onIntoView()},l=()=>{!0===this.config.pauseonhover&&this.pause()},h=()=>{!0===this.config.pauseonhover&&this.play()},c=new IntersectionObserver((e,t)=>{e=e.length?e[0]:null;e&&(!0===e.isIntersecting?this.onIntoView():this.onOutOfView())},{rootMargin:"0px 0px 20px 0px"});!function(){switch(s.config.system){case u.SYSTEM_JQUERY:case u.SYSTEM_VANILLA:case u.SYSTEM_WEBCOMPONENT:s.elems.shadowRoot=s.elems.rootElement.attachShadow({mode:"open"}),s.config.type===u.TYPE_VERTICAL?s.elems.shadowRoot.appendChild(p.content.cloneNode(!0)):s.elems.shadowRoot.appendChild(a.content.cloneNode(!0)),s.elems.container=s.elems.shadowRoot.querySelector("div.supermarquee-container"),s.elems.perspective=s.elems.shadowRoot.querySelector("div.supermarquee-perspective:first-child"),s.elems.outerWrapper=s.elems.shadowRoot.querySelector("div.supermarquee-outer-wrapper:first-child"),s.elems.innerContainer=s.elems.shadowRoot.querySelector("div.supermarquee-inner-container:first-child")}s.elems.scrollItem=s.elems.innerContainer.querySelector("div.supermarquee-item:first-child"),s.elems.scrollItemClone=s.elems.innerContainer.querySelector("div.supermarquee-item-clone"),window.addEventListener("resize",o),document.addEventListener("visibilitychange",r),s.elems.container.addEventListener("mouseenter",l),s.elems.container.addEventListener("mouseleave",h),c.observe(s.elems.container)}(),this.init=function(){this.elems.container.style.visibility="hidden";var t=this.elems.rootElement.style.position;this.elems.rootElement.style.position="initial",this.elems.scrollItem.innerHTML="",this.elems.scrollItemClone.innerHTML="";var i=this.config.content;if(u.TYPE_HORIZONTAL===this.config.type){let e;switch(this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerWidth:this.elems.container.clientWidth,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientWidth;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingLeft=this.elems.container.clientWidth+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerWidth:this.elems.container.clientWidth;e>this.elems.scrollItem.clientWidth;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}else{0<=this.elems.scrollItem.getBoundingClientRect().height&&(this.elems.scrollItem.innerHTML=" ");let e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;switch(this.elems.outerWrapper.style.maxHeight=e+"px",this.elems.scrollItem.innerHTML="",this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerHeight:this.elems.container.clientHeight,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientHeight;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingTop=this.elems.container.clientHeight+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;e>this.elems.scrollItem.clientHeight;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}this.updatePerspective(),setTimeout(()=>{this.updateDimensions(),this.updateTickLogic(),this.elems.container.style.visibility="visible"},100),this._currentXPos=0,this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,this._time=Date.now(),this.elems.rootElement.style.position=t,!1===this.config.hasLicense()&&window.console&&!1===d&&(d=!0,console.log("%c»SuperMarquee« by SuperPlug.in. Unlicensed version for non commercial use only.","font-family: monospace sans-serif; background-color: #8089ff; color: white;"))}.bind(this),this.updatePerspective=function(){this.elems.perspective.style.perspective=this.config.perspective.z+"px",this.elems.perspective.style.perspectiveOrigin=this.config.perspective.originX+"% "+this.config.perspective.originY+"%",this.elems.outerWrapper.style.transform="rotateX("+this.config.perspective.rotateX+"deg) rotateY("+this.config.perspective.rotateY+"deg) rotateZ("+this.config.perspective.rotateZ+"deg)"}.bind(this),this.updateTickLogic=function(){if(u.MODE_PINGPONG===s.config.mode)if(!1===s.config._gappedScrollingEnabled)n=g.fnNoScroll.bind(s);else if(u.TYPE_HORIZONTAL===s.config.type)switch(s.config.direction){case u.DIRECTION_RTL:this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalRtlPingPong.bind(s);break;default:case u.DIRECTION_LTR:this._currentXPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalLtrPingPong.bind(s)}else switch(s.config.direction){case u.DIRECTION_TTB:this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalTtbPingPong.bind(s);break;case u.DIRECTION_BTT:this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalBttPingPong.bind(s)}else if(u.TYPE_HORIZONTAL===s.config.type)switch(s.config.direction){case u.DIRECTION_RTL:n=g.fnHorizontalRtl.bind(s);break;default:case u.DIRECTION_LTR:n=g.fnHorizontalLtr.bind(s)}else switch(s.config.direction){case u.DIRECTION_TTB:n=g.fnVerticalTtb.bind(s);break;default:case u.DIRECTION_BTT:n=g.fnVerticalBtt.bind(s)}}.bind(this),this.updateDimensions=function(){this.dimensions.visibleWidth=this.elems.container.clientWidth,this.dimensions.visibleHeight=this.elems.container.clientHeight,this.dimensions.totalScrollItemWidth=this.elems.scrollItem.offsetWidth,this.dimensions.totalScrollItemHeight=this.elems.scrollItem.offsetHeight}.bind(this),this.tick=function(){var e=Date.now(),t=e-this._time;this._time=e,n(t),this._rafId=window.requestAnimationFrame(this.tick)}.bind(this),this.getRootElement=function(){return this.elems.rootElement}.bind(this),this.getEvents=function(){return i},this.destroy=function(){this._rafId&&(window.cancelAnimationFrame(this._rafId),this._rafId=null),window.removeEventListener("resize",o),document.removeEventListener("visibilitychange",r),this.elems.container.removeEventListener("mouseenter",l),this.elems.container.removeEventListener("mouseleave",h),c.unobserve(this.elems.container)},this.getScrollContent=function(){return this.config.content}}s.prototype.VERSION="1.2",s.prototype.play=function(){!(this._shouldPlay=!0)!==this._isInView&&(this._rafId||(this._time=Date.now(),this.tick(),this._wasPlaying=!0))},s.prototype.pause=function(){this._shouldPlay=!1,this._rafId?(window.cancelAnimationFrame(this._rafId),this._rafId=null,this._wasPlaying=!0):this._wasPlaying=!1},s.prototype.setScrollContent=function(e){this.config.setContent(e),this.init()},s.prototype.setScrollSpeed=function(e){this.config.setSpeed(e)},s.prototype.setPosition=function(e){switch(this.config.setPosition(e),this.config.position){case u.POSITION_FIXEDTOP:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.top=0,this.elems.rootElement.style.left=0;break;case u.POSITION_FIXEDBOTTOM:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.bottom=0,this.elems.rootElement.style.left=0;break;default:case u.POSITION_CUSTOM:this.elems.rootElement.style.removeProperty("position"),this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom")}this.init()},s.prototype.setPauseOnHover=function(e){this.config.setPauseOnHover(e)},s.prototype.setPerspective=function(e){this.config.setPerspective(e),this.updatePerspective()},s.prototype.onIntoView=function(){this._isInView=!0,this.play()},s.prototype.onOutOfView=function(){this._isInView=!1,this.pause()},s.prototype.destroy=function(){},s.prototype.Log=function(e,t="info"){console[t](e)};class e extends HTMLElement{constructor(){super();let t={},e,i=["type","direction","mode","speed","content","pauseonhover","autostart","easing","perspective"];for(let e=0;e<i.length;e++)this.hasAttribute(i[e])&&(t[i[e]]=this.getAttribute(i[e]));t.system=u.SYSTEM_WEBCOMPONENT,e=new u(t),console.log(e),this._core=new s(this,e)}connectedCallback(){console.log(" Conntected"),this._core.init(),this._core.config.autostart&&this._core.tick()}static get observedAttributes(){return["speed","content","position","pauseonhover","perspective"]}attributeChangedCallback(e,t,i){switch(e){case"content":this.setScrollContent(i);break;case"speed":this.setScrollSpeed(i);break;case"position":this.setPosition(i);break;case"pauseonhover":this.setPauseOnHover(i);break;case"perspective":this.setPerspective(i)}}disconnectedCallback(){this._core.destroy()}play(){this._core.play()}pause(){this._core.pause()}setScrollContent(e){this._core.setScrollContent(e)}setScrollSpeed(e){this._core.setScrollSpeed(e)}setPosition(e){this._core.setPosition(e)}setPauseOnHover(e){this._core.setPauseOnHover(e)}}window.customElements.define("super-marquee",e)}(); | ||
`,u.SYSTEM_WEBCOMPONENT="webcomponent",u.SYSTEM_JQUERY="jquery",u.SYSTEM_VANILLA="vanilla",u.SYSTEMS=[u.SYSTEM_WEBCOMPONENT,u.SYSTEM_JQUERY,u.SYSTEM_VANILLA],u.TYPE_HORIZONTAL="horizontal",u.TYPE_VERTICAL="vertical",u.TYPES=[u.TYPE_HORIZONTAL,u.TYPE_VERTICAL],u.DIRECTION_LTR="ltr",u.DIRECTION_RTL="rtl",u.DIRECTION_BTT="btt",u.DIRECTION_TTB="ttb",u.DIRECTIONS=[u.DIRECTION_LTR,u.DIRECTION_RTL,u.DIRECTION_BTT,u.DIRECTION_TTB],u.POSITION_CUSTOM="custom",u.POSITION_FIXEDTOP="fixedTop",u.POSITION_FIXEDBOTTOM="fixedBottom",u.POSITIONS=[u.POSITION_CUSTOM,u.POSITION_FIXEDTOP,u.POSITION_FIXEDBOTTOM],u.MODE_CONTINOUS="continuous",u.MODE_GAPPED="gapped",u.MODE_PINGPONG="pingpong",u.MODES=[u.MODE_CONTINOUS,u.MODE_GAPPED,u.MODE_PINGPONG],u.SPEED_SUPERSLOW="superslow",u.SPEED_SLOW="slow",u.SPEED_MEDIUM="medium",u.SPEED_FAST="fast",u.SPEED_SUPERFAST="superfast",u.SPEED_HORIZONTAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.SPEED_VERTICAL={superslow:.0125,slow:.03,medium:.05,fast:.125,superfast:.2},u.PERSPECTIVE_DEFAULT={z:"none",originX:50,originY:50,rotateX:0,rotateY:0,rotateZ:0},u.PINGPONG_DELAY_DEFAULT=2e3,u.DEFAULT={license:null,system:u.SYSTEM_VANILLA,type:u.TYPE_HORIZONTAL,speed:u.SPEED_MEDIUM,direction:u.DIRECTION_LTR,mode:u.MODE_CONTINOUS,position:u.POSITION_CUSTOM,perspective:u.PERSPECTIVE_DEFAULT,pauseonhover:!1,autostart:!0,easing:!1,content:"SuperMarquee By SuperPlug.in Is Super !!!",pingPongDelay:u.PINGPONG_DELAY_DEFAULT,spacer:null},m.prototype.triggerInit=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("init"))},m.prototype.triggerStart=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("start"))},m.prototype.triggerLoop=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("loop"))},m.prototype.triggerPause=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("pause"))};const g={fnNoScroll:function(e){},fnHorizontalLtrPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos+this.dimensions.visibleWidth>this.dimensions.totalScrollItemWidth&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<=0&&(this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtlPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<0&&(this._currentXPos=0,this._pingPongCurrentDirection=0,g._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalTtbPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalBttPingPong:function(e){1===this._pingPongCurrentDirection?(this._currentYPos+=e*this.config.getSpeed(),0<this._currentYPos&&(this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1)):-1===this._pingPongCurrentDirection?(this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight)&&(this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=1)):(this._pingPongPauseDelay-=e,this._pingPongPauseDelay<0&&(this._pingPongCurrentDirection=this._pingPongNextDirection,this._pingPongPauseDelay=this.config.pingPongDelay)),this.elems.innerContainer.style.transform="translate3d(0,"+this._currentYPos+"px, 0)"},fnHorizontalLtr:function(e){this._currentXPos+=e*this.config.getSpeed(),this._currentXPos>this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth-this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+this._currentXPos+"px,0,0)"},fnHorizontalRtl:function(e){this._currentXPos-=e*this.config.getSpeed(),this._currentXPos<this.dimensions.totalScrollItemWidth&&(this._currentXPos=this.dimensions.totalScrollItemWidth+this._currentXPos),this.elems.innerContainer.style.transform="translate3d(-"+(this._currentXPos-this.dimensions.totalScrollItemWidth)+"px,0,0)"},fnVerticalBtt:function(e){this._currentYPos+=e*this.config.getSpeed(),this._currentYPos>this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight-this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+this._currentYPos+"px,0)"},fnVerticalTtb:function(e){this._currentYPos-=e*this.config.getSpeed(),this._currentYPos<this.dimensions.totalScrollItemHeight&&(this._currentYPos=this.dimensions.totalScrollItemHeight+this._currentYPos),this.elems.innerContainer.style.transform="translate3d(0, -"+(this._currentYPos-this.dimensions.totalScrollItemHeight)+"px,0)"}};let d=!(m.prototype.triggerResume=function(){let e=this.getInstance().getRootElement();e.dispatchEvent(new m("resume"))});function s(e,t){const s=this,i=new m(this);let n=g.fnNoScroll.bind(this);this.elems={rootElement:e,shadowRoot:null,container:null,outerWrapper:null,innerContainer:null,scrollItem:null,scrollItemClone:null},this.config=t,this.dimensions={},this._time=Date.now(),this._rafId=null,this._shouldPlay=!1,this._wasPlaying=!1,this._isInView=!0,this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight};const o=()=>{if(this.elems.rootElement.offsetWidth===this._previousDimensions.width&&this.elems.rootElement.offsetHeight===this._previousDimensions.height)return!1;let e=!(this._previousDimensions={width:this.elems.rootElement.offsetWidth,height:this.elems.rootElement.offsetHeight});this._rafId&&(e=!0,window.cancelAnimationFrame(this._rafId),this._rafId=null),this.init(),e&&this.tick()},r=()=>{!0===document.hidden?this.onOutOfView():this.onIntoView()},l=()=>{!0===this.config.pauseonhover&&this.pause()},h=()=>{!0===this.config.pauseonhover&&this.play()},c=new IntersectionObserver((e,t)=>{e=e.length?e[0]:null;e&&(!0===e.isIntersecting?this.onIntoView():this.onOutOfView())},{rootMargin:"0px 0px 20px 0px"});!function(){switch(s.config.system){case u.SYSTEM_JQUERY:case u.SYSTEM_VANILLA:case u.SYSTEM_WEBCOMPONENT:s.elems.shadowRoot=s.elems.rootElement.attachShadow({mode:"open"}),s.config.type===u.TYPE_VERTICAL?s.elems.shadowRoot.appendChild(p.content.cloneNode(!0)):s.elems.shadowRoot.appendChild(a.content.cloneNode(!0)),s.elems.container=s.elems.shadowRoot.querySelector("div.supermarquee-container"),s.elems.perspective=s.elems.shadowRoot.querySelector("div.supermarquee-perspective:first-child"),s.elems.outerWrapper=s.elems.shadowRoot.querySelector("div.supermarquee-outer-wrapper:first-child"),s.elems.innerContainer=s.elems.shadowRoot.querySelector("div.supermarquee-inner-container:first-child")}s.elems.scrollItem=s.elems.innerContainer.querySelector("div.supermarquee-item:first-child"),s.elems.scrollItemClone=s.elems.innerContainer.querySelector("div.supermarquee-item-clone"),window.addEventListener("resize",o),document.addEventListener("visibilitychange",r),s.elems.container.addEventListener("mouseenter",l),s.elems.container.addEventListener("mouseleave",h),c.observe(s.elems.container)}(),this.init=function(){this.elems.container.style.visibility="hidden";var t=this.elems.rootElement.style.position;this.elems.rootElement.style.position="initial",this.elems.scrollItem.innerHTML="",this.elems.scrollItemClone.innerHTML="";var i=this.config.content;if(u.TYPE_HORIZONTAL===this.config.type){let e;switch(this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerWidth:this.elems.container.clientWidth,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientWidth;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingLeft=this.elems.container.clientWidth+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerWidth:this.elems.container.clientWidth;e>this.elems.scrollItem.clientWidth;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}else{0<=this.elems.scrollItem.getBoundingClientRect().height&&(this.elems.scrollItem.innerHTML=" ");let e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;switch(this.elems.outerWrapper.style.maxHeight=e+"px",this.elems.scrollItem.innerHTML="",this.config.mode){case u.MODE_PINGPONG:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItemClone.innerHTML="",e="fixed"===t?window.innerHeight:this.elems.container.clientHeight,this.config._gappedScrollingEnabled=e<this.elems.scrollItem.clientHeight;break;case u.MODE_GAPPED:this.elems.scrollItem.innerHTML+=i,this.elems.scrollItem.style.paddingTop=this.elems.container.clientHeight+"px",this.elems.scrollItemClone.innerHTML="";break;default:case u.MODE_CONTINOUS:for(e="fixed"===t?window.innerHeight:this.elems.container.clientHeight;e>this.elems.scrollItem.clientHeight;)this.elems.scrollItem.innerHTML+=i;this.elems.scrollItemClone.innerHTML=this.elems.scrollItem.innerHTML}}this.updatePerspective(),setTimeout(()=>{this.updateDimensions(),this.updateTickLogic(),this.elems.container.style.visibility="visible",this.onIntoView()},100),this._currentXPos=0,this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,this._time=Date.now(),this.elems.rootElement.style.position=t,!1===this.config.hasLicense()&&window.console&&!1===d&&(d=!0,console.log("%c»SuperMarquee« by SuperPlug.in. Unlicensed version for non commercial use only.","font-family: monospace sans-serif; background-color: #8089ff; color: white;"))}.bind(this),this.updatePerspective=function(){this.elems.perspective.style.perspective=this.config.perspective.z+"px",this.elems.perspective.style.perspectiveOrigin=this.config.perspective.originX+"% "+this.config.perspective.originY+"%",this.elems.outerWrapper.style.transform="rotateX("+this.config.perspective.rotateX+"deg) rotateY("+this.config.perspective.rotateY+"deg) rotateZ("+this.config.perspective.rotateZ+"deg)"}.bind(this),this.updateTickLogic=function(){if(u.MODE_PINGPONG===s.config.mode)if(!1===s.config._gappedScrollingEnabled)n=g.fnNoScroll.bind(s);else if(u.TYPE_HORIZONTAL===s.config.type)switch(s.config.direction){case u.DIRECTION_RTL:this._currentXPos=this.dimensions.totalScrollItemWidth-this.dimensions.visibleWidth,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalRtlPingPong.bind(s);break;default:case u.DIRECTION_LTR:this._currentXPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalLtrPingPong.bind(s)}else switch(s.config.direction){case u.DIRECTION_TTB:this._currentYPos=-(this.dimensions.totalScrollItemHeight-this.dimensions.visibleHeight),this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalTtbPingPong.bind(s);break;case u.DIRECTION_BTT:this._currentYPos=0,this._pingPongCurrentDirection=0,this._pingPongNextDirection=-1,this._pingPongPauseDelay=s.config.pingPongDelay,n=g.fnHorizontalBttPingPong.bind(s)}else if(u.TYPE_HORIZONTAL===s.config.type)switch(s.config.direction){case u.DIRECTION_RTL:n=g.fnHorizontalRtl.bind(s);break;default:case u.DIRECTION_LTR:n=g.fnHorizontalLtr.bind(s)}else switch(s.config.direction){case u.DIRECTION_TTB:n=g.fnVerticalTtb.bind(s);break;default:case u.DIRECTION_BTT:n=g.fnVerticalBtt.bind(s)}}.bind(this),this.updateDimensions=function(){this.dimensions.visibleWidth=this.elems.container.clientWidth,this.dimensions.visibleHeight=this.elems.container.clientHeight,this.dimensions.totalScrollItemWidth=this.elems.scrollItem.offsetWidth,this.dimensions.totalScrollItemHeight=this.elems.scrollItem.offsetHeight}.bind(this),this.tick=function(){var e=Date.now(),t=e-this._time;this._time=e,n(t),this._rafId=window.requestAnimationFrame(this.tick)}.bind(this),this.getRootElement=function(){return this.elems.rootElement}.bind(this),this.getEvents=function(){return i},this.destroy=function(){this._rafId&&(window.cancelAnimationFrame(this._rafId),this._rafId=null),window.removeEventListener("resize",o),document.removeEventListener("visibilitychange",r),this.elems.container.removeEventListener("mouseenter",l),this.elems.container.removeEventListener("mouseleave",h),c.unobserve(this.elems.container)},this.getScrollContent=function(){return this.config.content}}s.prototype.VERSION="1.3",s.prototype.play=function(){!(this._shouldPlay=!0)!==this._isInView&&(this._rafId||(this._time=Date.now(),this.tick(),this._wasPlaying=!0))},s.prototype.pause=function(){this._shouldPlay=!1,this._rafId?(window.cancelAnimationFrame(this._rafId),this._rafId=null,this._wasPlaying=!0):this._wasPlaying=!1},s.prototype.setScrollContent=function(e){this.config.setContent(e),this.init()},s.prototype.setScrollSpeed=function(e){this.config.setSpeed(e)},s.prototype.setPosition=function(e){switch(this.config.setPosition(e),this.config.position){case u.POSITION_FIXEDTOP:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.top=0,this.elems.rootElement.style.left=0;break;case u.POSITION_FIXEDBOTTOM:this.elems.rootElement.style.position="fixed",this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom"),this.elems.rootElement.style.width="100%",this.elems.rootElement.style.bottom=0,this.elems.rootElement.style.left=0;break;default:case u.POSITION_CUSTOM:this.elems.rootElement.style.removeProperty("position"),this.elems.rootElement.style.removeProperty("left"),this.elems.rootElement.style.removeProperty("top"),this.elems.rootElement.style.removeProperty("bottom")}this.init()},s.prototype.setPauseOnHover=function(e){this.config.setPauseOnHover(e)},s.prototype.setPerspective=function(e){this.config.setPerspective(e),this.updatePerspective()},s.prototype.onIntoView=function(){this._isInView=!0,this.play()},s.prototype.onOutOfView=function(){this._isInView=!1,this.pause()},s.prototype.destroy=function(){},s.prototype.Log=function(e,t="info"){console[t](e)};class e extends HTMLElement{constructor(){super();let t={},e,i=["type","direction","mode","speed","content","pauseonhover","autostart","easing","perspective"];for(let e=0;e<i.length;e++)this.hasAttribute(i[e])&&(t[i[e]]=this.getAttribute(i[e]));t.system=u.SYSTEM_WEBCOMPONENT,e=new u(t),console.log(e),this._core=new s(this,e)}connectedCallback(){console.log(" Conntected"),this._core.init(),this._core.config.autostart&&this._core.tick()}static get observedAttributes(){return["speed","content","position","pauseonhover","perspective"]}attributeChangedCallback(e,t,i){switch(e){case"content":this.setScrollContent(i);break;case"speed":this.setScrollSpeed(i);break;case"position":this.setPosition(i);break;case"pauseonhover":this.setPauseOnHover(i);break;case"perspective":this.setPerspective(i)}}disconnectedCallback(){this._core.destroy()}play(){this._core.play()}pause(){this._core.pause()}setScrollContent(e){this._core.setScrollContent(e)}setScrollSpeed(e){this._core.setScrollSpeed(e)}setPosition(e){this._core.setPosition(e)}setPauseOnHover(e){this._core.setPauseOnHover(e)}}window.customElements.define("super-marquee",e)}(); |
{ | ||
"name": "sp-supermarquee", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Super smooth marquee library for your applications.", | ||
@@ -5,0 +5,0 @@ "type" : "module", |
![SuperMarquee](./res/github/SuperMarqueeLogoWhiteBg.png) | ||
**SuperMarquee** is the super smooth marquee web component for your web applications. | ||
![SupportedFrameworkIcons](./res/github/sp-supported-frameworks.jpg) | ||
@@ -9,2 +9,12 @@ [![npm](https://img.shields.io/npm/dt/sp-supermarquee.svg)](https://npmjs.com/package/sp-supermarquee) | ||
## About | ||
**SuperMarquee** is the super smooth marquee web component for your web applications. | ||
It covers all features for marquee usages, like horizontal- and vertical scrolling, different scroll speeds, custom styling etc. | ||
In addition, SuperMarquee comes with features which no other solution have. This includes 3D hardware acceleration, inbuilt 3D transformation functionalities and the unique ping-pong mode. | ||
Needless to say that SuperMarquee supports all your favourite frontend frameworks. | ||
## Showcase | ||
@@ -56,2 +66,6 @@ | ||
- [Getting Started with Web Component](https://superplug.in/supermarquee/docs#start-webcomponent) | ||
- [Getting Started with Angular](https://superplug.in/supermarquee/docs#start-angular) | ||
- [Getting Started with React](https://superplug.in/supermarquee/docs#start-react) | ||
- [Getting Started with Svelte](https://superplug.in/supermarquee/docs#start-svelte) | ||
- [Getting Started with Vue](https://superplug.in/supermarquee/docs#start-vue) | ||
- [API Reference](https://superplug.in/supermarquee/docs#instantiation) | ||
@@ -95,2 +109,4 @@ - [Changelog](https://superplug.in/supermarquee/docs#changelog) | ||
Refer to the [official documentation](https://superplug.in/supermarquee/docs) for more details. | ||
## Support | ||
@@ -97,0 +113,0 @@ |
@@ -198,2 +198,3 @@ import { templateVertical, templateHorizontal } from "./Template.js"; | ||
this.elems.container.style.visibility = 'visible'; | ||
this.onIntoView(); | ||
}, 100 ); | ||
@@ -403,3 +404,3 @@ | ||
Core.prototype.VERSION = "1.2"; | ||
Core.prototype.VERSION = "1.3"; | ||
@@ -406,0 +407,0 @@ Core.prototype.play = function() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
343154
20
5454
121