: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
global.FS = global.FS || {};
global.FS.PostMessage = function ()
_postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
_parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
_parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
_postman.receiveMessage(function (e) {
var data = JSON.parse(e.data);
if (_callbacks[data.type]) {
for (var i = 0; i < _callbacks[data.type].length; i++) {
// Execute type callbacks.
_callbacks[data.type][i](data.data);
_hasParent = ('' !== _parent_url),
init : function (url, iframes)
// Automatically receive forward messages.
FS.PostMessage.receiveOnce('forward', function (data){
window.location = data.url;
if (iframes.length > 0) {
$window.on('scroll', function () {
for (var i = 0; i < iframes.length; i++) {
FS.PostMessage.postScroll(iframes[i]);
this.init(_parent_subdomain);
// Post height of a child right after window is loaded.
$(window).bind('load', function () {
FS.PostMessage.postHeight();
// Post message that window was loaded.
FS.PostMessage.post('loaded');
postHeight : function (diff, wrapper) {
wrapper = wrapper || '#wrap_section';
height: diff + $(wrapper).outerHeight(true)
postScroll : function (iframe) {
top: $window.scrollTop(),
height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
post : function (type, data, iframe)
console.debug('PostMessage.post', type);
_postman.postMessage(JSON.stringify({
}), iframe.src, iframe.contentWindow);
_postman.postMessage(JSON.stringify({
}), _parent_url, window.parent);
receive: function (type, callback)
console.debug('PostMessage.receive', type);
if (undef === _callbacks[type])
_callbacks[type].push(callback);
receiveOnce: function (type, callback)
this.receive(type, callback);
// Check if any callbacks assigned to a specified message type.
return (undef != _callbacks[type]);
parent_subdomain: function ()
return _parent_subdomain;