You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fipamo/themes/default/assets/js/toolkit.min.js

1 line
17 KiB
JavaScript

!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.ScrambleText=i()}(this,function(){"use strict";function t(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function i(){var t=Date.now()-this._startTime,i=t-this._elapsedTime;if(!(1e3/this.fps<=i))return void requestAnimationFrame(this._anim);if(this._elapsedTime=t,this._position=this._idling?0:this._elapsedTime/this.timeOffset|0,this._running){if(this._position>=this._contents.length)return this._running=!1,this.el.innerHTML=this._contents.map(function(t){return t.content}).join(""),this.el.removeAttribute("data-scramble-text-running"),void this.callback();requestAnimationFrame(this._anim);var n=e(this._contents,this.chars,this._position);this.el.innerHTML=n.join("")}}function e(t,i,e){for(var s=[],r=0,a=t.length;r<a;r++)"tag"!==t[r].type?r<e?s.push(t[r].content):s.push(n(i)):s.push(t[r].content);return s}function n(t){var i=Math.floor(Math.random()*t.length),e=-.5+Math.random(),n=t[i];return e<0?n.toLowerCase():n}function s(t){var i=[];for(t=t.replace(/^\s+/,"").replace(/\s+$/,"");0!==t.length;){var e=t.match(/^(\s*)?<\/?[a-z](.*?)>(\s*)?/i);if(e)i.push({type:"tag",content:e[0].replace(/^(\s*)(.+)(\s*)$/,"$1$2$3")}),t=t.replace(e[0],"");else{var n=t.match(/^\s+/);n?(i.push({type:"space",content:" "}),t=t.replace(n[0],"")):(i.push({type:"character",content:t[0]}),t=t.slice(1))}}return i}var r="data-scramble-text-idling";return function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t(this,e),this._startTime=0,this._elapsedTime=0,this._running=!1,this._idling=!0,this._position=0,this._contents=s(n.innerHTML),this._anim=i.bind(this),this.el=n,this.timeOffset=r.timeOffset||50,this.fps=r.fps||60,this.chars=r.chars||["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","!","#","$","%","&",":",";","?","@","[","]","^","_","{","|","}","~"],this.callback="function"==typeof r.callback?r.callback:function(){},this.play(),this}return e.prototype.play=function(){return this._running?this:(this._idling=!0,this._running=!0,this._position=0,this.el.setAttribute(r,""),this.el.setAttribute("data-scramble-text-running",""),this._anim(),this)},e.prototype.start=function(){return this._idling=!1,this._startTime=Date.now(),this._elapsedTime=0,this._position=0,this.el.removeAttribute(r),this},e.prototype.stop=function(){return this._running=!1,this.el.removeAttribute(r),this.el.removeAttribute("data-scramble-text-running"),this},e}()});var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,r,p){if(p.get||p.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[r]=p.value)},$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e},$jscomp.global=$jscomp.getGlobal(this),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.symbolCounter_=0,$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++},$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(e){var r=0;return $jscomp.iteratorPrototype(function(){return r<e.length?{done:!1,value:e[r++]}:{done:!0}})},$jscomp.iteratorPrototype=function(e){return $jscomp.initSymbolIterator(),e={next:e},e[$jscomp.global.Symbol.iterator]=function(){return this},e},$jscomp.array=$jscomp.array||{},$jscomp.iteratorFromArray=function(e,r){$jscomp.initSymbolIterator(),e inst