Changeset 2809836
- Timestamp:
- 11/02/2022 11:38:05 AM (3 years ago)
- Location:
- accessible-poetry
- Files:
-
- 22 added
- 3 edited
-
tags/5.1.3 (added)
-
tags/5.1.3/accessible-wp-toolbar.php (added)
-
tags/5.1.3/assets (added)
-
tags/5.1.3/assets/css (added)
-
tags/5.1.3/assets/css/admin.css (added)
-
tags/5.1.3/assets/css/main.css (added)
-
tags/5.1.3/assets/js (added)
-
tags/5.1.3/assets/js/_functions.js (added)
-
tags/5.1.3/assets/js/admin.js (added)
-
tags/5.1.3/assets/js/toolbar.js (added)
-
tags/5.1.3/inc (added)
-
tags/5.1.3/inc/assets.php (added)
-
tags/5.1.3/inc/body-classes.php (added)
-
tags/5.1.3/inc/panel.php (added)
-
tags/5.1.3/inc/styles.php (added)
-
tags/5.1.3/inc/toolbar.php (added)
-
tags/5.1.3/index.php (added)
-
tags/5.1.3/lang (added)
-
tags/5.1.3/lang/acwp-he_IL.mo (added)
-
tags/5.1.3/lang/acwp-he_IL.po (added)
-
tags/5.1.3/lang/acwp.pot (added)
-
tags/5.1.3/readme.txt (added)
-
trunk/accessible-wp-toolbar.php (modified) (1 diff)
-
trunk/assets/js/toolbar.js (modified) (10 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
accessible-poetry/trunk/accessible-wp-toolbar.php
r2809810 r2809836 6 6 * Author: Codenroll 7 7 * Author URI: https://www.codenroll.co.il/ 8 * Version: 5.1. 28 * Version: 5.1.3 9 9 * Text Domain: acwp 10 10 * 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 54 54 55 55 // Increase font size 56 const IncreseFont = ( ) => {56 const IncreseFont = (toggle) => { 57 57 58 58 // set the font size distance … … 68 68 decCheckbox.checked = false; 69 69 70 if( incCheckbox.checked == true ) { 71 70 if( toggle ){ 72 71 // Add toolbar class 73 72 jQuery('#acwp-toolbar').addClass('incresed'); 74 73 75 74 // Change font size by tags 76 75 jQuery(customTags).not(customexlcude_option).each(function () { … … 99 98 } 100 99 }); 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 } 120 151 } 121 152 } 122 153 123 154 // Decrease font size 124 const DecreaseFont = ( ) => {155 const DecreaseFont = (toggle) => { 125 156 // set the new size 126 157 let newSize = (acwp_attr.fontsizer_min !== '') ? parseFloat(acwp_attr.fontsizer_min) / 100 : 0.8; … … 133 164 incfontCheckbox.checked = false; 134 165 } 135 136 // decrease checkbox 137 var checkbox = document.getElementById('acwp-toggler-decfont'); 138 139 if( checkbox.checked == true ) { 140 166 if( toggle ){ 141 167 jQuery(customTags).each(function () { 142 168 let fontSize = jQuery(this).css('font-size'); … … 144 170 if( !jQuery(this).data('acwp-fontsize') ) 145 171 jQuery(this).attr('data-acwp-fontsize', fontSize.substring(0, fontSize.length - 2)); 172 146 173 jQuery(this).css('font-size', parseInt(fontSize) * newSize + 'px'); 147 174 … … 153 180 } 154 181 }); 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 167 215 } 168 216 169 217 // Toggle contrast 170 const ToggleContrast = () => { 218 const ToggleContrast = (toggle) => { 219 220 // Get checkbox data 171 221 var checkbox = document.getElementById('acwp-toggler-contrast'); 222 223 // Get excluded items 172 224 var exclude = acwp_attr.contrast_exclude; 173 if( checkbox.checked == true && !$('body').hasClass('acwp-contrast')) { 225 226 if( toggle ){ 174 227 $('body').addClass('acwp-contrast'); 175 228 176 229 if( $('body').hasClass('acwp-contrast-js') ) { 177 178 179 230 180 231 // imgs … … 205 256 }); 206 257 } 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 }); 238 291 } 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 250 339 } 251 340 … … 289 378 checkbox.checked = true; 290 379 $('body').addClass('acwp-incfont'); 291 IncreseFont( );380 IncreseFont(true); 292 381 } 293 382 if( stored_decfont === 'yes' ){ … … 295 384 checkbox.checked = true; 296 385 $('body').addClass('acwp-decfont'); 297 DecreaseFont( );386 DecreaseFont(true); 298 387 } 299 388 if( stored_contrast === 'yes' ){ 300 389 var checkbox = document.getElementById('acwp-toggler-contrast'); 301 390 checkbox.checked = true; 302 ToggleContrast(); 303 } 304 } 305 306 391 ToggleContrast(true); 392 } 393 } 394 307 395 $('.acwp-toggler label').each(function(){ 308 309 396 $(this).click(function(e){ 310 397 if( e.target.tagName === 'LABEL' ){ … … 315 402 // get hidden input 316 403 var checkbox = document.getElementById('acwp-toggler-' + name); 317 318 // Toggle Option &body class319 if( checkbox.checked === true && !$('body').hasClass( 'acwp-' + name ) ){404 405 // Toggle body class 406 if( checkbox.checked !== true && !$('body').hasClass( 'acwp-' + name ) ){ 320 407 $('body').addClass('acwp-' + name); 321 408 } else { -
accessible-poetry/trunk/readme.txt
r2809800 r2809836 5 5 Requires at least: 4.1 6 6 Tested up to: 6.1 7 Stable tag: 5.1. 28 Version: 5.1. 27 Stable tag: 5.1.3 8 Version: 5.1.3 9 9 License: GPLv2 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 32 32 33 33 == Changelog == 34 = 5.1.3 = 35 * Fix issue with the last version where the user need to click twice on each option. 36 34 37 = 5.1.2 = 35 38 * Saves user actions in cookies for reuse on other pages.
Note: See TracChangeset
for help on using the changeset viewer.