https://www.parcodelnera.it/wp-content/plugins/wp-photo-album-plus/js/wppa-utils.js?ver=260919-32438
1// wppa-utils.js 2// 3// conatins common vars and functions 4// 5wppaJsUtilsVersion = '9.1.12.002'; 6 7// Handle animation dependant of setting for mobile 8function wppaAnimate( selector, properties, duration, easing, complete ) { 9 10 // If no animation on mobile, do not animate 11 if ( wppaIsMobile && wppaNoAnimateOnMobile ) { 12 jQuery( selector ).css( properties ); 13 if ( complete ) { 14 setTimeout( complete, 10 ); 15 } 16 } 17 18 // Just do it 19 else { 20 jQuery( selector ).stop().animate( properties, duration, easing, complete ); 21 } 22} 23 24// Handle fading dependant of setting for mobile 25function wppaFadeIn( selector, duration, complete ) { 26 if ( wppaIsMobile && wppaNoAnimateOnMobile ) { 27 jQuery( selector ).css( {display:''} ); 28 if ( complete ) { 29 setTimeout( complete, 10 ); 30 } 31 } 32 else { 33 jQuery( selector ).stop().fadeIn( duration, complete ); 34 } 35} 36function wppaFadeOut( selector, duration, complete ) { 37 if ( wppaIsMobile && wppaNoAnimateOnMobile ) { 38 jQuery( selector ).css( {display:'none'} ); 39 if ( complete ) { 40 setTimeout( complete, 10 ); 41 } 42 } 43 else {
44 jQuery( selector ).stop().fadeOut( duration, complete ); 45 } 46} 47function wppaFadeTo( selector, duration, opacity, complete ) { 48 if ( wppaIsMobile && wppaNoAnimateOnMobile ) { 49 jQuery( selector ).css( {display:'', opacity: opacity} ); 50 if ( complete ) { 51 setTimeout( complete, 10 ); 52 } 53 } 54 else { 55 jQuery( selector ).stop().fadeTo( duration, opacity, complete ); 56 } 57} 58 59// Trim 60// @1 string to be trimmed 61// @2 character, string, or array of characters or strings to trim off, 62// default: trim spaces, tabs and newlines 63function wppaTrim( str, arg ) { 64 65 var result; 66 67 result = wppaTrimLeft( str, arg ); 68 result = wppaTrimRight( result, arg ); 69 70 return result; 71} 72 73// Trim left 74// @1 string to be trimmed 75// @2 character, string, or array of characters or strings to trim off, 76// default: trim spaces, tabs and newlines 77function wppaTrimLeft( str, arg ) { 78 79 var result; 80 var strlen; 81 var arglen; 82 var argcount; 83 var i; 84 var done; 85 var oldStr, newStr; 86 87 switch ( typeof ( arg ) ) { 88 case 'string': 89 result = str; 90 strlen = str.length; 91 arglen = arg.length; 92 while ( strlen >= arglen && result.substr( 0, arglen ) == arg ) { 93 result = result.substr( arglen ); 94 strlen = result.length; 95 } 96 break; 97 case 'object': 98 done = false; 99 newStr = str; 100 while ( ! done ) { 101 i = 0; 102 oldStr = newStr; 103 while ( i < arg.length ) { 104 newStr = wppaTrimLeft( newStr, arg[i] ); 105 i++; 106 } 107 done = ( oldStr == newStr ); 108 } 109 result = newStr; 110 break; 111 default: 112 return str.replace( /^\s\s*/, '' ); 113 } 114 115 return result; 116} 117 118// Trim right 119// @1 string to be trimmed 120// @2 character, string, or array of characters or strings to trim off, 121// default: trim spaces, tabs and newlines 122function wppaTrimRight( str, arg ) { 123 124 var result; 125 var strlen; 126 var arglen; 127 var argcount; 128 var i; 129 var done; 130 var oldStr, newStr; 131 132 switch ( typeof ( arg ) ) { 133 case 'string': 134 result = str; 135 strlen = str.length; 136 arglen = arg.length; 137 while ( strlen >= arglen && result.substr( strlen - arglen ) == arg ) { 138 result = result.substr( 0, strlen - arglen ); 139 strlen = result.length; 140 } 141 break; 142 case 'object': 143 done = false; 144 newStr = str; 145 while ( ! done ) { 146 i = 0; 147 oldStr = newStr; 148 while ( i < arg.length ) { 149 newStr = wppaTrimRight( newStr, arg[i] ); 150 i++; 151 } 152 done = ( oldStr == newStr ); 153 } 154 result = newStr; 155 break; 156 default: 157 return str.replace( /\s\s*$/, '' ); 158 } 159 160 return result; 161} 162 163// Cookie handling 164function wppa_setCookie(c_name,value,exdays) { 165 var exdate=new Date(); 166 exdate.setDate(exdate.getDate() + exdays); 167 var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); 168 document.cookie=c_name + "=" + c_value; 169} 170 171function wppa_getCookie(c_name) { 172 var i,x,y,ARRcookies=document.cookie.split(";"); 173 for (i=0;i<ARRcookies.length;i++) { 174 x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); 175 y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); 176 x=x.replace(/^\s+|\s+$/g,""); 177 if (x==c_name) { 178 return unescape(y); 179 } 180 } 181 return ""; 182} 183 184// Change stereotype cookie 185function wppaStereoTypeChange( newval ) { 186 wppa_setCookie( 'stereotype', newval, 365 ); 187} 188 189// Change stereoglass cookie 190function wppaStereoGlassChange( newval ) { 191 wppa_setCookie( 'stereoglass', newval, 365 ); 192} 193 194// Console logging 195function wppaConsoleLog( arg ) { 196 197 if ( typeof( console ) != 'undefined' ) { 198 var d = new Date(); 199 var n = d.getTime(); 200 var t = n % (24*60*60*1000); // msec this day 201 var h = Math.floor( t / ( 60*60*1000 ) ); // Hours this day 202 t -= h * 60*60*1000; // msec this hour 203 var m = Math.floor( t / ( 60*1000 ) ); // Minutes this hour 204 t -= m * 60*1000; // msec this minute 205 var s = Math.floor( t / 1000 ); // Sec this minute 206 t -= s * 1000; // msec this sec 207 console.log( 'At: ' + h + ':' + m + ':' + s + '.' + t + ' message: ' + arg ); 208 } 209} 210 211// Get an svg image html 212// @1: string: Name of the .svg file without extension 213// @2: string: CSS height or empty, no ; required 214// @3: bool: True if for lightbox. Use lightbox colors 215// @4: bool: if true: add border 216// @5: radius in % type none 217// @6: radius in % type light 218// @7: radius in % type medium 219// @8: radius in % type heavy 220function wppaSvgHtml( image, height, isLightbox, border, none, light, medium, heavy ) { 221 222 var fc; // Foreground (fill) color 223 var bc;
223 // Background color 224 225 if ( ! none ) none = '0'; 226 if ( ! light ) light = '10'; 227 if ( ! medium ) medium = '20'; 228 if ( ! heavy ) heavy = '50'; 229 230 border = false; // debug 231 232 // Find Radius 233 switch ( wppaSvgCornerStyle ) { 234 case 'gif': 235 case 'none': 236 radius = none; 237 break; 238 case 'light': 239 radius = light; 240 break; 241 case 'medium': 242 radius = medium; 243 break; 244 case 'heavy': 245 radius = heavy; 246 break; 247 } 248 249 // Init Height 250 if ( ! height ) { 251 height = '32px'; 252 } 253 254 // Get Colors 255 if ( image == 'Full-Screen' || image == 'Exit-Full-Screen' ) { 256 fc = wppaFsFillcolor; 257 bc = wppaFsBgcolor; 258 } 259 else { 260 if ( isLightbox ) { 261 fc = wppaOvlSvgFillcolor; 262 bc = wppaOvlSvgBgcolor; 263 } 264 else { 265 fc = wppaSvgFillcolor; 266 bc = wppaSvgBgcolor; 267 } 268 } 269 270 // Replace empty color attribute by transparent 271 if ( fc == '' ) fc = 'transparent'; 272 if ( bc == '' ) bc = 'transparent'; 273 274 // Make the html. Native svg html 275 var result = '<svg' + 276 ' version="1.1"' + 277 ' xmlns="http://www.w3.org/2000/svg"' + 278 // ' xmlns:xlink="http://www.w3.org/1999/xlink"' + 279 ' x="0px"' + 280 ' y="0px"' + 281 ' viewBox="0 0 30 30"' + 282 ' style="' + 283 ( height ? 'height:' + height + ';' : '' ) + 284 'fill:' + fc + ';' + 285 'background-color:' + bc + ';' + 286 'text-decoration:none !important;' + 287 'vertical-align:middle;' + 288 ( radius ? 'border-radius:' + radius + '%;' : '' ) + 289 ( border ? 'border:2px solid ' + bc + ';box-sizing:content-box;' : '' ) + 290 '"' + 291 ' xml:space="preserve"' + 292 ' >' + 293 '<g>'; 294 switch ( image ) { 295 case 'Next-Button': 296 result += '<path' + 297 ' d="M30,0H0V30H30V0z M20,20.5' + 298 'c0,0.3-0.2,0.5-0.5,0.5S19,20.8,19,20.5v-4.2l-8.3,4.6c-0.1,0-0.2,0.1-0.2,0.1c-0.1,0-0.2,0-0.3-0.1c-0.2-0.1-0.2-0.3-0.2-0.4v-11' + 299 'c0-0.2,0.1-0.4,0.3-0.4c0.2-0.1,0.4-0.1,0.5,0l8.2,5.5V9.5C19,9.2,19.2,9,19.5,9S20,9.2,20,9.5V20.5z"' + 300 ' />'; 301 break; 302 case 'Next-Button-Big': 303 result += '<line x1="8" y1="2" x2="21.75" y2="15.75" stroke="'+fc+'" stroke-width="2.14" />' + 304 '<line x1="21.75" y1="14.25" x2="8" y2="28" stroke="'+fc+'" stroke-width="2.14" />'; 305 // '<path' + 306 // ' d="M8,29.5c-0.1,0-0.3,0-0.4-0.1c-0.2-0.2-0.2-0.5,0-0.7L21.3,15L7.6,1.4c-0.2-0.2-0.2-0.5,0-0.7s0.5-0.2,0.7,0l14,14' + 307 // 'c0.2,0.2,0.2,0.5,0,0.7l-14,14C8.3,29.5,8.1,29.5,8,29.5z"/>'; 308 break; 309 case 'Prev-Button': 310 result += '<path' + 311 ' d="M30,0H0V30H30V0z M20,20.5' + 312 'c0,0.2-0.1,0.4-0.3,0.4c-0.1,0-0.2,0.1-0.2,0.1c-0.1,0-0.2,0-0.3-0.1L11,15.4v5.1c0,0.3-0.2,0.5-0.5,0.5S10,20.8,10,20.5v-11' + 313 'C10,9.2,10.2,9,10.5,9S11,9.2,11,9.5v4.2l8.3-4.6c0.2-0.1,0.3-0.1,0.5,0S20,9.3,20,9.5V20.5z"' + 314 ' />'; 315 break; 316 case 'Prev-Button-Big': 317 result += '<line x1="22" y1="2" x2="8.25" y2="15.75" stroke="'+fc+'" stroke-width="2.14" />' + 318 '<line x1="8.25" y1="14.25" x2="22" y2="28" stroke="'+fc+'" stroke-width="2.14" />'; 319 320 //'<path' + 321 // ' d="M22,29.5c-0.1,0-0.3,0-0.4-0.1l-14-14c-0.2-0.2-0.2-0.5,0-0.7l14-14c0.2-0.2,0.5-0.2,0.7,0s0.2,0.5,0,0.7L8.7,15l13.6,13.6' + 322 // ' c0.2,0.2,0.2,0.5,0,0.7C22.3,29.5,22.1,29.5,22,29.5z"/>'; 323 break; 324 case 'Pause-Button': 325 result += '<path' + 326 ' d="M30,0H0V30H30V0z M14,20.5' + 327 'c0,0.3-0.2,0.5-0.5,0.5h-4C9.2,21,9,20.8,9,20.5v-11C9,9.2,9.2,9,9.5,9h4C13.8,9,14,9.2,14,9.5V20.5z M21,20.5' + 328 'c0,0.3-0.2,0.5-0.5,0.5h-4c-0.3,0-0.5-0.2-0.5-0.5v-11C16,9.2,16.2,9,16.5,9h4C20.8,9,21,9.2,21,9.5V20.5z"' + 329 ' />'; 330 break; 331 case 'Pause-Button-New': 332 result += '<line x1="6" y1="0" x2="6" y2="30" stroke="'+fc+'" stroke-width="6" />' + 333 '<line x1="18" y1="0" x2="18" y2="30" stroke="'+fc+'" stroke-width="6" />'; 334 break; 335 case 'Play-Button': 336 result += '<path' + 337 ' d="M30,0H0V30H30V0z' + 338 'M19.8,14.9l-8,5C11.7,20,11.6,20,11.5,20c-0.1,0-0.2,0-0.2-0.1c-0.2-0.1-0.3-0.3-0.3-0.4v-9c0-0.2,0.1-0.3,0.2-0.4' +
339 'c0.1-0.1,0.3-0.1,0.5,0l8,4c0.2,0.1,0.3,0.2,0.3,0.4C20,14.7,19.9,14.8,19.8,14.9z"' + 340 ' />'; 341 break; 342 case 'Play-Button-New': 343 result += '<path stroke-linejoin="miter-clip" stroke-width="0.025"' + 344 ' d="M5,0 L25,15 L5,30 z"' + 345 ' />'; 346 break; 347 case 'Stop-Button': 348 result += '<path' + 349 ' d="M30,0H0V30H30V0z M21,20.5' + 350 'c0,0.3-0.2,0.5-0.5,0.5h-11C9.2,21,9,20.8,9,20.5v-11C9,9.2,9.2,9,9.5,9h11C20.8,9,21,9.2,21,9.5V20.5z"' + 351 '/>'; 352 break; 353 case 'Exit': 354 result += '<path d="M30 24.398l-8.406-8.398 8.406-8.398-5.602-5.602-8.398 8.402-8.402-8.402-5.598 5.602 8.398 8.398-8.398 8.398 5.598 5.602 8.402-8.402 8.398 8.402z"></path>'; 355 break; 356 case 'Exit-2': 357 result += '<path d="M30,0H0V30H30V0z M9 4 L15 10 L21 4 L26 9 L20 15 L26 21 L21 26 L15 20 L9 26 L4 21 L10 15 L4 9Z" />'; 358 break; 359 case 'Exit-Big': 360 result += '<line x1="4" y1="4" x2="26" y2="26" stroke="'+fc+'" stroke-width="2.14" />'+ 361 '<line x1="4" y1="26" x2="26" y2="4" stroke="'+fc+'" stroke-width="2.14" />'; 362 break; 363 case 'Full-Screen': 364 result += '<path d="M27.414 24.586l-4.586-4.586-2.828 2.828 4.586 4.586-4.586 4.586h12v-12zM12 0h-12v12l4.586-4.586 4.543 4.539 2.828-2.828-4.543-4.539zM12 22.828l-2.828-2.828-4.586 4.586-4.586-4.586v12h12l-4.586-4.586zM32 0h-12l4.586 4.586-4.543 4.539 2.828 2.828 4.543-4.539 4.586 4.586z"></path>'; 365 break; 366 case 'Full-Screen-2': 367 result += '<path d="M30,0H0V30H30V0z M4 4 L12 4 L10 6 L14 10 L10 14 L6 10 L4 12Z M18 4 L26 4 L26 12 L24 10 L20 14 L16 10 L20 6Z M26 26 L18 26 L20 24 L16 20 L20 16 L24 20 L26 18Z M4 26 L4 18 L6 20 L10 16 L14 20 L10 24 L12 26Z" />'; 368 break; 369 case 'Exit-Full-Screen': 370 result += '<path d="M24.586 27.414l4.586 4.586 2.828-2.828-4.586-4.586 4.586-4.586h-12v12zM0 12h12v-12l-4.586 4.586-4.539-4.543-2.828 2.828 4.539 4.543zM0 29.172l2.828 2.828 4.586-4.586 4.586 4.586v-12h-12l4.586 4.586zM20 12h12l-4.586-4.586 4.547-4.543-2.828-2.828-4.547 4.543-4.586-4.586z"></path>'; 371 break; 372 case 'Exit-Full-Screen-2': 373 result += '<path d="M30,0H0V30H30V0z M17 17 L25 17 L23 19 L27 23 L23 27 L19 23 L17 25Z M5 17 L13 17 L13 25 L11 23 L7 27 L3 23 L7 19Z M13 13 L5 13 L7 11 L3 7 L7 3 L11 7 L13 5Z M17 13 L17 5 L19 7 L23 3 L27 7 L23 11 L25 13Z" />'; 374 break; 375 default: 376 result += '<path d="M30,0H0V30H30V0z" />'; 377 break; 378 } 379 result += '</g>' + 380 '</svg>'; 381 382 383 return result; 384} 385 386// Determines whether (a part of) element elm (an image) is inside browser window 387function wppaIsElementInViewport( elm ) { 388 389 if ( typeof elm === "undefined" ) return false; 390 if ( ! elm ) return false; 391 if ( elm.length == 0 ) return false; 392 if ( window.closed ) return false; 393 if ( document.hidden ) return false; 394 395 // Check if elm or its (grand)parent has display none 396 var e = jQuery(elm); 397 while ( e[0] && e[0].nodeName != "BODY" ) { 398 399 if ( jQuery( e[0] ).css("display") == "none" ) { 400 return false; // may be filmstrip image for canvas 401 } 402 var vis = jQuery( e[0] ).css("visibility"); 403 if ( vis == "hidden" || vis == "collapse" ) { 404 return false; 405 } 406 e = jQuery( e[0] ).parent(); 407 } 408 409 // If elm is a jQuery result, convert to single js item 410 if ( elm instanceof jQuery ) { 411 elm = elm[0]; 412 } 413 414 var result; 415 var rect = elm.getBoundingClientRect(); 416 417 if ( rect ) { 418 if ( wppaIsMobile ) { 419 result = rect.bottom > 0 && rect.right > 0 && rect.left < 3 * screen.width && rect.top < 3 * screen.height; 420 } 421 else { 422 result = rect.bottom > 0 && rect.right > 0 && rect.left < wppaWindowWidth() && rect.top < wppaWindowHeight(); 423 } 424 } 425 else { 426 result = true; 427 } 428 429 return result; 430} 431 432// Size scrollable areas 433function wppaSizeArea() { 434 435 // Thumb and album lists 436 if ( wppaAreaMaxFrac > 0 && wppaAreaMaxFrac < 1 ) { 437 jQuery( '.wppa-thumb-area' ).css( 'max-height', ( wppaWindowHeight() * wppaAreaMaxFrac ) ); 438 jQuery( '.albumlist' ).css( 'max-height', ( wppaWindowHeight() * wppaAreaMaxFrac ) ); 439 440 } 441 442 // Slideshow 443 if ( wppaAreaMaxFracSlide > 0 && wppaAreaMaxFracSlide < 1 ) { 444 jQuery( '.slidelist' ).css( 'max-height', ( wppaWindowHeight() * wppaAreaMaxFracSlide ) ); 445 } 446 447 // Audio only box for albums 448 if ( wppaAreaMaxFracAudio > 0 && wppaAreaMaxFracAudio < 1 ) { 449 jQuery( '.audiolist' ).css( 'max-height', ( wppaWindowHeight() * wppaAreaMaxFracAudio ) ); 450 } 451 452 // Modal 453 jQuery( '.wppa-modal' ).css({maxHeight:wppaWindowHeight()*0.8});
454 jQuery( '.wppa-modal' ).each(function(){ 455 var t = ( wppaWindowHeight() - jQuery(this).height() ) / 2 - 24; 456 if ( wppaIsMobile ) { 457 t -= 24; 458 } 459 jQuery(this).parent().parent().css({top:t}); 460 }); 461 462 // Nice scroller 463 wppaResizeNice('wppaSizeArea'); 464 465} 466 467// Get the icon size 468function wppaIconSize( mocc, dflt, large ) { 469 470 var opt = large ? wppaIconSizeSlide : wppaIconSizeNormal; 471 if ( opt == 'default' ) { 472 return dflt; 473 } 474 475 var result = ( wppaIsMini[mocc] ? opt / 2 : opt ) + 'px;'; 476 477 return result; 478} 479 480// Revert php htmlentities() 481function wppaEntityDecode( txt ) { 482 var result; 483 484 result = txt; 485 result = result.split('&').join('&'); 486 result = result.split('>').join('>'); 487 result = result.split('<').join('<'); 488 result = result.split('"').join('"'); 489 result = result.split(''').join("'"); 490 491 return result; 492} 493 494// For tye fe upload select button 495function wppaSetMaxWidthToParentWidth(elm) { 496 var w = elm.parentNode.clientWidth; 497 jQuery(elm).css({maxWidth:w}); 498} 499 500// Even $ fails sometimes on jQuery(window).height() 501function wppaWindowHeight() { 502 503 return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 504} 505 506// 507function wppaWindowWidth() { 508 509 return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 510 511} 512 513// In fullscreen mode, place the controlbar at the bottom of the screen, 100% wide 514// Check max iconsizes 515function wppaAdjustControlbar(mocc) { 516 517 518 var barWidth; 519 520 // Is lightbox active? 521 if ( wppaOvlOpen ) { 522 523 // and fullscreen? 524 if ( wppaIsFs() ) { 525 526 // Adjust ctrlbar 527 jQuery( ".wppa-pctl-div-lb" ).css({ 528 position:"fixed", 529 left:0, 530 right:0, 531 bottom:0, 532 }); 533 534 barWidth = screen.width; 535 } 536 else { 537 538 // Adjust ctrlbar 539 jQuery( ".wppa-pctl-div-lb" ).css({ 540 position:"initial", 541 }); 542 543 barWidth = jQuery("#wppa-ovl-pan-container").width(); 544 } 545 if ( wppaIsMobile && wppaIsFs() ) { 546 barWidth -= 20; 547 } 548 549 // Check iconsizes 550 var newHeight; 551 if ( barWidth < 12 * ( parseInt( wppaOvlIconSize ) + 4 ) ) { 552 newHeight = parseInt( barWidth / 12 - 4 ); 553 554 if ( newHeight > 0 ) { 555 jQuery( ".wppa-pctl-div-lb" ).find( "svg" ).css({height:newHeight,width:newHeight}); 556 jQuery( ".wppa-pctl-div-lb" ).find( "span" ).css({height:newHeight,width:newHeight}); 557 } 558 } 559 else { 560 newHeight = wppaOvlIconSize; 561 jQuery( ".wppa-pctl-div-lb" ).find( "svg" ).css({height:newHeight,width:newHeight}); 562 jQuery( ".wppa-pctl-div-lb" ).find( "span" ).css({height:newHeight,width:newHeight}); 563 } 564 jQuery( ".sixty" ).css({height:60,width:60}); 565 jQuery( ".sixty" ).find( "svg" ).css({height:60,width:60}); 566 567 // Adjust start/stop button display 568 if ( wppaOvlIsSingle ) { 569 jQuery( '#wppa-ovl-start-btn' ).hide(); 570 jQuery( '#wppa-ovl-stop-btn' ).hide(); 571 } 572 else { 573 if ( wppaOvlRunning ) { 574 jQuery( '#wppa-ovl-stop-btn' ).show(); 575 jQuery( '#wppa-ovl-start-btn' ).hide(); 576 } 577 else { 578 jQuery( '#wppa-ovl-start-btn' ).show(); 579 jQuery( '#wppa-ovl-stop-btn' ).hide(); 580 } 581 } 582 583 // Mobile lanscape fullscreen requires space at the ends for round corners 584 if ( wppaIsMobile && wppaIsFs() ) { 585 jQuery( ".wppa-pctl-div-lb" ).css({paddingLeft:10,paddingRight:10}); 586 } 587 else { 588 jQuery( ".wppa-pctl-div-lb" ).css({paddingLeft:0,paddingRight:0}); 589 } 590 591 // Make it visible 592 jQuery( ".wppa-pctl-div-lb" ).css({visibility:"visible"}); 593 } 594 595 if ( typeof( mocc ) == 'number' ) { 596 if ( wppaHasControlbar ) { 597 jQuery('#wppa-pctl-div-'+mocc).show(); 598 } 599 else { 600 jQuery('#wppa-pctl-div-'+mocc).hide(); 601 } 602 } 603 604} 605 606// Kill event 607function wppaKillEvent(e) { 608 609 e.preventDefault(); 610 e.stopPropagation(); 611 return false; 612} 613 614// Log on the server 615function wppaServerLog( message ) { 616 617 if ( ! message ) return; 618 619 jQuery.ajax( { url: wppaAjaxUrl, 620 data: 'action=wppa' + 621 '&wppa-action=log' + 622 '&message=' + message, 623 async: true, 624 type: 'GET', 625 timeout: 60000, 626 success: function( result, status, xhr ) { 627 628 }, 629 error: function( xhr, status, error ) { 630 wppaConsoleLog( 'wppaServerLog failed. Error = ' + error + ', status = ' + status ); 631 }, 632 } ); 633} 634 635function wppaTimNow() { 636 var d = new Date(); 637 var t = d.getTime(); 638 return t; 639} 640 641function wppaShowCoords(elm) { 642 643 var rect = elm.getBoundingClientRect(); 644 645 alert('Top = '+parseInt(rect.top)+', Left = '+parseInt(rect.left)+', WinH = '+jQuery(window).height()+', WinW = '+jQuery(window).width()+', Scrolltop = '+jQuery(document).scrollTop()); 646} 647 648// Are we on a widget activation screen? 649function wppaOnWidgets() { 650 651 var url = document.location.href; 652 653 return url.search("widgets.php") != -1; 654} 655function wppaOnPost() { 656 return ! wppaOnWidgets(); 657} 658 659// Get Tinymce editor content by id 660function wppaGetTinyMceContent( longId ) { 661 662 if ( jQuery('#'+longId).css('display') != 'none' ) { 663 var result = jQuery('#'+longId).val(); 664 } 665 else { 666 var result = tinymce.get(longId).getContent(); 667 } 668 669 return result; 670} 671 672// Stop propagation 673function wppaStopProp(event) { 674 event.stopPropagation(); 675} 676 677// screenwidth and screen.height not always give the right vakue 678function wppaScreenWidth() { 679 /* 680 var result = jQuery('#wppa-screen-anchor').position().left + 10; 681 console.log( 'W = '+result ); 682 */ 683 var result = window.innerWidth; // screen.width; 684 return result; 685} 686function wppaScreenHeight() { 687 /* 688 var result = jQuery('#wppa-screen-anchor').position().top + 10; 689 if ( wppaOvlIsVideo ) { 690 result -= wppaOvlNavIconSize; 691 } 692 console.log( 'H = '+result ); 693 */ 694 var result = window.innerHeight // screen.height; 695 return result; 696}
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.