Plugin Directory

Changeset 3022094


Ignore:
Timestamp:
01/16/2024 02:35:51 AM (2 years ago)
Author:
web83info
Message:

Fix: Minor bug fix.

Location:
show-current-width
Files:
21 added
7 edited

Legend:

Unmodified
Added
Removed
  • show-current-width/trunk/assets/show-current-width.js

    r3014928 r3022094  
    1111        this.widthNow = 0;
    1212        this.countUpProceeding = false;
    13         window.addEventListener('load', this.showWidth());
    14         window.addEventListener('load', this.showWidthDelay());
     13        window.addEventListener('load', () => { this.showWidth(); });
     14        window.addEventListener('load', () => { this.showWidthDelay(); });
    1515    }
    1616
  • show-current-width/trunk/assets/show-current-width.min.js

    r3014928 r3022094  
    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.widthTo&&(this.widthNow+=t),Math.abs(this.widthNow-this.widthTo)<=t&&(this.widthNow=this.widthTo,this.countUpProceeding=!1),this.timeoutCountUp=setTimeout(()=>{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[1]?(i=d[2],h=d[3],o[e]=!0):o[e]=!1}),document.querySelector("#wp-admin-bar-show-current-width .ab-icon .width").textContent=Math.round(t),document.querySelector("#wp-admin-bar-show-current-width .ab-label .width").textContent=Math.round(t),1==ShowCurrentWidthVariables.breakpoints_show&&(document.querySelector("#wp-admin-bar-show-current-width .breakpoint").textContent=i,document.querySelector("#wp-admin-bar-show-current-width-breakpoint .breakpoint").textContent=h,o.forEach((t,i)=>{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;
     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.widthTo&&(this.widthNow+=t),Math.abs(this.widthNow-this.widthTo)<=t&&(this.widthNow=this.widthTo,this.countUpProceeding=!1),this.timeoutCountUp=setTimeout(()=>{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[1]?(i=d[2],h=d[3],o[e]=!0):o[e]=!1}),document.querySelector("#wp-admin-bar-show-current-width .ab-icon .width").textContent=Math.round(t),document.querySelector("#wp-admin-bar-show-current-width .ab-label .width").textContent=Math.round(t),1==ShowCurrentWidthVariables.breakpoints_show&&(document.querySelector("#wp-admin-bar-show-current-width .breakpoint").textContent=i,document.querySelector("#wp-admin-bar-show-current-width-breakpoint .breakpoint").textContent=h,o.forEach((t,i)=>{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;
  • show-current-width/trunk/class/class-showcurrentwidth-admin.php

    r3009226 r3022094  
    357357            echo '</li>';
    358358        }
     359        echo '</ul>';
    359360    }
    360361
  • show-current-width/trunk/class/class-showcurrentwidth-core.php

    r3014928 r3022094  
    2323     * Plugin constant.
    2424     */
    25     const PLUGIN_VERSION           = '1.2.5';
     25    const PLUGIN_VERSION           = '1.2.6';
    2626    const PLUGIN_PREFIX            = 'show-current-width';
    2727    const PLUGIN_PREFIX_DEPRECATED = 'w83-show-current-width';
    2828    const PLUGIN_GITHUB            = 'https://github.com/web83info/show-current-width';
    2929
    30     const OPTION_DEFAULT_BREAKPOINTS_DEFINITION     = <<< EOT
    31         0,576,xs,X-Small
    32         576,768,sm,Small
    33         768,992,md,Medium
    34         992,1200,lg,Large
    35         1200,1400,xl,Extra large
    36         1400,9999,xll,Extra extra large
    37         EOT;
     30    const OPTION_DEFAULT_BREAKPOINTS_DEFINITION     =
     31        '0,576,xs,X-Small' . PHP_EOL .
     32        '576,768,sm,Small' . PHP_EOL .
     33        '768,992,md,Medium' . PHP_EOL .
     34        '992,1200,lg,Large' . PHP_EOL .
     35        '1200,1400,xl,Extra large' . PHP_EOL .
     36        '1400,9999,xll,Extra extra large';
    3837    const OPTION_DEFAULT_BREAKPOINTS_SHOW           = 1;
    3938    const OPTION_DEFAULT_BREAKPOINTS_LIMITWIDTH     = 0;
  • show-current-width/trunk/class/trait-singleton.php

    r2973725 r3022094  
    11<?php
    22/**
    3  * ShowCurrentWidth_Core
     3 * Singleton
    44 *
    55 * @package None
  • show-current-width/trunk/readme.txt

    r3014928 r3022094  
    66Tested up to: 6.4.2
    77Requires PHP: 7.4
    8 Stable tag: 1.2.5
     8Stable tag: 1.2.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2121== Changelog ==
    2222
     23= 1.2.6 - 2024-01-16 =
     24* Fix: Minor bug fix.
     25
    2326= 1.2.5 - 2023-12-28 =
    2427* Fix: JS error when no WP adminbar.
    25 * Tested up to WordPress 6.4.2.
    2628
    2729= 1.2.4 - 2023-12-13 =
  • show-current-width/trunk/w83-show-current-width.php

    r3014928 r3022094  
    11<?php
    22/**
     3 * Show Current Width
     4 *
     5 * @package             Show_Current_Width
     6 * @author              web83info
     7 * @copyright           2023 web83info
     8 * @license             GPL-2.0-or-later
     9 *
     10 * @wordpress-plugin
    311 * Plugin Name:         Show Current Width
    412 * Plugin URI:
    513 * Description:         This plugin shows a current screen width on WP adminbar.
    6  * Version:             1.2.5
     14 * Version:             1.2.6
    715 * Requires at least:   6.0
    816 * Tested up to:        6.4.2
     
    1018 * Author:              web83info <[email protected]>
    1119 * Author URI:
    12  * Requires License:    no
    13  * License:             GPLv2+
    14  *
    15  * @package Show_Current_Width
    16  * @author  web83info
    17  * @link
    18  * @license
     20 * License:             GPL v2 or later
     21 * License URI:         https://www.gnu.org/licenses/gpl-2.0.html
    1922 */
    2023
Note: See TracChangeset for help on using the changeset viewer.