PageSourceSearch

https://st-albertus.sch.id/wp-content/plugins/pb-add-on-custom-pro…/assets/js/wppb_cpm_main.js?ver=1.1.1

js st-albertus.sch.id collected 2026-10-08 18:47:54 UTC 5,805 bytes, 149 lines download raw bytes

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}
73wppb_cpm_check_iframe();
74
75// edited tb_remove() function
76function wppb_tb_remove() {
77    jQuery( "#TB_imageOff" ).unbind( "click" );
78    jQuery( "#TB_closeWindowButton" ).unbind( "click" );
79    jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).unbind().remove();
80    jQuery( 'body' ).removeClass( 'modal-open' );
81    jQuery( "#TB_load" ).remove();
82    if( typeof document.body.style.maxHeight == "undefined" ) { // if IE 6
83        jQuery( "body", "html" ).css( { height: "auto", width: "auto" } );
84        jQuery( "html" ).css( "overflow", "" );
85    }
86    jQuery( document ).unbind( '.thickbox' );
87    return false;
88}
89
90jQuery( window ).resize( function() {
91    if( document.getElementById( 'TB_iframeContent' ) && document.getElementById( 'TB_iframeContent' )['src'].indexOf( "wppb_cpm_iframe=yes" ) !== -1 ) {
92        wppb_cpm_resize_iframe();
93    }
94} );
95
96function wppb_cpm_resize_iframe() {
97    var max_height = wppb_cpm_global_height;
98    var max_width = wppb_cpm_global_width;
99
100    var iframe_max_height = jQuery( window ).height() * 75 / 100;
101    var iframe_max_width = jQuery( window ).width() * 80 / 100;
102
103    var iframe_selector = jQuery( '#TB_iframeContent');
104    var iframe_wrap_selector = jQuery( '.wppb_cpm_iframe_wrap');
105    var tb_window_selector = jQuery( '#TB_window');
106
107    iframe_selector.height( ( iframe_max_height < max_height ? iframe_max_height : max_height ) );
108    iframe_wrap_selector.height( ( iframe_max_height < max_height ? iframe_max_height : max_height ) );
109    tb_window_selector.css( "margin-top", parseInt( "-" + ( iframe_max_height < max_height ? iframe_max_height : max_height ) / 2 ) );
110    tb_window_selector.css( "margin-left", parseInt( "-" + ( iframe_max_width < max_width ? iframe_max_width : max_width ) / 2 ) );
111    iframe_selector.width( ( iframe_max_width < max_width ? iframe_max_width : max_width ) );
112    iframe_wrap_selector.width( ( iframe_max_width < max_width ? iframe_max_width : max_width ) );
113    tb_window_selector.width( ( iframe_max_width < max_width ? iframe_max_width : max_width ) );
114}
115
116/**
117 * Determine the mobile operating system.
118 * This function either returns 'iOS' or 'unknown'
119 *
120 * @returns {String}
121 */
122function wppb_getMobileOperatingSystem() {
123    var userAgent = navigator.userAgent || navigator.vendor || window.opera;
124
125    if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) ) {
126        return 'iOS';
127    } else {
128        return 'unknown';
129    }
130}
131
132/**
133 * Get parameters from url (by name)
134 *
135 * @returns {String}
136 */
137function wppb_getParameterByName( name, url ) {
138    name = name.replace( /[\[\]]/g, "\\$&" );
139
140    var regex = new RegExp( "[?&]" + name + "(=([^&#]*)|&|#|$)" ), results = regex.exec( url );
141
142    if( ! results)
143        return null;
144
145    if( ! results[2])
146        return '';
147
148    return decodeURIComponent( results[2].replace( /\+/g, " " ) );
149}

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.