Community = new function(){} Community.Page = new function(){ this.noHat = false; this.hostname = window.location.hostname; this.path = window.location.pathname; this.qs = window.location.search.substring(1); this.vars = this.qs.split("&"); this.baseUrl = (this.hostname.indexOf("mtv-q.mtvi.com") > 0) ? "http://www.mtv-d.mtvi.com" : "http://www.mtv.com"; this.headTag = document.getElementsByTagName("head").item(0); this.cssOverrideSet = false; this.isFN = false; /* JS/JSON FOR OLD MTV.COM NAV - EAR 8/17/09 this.init = function(){ Community.Page.updatePage(); Community.Widgets.createFooter('MTVFooter'); if(Community.Page.isFN){ Community.Widgets.createNav('MTVNav', Community.Widgets.fnHeaderObj); } else{ Community.Widgets.createArtistlist('MTVArtistList'); Community.Widgets.createSearch('MTVSearch'); Community.Widgets.createNav('MTVNav'); } } THE FOLLOWING FOR THE NEW MTV.COM NAV */ this.init = function(){ Community.Page.updatePage(); //COMMENTED OUT THE LINE BELOW AS WE NO LONGER USE THIS TO CREATE THE FOOTER, EAR 10/1/10 //Community.Widgets.createFooter('MTVFooter'); if(Community.Page.isFN){ Community.Widgets.createNav('MTVNav', Community.Widgets.fnHeaderObj); } else{ //COMMENTED OUT THE LINE BELOW AS WE NO LONGER USE THIS TO CREATE THE HEADER/FOOTER, EAR 10/1/10 //Community.Widgets.createNav('nav'); } } this.createScript = function(url){ var scriptObj = document.createElement("script"); scriptObj.setAttribute("type", "text/javascript"); scriptObj.setAttribute("src", Community.Page.baseUrl+url); Community.Page.headTag.appendChild(scriptObj); } this.setDiscussionCSS = function(){ var tcId = ""; for (var i=0; i"; h1.className = "main-title" var img = document.createElement("img"); img.className = "thumb"; img.setAttribute("src", Community.Page.baseUrl + category.images.img.src); var div = document.createElement("div"); div.className = "deck"; if(category.description!=null){ var p = document.createElement("p"); p.appendChild(document.createTextNode(category.description)); div.appendChild(p); } var action = document.createElement("a"); action.className = "action"; action.setAttribute("href", Community.Page.baseUrl + "/ontv/fn-mtv/uploads.jhtml"); action.appendChild(document.createTextNode("Back to all uploads categories")); div.appendChild(action); if(category.videoId!=null){ var button = document.createElement("a"); button.setAttribute("href", Community.Page.baseUrl + "/ontv/fn-mtv/upload.jhtml?categoryId=" + category.id); button.innerHTML = "<" + "img src=\"" + Community.Page.baseUrl + "/content/ontv/fn-mtv/images/bttn-upload-to-category.gif\"/>"; div.appendChild(button); } fnHeader.appendChild(h1); fnHeader.appendChild(img); fnHeader.appendChild(div); var zone = document.getElementById("ctl01_ctl00_ctl00_phBody_phBody_phBody_ctl00_zone2_zone2"); zone.insertBefore(fnHeader, zone.childNodes[0]); }// fn video category pages // trim non-community greeting if(!document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_quickMenu_pnlCommunityMember')){ var q = document.getElementById('quickmenu'); if (q) { var spans = q.getElementsByTagName('span'); var container; for (var x=0; x= 0){ pnlDelimiter.replaceChild(document.createTextNode(' | '), element); } else pnlDelimiter.removeChild(element); } } } // add User Search link to Friends page if(Community.Page.path.indexOf('FriendsManagement.aspx') > 0 || Community.Page.path.indexOf('FriendsManagment.aspx') > 0){ var inviteLink = document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_phBody_cFriendManagement_btnReorderFriends'); if(inviteLink){ var tbody = inviteLink.parentNode.parentNode.parentNode; var newTR = document.createElement('tr'); var newTD = document.createElement('td'); newTD.setAttribute('align', 'right'); var newA = document.createElement('a'); newA.setAttribute('href', '/-/Community/BrowseUsers.aspx'); newA.appendChild(document.createTextNode('Browse Members')); newTD.appendChild(newA); newTR.appendChild(document.createElement('td')); newTR.appendChild(newTD); tbody.appendChild(newTR); } }// end user search // add Upload links to Feed Detail pages if(Community.Page.path.indexOf('/Content/Picture/Pictures.aspx') >0 || Community.Page.path.indexOf('/Content/Video/Videos.aspx') > 0){ var contentType; if(Community.Page.path.indexOf('/Content/Picture/Pictures.aspx') >0) contentType = 'photo'; else if(Community.Page.path.indexOf('/Content/Video/Videos.aspx') >0) contentType = 'video'; var hook = document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_phBody_contentFilterControl_lbPersonal'); if(hook){ var sidebar = hook.parentNode.parentNode.parentNode.parentNode; var a = document.createElement('a'); var text; switch(contentType){ case 'video': a.setAttribute('href', '/-/Content/Video/AddVideo.aspx'); text = 'Upload Videos'; break; case 'photo': a.setAttribute('href', '/-/Content/Picture/AddPhoto.aspx'); text = 'Upload Photos'; break; default: break; } a.appendChild(document.createTextNode(text)); sidebar.appendChild(a); } }// end upload links // discussion boards breadcrumb if(Community.Page.path.indexOf('DiscussionResults.aspx') > 0 && (Community.Page.qs.indexOf('tcid') >= 0 || Community.Page.qs.indexOf('tcId') >= 0)){ var tcid = ""; for (var i=0; i 0){ var breadcrumb = ""; var catId = ""; var tds = document.getElementsByTagName("td"); for(var i=0; i 0){ breadcrumb = tds[i].getElementsByTagName("a")[0]; } if(tds[i].id.indexOf('fluxBreadCrumbs_rptBreadCrumbs_ctl03_tdBreadCrumbCell') > 0){ var categoryLink = tds[i].getElementsByTagName("a")[0].href; catId = categoryLink.substring(categoryLink.indexOf("catId=")+6, categoryLink.length); } } var categories = Community.Data.discussionCategories; for(var i=0; i