Plugin Directory

Changeset 2809836


Ignore:
Timestamp:
11/02/2022 11:38:05 AM (3 years ago)
Author:
digisphere
Message:

uploading version 5.1.3

Location:
accessible-poetry
Files:
22 added
3 edited

Legend:

Unmodified
Added
Removed
  • accessible-poetry/trunk/accessible-wp-toolbar.php

    r2809810 r2809836  
    66 * Author: Codenroll
    77 * Author URI: https://www.codenroll.co.il/
    8  * Version: 5.1.2
     8 * Version: 5.1.3
    99 * Text Domain: acwp
    1010 * License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  • accessible-poetry/trunk/assets/js/toolbar.js

    r2801604 r2809836  
    5454   
    5555    // Increase font size
    56     const IncreseFont = () => {
     56    const IncreseFont = (toggle) => {
    5757
    5858        // set the font size distance
     
    6868            decCheckbox.checked = false;
    6969
    70         if( incCheckbox.checked == true ) {
    71            
     70        if( toggle ){
    7271            // Add toolbar class
    7372            jQuery('#acwp-toolbar').addClass('incresed');
    74            
     73                       
    7574            // Change font size by tags
    7675            jQuery(customTags).not(customexlcude_option).each(function () {
     
    9998                }
    10099            });
    101         }
    102         else {
    103             // Add toolbar class
    104             jQuery('#acwp-toolbar').removeClass('incresed');
    105             // change size by tag
    106             jQuery(customTags).not(customexlcude_option).each(function () {
    107                
    108                 // get default size
    109                 let fontSize = jQuery(this).data('acwp-fontsize');
    110                
    111                 // change the size
    112                 jQuery(this).css('font-size', parseInt(fontSize) + 'px');
    113                
    114                 // set line height
    115                 if(noLineHeight !== 'yes'){
    116                     let lineHeight = jQuery(this).data('acwp-lineheight');
    117                     jQuery(this).css('line-height', parseInt(lineHeight) + 'px');
    118                 }
    119             });
     100        } else {
     101            if( incCheckbox.checked !== true ) {
     102           
     103                // Add toolbar class
     104                jQuery('#acwp-toolbar').addClass('incresed');
     105               
     106                // Change font size by tags
     107                jQuery(customTags).not(customexlcude_option).each(function () {
     108                   
     109                    // get current font size
     110                    let fontSize = jQuery(this).css('font-size');
     111                   
     112                    // set default font size as data attr
     113                    if( !jQuery(this).data('acwp-fontsize') )
     114                        jQuery(this).attr('data-acwp-fontsize', fontSize.substring(0, fontSize.length - 2));
     115                   
     116                    // change the size
     117                    jQuery(this).css('font-size', parseInt(fontSize) * newSize + 'px');
     118   
     119                    if( noLineHeight !== 'yes' ){
     120                       
     121                        // get the default line height
     122                        let lineHeight = jQuery(this).css('line-height');
     123                       
     124                        // set default line height as data attr
     125                        if( !jQuery(this).data('acwp-lineheight') )
     126                            jQuery(this).attr('data-acwp-lineheight', lineHeight.substring(0, lineHeight.length - 2));
     127                       
     128                        // change the size
     129                        jQuery(this).css('line-height', 'normal');
     130                    }
     131                });
     132            } else {
     133                // Add toolbar class
     134                jQuery('#acwp-toolbar').removeClass('incresed');
     135                // change size by tag
     136                jQuery(customTags).not(customexlcude_option).each(function () {
     137                   
     138                    // get default size
     139                    let fontSize = jQuery(this).data('acwp-fontsize');
     140                   
     141                    // change the size
     142                    jQuery(this).css('font-size', parseInt(fontSize) + 'px');
     143                   
     144                    // set line height
     145                    if(noLineHeight !== 'yes'){
     146                        let lineHeight = jQuery(this).data('acwp-lineheight');
     147                        jQuery(this).css('line-height', parseInt(lineHeight) + 'px');
     148                    }
     149                });
     150            }
    120151        }
    121152    }
    122153
    123154    // Decrease font size
    124     const DecreaseFont = () => {
     155    const DecreaseFont = (toggle) => {
    125156        // set the new size
    126157        let newSize = (acwp_attr.fontsizer_min !== '') ? parseFloat(acwp_attr.fontsizer_min) / 100 : 0.8;
     
    133164            incfontCheckbox.checked = false;
    134165        }
    135 
    136         // decrease checkbox
    137         var checkbox = document.getElementById('acwp-toggler-decfont');
    138        
    139         if( checkbox.checked == true ) {
    140 
     166        if( toggle ){
    141167            jQuery(customTags).each(function () {
    142168                let fontSize = jQuery(this).css('font-size');
     
    144170                if( !jQuery(this).data('acwp-fontsize') )
    145171                    jQuery(this).attr('data-acwp-fontsize', fontSize.substring(0, fontSize.length - 2));
     172               
    146173                jQuery(this).css('font-size', parseInt(fontSize) * newSize + 'px');
    147174
     
    153180                }
    154181            });
    155         }
    156         else {
    157             jQuery(customTags).each(function () {
    158                 let fontSize = jQuery(this).data('acwp-fontsize');
    159                 jQuery(this).css('font-size', parseInt(fontSize) + 'px');
    160 
    161                 if(noLineHeight !== 'yes'){
    162                     let lineHeight = jQuery(this).data('acwp-lineheight');
    163                     jQuery(this).css('line-height', parseInt(lineHeight) + 'px');
    164                 }
    165             });
    166         }
     182        } else {
     183            // decrease checkbox
     184            var checkbox = document.getElementById('acwp-toggler-decfont');
     185                   
     186            if( checkbox.checked !== true ) {
     187                jQuery(customTags).each(function () {
     188                    let fontSize = jQuery(this).css('font-size');
     189
     190                    if( !jQuery(this).data('acwp-fontsize') )
     191                        jQuery(this).attr('data-acwp-fontsize', fontSize.substring(0, fontSize.length - 2));
     192                    jQuery(this).css('font-size', parseInt(fontSize) * newSize + 'px');
     193
     194                    if(noLineHeight !== 'yes'){
     195                        let lineHeight = jQuery(this).css('line-height');
     196                        if( !jQuery(this).data('acwp-lineheight') )
     197                            jQuery(this).attr('data-acwp-lineheight', lineHeight.substring(0, lineHeight.length - 2));
     198                        jQuery(this).css('line-height', 'normal');
     199                    }
     200                });
     201            }
     202            else {
     203                jQuery(customTags).each(function () {
     204                    let fontSize = jQuery(this).data('acwp-fontsize');
     205                    jQuery(this).css('font-size', parseInt(fontSize) + 'px');
     206
     207                    if(noLineHeight !== 'yes'){
     208                        let lineHeight = jQuery(this).data('acwp-lineheight');
     209                        jQuery(this).css('line-height', parseInt(lineHeight) + 'px');
     210                    }
     211                });
     212            }
     213        }
     214       
    167215    }
    168216   
    169217    // Toggle contrast
    170     const ToggleContrast = () => {
     218    const ToggleContrast = (toggle) => {
     219       
     220        // Get checkbox data
    171221        var checkbox = document.getElementById('acwp-toggler-contrast');
     222
     223        // Get excluded items
    172224        var exclude = acwp_attr.contrast_exclude;
    173         if( checkbox.checked == true && !$('body').hasClass('acwp-contrast')) {
     225
     226        if( toggle ){
    174227            $('body').addClass('acwp-contrast');
    175228
    176229            if( $('body').hasClass('acwp-contrast-js') ) {
    177                
    178                
    179230               
    180231                // imgs
     
    205256                });
    206257            }
    207         }
    208         else {
    209             // imgs
    210             jQuery('body *').not(exclude).each(function () {
    211                 if( this.style.backgroundImage != '' )
    212                     this.style.backgroundImage = '';
    213             });
    214             jQuery('body [data-acwp-bgimage]').not(exclude).each(function () {
    215                 let bg = jQuery(this).attr('data-acwp-bgimage');
    216                 if( bg != '' )
    217                     this.style.backgroundImage = bg;
    218             });
    219             // bgs
    220             jQuery('body *').not(exclude).each(function () {
    221                 if( this.style.backgroundColor != '' )
    222                     this.style.backgroundColor = '';
    223             });
    224             jQuery('body [data-acwp-bgcolor]').not(exclude).each(function () {
    225                 let bg = jQuery(this).attr('data-acwp-bgcolor');
    226                 if( bg != '' )
    227                     this.style.backgroundColor = bg;
    228             });
    229 
    230             // txt
    231             jQuery('body *').not(exclude).each(function () {
    232                 if( this.tagName == 'a' || this.tagName == 'button' || this.tagName == 'label' ) {
    233                     let clr = jQuery(this).not(exclude).attr('data-acwp-lnkcolor');
    234                     if( clr != '' )
    235                         this.style.color = clr;
    236                     if( this.style.color != '' )
    237                         this.style.color = '';
     258        } else {
     259            // If its checked and body doesnt have the class
     260            if( checkbox.checked !== true && !$('body').hasClass('acwp-contrast')) {
     261                $('body').addClass('acwp-contrast');
     262
     263                if( $('body').hasClass('acwp-contrast-js') ) {
     264                   
     265                    // imgs
     266                    jQuery('body *').not(exclude).each(function () {
     267                        if( this.style.backgroundImage != '' )
     268                            jQuery(this).attr('data-acwp-bgimage', this.style.backgroundImage);
     269                        this.style.backgroundImage = 'none';
     270                    });
     271                   
     272                    // bgs
     273                    jQuery('body *').not(exclude).each(function () {
     274                        if( this.style.backgroundColor != '' )
     275                            jQuery(this).attr('data-acwp-bgcolor', this.style.backgroundColor);
     276                        this.style.backgroundColor = 'black';
     277                    });
     278                    // txt
     279                    jQuery('body *').not(exclude).each(function () {
     280                        if( this.tagName == 'A' || this.tagName == 'BUTTON' || this.tagName == 'LABEL' ){
     281                            if( this.style.color != '' )
     282                                jQuery(this).not(exclude).attr('data-acwp-lnkcolor', this.style.color);
     283                            this.style.color = 'yellow';
     284                        }
     285                        else {
     286                            if( this.style.color != '' )
     287                                jQuery(this).not(exclude).attr('data-acwp-txtcolor', this.style.color);
     288                            this.style.color = 'white';
     289                        }
     290                    });
    238291                }
    239                 else {
    240                     let clr = jQuery(this).not(exclude).attr('data-acwp-txtcolor');
    241 
    242                     if( this.style.color != '' )
    243                         this.style.color = '';
    244                     if( clr && clr != '' )
    245                         this.style.color = clr;
    246                 }
    247             });
    248             document.body.classList.remove('acwp-contrast');
    249         }
     292            }
     293            else {
     294                // imgs
     295                jQuery('body *').not(exclude).each(function () {
     296                    if( this.style.backgroundImage != '' )
     297                        this.style.backgroundImage = '';
     298                });
     299                jQuery('body [data-acwp-bgimage]').not(exclude).each(function () {
     300                    let bg = jQuery(this).attr('data-acwp-bgimage');
     301                    if( bg != '' )
     302                        this.style.backgroundImage = bg;
     303                });
     304                // bgs
     305                jQuery('body *').not(exclude).each(function () {
     306                    if( this.style.backgroundColor != '' )
     307                        this.style.backgroundColor = '';
     308                });
     309                jQuery('body [data-acwp-bgcolor]').not(exclude).each(function () {
     310                    let bg = jQuery(this).attr('data-acwp-bgcolor');
     311                    if( bg != '' )
     312                        this.style.backgroundColor = bg;
     313                });
     314
     315                // txt
     316                jQuery('body *').not(exclude).each(function () {
     317                    if( this.tagName == 'a' || this.tagName == 'button' || this.tagName == 'label' ) {
     318                        let clr = jQuery(this).not(exclude).attr('data-acwp-lnkcolor');
     319                        if( clr != '' )
     320                            this.style.color = clr;
     321                        if( this.style.color != '' )
     322                            this.style.color = '';
     323                    }
     324                    else {
     325                        let clr = jQuery(this).not(exclude).attr('data-acwp-txtcolor');
     326
     327                        if( this.style.color != '' )
     328                            this.style.color = '';
     329                        if( clr && clr != '' )
     330                            this.style.color = clr;
     331                    }
     332                });
     333                document.body.classList.remove('acwp-contrast');
     334            }
     335        }
     336       
     337
     338       
    250339    }
    251340   
     
    289378            checkbox.checked = true;
    290379            $('body').addClass('acwp-incfont');
    291             IncreseFont();
     380            IncreseFont(true);
    292381        }
    293382        if( stored_decfont === 'yes' ){
     
    295384            checkbox.checked = true;
    296385            $('body').addClass('acwp-decfont');
    297             DecreaseFont();
     386            DecreaseFont(true);
    298387        }
    299388        if( stored_contrast === 'yes' ){
    300389            var checkbox = document.getElementById('acwp-toggler-contrast');
    301390            checkbox.checked = true;
    302             ToggleContrast();
    303         }
    304     }
    305    
    306 
     391            ToggleContrast(true);
     392        }
     393    }
     394   
    307395    $('.acwp-toggler label').each(function(){
    308 
    309396        $(this).click(function(e){
    310397            if( e.target.tagName === 'LABEL' ){
     
    315402                    // get hidden input
    316403                    var checkbox = document.getElementById('acwp-toggler-' + name);
    317        
    318                     // Toggle Option & body class
    319                     if( checkbox.checked === true && !$('body').hasClass( 'acwp-' + name ) ){
     404
     405                    // Toggle body class
     406                    if( checkbox.checked !== true && !$('body').hasClass( 'acwp-' + name ) ){
    320407                        $('body').addClass('acwp-' + name);
    321408                    } else {
  • accessible-poetry/trunk/readme.txt

    r2809800 r2809836  
    55Requires at least: 4.1
    66Tested up to: 6.1
    7 Stable tag: 5.1.2
    8 Version: 5.1.2
     7Stable tag: 5.1.3
     8Version: 5.1.3
    99License: GPLv2
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3232
    3333== Changelog ==
     34= 5.1.3 =
     35* Fix issue with the last version where the user need to click twice on each option.
     36
    3437= 5.1.2 =
    3538* Saves user actions in cookies for reuse on other pages.
Note: See TracChangeset for help on using the changeset viewer.