развернуть ↓
<style> #w-o-s-external-banner-id-3 { } </style> <script> (function (window, document) { var WOSBanner = new function () { var wos = this, $dom = {}, $, $window; this.type = 'fullscreen'; this.id = 3; var findIframeByUrl = function (iframe_url) { return $('iframe[src*="'+ iframe_url +'"]'); }; var assign = function () { $ = window.jQuery; $dom.banner = $('#w-o-s-external-banner-id-' + wos.id); $dom.iframe = findIframeByUrl('/richmedia/projects/mts/1000x400/index.html'); $dom.iframe = $dom.iframe.add($dom.iframe.parent()); $dom.iframe.css('width', '1000px'); $window = $(window); }; var bind = function () { $(window).bind('statechange.w-o-s-banner-id-' + wos.id, function(){ wos.hide(function () { _postMessage('wos_banner', '*', window, { id: wos.id, remove: true }); unbind(); }); }); _getMessage('wos_external_banner', '*', function (data, e) { if (data.showFullscreen) { wos.show(); } if (data.hide) { wos.hide(); } }); }; var unbind = function () { $window.unbind('statechange.w-o-s-banner-id-' + wos.id); $dom = {}; }; wos.ready = function () { assign(); bind(); }; wos.show = function (callback) { $dom.iframe.animate({ height: 400 }, 500, 'swing', function () { }); }; wos.hide = function (callback) { $dom.iframe.animate({ height: 90 }, 500, 'swing', function () { callback && callback(); // unbind(); }); }; wos.init = function () { var scripts = ['http://w-o-s.ru/richmedia/messages.js']; if (window._extCode === undefined) { scripts.push('http://w-o-s.ru/richmedia/projects/mts/1000x400/core.js'); } if (!window.jQuery) { scripts.unshift('http://code.jquery.com/jquery-1.11.0.min.js'); } if (document.body == null) { document.addEventListener("DOMContentLoaded", function(event) { wos.loadScripts(scripts, function () { wos.ready(); }); }); }else{ wos.loadScripts(scripts, function () { wos.ready(); }); } }; wos.loadScripts = function(url, callback) { if (!(url instanceof Array)) { url = [url]; } var url_counter = 0, url_length = url.length, onload = function() { url_counter++; if (url_counter >= url_length) { callback(); } else { loadScript(url[url_counter], onload); } }; if (url_length === 0) { callback(); } else { loadScript(url[0], onload); } } var adfoxPixelEmitter = function(pixel_name) { var pixels = { 'expand': '', 'collapse': '' } (new Image).src = pixels[pixel_name]; }; var loadScript = function(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; if (callback) callback(); } }; } else { //Others script.onload = function(){ if (callback) callback(); }; } script.src = url; document.body.appendChild(script); }; var preloadImage = function (src, callback) { var $img = $('<img src="'+ src +'">'); $img.load(function () { callback && callback(); }).error(function () { _log('Error loading image:', src); }); }; }; WOSBanner.init(); })(window, document); </script> <div id="w-o-s-external-banner-id-3"> </div>