1var wppb_cpm_global_height = ""; 2var wppb_cpm_global_width = ""; 3 4jQuery( document ).ready( function() { 5 var url; 6 7 jQuery( 'body' ).click( function( e ) { 8 if( ( jQuery( e.target ).is( 'span.ubermenu-target-title' ) && jQuery( e.target ).parents( '.ubermenu-item-type-wppb_cpm_login_iframe, .ubermenu-item-type-wppb_cpm_register_iframe, .ubermenu-item-type-wppb_cpm_edit_profile_iframe' ).length ) 9 || ( jQuery( e.target ).is( 'a.ubermenu-target' ) && jQuery( e.target ).parents( '.ubermenu-item-type-wppb_cpm_login_iframe, .ubermenu-item-type-wppb_cpm_register_iframe, .ubermenu-item-type-wppb_cpm_edit_profile_iframe' ).length ) ) { 10 e.preventDefault(); 11 12 if( jQuery( e.target ).is( 'span.ubermenu-target-title' ) ) { 13 url = jQuery( e.target ).parent().attr( 'href' ); 14 } else { 15 url = jQuery( e.target ).attr( 'href' ); 16 } 17 18 if( url !== undefined ) { 19 wppb_cpm_open_iframe( url ); 20 } 21 } 22 } ); 23 24 jQuery( '.menu-item-type-wppb_cpm_login_iframe, .menu-item-type-wppb_cpm_edit_profile_iframe, .menu-item-type-wppb_cpm_register_iframe' ).click( function( e ) { 25 e.preventDefault(); 26 27 url = jQuery( this ).children().attr( 'href' ); 28 29 if( url !== undefined ) { 30 wppb_cpm_open_iframe( url ); 31 } 32 } ); 33} ); 34 35function wppb_cpm_open_iframe( url ) { 36 var title = wppb_getParameterByName( 'wppb_cpm_iframe_title', url ); 37 wppb_cpm_global_height = wppb_getParameterByName( 'wppb_cpm_iframe_height', url ); 38 wppb_cpm_global_width = wppb_getParameterByName( 'wppb_cpm_iframe_width', url ); 39 40 tb_show( title, url + 'TB_iframe=true&width=' + wppb_cpm_global_width + '&height=' + wppb_cpm_global_height, '' ); 41 42 jQuery( '#TB_window').append( '<div id="wppb_cpm_spinner"></div>' ); 43 44 wppb_cpm_resize_iframe(); 45 46 if( wppb_getMobileOperatingSystem() == 'iOS' ) { 47 jQuery( '#TB_iframeContent' ).wrap( "<div class='wppb_cpm_iframe_wrap'></div>" ); 48 } 49 50 jQuery( '#TB_iframeContent' ).load( function() { 51 jQuery( '#wppb_cpm_spinner' ).remove(); 52 wppb_cpm_resize_iframe(); 53 } ); 54} 55 56function wppb_cpm_check_iframe() { 57 var current_url = jQuery( document )[0]['URL']; 58 var iFrame_check = ( window.location != window.parent.location ); 59 60 if( iFrame_check ) { 61 if( current_url.indexOf( "wppb_cpm_redirect=yes" ) !== -1 && current_url.indexOf( "wppb_cpm_iframe=yes" ) === -1 ) { 62 window.parent.location.href = current_url; 63 parent.wppb_tb_remove(); 64 } else { 65 jQuery( window ).on("unload", function() { 66 if( jQuery( '.wppb-cpm-logged-in' ).length !== 0 && current_url.indexOf( "wppb_cpm_form=login" ) !== -1 ) { 67 window.parent.location.reload(); 68 } 69 } ); 70 } 71 } 72 73 removeQueryVariable( 'wppb_cpm_redirect', current_url ); 74} 75wppb_cpm_check_iframe(); 76 77function removeQueryVariable( variable, current_url ) { 78 79 var url_parts = current_url.split('?'); 80 var urlSearchParams = new URLSearchParams( url_parts[1] ); 81 82 if ( urlSearchParams.has( variable ) ){ 83 urlSearchParams.delete( variable ); 84 85 var remaining_query = urlSearchParams.toString(); 86 var url = url_parts[0] + ( remaining_query ? '?' + remaining_query : '' ); 87 88 window.history.replaceState({}, document.title, url); 89 } 90} 91 92// edited tb_remove() function 93function wppb_tb_remove() { 94 jQuery( "#TB_imageOff" ).unbind( "click" ); 95 jQuery( "#TB_closeWindowButton" ).unbind( "click" ); 96 jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).unbind().remove(); 97 jQuery( 'body' ).removeClass( 'modal-open' ); 98 jQuery( "#TB_load" ).remove(); 99 if( typeof document.body.style.maxHeight == "undefined" ) { // if IE 6 100 jQuery( "body", "html" ).css( { height: "auto", width: "auto" } ); 101 jQuery( "html" ).css( "overflow", "" ); 102 } 103 jQuery( document ).unbind( '.thickbox' ); 104 return false; 105} 106 107jQuery( window ).resize( function() { 108 if( document.getElementById( 'TB_iframeContent' ) && document.getElementById( 'TB_iframeContent' )['src'].indexOf( "wppb_cpm_iframe=yes" ) !== -1 ) { 109 wppb_cpm_resize_iframe(); 110 } 111} ); 112 113function wppb_cpm_resize_iframe() { 114 var max_height = wppb_cpm_global_height; 115 var max_width = wppb_cpm_global_width; 116 117 var iframe_max_height = jQuery( window ).height() * 75 / 100; 118 var iframe_max_width = jQuery( window ).width() * 80 / 100; 119 120 var iframe_selector = jQuery( '#TB_iframeContent'); 121 var iframe_wrap_selector = jQuery( '.wppb_cpm_iframe_wrap'); 122 var tb_window_selector = jQuery( '#TB_window'); 123 124 iframe_selector.height( ( iframe_max_height < max_height ? iframe_max_height : max_height ) ); 125 iframe_wrap_selector.height( ( iframe_max_height < max_height ? iframe_max_height : max_height ) ); 126 tb_window_selector.css( "margin-top", parseInt( "-" + ( iframe_max_height < max_height ? iframe_max_height : max_height ) / 2 ) ); 127 tb_window_selector.css( "margin-left", parseInt( "-" + ( iframe_max_width < max_width ? iframe_max_width : max_width ) / 2 ) ); 128 iframe_selector.width( ( iframe_max_width < max_width ? iframe_max_width : max_width ) ); 129 iframe_wrap_selector.width( ( iframe_max_width < max_width ? iframe_max_width : max_width ) ); 130 tb_window_selector.width( ( iframe_max_width < max_width ? iframe_max_width : max_width ) ); 131} 132 133/** 134 * Determine the mobile operating system. 135 * This function either returns 'iOS' or 'unknown' 136 * 137 * @returns {String} 138 */ 139function wppb_getMobileOperatingSystem() { 140 var userAgent = navigator.userAgent || navigator.vendor || window.opera; 141 142 if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) ) { 143 return 'iOS'; 144 } else { 145 return 'unknown'; 146 } 147} 148 149/** 150 * Get parameters from url (by name) 151 * 152 * @returns {String} 153 */ 154function wppb_getParameterByName( name, url ) { 155 name = name.replace( /[\[\]]/g, "\\$&" ); 156 157 var regex = new RegExp( "[?&]" + name + "(=([^&#]*)|&|#|$)" ), results = regex.exec( url ); 158 159 if( ! results) 160 return null; 161 162 if( ! results[2]) 163 return ''; 164 165 return decodeURIComponent( results[2].replace( /\+/g, " " ) ); 166}
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.