| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/ict/wp-content/plugins/so-widgets-bundle/widgets/google-map/js/ |
Upload File : |
/* globals jQuery, sowb */
var sowb = window.sowb || {};
jQuery( function ( $ ) {
var setupStaticMapErrorHandler = function () {
$( '.sowb-google-map-static' ).each( function () {
var $this = $( this );
var showFallbackImage = function () {
if ( $this.data( 'fallbackImage' ) ) {
var imgData = $this.data( 'fallbackImage' );
if ( imgData.hasOwnProperty( 'img' ) && imgData.img.length > 0 ) {
$this.parent().append( imgData.img );
$this.remove();
}
}
};
if ( this.sowbLoadError ) {
showFallbackImage();
} else if ( !this.complete ) {
$this.on( 'error', showFallbackImage );
}
} );
};
setupStaticMapErrorHandler();
$( window ).on('load resize setup_widgets', function() {
$( '.sowb-google-map-static' ).each( function () {
var $this = $( this );
var src = $this.prop( 'src' );
var breakpointCheck = window.matchMedia( '(max-width: ' + $this.data( 'breakpoint' ) + 'px)' )
// Check if the user is viewing the map on mobile
if ( breakpointCheck.matches ) {
// Scale the map for mobile
$this.attr( 'src', src + '&scale=2' );
} else {
// Check if the static map enabled for mobile and if it is, restore it back to normal
if ( src.indexOf( '&scale=2' ) >= 0 ) {
$this.attr( 'src', src.split('&scale=2')[0] );
}
}
} );
} );
} );
window.sowb = sowb;