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/wp-conte.../plugins/content-.../inc/freemius/assets/js
File: nojquery.ba-postmessage.js
/*!
[0] Fix | Delete
* jQuery postMessage - v0.5 - 9/11/2009
[1] Fix | Delete
* http://benalman.com/projects/jquery-postmessage-plugin/
[2] Fix | Delete
*
[3] Fix | Delete
* Copyright (c) 2009 "Cowboy" Ben Alman
[4] Fix | Delete
* Dual licensed under the MIT and GPL licenses.
[5] Fix | Delete
* http://benalman.com/about/license/
[6] Fix | Delete
*
[7] Fix | Delete
* Non-jQuery fork by Jeff Lee
[8] Fix | Delete
*
[9] Fix | Delete
* This fork consists of the following changes:
[10] Fix | Delete
* 1. Basic code cleanup and restructuring, for legibility.
[11] Fix | Delete
* 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
[12] Fix | Delete
* in terms of both function names and object scope. Scope is specified by
[13] Fix | Delete
* the the "this" context of NoJQueryPostMessageMixin();
[14] Fix | Delete
* 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
[15] Fix | Delete
* at least three different GitHub users requesting the removal of this
[16] Fix | Delete
* "Opera sniff" on the original project's Issues page, so I figured this
[17] Fix | Delete
* would be a relatively safe change.
[18] Fix | Delete
* 4. `postMessage` no longer uses `$.param` to serialize messages that are not
[19] Fix | Delete
* strings. I actually prefer this structure anyway. `receiveMessage` does
[20] Fix | Delete
* not implement a corresponding deserialization step, and as such it seems
[21] Fix | Delete
* cleaner and more symmetric to leave both data serialization and
[22] Fix | Delete
* deserialization to the client.
[23] Fix | Delete
* 5. The use of `$.isFunction` is replaced by a functionally-identical check.
[24] Fix | Delete
* 6. The `$:nomunge` YUI option is no longer necessary.
[25] Fix | Delete
*/
[26] Fix | Delete
[27] Fix | Delete
function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
[28] Fix | Delete
[29] Fix | Delete
var setMessageCallback, unsetMessageCallback, currentMsgCallback,
[30] Fix | Delete
intervalId, lastHash, cacheBust = 1;
[31] Fix | Delete
[32] Fix | Delete
if (window.postMessage) {
[33] Fix | Delete
[34] Fix | Delete
if (window.addEventListener) {
[35] Fix | Delete
setMessageCallback = function(callback) {
[36] Fix | Delete
window.addEventListener('message', callback, false);
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
unsetMessageCallback = function(callback) {
[40] Fix | Delete
window.removeEventListener('message', callback, false);
[41] Fix | Delete
}
[42] Fix | Delete
} else {
[43] Fix | Delete
setMessageCallback = function(callback) {
[44] Fix | Delete
window.attachEvent('onmessage', callback);
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
unsetMessageCallback = function(callback) {
[48] Fix | Delete
window.detachEvent('onmessage', callback);
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
this[postBinding] = function(message, targetUrl, target) {
[53] Fix | Delete
if (!targetUrl) {
[54] Fix | Delete
return;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
// The browser supports window.postMessage, so call it with a targetOrigin
[58] Fix | Delete
// set appropriately, based on the targetUrl parameter.
[59] Fix | Delete
target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
// Since the browser supports window.postMessage, the callback will be
[63] Fix | Delete
// bound to the actual event associated with window.postMessage.
[64] Fix | Delete
this[receiveBinding] = function(callback, sourceOrigin, delay) {
[65] Fix | Delete
// Unbind an existing callback if it exists.
[66] Fix | Delete
if (currentMsgCallback) {
[67] Fix | Delete
unsetMessageCallback(currentMsgCallback);
[68] Fix | Delete
currentMsgCallback = null;
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
if (!callback) {
[72] Fix | Delete
return false;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
// Bind the callback. A reference to the callback is stored for ease of
[76] Fix | Delete
// unbinding.
[77] Fix | Delete
currentMsgCallback = setMessageCallback(function(e) {
[78] Fix | Delete
switch(Object.prototype.toString.call(sourceOrigin)) {
[79] Fix | Delete
case '[object String]':
[80] Fix | Delete
if (sourceOrigin !== e.origin) {
[81] Fix | Delete
return false;
[82] Fix | Delete
}
[83] Fix | Delete
break;
[84] Fix | Delete
case '[object Function]':
[85] Fix | Delete
if (sourceOrigin(e.origin)) {
[86] Fix | Delete
return false;
[87] Fix | Delete
}
[88] Fix | Delete
break;
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
callback(e);
[92] Fix | Delete
});
[93] Fix | Delete
};
[94] Fix | Delete
[95] Fix | Delete
} else {
[96] Fix | Delete
[97] Fix | Delete
this[postBinding] = function(message, targetUrl, target) {
[98] Fix | Delete
if (!targetUrl) {
[99] Fix | Delete
return;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
// The browser does not support window.postMessage, so set the location
[103] Fix | Delete
// of the target to targetUrl#message. A bit ugly, but it works! A cache
[104] Fix | Delete
// bust parameter is added to ensure that repeat messages trigger the
[105] Fix | Delete
// callback.
[106] Fix | Delete
target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
// Since the browser sucks, a polling loop will be started, and the
[110] Fix | Delete
// callback will be called whenever the location.hash changes.
[111] Fix | Delete
this[receiveBinding] = function(callback, sourceOrigin, delay) {
[112] Fix | Delete
if (intervalId) {
[113] Fix | Delete
clearInterval(intervalId);
[114] Fix | Delete
intervalId = null;
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
if (callback) {
[118] Fix | Delete
delay = typeof sourceOrigin === 'number'
[119] Fix | Delete
? sourceOrigin
[120] Fix | Delete
: typeof delay === 'number'
[121] Fix | Delete
? delay
[122] Fix | Delete
: 100;
[123] Fix | Delete
[124] Fix | Delete
intervalId = setInterval(function(){
[125] Fix | Delete
var hash = document.location.hash,
[126] Fix | Delete
re = /^#?\d+&/;
[127] Fix | Delete
if ( hash !== lastHash && re.test( hash ) ) {
[128] Fix | Delete
lastHash = hash;
[129] Fix | Delete
callback({ data: hash.replace( re, '' ) });
[130] Fix | Delete
}
[131] Fix | Delete
}, delay );
[132] Fix | Delete
}
[133] Fix | Delete
};
[134] Fix | Delete
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
return this;
[138] Fix | Delete
}
[139] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function