Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/popup-ma.../trunk/assets/js
File: admin-pointer.js
/**
[0] Fix | Delete
* Handles pointers throughout Popup Maker.
[1] Fix | Delete
*/
[2] Fix | Delete
( function( $ ) {
[3] Fix | Delete
window.pumPointers = window.pumPointers || {
[4] Fix | Delete
pointers: [],
[5] Fix | Delete
};
[6] Fix | Delete
window.skipTour = false;
[7] Fix | Delete
function open_pointer( id ) {
[8] Fix | Delete
id = parseInt( id );
[9] Fix | Delete
var pointer = pumPointers.pointers[id];
[10] Fix | Delete
[11] Fix | Delete
// Checks if we need to do anything prior to opening pointer.
[12] Fix | Delete
if ( pointer.hasOwnProperty( 'pre' ) ) {
[13] Fix | Delete
// Checks if we need to do any clicks.
[14] Fix | Delete
if ( pointer.pre.hasOwnProperty( 'clicks' ) ) {
[15] Fix | Delete
$.each( pointer.pre.clicks, function( index, element ) {
[16] Fix | Delete
$( element ).click();
[17] Fix | Delete
} );
[18] Fix | Delete
}
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
// If target is not valid, exit early.
[22] Fix | Delete
var $target = $( pointer.target );
[23] Fix | Delete
if ( 0 === $target.length ) {
[24] Fix | Delete
return;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
// Prepare the options to be passed to wp-pointer.
[28] Fix | Delete
var options = $.extend( pointer.options, {
[29] Fix | Delete
close: function() {
[30] Fix | Delete
$.post( ajaxurl, {
[31] Fix | Delete
pointer: pointer.pointer_id,
[32] Fix | Delete
action: 'dismiss-wp-pointer',
[33] Fix | Delete
} );
[34] Fix | Delete
[35] Fix | Delete
// If we have other pointers left in tour, open the next.
[36] Fix | Delete
if ( false === skipTour && id !== pumPointers.pointers.length - 1 ) {
[37] Fix | Delete
open_pointer( id + 1 );
[38] Fix | Delete
}
[39] Fix | Delete
},
[40] Fix | Delete
buttons: function( event, t ) {
[41] Fix | Delete
var $btn_skip = $( '<button class="button" style="margin-right: 10px;">Skip tour</button>' );
[42] Fix | Delete
var $btn_next = $( '<button class="button button-primary">Next</button>' );
[43] Fix | Delete
var $btn_complete = $( '<button class="button button-primary">Thanks!</button>' );
[44] Fix | Delete
var $wrapper = $( '<div class=\"pum-pointer-buttons\" />' );
[45] Fix | Delete
$btn_skip.bind( 'click.point', function( e ) {
[46] Fix | Delete
e.preventDefault();
[47] Fix | Delete
skipTour = true;
[48] Fix | Delete
t.element.pointer( 'close' );
[49] Fix | Delete
for ( var i = 0; i < pumPointers.pointers.length; i++ ) {
[50] Fix | Delete
/**
[51] Fix | Delete
* If the user has never dismissed pointers before, there is a chance
[52] Fix | Delete
* their user meta key hasn't been set yet. If we fire too many of these
[53] Fix | Delete
* at once, WordPress will rewrite itself a few times causing not all
[54] Fix | Delete
* to be dismissed.
[55] Fix | Delete
*/
[56] Fix | Delete
setTimeout( function( i ) {
[57] Fix | Delete
$.post( ajaxurl, {
[58] Fix | Delete
pointer: pumPointers.pointers[i].pointer_id,
[59] Fix | Delete
action: 'dismiss-wp-pointer',
[60] Fix | Delete
} );
[61] Fix | Delete
}, ( i * 500 ) + 1, i );
[62] Fix | Delete
}
[63] Fix | Delete
} );
[64] Fix | Delete
$btn_next.bind( 'click.pointer', function( e ) {
[65] Fix | Delete
e.preventDefault();
[66] Fix | Delete
t.element.pointer( 'close' );
[67] Fix | Delete
} );
[68] Fix | Delete
$btn_complete.bind( 'click.pointer', function( e ) {
[69] Fix | Delete
e.preventDefault();
[70] Fix | Delete
t.element.pointer( 'close' );
[71] Fix | Delete
} );
[72] Fix | Delete
[73] Fix | Delete
// If this is the first pointer of a tour...
[74] Fix | Delete
if ( 1 !== pumPointers.pointers.length && 0 === id ) {
[75] Fix | Delete
// ... then show a skip tour button.
[76] Fix | Delete
$wrapper.append( $btn_skip );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
// If this is the last pointer in tour...
[80] Fix | Delete
if ( id === pumPointers.pointers.length - 1 ) {
[81] Fix | Delete
// ... then show complete button.
[82] Fix | Delete
$wrapper.append( $btn_complete );
[83] Fix | Delete
} else {
[84] Fix | Delete
// ... else show next button.
[85] Fix | Delete
$wrapper.append( $btn_next );
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
return $wrapper;
[89] Fix | Delete
},
[90] Fix | Delete
} );
[91] Fix | Delete
[92] Fix | Delete
// Show pointer after scrolling to target.
[93] Fix | Delete
var this_pointer = $target.pointer( options );
[94] Fix | Delete
$( 'html, body' ).animate( { scrollTop: $target.offset().top - 200 } );
[95] Fix | Delete
this_pointer.pointer( 'open' );
[96] Fix | Delete
}
[97] Fix | Delete
$( function( $ ) {
[98] Fix | Delete
/**
[99] Fix | Delete
* Since many of our fields and screens are dynamically loaded, we need to ensure
[100] Fix | Delete
* the first pointer doesn't start until after they are loaded. But, we can set those
[101] Fix | Delete
* JS files as dependencies as we these pointers could be loaded on any admin screen.
[102] Fix | Delete
*/
[103] Fix | Delete
setTimeout( function() {
[104] Fix | Delete
if ( 0 < pumPointers.pointers.length ) {
[105] Fix | Delete
open_pointer( 0 );
[106] Fix | Delete
}
[107] Fix | Delete
}, 1000 );
[108] Fix | Delete
} );
[109] Fix | Delete
}( jQuery ) );
[110] Fix | Delete
[111] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function