1 2function acp_createCookie(name, value, days) { 3 var expires; 4 if (days) { 5 var date = new Date(); 6 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 7 expires = "; expires=" + date.toGMTString(); 8 } else { 9 expires = ""; 10 } 11 document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/; SameSite=Lax"; 12} 13 14function acp_readCookie(name) { 15 var nameEQ = encodeURIComponent(name) + "="; 16 var ca = document.cookie.split(';'); 17 for (var i = 0; i < ca.length; i++) { 18 var c = ca[i]; 19 while (c.charAt(0) === ' ') 20 c = c.substring(1, c.length); 21 if (c.indexOf(nameEQ) === 0) 22 return decodeURIComponent(c.substring(nameEQ.length, c.length)); 23 } 24 return null; 25} 26 27function acp_eraseCookie(name) { 28 acp_createCookie(name, "", -1); 29} 30 31 32 33jQuery(document).ready(function ($) { 34 35 setTimeout(function () { 36 $('#acwp-toolbar-btn-wrap').addClass('show'); 37 }, 250); 38 39 // Hide text sizer 40 // const hideTextSizer = acwp_attr.hide_fontsize; 41 42 // Should we use cookies? 43 const noCookies = acwp_attr.nocookies; 44 45 // get line height option 46 const noLineHeight = acwp_attr.fontsizer_nolineheight; 47 48 // get our custom tags if there's 49 const customtags_option = acwp_attr.fontsizer_customtags; 50 const customTags = customtags_option !== '' ? customtags_option : 'p,h1,h2,h3,h4,h5,h6,label'; 51 52 // exclude 53 const customexlcude_option = acwp_attr.fontsize_excludetags; 54 55 // Increase font size 56 const IncreseFont = (toggle) => { 57 58 // set the font size distance 59 let newSize = acwp_attr.fontsizer_max != '' ? parseFloat( acwp_attr.fontsizer_max ) / 100 : 1.6; 60 61 // get increase checkbox 62 let incCheckbox = document.getElementById('acwp-toggler-incfont'); 63 64 // get decrease checkbox 65 let decCheckbox = document.getElementById('acwp-toggler-decfont'); 66 67 if( decCheckbox.checked == true ) 68 decCheckbox.checked = false; 69 70 if( toggle ){ 71 // Add toolbar class 72 jQuery('#acwp-toolbar').addClass('incresed'); 73 74 // Change font size by tags 75 jQuery(customTags).not(customexlcude_option).each(function () { 76 77 // get current font size 78 let fontSize = jQuery(this).css('font-size'); 79 80 // set default font size as data attr 81 if( !jQuery(this).data('acwp-fontsize') ) 82 jQuery(this).attr('data-acwp-fontsize', fontSize.substring(0, fontSize.length - 2)); 83 84 // change the size 85 jQuery(this).css('font-size', parseInt(fontSize) * newSize + 'px'); 86 87 if( noLineHeight !== 'yes' ){ 88 89 // get the default line height 90 let lineHeight = jQuery(this).css('line-height'); 91 92 // set default line height as data attr 93 if( !jQuery(this).data('acwp-lineheight') ) 94 jQuery(this).attr('data-acwp-lineheight', lineHeight.substring(0, lineHeight.length - 2)); 95 96 // change the size 97 jQuery(this).css('line-height', 'normal'); 98 } 99 }); 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 } 151 } 152 } 153 154 // Decrease font size 155 const DecreaseFont = (toggle) => { 156 // set the new size 157 let newSize = (acwp_attr.fontsizer_min !== '') ? parseFloat(acwp_attr.fontsizer_min) / 100 : 0.8; 158 159 // get increase checkbox 160 let incfontCheckbox = document.getElementById('acwp-toggler-incfont'); 161 162 // toggle increase checkbox 163 if( incfontCheckbox.checked == true ) { 164 incfontCheckbox.checked = false;
165 } 166 if( toggle ){ 167 jQuery(customTags).each(function () { 168 let fontSize = jQuery(this).css('font-size'); 169 170 if( !jQuery(this).data('acwp-fontsize') ) 171 jQuery(this).attr('data-acwp-fontsize', fontSize.substring(0, fontSize.length - 2)); 172 173 jQuery(this).css('font-size', parseInt(fontSize) * newSize + 'px'); 174 175 if(noLineHeight !== 'yes'){ 176 let lineHeight = jQuery(this).css('line-height'); 177 if( !jQuery(this).data('acwp-lineheight') ) 178 jQuery(this).attr('data-acwp-lineheight', lineHeight.substring(0, lineHeight.length - 2)); 179 jQuery(this).css('line-height', 'normal'); 180 } 181 }); 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 215 } 216 217 // Toggle contrast 218 const ToggleContrast = (toggle) => { 219 220 // Get checkbox data 221 var checkbox = document.getElementById('acwp-toggler-contrast'); 222 223 // Get excluded items 224 var exclude = acwp_attr.contrast_exclude; 225 226 if( toggle ){ 227 $('body').addClass('acwp-contrast'); 228 229 if( $('body').hasClass('acwp-contrast-js') ) { 230 231 // imgs 232 jQuery('body *').not(exclude).each(function () { 233 if( this.style.backgroundImage != '' ) 234 jQuery(this).attr('data-acwp-bgimage', this.style.backgroundImage); 235 this.style.backgroundImage = 'none'; 236 }); 237 238 // bgs 239 jQuery('body *').not(exclude).each(function () { 240 if( this.style.backgroundColor != '' ) 241 jQuery(this).attr('data-acwp-bgcolor', this.style.backgroundColor); 242 this.style.backgroundColor = 'black'; 243 }); 244 // txt 245 jQuery('body *').not(exclude).each(function () { 246 if( this.tagName == 'A' || this.tagName == 'BUTTON' || this.tagName == 'LABEL' ){ 247 if( this.style.color != '' ) 248 jQuery(this).not(exclude).attr('data-acwp-lnkcolor', this.style.color); 249 this.style.color = 'yellow'; 250 } 251 else { 252 if( this.style.color != '' ) 253 jQuery(this).not(exclude).attr('data-acwp-txtcolor', this.style.color); 254 this.style.color = 'white'; 255 } 256 }); 257 } 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 }); 291 } 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 339 } 340 341 if( noCookies !== 'yes' ){ 342 const stored_keyboard = acp_readCookie('keyboard'); 343 const stored_animations = acp_readCookie('animations'); 344 const stored_contrast = acp_readCookie('contrast'); 345 const stored_incfont = acp_readCookie('incfont'); 346 const stored_decfont = acp_readCookie('decfont'); 347 const stored_readable = acp_readCookie('readable'); 348 const stored_marktitles = acp_readCookie('marktitles'); 349 const stored_underline = acp_readCookie('underline'); 350 351 if( stored_keyboard === 'yes' ){ 352 var checkbox = document.getElementById('acwp-toggler-keyboard'); 353 checkbox.checked = true; 354 $('body').addClass('acwp-keyboard'); 355 } 356 if( stored_readable === 'yes' ){ 357 var checkbox = document.getElementById('acwp-toggler-readable'); 358 checkbox.checked = true; 359 $('body').addClass('acwp-readable'); 360 } 361 if( stored_marktitles === 'yes' ){ 362 var checkbox = document.getElementById('acwp-toggler-marktitles'); 363 checkbox.checked = true; 364 $('body').addClass('acwp-marktitles'); 365 } 366 if( stored_underline === 'yes' ){ 367 var checkbox = document.getElementById('acwp-toggler-underline'); 368 checkbox.checked = true; 369 $('body').addClass('acwp-underline'); 370 } 371 if( stored_animations === 'yes' ){ 372 var checkbox = document.getElementById('acwp-toggler-animations'); 373 checkbox.checked = true; 374 $('body').addClass('acwp-animations'); 375 } 376 if( stored_incfont === 'yes' ){ 377 var checkbox = document.getElementById('acwp-toggler-incfont'); 378 checkbox.checked = true; 379 $('body').addClass('acwp-incfont'); 380 IncreseFont(true); 381 } 382 if( stored_decfont === 'yes' ){ 383 var checkbox = document.getElementById('acwp-toggler-decfont'); 384 checkbox.checked = true; 385 $('body').addClass('acwp-decfont'); 386 DecreaseFont(true); 387 } 388 if( stored_contrast === 'yes' ){ 389 var checkbox = document.getElementById('acwp-toggler-contrast'); 390 checkbox.checked = true; 391 ToggleContrast(true); 392 } 393 } 394 395 $('.acwp-toggler label').each(function(){ 396 $(this).click(function(e){ 397 if( e.target.tagName === 'LABEL' ){ 398 const name = $(this).data('name'); 399 400 if( name !== 'contrast' ){ 401 402 // get hidden input 403 var checkbox = document.getElementById('acwp-toggler-' + name); 404 405 // Toggle body class 406 if( checkbox.checked !== true && !$('body').hasClass( 'acwp-' + name ) ){ 407 $('body').addClass('acwp-' + name); 408 } else { 409 $('body').removeClass('acwp-' + name); 410 } 411 412 if( name === 'incfont' ){ 413 IncreseFont(); 414 } 415 else if( name === 'decfont' ){ 416 DecreaseFont(); 417 } 418 } 419 else if( name === 'contrast' ){ 420 ToggleContrast(); 421 } 422 423 if( noCookies !== 'yes' ){ 424 const itemCookie = acp_readCookie( name ); 425 if( itemCookie )
426 acp_eraseCookie( name ); 427 else 428 acp_createCookie( name, 'yes', 1 ); 429 } 430 431 } 432 433 }); 434 }); 435 436 // ? 437 jQuery( "#acwp-toolbar .acwp-toggler label" ).keypress(function( event ) { 438 if ( event.which == 13 ) { 439 event.preventDefault(); 440 jQuery(this).click(); 441 } 442 }); 443 444 if( acwp_attr.no_btn_drage !== 'yes' ){ 445 jQuery( "#acwp-toolbar-btn-wrap" ).on('mousedown', function (e) { 446 e.preventDefault(); 447 window.my_dragging = {}; 448 my_dragging.pageX0 = e.pageX; 449 my_dragging.pageY0 = e.pageY; 450 my_dragging.elem = this; 451 my_dragging.offset0 = jQuery(this).offset(); 452 function handle_dragging(e){ 453 var top = my_dragging.offset0.top + (e.pageY - my_dragging.pageY0); 454 $(my_dragging.elem) 455 .offset({top: top}); 456 } 457 function handle_mouseup(e){ 458 jQuery('body') 459 .off('mousemove', handle_dragging) 460 .off('mouseup', handle_mouseup); 461 } 462 jQuery('body') 463 .on('mouseup', handle_mouseup) 464 .on('mousemove', handle_dragging); 465 }); 466 } 467 468 $('#acwp-toolbar-btn').click(function(){ 469 $('#acwp-toolbar-btn-wrap').removeClass('show'); 470 $('.acwp-toolbar').addClass('acwp-toolbar-active'); 471 setTimeout(function(){ 472 $('.acwp-toolbar').addClass('acwp-toolbar-show'); 473 }, 100); 474 }); 475 $('#acwp-close-toolbar').click(function(){ 476 $('#acwp-toolbar-btn-wrap').addClass('show'); 477 $('.acwp-toolbar').removeClass('acwp-toolbar-show'); 478 setTimeout(function(){ 479 $('.acwp-toolbar').removeClass('acwp-toolbar-active'); 480 }, 500); 481 }); 482});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.