/** * NBC Player Maker * A Javascript widget that will dynamically create an iframe pointing to * our video player * * Created by: Rob Sable * Date created: 11/19/2013 * * Last edited by: Rob Sable * Last modified: 04/23/2014 */ /** * Usage: * * WARNING: DO NOT CALL .JS FILE DIRECTLY */ if(typeof console == "undefined") { console = {}; console.log = function(msg) { // fail silently } console.warn = function(msg) { // fail silently } console.error = function(msg) { // fail silently } console.info = function(msg) { // fail silently } } (function() { //console.log("/////////////////////////////////////////"); //console.log("/// NBC PLAYER MAKER ////////////////////"); //console.log("/////////////////////////////////////////"); // Gather the scripts on the page. window['nbcLMP6389'] = {}; // Parameter parsing window['nbcLMP6389'].scriptTagsOnPage = document.getElementsByTagName('script'); window['nbcLMP6389'].thisScriptName = '/weather/dmn-forecast'; window['nbcLMP6389'].thisScriptSource = null; window['nbcLMP6389'].activeEmbeds = new Array(); window['nbcLMP6389'].usedEmbeds = new Array(); window['nbcLMP6389'].scriptSplit = null; window['nbcLMP6389'].scriptParams = null; window['nbcLMP6389'].discreteParams = null; window['nbcLMP6389'].useThisAsParent = null; window['nbcLMP6389'].encodedURI = encodeURIComponent(location.origin+location.pathname); window['nbcLMP6389'].encodedHost = encodeURIComponent(location.origin); window['nbcLMP6389'].origin = null; window['nbcLMP6389'].videoThumbPath = '"//media.nbcdfw.com/images/300*169/wx-dmn-social-gj-062817_1200x675_977804867637.jpg'; // Comb the scripts! for(var a=0; a'); // DOM element creation - THUMBNAIL/PLAY BUTTON window['nbcLMP6389'].thumbnailContainer = document.createElement('div'); // Container with background image as thumbnail window['nbcLMP6389'].playButton = document.createElement('img'); // Absolutely positioned. window['nbcLMP6389'].thumbnailContainer.id = 'nbcrcplayer'; window['nbcLMP6389'].thumbnailContainer.style.width = '300px'; window['nbcLMP6389'].thumbnailContainer.style.height = '169px'; window['nbcLMP6389'].thumbnailContainer.style.position = 'relative'; window['nbcLMP6389'].thumbnailContainer.style.backgroundImage="url('//media.nbcdfw.com/images/300*169/wx-dmn-social-gj-062817_1200x675_977804867637.jpg')"; window['nbcLMP6389'].playButton.src = 'http://media.nbcdfw.com/designimages/solo_sprite_hp_play_video.png'; window['nbcLMP6389'].playButton.width = 55; window['nbcLMP6389'].playButton.height = 41; window['nbcLMP6389'].playButton.style.position = 'absolute'; window['nbcLMP6389'].playButton.style.top = "68px"; window['nbcLMP6389'].playButton.style.left = "127px"; window['nbcLMP6389'].playButton.onclick=function(){createVideoFrame()}; window['nbcLMP6389'].thumbnailContainer.appendChild(window['nbcLMP6389'].playButton); window['nbcLMP6389'].useThisAsParent.appendChild(window['nbcLMP6389'].thumbnailContainer); window['nbcLMP6389'].noteTheDOMPos = window['nbcLMP6389'].useThisAsParent.lastChild; // DOM element creation - IFRAME function createVideoFrame () { window['nbcLMP6389'].useThisAsParent.removeChild(window['nbcLMP6389'].noteTheDOMPos); window['nbcLMP6389'].videoframe = document.createElement('iframe'); window['nbcLMP6389'].videoframe.style.border = 'none'; window['nbcLMP6389'].videoframe.width = 300; window['nbcLMP6389'].videoframe.height = 169; window['nbcLMP6389'].videoframe.scrolling = "no"; window['nbcLMP6389'].videoframe.src = "http://www.nbcdfw.com/templates/nbc_partner_player?cmsID=431258123&videoID=X3RCeDc4pGot&autoplay=true&origin=www.nbcdfw.com&sec=news&subsec=weather&width=300&height=169&rand=6389&turl="+window['nbcLMP6389'].encodedURI + "&ourl=" + window['nbcLMP6389'].encodedHost + "&lp=1"; window['nbcLMP6389'].useThisAsParent.appendChild(window['nbcLMP6389'].videoframe); } })();