diff --git a/assets/show-current-width.js b/assets/show-current-width.js index e2ccb4c..361372c 100644 --- a/assets/show-current-width.js +++ b/assets/show-current-width.js @@ -16,7 +16,7 @@ class ShowCurrentWidth { showWidth() { this.widthTo = window.innerWidth; - if(document.getElementById('wpadminbar') == null) { + if(document.getElementById('wp-admin-bar-show-current-width') == null) { return; } if(1 == ShowCurrentWidthVariables.animation_show) { diff --git a/assets/show-current-width.min.js b/assets/show-current-width.min.js index f500474..42acc41 100644 --- a/assets/show-current-width.min.js +++ b/assets/show-current-width.min.js @@ -1 +1 @@ -"use strict";class ShowCurrentWidth{constructor(){this.timeoutWidth=void 0,this.timeoutCountUp=void 0,this.delay=ShowCurrentWidthVariables.animation_timeout,this.widthFrom=0,this.widthTo=window.innerWidth,this.widthNow=0,this.countUpProceeding=!1,window.addEventListener("load",()=>{this.showWidth()}),window.addEventListener("load",()=>{this.showWidthDelay()})}showWidth(){this.widthTo=window.innerWidth,null!=document.getElementById("wpadminbar")&&(1==ShowCurrentWidthVariables.animation_show?(this.countUpProceeding=!0,this.showWidthWithAnimation()):this.showWidthWithoutAnimation())}showWidthWithAnimation(){let t=Math.abs(this.widthTo-this.widthFrom)/30;if(this.showWidthCore(this.widthNow),!this.countUpProceeding)return clearTimeout(this.timeoutCountUp),void(this.widthFrom=this.widthTo);this.widthNow>this.widthTo?this.widthNow-=t:this.widthNow{this.showWidthWithAnimation()},7)}showWidthWithoutAnimation(){this.showWidthCore(this.widthTo)}showWidthCore(t){let i=void 0,h=void 0,o=new Array,e="»",d=void 0;ShowCurrentWidthVariables.breakpoints_definition.split("\n").forEach((t,e)=>{let d=t.trim().split(/\s*,\s*/);d[0]<=this.widthNow&&this.widthNow{d=t?e:"",document.querySelector("#wp-admin-bar-show-current-width-breakpoint-"+i+" .icon").textContent=d}))}showWidthDelay(){window.addEventListener("resize",()=>{clearTimeout(this.timeoutWidth),this.timeoutWidth=setTimeout(()=>{this.showWidth()},this.delay)},!1)}}new ShowCurrentWidth; \ No newline at end of file +"use strict";class ShowCurrentWidth{constructor(){this.timeoutWidth=void 0,this.timeoutCountUp=void 0,this.delay=ShowCurrentWidthVariables.animation_timeout,this.widthFrom=0,this.widthTo=window.innerWidth,this.widthNow=0,this.countUpProceeding=!1,window.addEventListener("load",()=>{this.showWidth()}),window.addEventListener("load",()=>{this.showWidthDelay()})}showWidth(){this.widthTo=window.innerWidth,null!=document.getElementById("wp-admin-bar-show-current-width")&&(1==ShowCurrentWidthVariables.animation_show?(this.countUpProceeding=!0,this.showWidthWithAnimation()):this.showWidthWithoutAnimation())}showWidthWithAnimation(){let t=Math.abs(this.widthTo-this.widthFrom)/30;if(this.showWidthCore(this.widthNow),!this.countUpProceeding)return clearTimeout(this.timeoutCountUp),void(this.widthFrom=this.widthTo);this.widthNow>this.widthTo?this.widthNow-=t:this.widthNow{this.showWidthWithAnimation()},7)}showWidthWithoutAnimation(){this.showWidthCore(this.widthTo)}showWidthCore(t){let i=void 0,h=void 0,o=new Array,e="»",d=void 0;ShowCurrentWidthVariables.breakpoints_definition.split("\n").forEach((t,e)=>{let d=t.trim().split(/\s*,\s*/);d[0]<=this.widthNow&&this.widthNow{d=t?e:"",document.querySelector("#wp-admin-bar-show-current-width-breakpoint-"+i+" .icon").textContent=d}))}showWidthDelay(){window.addEventListener("resize",()=>{clearTimeout(this.timeoutWidth),this.timeoutWidth=setTimeout(()=>{this.showWidth()},this.delay)},!1)}}new ShowCurrentWidth; \ No newline at end of file