/** * 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['nbcLMP5491'] = {}; // Parameter parsing window['nbcLMP5491'].scriptTagsOnPage = document.getElementsByTagName('script'); window['nbcLMP5491'].thisScriptName = '/weather/dmn-forecast'; window['nbcLMP5491'].thisScriptSource = null; window['nbcLMP5491'].activeEmbeds = new Array(); window['nbcLMP5491'].usedEmbeds = new Array(); window['nbcLMP5491'].scriptSplit = null; window['nbcLMP5491'].scriptParams = null; window['nbcLMP5491'].discreteParams = null; window['nbcLMP5491'].useThisAsParent = null; window['nbcLMP5491'].encodedURI = encodeURIComponent(location.origin+location.pathname); window['nbcLMP5491'].encodedHost = encodeURIComponent(location.origin); window['nbcLMP5491'].origin = null; window['nbcLMP5491'].videoThumbPath = '"https://media.nbcdfw.com/images/300*169/dmnFB_SD_0101_4am.jpg'; // Comb the scripts! for(var a=0; a'); // DOM element creation - THUMBNAIL/PLAY BUTTON window['nbcLMP5491'].thumbnailContainer = document.createElement('div'); // Container with background image as thumbnail window['nbcLMP5491'].playButton = document.createElement('img'); // Absolutely positioned. window['nbcLMP5491'].thumbnailContainer.id = 'nbcrcplayer'; window['nbcLMP5491'].thumbnailContainer.style.width = '300px'; window['nbcLMP5491'].thumbnailContainer.style.height = '169px'; window['nbcLMP5491'].thumbnailContainer.style.position = 'relative'; window['nbcLMP5491'].thumbnailContainer.style.backgroundImage="url('https://media.nbcdfw.com/images/300*169/dmnFB_SD_0101_4am.jpg')"; window['nbcLMP5491'].playButton.src = 'https://media.nbcdfw.com/designimages/solo_sprite_hp_play_video.png'; window['nbcLMP5491'].playButton.width = 55; window['nbcLMP5491'].playButton.height = 41; window['nbcLMP5491'].playButton.style.position = 'absolute'; window['nbcLMP5491'].playButton.style.top = "68px"; window['nbcLMP5491'].playButton.style.left = "127px"; window['nbcLMP5491'].playButton.onclick=function(){createVideoFrame()}; window['nbcLMP5491'].thumbnailContainer.appendChild(window['nbcLMP5491'].playButton); window['nbcLMP5491'].useThisAsParent.appendChild(window['nbcLMP5491'].thumbnailContainer); window['nbcLMP5491'].noteTheDOMPos = window['nbcLMP5491'].useThisAsParent.lastChild; // DOM element creation - IFRAME function createVideoFrame () { window['nbcLMP5491'].useThisAsParent.removeChild(window['nbcLMP5491'].noteTheDOMPos); window['nbcLMP5491'].videoframe = document.createElement('iframe'); window['nbcLMP5491'].videoframe.style.border = 'none'; window['nbcLMP5491'].videoframe.width = 300; window['nbcLMP5491'].videoframe.height = 169; window['nbcLMP5491'].videoframe.scrolling = "no"; window['nbcLMP5491'].videoframe.src = "https://www.nbcdfw.com/templates/nbc_partner_player?cmsID=503754042&videoID=4Cpt4psaISV6&autoplay=true&origin=www.nbcdfw.com&sec=news&subsec=weather&width=300&height=169&rand=5491&turl="+window['nbcLMP5491'].encodedURI + "&ourl=" + window['nbcLMP5491'].encodedHost + "&lp=1"; window['nbcLMP5491'].useThisAsParent.appendChild(window['nbcLMP5491'].videoframe); } })();