/** *** MTVM Object *** *** 1. Any function that start with "__" ie "__getVar" will denote, cosmetically, *** a 'private' function of the object. This will help to identify *** their usage although js doesn't support public/private functions. ***/ if (typeof MTVM == "undefined") { var MTVM = {}; } /** ############# BASED ON YAHOO YUI JS LIB ############ */ MTVM.registerNamespace = function() { var a=arguments, o=null, i, j, d; for (i=0; i-1) { if(document.location.hostname.indexOf("-l.mtvi.com")>-1) { return "l"; //local } if(document.location.hostname.indexOf("-d.mtvi.com")>-1) { return "d"; } else if(document.location.hostname.indexOf("-q.mtvi.com")>-1) { return "q"; } } else {return "live";}} )(); // l/d/q/live MTVM.config.serverHostName = (function(){ switch(MTVM.config.serverPlatform) { case "l": return "http://www.mtvhive-l.mtvi.com/"; break; case "d": return "http://www.mtvhive-d.mtvi.com/"; break; case "q": return "http://www.mtvhive-q.mtvi.com/"; break; default: //live return "http://www.mtvhive.com/"; break; }})(); MTVM.config.reportingSuite = "viamtvmusic"; MTVM.config.swfPlayer = {} MTVM.config.swfPlayer.height = "391"; MTVM.config.swfPlayer.width = "640"; MTVM.config.swfPlayer.heightPrime = "360"; MTVM.config.swfPlayer.widthPrime = "640"; MTVM.config.swfPlayer.hdHeight = "463"; MTVM.config.swfPlayer.hdWidth = "768"; MTVM.config.swfPlayer.hdHeightPrime = "432"; MTVM.config.swfPlayer.hdWidthPrime = "768"; MTVM.config.swfPlayer.playerVersion = "prime"; MTVM.config.swfPlayer.getCssClass = function() { var renditionWidth = ""; var returnValue = ""; if(typeof MTVM.contextValues.video != "undefined" && MTVM.contextValues.video.largestRenditionWidth != null) { renditionWidth = MTVM.contextValues.video.largestRenditionWidth; } //return HD for VIDEO PAGES ONLY if(MTVM.contextValues.pageType.toLowerCase() == "video" && (renditionWidth != "" && renditionWidth >= 1280) && MTVM.util.isUserScreenHDCapable() ) { if(MTVM.config.swfPlayer.playerVersion!=""){ //return HD prime returnValue = "hdPrime"; }else{//return HD non prime returnValue = "hd"; } }else{ //return SD if(MTVM.config.swfPlayer.playerVersion!="" && MTVM.config.swfPlayer.playerVersion == "prime"){ //return SD prime returnValue = "prime" }else{ //return SD non-prime returnValue = "sd"; } } return returnValue; } MTVM.config.swfPlayerContainerId = "swfPlayerContainer"; MTVM.config.swfPlayerId = "swfPlayer"; MTVM.config.debugLogEnabled = (function(){switch(MTVM.config.serverPlatform) { case "l":return true; break; case "d":return false; break; case "q":return false; break; case "live":return false; break; default: return false; break; }})(); MTVM.config.useFireBugLite = (function(){switch(MTVM.config.serverPlatform) { case "l":return false; break; case "d":return false; break; case "q":return false; break; case "live":return false; break; default: return false; break; }})(); MTVM.config.swfObjForVideoPlayer = null; MTVM.config.hiveUrl = "www.mtvhive.com"; MTVM.config.wpBlogUrl = "http://read.mtvhive.com"; MTVM.config.meterUrl = "http://www.mtvmusicmeter.com"; MTVM.config.mtvnservicesURL = "http://media.mtvnservices.com"; ; MTVM.config.playlistAppId = "13"; MTVM.config.playlistAppVersion = (function(){switch(MTVM.config.serverPlatform) { case "l":return "1.0.3"; break; case "d":return "1.0.3"; break; case "q":return "1.0.3"; break; case "live":return "1.0.3"; break; default: return "1.0.3"; break; }})(); MTVM.config.playlistServicesURL = (function(){switch(MTVM.config.serverPlatform) { case "l": return "playlists.mtvnservices.com"; break; //return "playlists.mtvnservices.com"; break; case "d": return "playlists.mtvnservices.com"; break; //return "playlists.mtvnservices.com"; break; case "q": return "playlists.mtvnservices.com"; break; //return "playlists.mtvnservices.com"; break; case "live": default: return "playlists.mtvnservices.com"; break; }})(); MTVM.config.playlistDebug =(function(){switch(MTVM.config.serverPlatform){ case "l": return false; break; case "d":return false; break; case "q":return false; break; default:return false; break; }})(); MTVM.config.fluxCommunityUcid = "B8E6FFFF00F179450002FFFFE6B8"; MTVM.config.fluxCommunityUrl = "http://community.mtvmusic.com"; MTVM.config.flux4ContextUrl = "http://cus.flux.com"; MTVM.config.flux3WidgetsUrl = "http://widgets3.flux.com"; MTVM.config.dartSiteRegion = "us"; MTVM.config.dartSite = (function(){ var host = document.location.protocol+"//"+document.location.hostname; var dartSiteUrl = ""; switch(MTVM.config.serverPlatform) { case "l": dartSiteUrl = "mtvhive.mtvi" + "/" + "us"; break; case "d": dartSiteUrl = "mtvhive.mtvi" + "/" + "us"; break; case "q": dartSiteUrl = "mtvhive.mtvi" + "/" + "us"; break; default: //live dartSiteUrl = "mtvhive.mtvi" + "/" + "us"; break; } //community if(host == MTVM.config.fluxCommunityUrl) {dartSiteUrl = dartSiteUrl + "/community";} return dartSiteUrl; })(); MTVM.config.dartSiteMeter = (function(){ var host = document.location.protocol+"//"+document.location.hostname; var dartSiteUrl = ""; switch(MTVM.config.serverPlatform) { case "l": dartSiteUrl = "musicmeter.mtvi" + "/" + "us"; break; case "d": dartSiteUrl = "musicmeter.mtvi" + "/" + "us"; break; case "q": dartSiteUrl = "musicmeter.mtvi" + "/" + "us"; break; default: //live dartSiteUrl = "musicmeter.mtvi" + "/" + "us"; break; } //community if(host == MTVM.config.fluxCommunityUrl) {dartSiteUrl = dartSiteUrl + "/community";} return dartSiteUrl; })(); MTVM.config.mgidPrefix = "mgid:uma:video:mtvmusic.com:"; MTVM.config.playlistMgidPrefix = "mgid:playlist:video:mtvmusic.com:"; MTVM.config.routes = { artistPage: "artist" }; MTVM.config.featuredDreIds = { firstCol: "3598", secondCol: "3594", thirdCol: "3600" } //MTVM.config.sponsorPageType = ""; MTVM.config.choiceStream = { staging: "http://stgapi.choicestream.com/instr/csanywhere.js", live: "http://api.choicestream.com/instr/csanywhere.js" } /******************************************************************************************/ /************************************ MTVM LANGUAGES ***********************************/ /******************************************************************************************/ MTVM.lang ={ site: {}, nav: {}, alphaBrowse: {}, utils: {}, playlist: { playAllPage: {}, translations:{} }, widgets: {}, video: {}, urls: {}, flux: { quickmenu: {}, comments: {}, usage: {}, ratings: {} } } MTVM.lang.site.name = "MTV HIVE"; MTVM.lang.site.url = "MTVHive.com"; MTVM.lang.site.embedConfigParams = "vl%3Den"; MTVM.lang.nav.random = "RANDOM"; MTVM.lang.nav.findArtist = "FIND ARTIST"; MTVM.lang.urls.charts = "top100"; MTVM.lang.urls.featured = "featured"; MTVM.lang.urls.artist = "artist"; MTVM.lang.urls.top100 = "top100"; MTVM.lang.utils.route_search = 'search'; MTVM.lang.utils.searchInputText = 'Search'; MTVM.lang.widgets.moreVideos = "More Videos"; MTVM.lang.widgets.moreFrom = "More from"; MTVM.lang.widgets.of = "of"; MTVM.lang.alphaBrowse.rename = "Browse By Letter"; MTVM.lang.playlist.rename = "Rename"; MTVM.lang.playlist.newPlaylist = "New Playlist"; MTVM.lang.playlist.playPrevious = "Play Previous"; MTVM.lang.playlist.playNext = "Play Next"; MTVM.lang.playlist.playAll = "Play All"; MTVM.lang.playlist.saveAsAPlaylist = "Save As a Playlist"; MTVM.lang.playlist.addToPlaylist = "Add to Playlist"; MTVM.lang.playlist.edit = "Edit"; MTVM.lang.playlist.shareThisPlaylist = "Share This Playlist"; MTVM.lang.playlist.by = "By"; MTVM.lang.playlist.memberPlaylists = "MTVM Member's Playlists"; MTVM.lang.playlist.quicklistTipTop = "Quick Tip"; MTVM.lang.playlist.quicklistTipBot = "You can reorder videos in your Playlist by typing a track number in the text boxes below."; MTVM.lang.playlist.areYouSure = "Are you sure you want to delete "; MTVM.lang.playlist.yes = "Yes"; MTVM.lang.playlist.no = "No"; MTVM.lang.playlist.listEmpty = "Your list is empty"; MTVM.lang.playlist.clickThe = "Click the"; MTVM.lang.playlist.buttonAdd = "button to add videos to your list"; MTVM.lang.playlist.order = "Order"; MTVM.lang.playlist.titleAndArtist = "Title & Artist"; MTVM.lang.playlist.deleteIt = "Delete"; MTVM.lang.playlist.dontHave = "You currently don't have any playlists. Click \"New Playlist\" below to get started."; MTVM.lang.playlist.addToPlaylist = "Add to Playlist"; MTVM.lang.playlist.quicklistEmptyMesg = "Your list is empty.Click the button to add videos to your list.Browse Videos to start adding."; MTVM.lang.playlist.browseVideo = "Browse Videos"; MTVM.lang.playlist.startAdding = "to start adding."; MTVM.lang.playlist.myPlaylists = "My Playlists"; MTVM.lang.playlist.justAdded = "Just Added"; MTVM.lang.playlist.myQuicklist = "My Quicklist"; MTVM.lang.playlist.myPlaylist = "My Playlist"; MTVM.lang.playlist.embed = "Embed Code"; MTVM.lang.playlist.createdBy = "created by"; MTVM.lang.playlist.containingVideo = "Playlists Containing This Video"; MTVM.lang.playlist.nextAiring = "Next airing"; MTVM.lang.playlist.seriesPalladia = "This originally aired as part of [SERIESNAME] on Palladia, the HD music television channel."; MTVM.lang.playlist.seriesNonPalladia = "This originally aired as part of [SERIESNAME] on [SERIESCHANNELNAME]."; MTVM.lang.playlist.buyDvd = "Buy DVD of the concert"; MTVM.lang.playlist.goFullScreen = "Go full screen for the best HD experience"; MTVM.lang.playlist.rolloverFirst = "Videos In This Playlist"; MTVM.lang.playlist.rolloverLastLeft = "and [COUNT] more videos"; MTVM.lang.playlist.rolloverLastRight = "watch this playlist"; MTVM.lang.playlist.mostRecentPlaylists = "Most Recent Playlists"; MTVM.lang.playlist.playAllPage.all = "All"; MTVM.lang.playlist.playAllPage.allOther = "All Other Videos"; MTVM.lang.playlist.playAllPage.allCollaborations = "All Collaborations"; MTVM.lang.playlist.playAllPage.allInterviews = "All Interviews"; MTVM.lang.playlist.playAllPage.videosRelatedTo = "Related Videos"; MTVM.lang.playlist.playAllPage.moreHDVideos = "More HD Videos"; MTVM.lang.playlist.playAllPage.allFeaturedConcertPerformances = "All Featured Concert Performances"; if(MTVM.config.playlistAppVersion != "1.0.2") { MTVM.lang.playlist.translations.us={ "Added":"Added!", "AddedToNewPlaylist":"has been added to your new playlist", "Adding":"Adding", "AddVideoTo":"Add Video To", "Cancel":"Cancel", "ClickToAddVideo":"Click to add this video to your playlist.", "ClickToAddVideos":"Click the {addButtonMarkup} to add videos to your list.", "ConfirmDelete":"Are you sure you want to delete", "CopyOf":"Copy of", "CopyPlaylist":"Copy playlist", "Created":"has been created.", "CreateNewPlaylist":"Create a new playlist", "DeleteList":"Delete list", "DescMaxLen":"max length {descMaxLen} chars", "Description":"Description", "DifferentOwnersMsg":"Current user and playlist owner are different", "Edit":"Edit", "EditList":"Edit List", "EditPagePreMsg":"Takes the user to an edit page", "EditPlaylist":"Edit Playlist", "Error":"Error", "ErrorMsg":"An error occurred while contacting the playlist serivce.", "Join":"Join", "JoinCommunity":"Join Community", "JoinNowPrompt":"Would you like to join now?", "JoinPagePreMsg":"Takes user to the community join page.", "JustAdded":"Just Added", "List":"List", "ListDeleted":"List Deleted", "ListDeletedMsg":"List successfully deleted.", "ListEditMsg":"This will edit a list.", "ListEmpty":"Your list is empty.", "ListPlayMsg":"This will play a list.", "ListSaveMsg":"This will save a list.", "ListShareMsg":"This will share a list.", "Loading":"Loading...", "LoginPagePreMsg":"Takes user to a login page.", "LoginPrompt":"Would you like to log in or create an account now?", "LoginRequired":"Login Required", "MakePlaylistPrivate":"Make playlist private", "MembershipRequired":"Membership Required", "MyPlaylist":"My Playlist", "MyPlaylists":"My Playlists", "MyQuicklist":"My Quicklist", "NamePlaylist":"Name Your Playlist", "NewPlaylist":"New Playlist", "NewPlaylistName":"New Playlist Name", "No":"No", "NoPlaylistMsg":"Sorry, that playlist is gone daddy gone.", "NoTitle":"No title", "NotMemberMsg":"You are not a member of this community.", "NowPlaying":"Now Playing", "Ok":"OK", "Oops":"Oops!", "PlayAll":"Play All", "PlayingItem":"Playing item", "PlaylistBy":"By", "PlaylistDeleted":"Playlist deleted", "PlaylistDeletedMsg":"The playlist you're looking for has been deleted.", "PlaylistName":"Playlist name", "PlaylistNameMsg":"Please enter a playlist name.", "PlaylistNamePrompt":"Give your playlist a name", "PlaylistSaved":"Your playlist has been saved.", "QuicklistConvertedMsg":"The quicklist has been converted.", "Rename":"Rename", "SaveAsPlaylist":"Save as a Playlist", "SavePlaylist":"Save Playlist", "Share":"Share", "SharePlaylist":"Share This Playlist", "SignIn":"Sign In", "Sorry":"Sorry", "Thumbnails":"Thumbnails", "TryLaterMsg":"Please try your request again later.", "UpdatePlaylist":"Update Playlist", "UserLogin":"User Login", "UserMismatch":"User Mismatch", "Video":"Video", "Videos":"Videos", "Yes":"Yes ", "YourPlaylist":"Your Playlist" } MTVM.lang.playlist.translations.it={ AddVideoTo: "Aggiungi%20video%20a", Added: "Aggiunto%21", AddedToNewPlaylist: "%E8%20stato%20aggiunto%20alla%20tua%20nuova%20playlist", Adding: "Sto%20aggiungendo", Cancel: "Cancella", ClickToAddVideo: "Clicca%20per%20aggiungere%20questo%20video%20alla%20tua%20playlist", ClickToAddVideos: "Clicca%20il%20%7BaddButtonMarkup%7D%20per%20aggiungere%20video%20alla%20tua%20lista.", ConfirmDelete: "Sei%20sicuro%20di%20voler%20cancellare", CopyOf: "Copia%20di", CopyPlaylist: "Copia%20playlist", CreateNewPlaylist: "Crea%20una%20nuova%20playlist", Created: "%E8%20stata%20creata.", DeleteList: "Cancella%20lista", DescMaxLen: "max%20%7BdescMaxLen%7D%20caratteri", Description: "Descrizione", DifferentOwnersMsg: "L%27utente%20corrente%20e%20il%20proprietario%20della%20playlist%20sono%20differenti", Edit: "Modifica", EditList: "Modifica%20Lista", EditPagePreMsg: "Porta%20l%27utente%20ad%20una%20pagina%20di%20modifica", EditPlaylist: "Modifica%20Playlist", Error: "Errore", ErrorMsg: "Si%20%E8%20verificato%20un%20errore%20contattanto%20il%20servizio%20delle%20playlist.", Join: "Entra", JoinCommunity: "Entra%20nella%20community", JoinNowPrompt: "Vuoi%20unirti%20ora%3F", JoinPagePreMsg: "Porta%20l%27utente%20alla%20pagina%20di%20registrazione", JustAdded: "Appena%20aggiunti", List: "Lista", ListDeleted: "Lista%20cancellata", ListDeletedMsg: "Lista%20cancellata%20con%20successo.", ListEditMsg: "Questo%20modificher%E0%20la%20lista.", ListEmpty: "La%20tua%20lista%20%E8%20vuota.", ListPlayMsg: "Questo%20riprodurr%E0%20la%20lista.", ListSaveMsg: "Questo%20salver%E0%20la%20lista.", ListShareMsg: "Questo%20condivider%E0%20la%20lista.", Loading: "Caricando...", LoginPagePreMsg: "Porta%20l%27utente%20alla%20pagina%20di%20login", LoginPrompt: "Vuoi%20loggarti%20o%20creare%20un%20account%3F", LoginRequired: "Login%20richiesto", MakePlaylistPrivate: "Rendi%20privata%20la%20playlist", MembershipRequired: "Registrazione%20richiesta", MyPlaylist: "My%20Playlist", MyPlaylists: "My%20Playlists", MyQuicklist: "My%20Quicklist", NamePlaylist: "Dai%20un%20nome%20alla%20Playlist", NewPlaylist: "Nuova%20Playlist", NewPlaylistName: "Nome%20nuova%20Playlist", No: "No", NoPlaylistMsg: "Spiacenti%2C%20la%20playlist%20non%20esiste%20pi%F9.", NoTitle: "Nessun%20titolo", NotMemberMsg: "Non%20sei%20un%20membro%20della%20community", NowPlaying: "In%20riproduzione", Ok: "OK", Oops: "Oops%21", PlayAll: "Riproduci%20tutte", PlayingItem: "In%20riproduzione", PlaylistBy: "Di", PlaylistDeleted: "Playlist%20cancellata", PlaylistDeletedMsg: "La%20playlist%20che%20stai%20cercando%20%E8%20stata%20cancellata.", PlaylistName: "Nome%20playlist", PlaylistNameMsg: "Prego%2C%20inserisci%20in%20nome%20della%20playlist.", PlaylistNamePrompt: "Dai%20un%20nome%20alla%20Playlist", PlaylistSaved: "La%20tua%20playlist%20%E8%20stata%20salvata.", QuicklistConvertedMsg: "La%20quicklist%20%E8%20stata%20convertita.", Rename: "Rinomina", SaveAsPlaylist: "Salva%20come%20playlist", SavePlaylist: "Salva%20playlist", Share: "Condividi", SharePlaylist: "Condividi%20questa%20Playlist", SignIn: "Login", Sorry: "Scusa", Thumbnails: "Miniatura", TryLaterMsg: "Prego%2C%20riprova%20pi%F9%20tardi.", UpdatePlaylist: "Aggiorna%20Playlist", UserLogin: "Login%20utente", UserMismatch: "Utente%20non%20riconosciuto", Video: "Video", Videos: "Video", Yes: "S%EC", YourPlaylist: "Tua%20Playlist" } MTVM.lang.playlist.translations.la={ AddVideoTo: "Agregar%20video%20a", Added: "Agregado%21", AddedToNewPlaylist: "fue%20agregado%20a%20su%20nuevo%20playlist", Adding: "Agregando", Cancel: "Cancelar", ClickToAddVideo: "Haz%20click%20en%20el%20bot%F3n%20para%20agregar%20v%EDdeo%20a%20tu%20lista.", ClickToAddVideos: "Haz%20click%20en%20el%20%7BaddButtonMarkup%7D%20para%20agregar%20videos%20a%20tu%20lista.", ConfirmDelete: "Estas%20seguro%20que%20quieres%20borrar", CopyOf: "Copia%20de", CopyPlaylist: "Copia%20playlist", CreateNewPlaylist: "Crea%20un%20nuevo%20playlist", Created: "fue%20creado.", DeleteList: "Borrar%20lista", DescMaxLen: "m%E1ximo%20de%20%7BdescMaxLen%7D%20caract%E9res", Description: "Descripci%F3n", DifferentOwnersMsg: "Usuario%20actual%20es%20distinto%20al%20due%F1o%20del%20playlist", Edit: "Editar", EditList: "Editar%20lista", EditPagePreMsg: "Lleva%20usuario%20a%20una%20p%E1gina%20para%20editar", EditPlaylist: "Editar%20Mi%20Playlist", Error: "Error", ErrorMsg: "Un%20error%20occuri%F3%20al%20contactar%20el%20servicio%20de%20playlist", Join: "%DAnase", JoinCommunity: "%DAnase%20a%20la%20comunidad", JoinNowPrompt: "%BFQuieres%20unirte%20ahora%3F", JoinPagePreMsg: "Lleva%20al%20usuario%20a%20la%20p%E1gina%20de%20membres%EDa.", JustAdded: "A%F1adido", List: "Lista", ListDeleted: "Lista%20borrada.", ListDeletedMsg: "Lista%20borrada.", ListEditMsg: "Esto%20editar%E1%20una%20lista.", ListEmpty: "Esto%20editar%E1%20una%20lista.", ListPlayMsg: "Esto%20iniciara%20una%20lista.", ListSaveMsg: "Esto%20guardara%20una%20lista.", ListShareMsg: "Esto%20compartira%20una%20lista", Loading: "Cargando...", LoginPagePreMsg: "Lleva%20al%20usuario%20a%20la%20p%E1gina%20de%20login.", LoginPrompt: "%BFQuieres%20registrarte%20o%20abrir%20una%20cuenta%20nueva%3F", LoginRequired: "Login%20obligatorio", MakePlaylistPrivate: "Ocultar%20playlist", MembershipRequired: "Membres%EDa%20Necesaria", MyPlaylist: "Mi%20Playlist", MyPlaylists: "Mi%20Playlists", MyQuicklist: "Mi%20Quicklist", NamePlaylist: "Dale%20un%20nombre%20a%20tu%20playlist", NewPlaylist: "Nuevo%20Playlist", NewPlaylistName: "Nuevo%20nombre%20de%20playlist", No: "No", NoPlaylistMsg: "Lo%20sentimos%2C%20esta%20lista%20ya%20no%20esta.", NoTitle: "Sin%20t%EDtulo", NotMemberMsg: "No%20eres%20miembro%20de%20esta%20comunidad.", NowPlaying: "Reproduciendo%20ahora", Ok: "OK", Oops: "%A1Oh%21", PlayAll: "Reproducir%20Todos", PlayingItem: "Reproduciendo%20ahora", PlaylistBy: "Por", PlaylistDeleted: "Playlist%20borrada", PlaylistDeletedMsg: "El%20playlist%20que%20est%E1s%20buscando%20fue%20borrado.", PlaylistName: "Nombre%20de%20Playlist", PlaylistNameMsg: "Por%20favor%20ingresa%20un%20nombre%20de%20playlist.", PlaylistNamePrompt: "Ponle%20un%20nombre%20a%20tu%20playlist", PlaylistSaved: "Tu%20playlist%20fue%20salvado.", QuicklistConvertedMsg: "El%20quicklist%20ha%20sido%20convertido%20.", Rename: "Renombrar", SaveAsPlaylist: "Guardar%20como%20Playlist", SavePlaylist: "Guardar%20Playlist", Share: "Compartir", SharePlaylist: "Comparte%20Este%20Playlist%20", SignIn: "Registrarse", Sorry: "Lo%20sentimos", Thumbnails: "Miniaturas", TryLaterMsg: "Por%20favor%20intenta%20m%E1s%20tarde.", UpdatePlaylist: "Actualizar%20playlist", UserLogin: "Login", UserMismatch: "Usuario%20no%20encontrado", Video: "Video", Videos: "V%EDdeos", Yes: "S%ED", YourPlaylist: "Su%20Playlist" } MTVM.lang.playlist.translations.es={ AddVideoTo: "Agregar%20video%20a", Added: "Agregado%21", AddedToNewPlaylist: "fue%20agregado%20a%20su%20nuevo%20playlist", Adding: "Agregando", Cancel: "Cancelar", ClickToAddVideo: "Haz%20click%20en%20el%20bot%F3n%20para%20agregar%20v%EDdeo%20a%20tu%20lista.", ClickToAddVideos: "Haz%20click%20en%20el%20%7BaddButtonMarkup%7D%20para%20agregar%20videos%20a%20tu%20lista.", ConfirmDelete: "Estas%20seguro%20que%20quieres%20borrar", CopyOf: "Copia%20de", CopyPlaylist: "Copia%20playlist", CreateNewPlaylist: "Crea%20un%20nuevo%20playlist", Created: "fue%20creado.", DeleteList: "Borrar%20lista", DescMaxLen: "m%E1ximo%20de%20%7BdescMaxLen%7D%20caract%E9res", Description: "Descripci%F3n", DifferentOwnersMsg: "Usuario%20actual%20es%20distinto%20al%20due%F1o%20del%20playlist", Edit: "Editar", EditList: "Editar%20lista", EditPagePreMsg: "Lleva%20usuario%20a%20una%20p%E1gina%20para%20editar", EditPlaylist: "Editar%20Mi%20Playlist", Error: "Error", ErrorMsg: "Un%20error%20occuri%F3%20al%20contactar%20el%20servicio%20de%20playlist", Join: "%DAnase", JoinCommunity: "%DAnase%20a%20la%20comunidad", JoinNowPrompt: "%BFQuieres%20unirte%20ahora%3F", JoinPagePreMsg: "Lleva%20al%20usuario%20a%20la%20p%E1gina%20de%20membres%EDa.", JustAdded: "A%F1adido", List: "Lista", ListDeleted: "Lista%20borrada.", ListDeletedMsg: "Lista%20borrada.", ListEditMsg: "Esto%20editar%E1%20una%20lista.", ListEmpty: "Esto%20editar%E1%20una%20lista.", ListPlayMsg: "Esto%20iniciara%20una%20lista.", ListSaveMsg: "Esto%20guardara%20una%20lista.", ListShareMsg: "Esto%20compartira%20una%20lista", Loading: "Cargando...", LoginPagePreMsg: "Lleva%20al%20usuario%20a%20la%20p%E1gina%20de%20login.", LoginPrompt: "%BFQuieres%20registrarte%20o%20abrir%20una%20cuenta%20nueva%3F", LoginRequired: "Login%20obligatorio", MakePlaylistPrivate: "Ocultar%20playlist", MembershipRequired: "Membres%EDa%20Necesaria", MyPlaylist: "Mi%20Playlist", MyPlaylists: "Mi%20Playlists", MyQuicklist: "Mi%20Quicklist", NamePlaylist: "Dale%20un%20nombre%20a%20tu%20playlist", NewPlaylist: "Nuevo%20Playlist", NewPlaylistName: "Nuevo%20nombre%20de%20playlist", No: "No", NoPlaylistMsg: "Lo%20sentimos%2C%20esta%20lista%20ya%20no%20esta.", NoTitle: "Sin%20t%EDtulo", NotMemberMsg: "No%20eres%20miembro%20de%20esta%20comunidad.", NowPlaying: "Reproduciendo%20ahora", Ok: "OK", Oops: "%A1Oh%21", PlayAll: "Reproducir%20Todos", PlayingItem: "Reproduciendo%20ahora", PlaylistBy: "Por", PlaylistDeleted: "Playlist%20borrada", PlaylistDeletedMsg: "El%20playlist%20que%20est%E1s%20buscando%20fue%20borrado.", PlaylistName: "Nombre%20de%20Playlist", PlaylistNameMsg: "Por%20favor%20ingresa%20un%20nombre%20de%20playlist.", PlaylistNamePrompt: "Ponle%20un%20nombre%20a%20tu%20playlist", PlaylistSaved: "Tu%20playlist%20fue%20salvado.", QuicklistConvertedMsg: "El%20quicklist%20ha%20sido%20convertido%20.", Rename: "Renombrar", SaveAsPlaylist: "Guardar%20como%20Playlist", SavePlaylist: "Guardar%20Playlist", Share: "Compartir", SharePlaylist: "Comparte%20Este%20Playlist%20", SignIn: "Registrarse", Sorry: "Lo%20sentimos", Thumbnails: "Miniaturas", TryLaterMsg: "Por%20favor%20intenta%20m%E1s%20tarde.", UpdatePlaylist: "Actualizar%20playlist", UserLogin: "Login", UserMismatch: "Usuario%20no%20encontrado", Video: "Video", Videos: "V%EDdeos", Yes: "S%ED", YourPlaylist: "Su%20Playlist" } } MTVM.lang.video.socialMesg = "Watch [ARTISTNAME] - [VIDEONAME] on MTVHive.com"; MTVM.lang.video.copy = "COPY"; MTVM.lang.video.featuring = "Featuring"; MTVM.lang.video.relatedVideos = "Related Videos"; MTVM.lang.video.seeAllFromArtist = "See all videos from this artist"; MTVM.lang.video.moreFrom = "More from"; MTVM.lang.video.moreShare = "More"; MTVM.lang.video.moreHDVideos = "More HD Videos"; MTVM.lang.video.videos = "Videos"; MTVM.lang.video.hd = "HD"; MTVM.lang.video.musicVideos = "Music Videos"; MTVM.lang.video.livePerformance = "Live Performance"; MTVM.lang.video.interview = "Interview"; MTVM.lang.video.flashUpdate = "You need to update your Flash Player to view this video. Update Now."; MTVM.lang.flux.comments.dateFormat = "mm.dd.yy hh:nnA/PM"; MTVM.lang.flux.comments.zeroCommentContent = "Be the first to comment!"; MTVM.lang.flux.comments.confirmDelete = "Are you sure you want to delete this comment?"; MTVM.lang.flux.comments.msgTooLong1 = "Your message is too long. A message can contain up to "; MTVM.lang.flux.comments.msgTooLong2 = "letters."; MTVM.lang.flux.comments.msgEmpty = "You are trying to publish an empty message. Please enter a valid message text."; MTVM.lang.flux.comments.days = "days"; MTVM.lang.flux.comments.hours = "hours"; MTVM.lang.flux.comments.minutes = "mins"; MTVM.lang.flux.comments.ago = "ago"; //boolean for drawing preposition in the right place MTVM.lang.flux.comments.agoPhraseGoesBeforeTime = false; /******************************************************************************************/ /************************************ MTVM LOGGER *****************************************/ /******************************************************************************************* USAGE: MTVM.logger.log(YOUR_DEBUG_MESSAGE, DEBUG_LEVEL); OR MTVM.log(YOUR_DEBUG_MESSAGE, DEBUG_LEVEL); MTVM.logger.log("my debug message here"); //will render a LOG level message MTVM.logger.log("my debug message here", 0); //will render a LOG level message MTVM.logger.log("my debug message here", "LOG"); //will render a LOG level message MTVM.logger.log("my INFO message here", 1); //will render an INFO level message MTVM.logger.log("my INFO message here", "INFO"); //will render an INFO level message MTVM.logger.log("my INFO message here", 2); //will render an WARNING level message MTVM.logger.log("my INFO message here", "WARNING"); //will render an WARNING level message NOTES: - CAN BE COMPLETELY ENABLED/DISABLED thru MTVM.config.debugLogEnabled - LOG Messages are avaiable to be viewed AFTER window.loaded event - On browsers w/o Firebug, able to capture console.log calls DEPENDENCIES: - jQuery TODO: Remove jquery dependency *******************************************************************************************/ /******************************************************************************************/ MTVM.logger = function() { var private = { LOG_LEVEL: ["LOG", "INFO", "WARNING"], initialized: false, __init: function(){ if(this.initialized == false) { if(document.getElementById(public.ELEMENT_ID_WRAPPER) == null) { this.__createNewDebugDiv(); } this.initialized = true; } }, //end __init __addEntryToDOM: function(tmpLogEntry) { public.CURRENT_LOG = public.CURRENT_LOG + tmpLogEntry; if(private.initialized == true) { document.getElementById(public.ELEMENT_ID_LOG).innerHTML = public.CURRENT_LOG; public.checkOptions(); } }, __createNewDebugDiv: function() { var debugOptions =""; var wrapper = document.createElement("div"); wrapper.id = public.ELEMENT_ID_WRAPPER; var debugButton = document.createElement("div"); var debugButtonText = document.createTextNode("x"); debugButton.appendChild(debugButtonText); debugButton.id = public.ELEMENT_ID_DEBUG_BUTTON; debugButton.onclick = public.show; document.body.insertBefore(debugButton, document.body.firstChild); document.body.insertBefore(wrapper, document.body.firstChild); for(var i=0; i '+private.LOG_LEVEL[i]+' '; } document.getElementById(public.ELEMENT_ID_WRAPPER).innerHTML ='
'+ debugOptions + '
'+ '
'; }, //end __createNewDebug __saveOptions: function() { for(var i=0; i < private.LOG_LEVEL.length; i++) { MTVM.util.setCookie(public.ELEMENT_ID_WRAPPER+private.LOG_LEVEL[i], document.getElementById("mtvm-debug-options-"+private.LOG_LEVEL[i]).checked, 3650) } }, //end __saveOptions __loadOptions: function() { for(var i=0; i =private.LOG_LEVEL.length?0:level; classname = public.CSS_STYLE_DEBUGTYPE+'-'+private.LOG_LEVEL[debugLevel]; break; case true: if(level in private.LOG_LEVEL) { classname = public.CSS_STYLE_DEBUGTYPE+'-'+level; } else { classname = public.CSS_STYLE_DEBUGTYPE+'-'+private.LOG_LEVEL[0]; } break; } }else { classname = public.CSS_STYLE_DEBUGTYPE+'-'+private.LOG_LEVEL[0]; } tmpLogEntry = "
"+ "
"+timestamp+"
"+ "
"+mesg+"
"+ "
"; private.__addEntryToDOM(tmpLogEntry); } }, //end log printToDom: function() { if(public.ENABLE_LOG()) { if(private.initialized == false) { private.__init(); document.getElementById(public.ELEMENT_ID_LOG).innerHTML = public.CURRENT_LOG; } document.getElementById(public.ELEMENT_ID_WRAPPER).style.display = "block"; private.__loadOptions(); public.checkOptions(); } }, //end printToDom show: function() { if(document.getElementById(public.ELEMENT_ID_LOG).style.display == 'none' || document.getElementById(public.ELEMENT_ID_LOG).style.display == '') { document.getElementById(public.ELEMENT_ID_LOG).style.display='block'; document.getElementById(public.ELEMENT_ID_OPTIONS).style.display='block'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.width='30%'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.height='auto'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.maxHeight='50%'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.border="dashed #aaa 1px"; } else { document.getElementById(public.ELEMENT_ID_OPTIONS).style.display='none'; document.getElementById(public.ELEMENT_ID_LOG).style.display='none'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.width='20px'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.height='20px'; document.getElementById(public.ELEMENT_ID_WRAPPER).style.border="0px"; } }, //end show checkOptions: function() { for(var i=0; i < private.LOG_LEVEL.length; i++) { switch(document.getElementById(public.ELEMENT_ID_OPTIONS+"-"+private.LOG_LEVEL[i]).checked) { case true: $J('.'+public.CSS_STYLE_DEBUGTYPE+'-'+private.LOG_LEVEL[i]).css("display", "block"); break; case false: $J('.'+public.CSS_STYLE_DEBUGTYPE+'-'+private.LOG_LEVEL[i]).css("display", "none"); break; } } private.__saveOptions(); } //end checkOptions }; return(public); }(); MTVM.log = MTVM.logger.log; if (typeof console == "undefined") { console = {}; console.log = MTVM.logger.log; } /************************* EventsManager 1. I want to use it for DOM Events. - MTVM.EventsManager is acting more like a wrapper around jQuery/PrototypeJS event binding in this mode. - IMPORTANT: DOM listeners are dispatched out to listen right before open BODY tag. [SAMPLE CODE] >>>>>>>>>>> Create Your DOM Event <<<<<<<<<<<< MTVM.EventsManager.events.onSearchBoxClick = new MTVM.EventsManager.events.BaseEvent() MTVM.EventsManager.events.onSearchBoxClick.invoke = function() //invoke function is required for DOM event { if(typeof jQuery != "undefined") { $J(window).load( //REQUIRED function() { //YOUR CUSTOM STUFF GOES HERE: $J('#searchInputBox').click(function(){ MTVM.EventsManager.events.onSearchBoxClick.__dispatchAllCallbacks(); }) } ) } } //SOME EXPLANATION: //$J(window).load() is required to wrap around all non-domready/window loaded events, ie, click events, mouse events, etc. etc. //This is because DOM listeners are dispatched out to listen before body tag and the rest of the dom are loaded. //MORE RAMBLING: //You can add your DOM Event's invoke function as a listener of MTVM.eventsManager.events.onWindowLoaded //or MTVM.eventsManager.events.onDomLoaded. By doing so, you wouldnt need to use $J(window).load to wrap your DOM event. >>>>>>>>>>> Add Event Listeners <<<<<<<<<<<< MTVM.EventsManager.addListener("onSearchBoxClick", myFunctionhere, myFunctionContext); OR MTVM.EventsManager.events.onSearchBoxClick.addListener(myFunctionhere, myFunctionContext); //myFunctionContext is not a required value. It's only necessary if you want to fire the callback within the scope you want to specify. [/END SAMPLE CODE] 2. I want to use it for Non-DOM Events - Any custom event you want to broadcast/listen on. [SAMPLE CODE] >>>>>>>>>>> Create Custom Event <<<<<<<<<<<< MTVM.EventsManager.events.onSomethingIsReady = new MTVM.EventsManager.events.BaseEvent('NOT_DOM_EVENT'); //"NOT_DOM_EVENT" can be any value except null. If null, EventsManager will treat it as a DOM event by default. >>>>>>>>>>> Add Event Listeners <<<<<<<<<<<< MTVM.EventsManager.addListener("onSomethingIsReady", myFunctionhere, myFunctionContext); OR MTVM.EventsManager.events.onSomethingIsReady.addListener(myFunctionhere, myFunctionContext); //myFunctionContext is not a required value. It's only necessary if you want to fire the callback within the scope you want to specify. >>>>>>>>>>>Broadcast the EVENT <<<<<<<<<<<< Broadcast the event and let loose all your callbacks MTVM.EventsManager.broadcast("onSomethingIsReady"); [/END SAMPLE CODE] TODO: A new listerner mode for NON-DOM listeners to be persistent. Ie, the listener is not popped out after the event is broadcasted. *************************/ MTVM.EventsManager = { events: {}, dispatchDOMListeners: function() //this is a special dispatch function for DOM event listeners. Must be fired before BODY tag { MTVM.logger.log("MTVM.EventsManager.dispatchDOMListeners ", 1); for(var event in this.events) { if(typeof this.events[event].invoke == "function" && this.events[event].eventType == 'DOM') { this.events[event].invoke(); } } }, addListener: function(myEvent, callbackFunc, callbackContext) //shortcut function for MTVM.EventsManager.events.onMYEVENT.addListener() { try{ MTVM.logger.log("MTVM.EventsManager.addListener " + myEvent, 1); MTVM.EventsManager.events[myEvent].addListener(callbackFunc, callbackContext); } catch(e) { MTVM.logger.log("MTVM.EventsManager.addListener "+e, 2); } }, broadcast: function(myEvent) { try{ MTVM.logger.log("MTVM.EventsManager.broadcast " + myEvent, 1); MTVM.EventsManager.events[myEvent].__dispatchAllCallbacks(); }catch(e) { MTVM.logger.log("MTVM.EventsManager.broadcast: "+myEvent+": "+e, 2); } }, removeAllListeners: function(myEvent) //remove all listeners for an event { try{ MTVM.logger.log("MTVM.EventsManager.removeAllListeners " + myEvent, 1); if(MTVM.EventsManager.events[myEvent]){ MTVM.EventsManager.events[myEvent].__removeAllCallbacks(); } }catch(e) { MTVM.logger.log("MTVM.EventsManager.removeAllListeners: "+myEvent+": "+e, 2); } } } MTVM.EventsManager.events.BaseEvent = function(eventType) { this.eventType = eventType?eventType:"DOM"; //eventType indicates whether it's a DOM event or a regular event. DOM event listeners will be activated/dispatched before BODY tag comes up. this.callbacks = new Array(); //each element of the array contains a hash with two values: callbackFunction and callbackContext } MTVM.EventsManager.events.BaseEvent.prototype.addListener = function(callbackFunc, callbackContext) //you can add the context which the callback function is scoped in. { MTVM.logger.log("MTVM.EventsManager.events.BaseEvent adding listener " + callbackFunc +"
eventType ="+this.eventType, 1); this.callbacks.push({}); this.callbacks[this.callbacks.length-1]['callbackFunction'] = callbackFunc; this.callbacks[this.callbacks.length-1]['callbackContext'] = callbackContext; } MTVM.EventsManager.events.BaseEvent.prototype.__getAndRemoveLastCallback = function() //not in use { var callbackObj = this.callbacks[this.callbacks.length-1]; this.callbacks.pop(); MTVM.logger.log("MTVM.EventsManager.events.BaseEvent __getAndRemoveLastCallback " + callbackObj, 1); return callbackObj; } MTVM.EventsManager.events.BaseEvent.prototype.__getAndRemoveFirstCallback = function() { var callbackObj = this.callbacks[0]; this.callbacks.shift(); MTVM.logger.log("MTVM.EventsManager.events.BaseEvent __getAndRemoveFirstCallback " + callbackObj, 1); return callbackObj; } MTVM.EventsManager.events.BaseEvent.prototype.__removeAllCallbacks = function() { var emptyArray = new Array(); this.callbacks = emptyArray; MTVM.logger.log("MTVM.EventsManager.events.BaseEvent __removeAllCallbacks ", 1); } MTVM.EventsManager.events.BaseEvent.prototype.__dispatchAllCallbacks = function() { var currCallback = null; var arrayLength = this.callbacks.length MTVM.logger.log("MTVM.EventsManager.events.BaseEvent __dispatchAllCallbacks ", 1); for(var i=0; iUpdate Now."; MTVM.lang.flux.comments.dateFormat = "mm.dd.yy hh:nnA/PM"; MTVM.lang.flux.comments.zeroCommentContent = "Be the first to comment!"; MTVM.lang.flux.comments.confirmDelete = "Are you sure you want to delete this comment?"; MTVM.lang.flux.comments.msgTooLong1 = "Your message is too long. A message can contain up to "; MTVM.lang.flux.comments.msgTooLong2 = "letters."; MTVM.lang.flux.comments.msgEmpty = "You are trying to publish an empty message. Please enter a valid message text."; MTVM.lang.flux.comments.days = "days"; MTVM.lang.flux.comments.hours = "hours"; MTVM.lang.flux.comments.minutes = "mins"; MTVM.lang.flux.comments.ago = "ago"; //boolean for drawing preposition in the right place MTVM.lang.flux.comments.agoPhraseGoesBeforeTime = false; MTVM.flux = {} MTVM.flux.context = {}; MTVM.flux.loadContext = function(){ //widgets3 only document.write(''); document.write(''); }; MTVM.flux.getWidgetVersion = function() { if(typeof Flux !="undefined") { if(typeof Flux.WDK != "undefined") { return Flux.WDK; } else { return "2.0"; } }else{return null;} } MTVM.flux.getCommunityUcid =function(){ return MTVM.config.fluxCommunityUcid; } MTVM.flux.isUserLoggedInFlux = function(){ var result = false; if(typeof Flux == "undefined") {return false;} else { switch(MTVM.flux.getWidgetVersion()) { default: if(typeof Flux != "undefined" && typeof Flux.context != "undefined" && Flux.context.user != null) { return MTVM.flux.getUserUcid()?true:false; }else{ return false; } break; } } }; MTVM.flux.isUserLoggedInFlux4 = function(){ var result = false; if(typeof window.Widgets4Context != "undefined" && window.Widgets4Context.user != null) { result = true; }else{ result = false; } return result; }; MTVM.flux.isUserCommunityMember = function(){ var result = false; if(typeof Flux == "undefined") {return false;} else { switch(MTVM.flux.getWidgetVersion()) { case "2.0": if(typeof Flux.Context != "undefined" && Flux.Context._isCommunityMember!=null && Flux.Context._isCommunityMember!=""){return true;}else {return false;} break; default: if(typeof Flux.context != "undefined" && Flux.context!=null) { if(typeof Flux.context.user != "undefined" && Flux.context.user != null) { return Flux.context.user.communityMember; }else{return false;} }else if(typeof Flux.Context != "undefined") { return Flux.Context.isCommunityMember(); }else{ return ""; } break; } } }; MTVM.flux.isUserCommunityMemberFlux4 = function(){ var result = false; if(typeof window.Widgets4Context != "undefined" && window.Widgets4Context.user != null) { result = window.Widgets4Context.user.communityMember }else{ result = false; } return result; }; MTVM.flux.getUserUcid = function(){ switch(MTVM.flux.getWidgetVersion()) { case "2.0": if(typeof Flux != "undefined" && typeof Flux.Context != "undefined") {return Flux.Context.getLoggedUserUcid();} else {return null;} break; default: if(typeof Flux.context != "undefined" && Flux.context.user != null) { return Flux.context.user.ucid?Flux.context.user.ucid:""; }else{ return ""; } break; } }; MTVM.flux.getUserUcidFlux4 = function(){ if(typeof window.Widgets4Context != "undefined" && window.Widgets4Context.user != null) { return window.Widgets4Context.user.ucid?window.Widgets4Context.user.ucid:""; }else{ return ""; } }; MTVM.flux.communityUrl = (function(){return MTVM.config.fluxCommunityUrl;})(); /* if(MTVM.flux.getWidgetVersion() == "3.0") { MTVM.flux.loadContext(); } */ MTVM.flux.onSignIn = function (){ MTVM.services.ui.showMyPlaylists(); //show tab if login again after logout //MTVM.services.ui.showFluxEditAccount(); } /**************************************/ /********** MTVM UTILS *****************/ /* Dependencies: -MTVM.util.checkFlashVersion requires AC_OETags.js */ /**************************************/ //Additional methods for String String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return this.replace(/^\s+/,""); } String.prototype.rtrim = function() { return this.replace(/\s+$/,""); } String.prototype.capitalize = function(){ return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } ); }; if (!document.getElementsByClassName) { document.getElementsByClassName = function (cn) { var rx = new RegExp("\\b" + cn + "\\b"), allT = document.getElementsByTagName("*"), allCN = [], i = 0, a; while (a = allT[i++]) { if (a.className && a.className.indexOf(cn) + 1) { if(a.className===cn){ allCN[allCN.length] = a; continue;} rx.test(a.className) ? (allCN[allCN.length] = a) : 0; } } return allCN; } } MTVM.util.getServerPlatform = function() { if(document.location.hostname.indexOf("mtvi.com")>-1) { if(document.location.hostname.indexOf("-l.mtvi.com")>-1) { return "l"; //local } if(document.location.hostname.indexOf("-d.mtvi.com")>-1) { return "d"; } else if(document.location.hostname.indexOf("-q.mtvi.com")>-1) { return "q"; } } else {return "live";} } MTVM.util.showVideoDetails = function(videoId, userUCID, options) { var ptr = this; var options = options || {}; if (userUCID==null) { var userUCIDs=["ABE43F02023FE4AB0001023FE4AB","2E603B02023B602E0001023B602E"]; var matched = false; for(var i=0; i < playlistsContainingVideoObj.playlists.length; i++) { for (x in userUCIDs){ if (playlistsContainingVideoObj.playlists[i].userUcid == userUCIDs[x]){ userUCID = playlistsContainingVideoObj.playlists[i].userUcid; matched = true; break; } } if (matched) break; } } var url = "/sitewide/dataservices/allVideosInUsersPlaylists/"; var ajaxType = ('ajaxType' in options) ? options.ajaxType : 'GET'; var data = ('data' in options) ? options.data : 'userUCID='+userUCID; var dataType = ('dataType' in options) ? options.dataType : 'json'; var timeout = ('timeout' in options) ? options.timeout : 10000; this.hideAllDetails = function(){ $J("#videoDetails120Minutes").css('display', 'none'); $J("#videoDetailsWeirdVibes").css('display', 'none'); $J("#videoDetailsNormal").css('display', 'none'); } if (videoId==null){ this.hideAllDetails(); $J("#videoDetailsNormal").css('display', 'block'); }else{ try{ $J.ajax({ url: url, type: ajaxType, data: data, dataType: dataType, timeout: timeout, error: function(){ ptr.errorHandler(); }, success: function(json) { ptr.successHandler(json); } }); } catch(e){ ptr.hideAllDetails(); $J("#videoDetailsNormal").css('display', 'block'); } } this.errorHandler = function(){ ptr.hideAllDetails(); $J("#videoDetailsNormal").css('display', 'block'); } this.successHandler = function(json){ //console.log("great success!"); var videoFound = false; var i=0; while (i < json.playlists.length && !videoFound){ var j=0; while (j < json.playlists[i].videos.length && !videoFound){ if (json.playlists[i].videos[j].id == videoId){ videoFound = true; } j++; } i++; } if (videoFound){ if (userUCID == "2E603B02023B602E0001023B602E"){ $J("#videoDetails120Minutes").css('display', 'block'); }else if (userUCID == "ABE43F02023FE4AB0001023FE4AB"){ $J("#videoDetailsWeirdVibes").css('display', 'block'); }else { $J("#videoDetailsNormal").css('display', 'block'); } } else { ptr.hideAllDetails(); $J("#videoDetailsNormal").css('display', 'block'); } } } MTVM.util.parseUrlParamsToJSON = function() { var searchString = document.location.search; var jsonObj = null; if(searchString.length>1) { searchString = searchString.substr(1, searchString.length); //remove leading ? searchString = searchString.replace(/=/g, ":'"); searchString = searchString.replace(/&/g, "',"); searchString = searchString.replace(/&/g, "',"); searchString = "{"+searchString+"'}"; eval ("jsonObj="+searchString); } return jsonObj; } MTVM.util.matchingValueInArray = function(arrayToMatch, matchingVal){ var matching = false; if (arrayToMatch && matchingVal){ for (var i=0; i0){ if (timeStr.indexOf('E')<0){ timeStr = timeStr.slice(timeStr.indexOf("S")+2, timeStr.length); }else{ timeStr = timeStr.slice(timeStr.indexOf("S")+2, timeStr.indexOf("|")); } }else if (paramName == 'E' && timeStr.indexOf('E')>0){ timeStr = timeStr.slice(timeStr.indexOf("E")+2, timeStr.length); } else if (paramName == 'S' && timeStr.indexOf("S")<0) { timeStr = "0m0s"; } else if (paramName == 'E' && timeStr.indexOf("E")<0) { timeStr = "999999m"; } var minStr = timeStr.slice(0, timeStr.indexOf("m")); var secStr = timeStr.slice(timeStr.indexOf("m")+1, timeStr.indexOf("s")); if(timeStr.indexOf("m")<0 || typeof minStr == "undefined" || minStr == ""){ minStr = 0; } if(timeStr.indexOf("s")<0 || typeof secStr == "undefined" || secStr == ""){ secStr = 0; } return totalSec = (minStr * 1) * 60 + secStr * 1; } MTVM.util.getCookie = function(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } MTVM.util.setCookie = function(c_name,value,expiredays, path) { var exdate=new Date(); var cookiePath = path?path:"/"; exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+"; path="+cookiePath; } /***************** ELLIPSIS / TRUNCATE TEXT *******************/ /***USAGE: "elementID" is the element you want to operate on***/ /*** if no elementId available, you can pass the html element itself as the context of "this"***/ /***"length" is the length you want the element to truncate at*/ /**************************************************************/ MTVM.util.truncateText = function(elementId, truncateLength, htmlElement) { var p = null; if(elementId) {p = document.getElementById(elementId);} else {p = htmlElement;} if (p) { var trunc = p.innerHTML; if (trunc.length> truncateLength) { /* Truncate the content of the element, then go back to the end of the previous word to ensure that we don't truncate in the middle of a word */ trunc = trunc.substring(0, truncateLength); trunc = trunc.replace(/\w+$/, ''); /* Add an ellipses to the end and make it a link that expands the paragraph back to its original size */ trunc += '' + '...<\/a>'; p.innerHTML = trunc; } } } /***************** ELLIPSIS / TRUNCATE STRING **************************/ /*truncateMode: "soft" will split by the space */ /*truncateMode: "hard" (default case) will split by the exact character*/ /***********************************************************************/ MTVM.util.truncateString = function(textString, truncateLength, truncateMode ) { if(truncateMode == null || truncateMode == "") { truncateMode = "hard"; } switch(truncateMode) { case 'soft': var bits, i; bits = textString.split(''); if (bits.length > truncateLength) { for (i = bits.length - 1; i > -1; --i) { if (i > truncateLength) { bits.length = i; } else if (' ' === bits[i]) { bits.length = i; break; } } bits.push('...'); } textString = bits.join(''); break; default: if (textString.length> truncateLength) { textString = textString.substring(0, truncateLength); /* Add an ellipses to the end*/ textString += '...'; } } return textString; } MTVM.util.flattenString = function (str) { var re = /[^0-9A-Za-z\s]/g; var flattenedStr = str.replace(re, ""); var re2 = /\s+/g; flattenedStr = flattenedStr.replace(re2, "_"); flattenedStr = MTVM.util.truncateString(flattenedStr, 10); return flattenedStr; } MTVM.util.escapeQuotes = function(string) { string = string.replace(/\'/g, "'"); string = string.replace(/\"/g, """); return string; } MTVM.util.escapeSearch = function(string) { string = string.replace(/&/g, "&"); string = string.replace(//g, ">"); string = string.replace(/"/g, """); string = string.replace(/'/g, "'"); return string; } MTVM.util.Clipboard = {} MTVM.util.Clipboard.copyEmbed = function() { document.getElementById('videoEmbedInput').select(); return document.getElementById('videoEmbedInput').value; } MTVM.util.Clipboard.copyUrl = function() { document.getElementById('urlInput').select(); return document.getElementById('urlInput').value; } MTVM.util.checkFlashVersion = function (requiredMajorVersion, requiredMinorVersion, requiredRevision) { var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); if (hasRequestedVersion) {return true;} else{ return false; } } MTVM.util.randomize = function(max) //randomize a number from 0 to max { var random = 0; random = Math.floor(Math.random()*max); return(random); } /***************** ELLIPSIS / TRUNCATE WORD WITH CONSIDERATION of SPACE *************/ /*** USAGE: "elementID" is the element you want to operate on *************/ /*** if no elementId available, you can pass the html element itself *************/ /*** as the context of "this""length" is the length you want the *************/ /*** element to truncate at. *************/ /** elementId: id of the html element htmlElement: when there is no html element id avail, you can pass in "this" with the script call. truncateLength: the length where you want to truncate a word. breakType: dictates how the word will be broken up. 1 = space, 2 =
*/ /************************************************************************************/ MTVM.util.truncateWord= function(elementId, htmlElement, truncateLength, breakType){ var theElement = null; if(elementId) {theElement = document.getElementById(elementId);} else {theElement = htmlElement;} if (theElement) { var entireText = theElement.innerHTML; } } /************** LISTEN ON KEYSTROKE *******************/ MTVM.util.keyListener= function (evnt, element) { var keyCode =""; var processKey = { enter: function(element) //ENTER key { MTVM.util.submitSearch(element.id); } } if(!evnt){evnt = window.event;} //for IE if (evnt.keyCode) keyCode = evnt.keyCode; else if (evnt.which) keyCode = evnt.which; switch(keyCode) { case 13: processKey.enter(element);break; //enter key } } MTVM.util.launchLoadingDialog = function() { $J('body').append(''); $J('#jquery-dialog-loading').html(''); $J('#jquery-dialog-loading').dialog( { closeOnEscape: false, dialogClass: 'musicmeter-loading-dialog', draggable: false, modal: true, resizable: false, autoResize: true, position: 'center', height: 100, width: 100 } ) } MTVM.util.submitSearch= function(inputElementId) { var value = null; var serverName = null; if((document.getElementById(inputElementId)).value!='' && (document.getElementById(inputElementId)).value !=null) { value = (document.getElementById(inputElementId)).value; //value = (document.getElementById(inputElementId)).value.replace(/^\s*|\s(?=\s)|\s*$/g, "").toLowerCase(); //(document.getElementById(inputElementId)).value = value; value = escape(value); //document.location = MTVM.config.serverHostName+'/'+MTVM.lang.utils.route_search+'/?term='+value+'&filter=music_video&mw=0&filter2=live_performance'; //document.location = '/'+MTVM.lang.utils.route_search+'/?term='+value+'&filter=music_video&mw=0&filter2=live_performance'; document.location = 'http://www.mtvhive.com/search/?term='+value; } } MTVM.util.checkSearchBox= function(inputElementId) { var value = null; var pass = false; if((document.getElementById(inputElementId)).value!='' && (document.getElementById(inputElementId)).value !=null) { /* value = (document.getElementById(inputElementId)).value; if (value == MTVM.lang.utils.searchInputText){ document.getElementById(inputElementId).focus(); } else if (value != MTVM.lang.utils.searchInputText){ pass = true; } */ pass = true; } return pass; }, MTVM.util.clearDefSearchValue= function(obj){ var value = obj.value; if(value.toUpperCase() == MTVM.lang.utils.searchInputText.toUpperCase() && (window._searchFieldClicked== false || window._searchFieldClicked == null)) { obj.value = ""; window._searchFieldClicked = true; } } MTVM.util.hideThumbnails= function(obj) { var col = $J('.videoThumbWrap'); var col2 = $J('.artistThumbWrap'); $J('.listView').css("color","#534c42"); $J('.thumbnailView').css("color","#f90464"); if(col!= null && col != "") { for(i=0; i '; franchiseOverlay += '
'+ linkText +'
'; if ("overlayImage" in VideoThumbOverlays[i]){ franchiseOverlay = '
'; } //document.getElementById("thumbOverlay"+vidToMatch).innerHTML = franchiseOverlay; $J('.thumbOverlay'+vidToMatch).html(franchiseOverlay); //document.write(franchiseOverlay); } } if (contentListIdsToMatch!=null){ var listOfcontentListToMatch = (contentListIdsToMatch.indexOf(",")) ? contentListIdsToMatch.split(",") : new Array(contentListIdsToMatch); var listOfContentListIdsArray = listOfContentListIds.split(","); for (var y=0; y < listOfcontentListToMatch.length; y++){ for (var x=0; x < listOfContentListIdsArray.length; x++){ if ($J.trim(listOfContentListIdsArray[x]) == $J.trim(listOfcontentListToMatch[y])){ var franchiseOverlay = '
 
'; franchiseOverlay += '
'+ linkText +'
'; if ("overlayImage" in VideoThumbOverlays[i]){ franchiseOverlay = '
'; } $J('.thumbOverlay'+vidToMatch).html(franchiseOverlay); } } } } } } } MTVM.util.popNewWindow = function(url, wName, misc) { if(misc == null || misc == "") { misc = 'toolbar=1,status=1,width=800,height=436'; } if(url !="") { var newWindow = window.open(url, wName, misc); } } MTVM.util.socialNetwork ={ shareUrl: "", shortUrl: "", mesg: "", embed: "" }; MTVM.util.socialNetwork.shortenUrl = function() { var options = options || {}; options.url = "/sitewide/dataservices/shortenUrl/?showComments=off&longUrl="+MTVM.util.socialNetwork.shareUrl; var url = ('url' in options) ? options.url : ''; var ajaxType = ('ajaxType' in options) ? options.ajaxType : 'GET'; var data = ('data' in options) ? options.data : ''; var dataType = ('dataType' in options) ? options.dataType : 'json'; var timeout = ('timeout' in options) ? options.timeout : 20000; try{ $J.ajax({ url: url, type: ajaxType, data: data, dataType: dataType, timeout: timeout, error: function(){ errorHandler(); }, success: function(json) { successHandler(json); } }); } catch(e){ MTVM.logger.log("MTVM.util.socialNetwork.shortenUrl ajax failed: "+e, 2); MTVM.util.socialNetwork.shortUrl = "FAILED"; MTVM.EventsManager.broadcast('onShortUrlReady'); } errorHandler = function() { MTVM.logger.log("MTVM.util.socialNetwork.shortenUrl ajax failed: ", 2); MTVM.util.socialNetwork.shortUrl = "FAILED"; MTVM.EventsManager.broadcast('onShortUrlReady'); } successHandler = function(json) { if(json.shortUrl && json.shortUrl != "") { MTVM.util.socialNetwork.shortUrl = json.shortUrl; }else { MTVM.util.socialNetwork.shortUrl = "FAILED"; } MTVM.EventsManager.broadcast('onShortUrlReady'); } } MTVM.util.twitter = {} MTVM.util.twitter.shareIt = function() { if($J.browser.msie == false){MTVM.util.popNewWindow('about:blank','share');} MTVM.EventsManager.addListener('onShortUrlReady', MTVM.util.twitter.shortenAndPop); MTVM.util.socialNetwork.shortenUrl(); } MTVM.util.twitter.shortenAndPop = function() { if(MTVM.util.socialNetwork.shortUrl!="" && MTVM.util.socialNetwork.shortUrl !="FAILED") { MTVM.util.twitter.fullUrl = "http://twitter.com/home?status="+encodeURIComponent(MTVM.util.socialNetwork.mesg)+" "+MTVM.util.socialNetwork.shortUrl; } else { MTVM.util.twitter.fullUrl = "http://twitter.com/home?status="+encodeURIComponent(MTVM.util.socialNetwork.mesg)+" "+MTVM.util.socialNetwork.shareUrl; } MTVM.util.popNewWindow(MTVM.util.twitter.fullUrl, "share"); } MTVM.util.facebook = {} MTVM.util.facebook.shareIt = function() { if($J.browser.msie == false) {MTVM.util.popNewWindow("about:blank","share");} MTVM.util.facebook.click(MTVM.util.socialNetwork.shareUrl, MTVM.util.socialNetwork.mesg); } MTVM.util.facebook.click = function(u, t) { u = u?u:location.href; t = t?t:document.title; window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'share','toolbar=0,status=0,width=626,height=436'); } MTVM.util.myspace ={} MTVM.util.myspace.shareIt = function() { if($J.browser.msie == false){MTVM.util.popNewWindow("about:blank","share");} MTVM.util.myspace.getThis(MTVM.util.socialNetwork.mesg, MTVM.util.socialNetwork.embed, MTVM.util.socialNetwork.shareUrl); } MTVM.util.myspace.getThis= function(T, C, U, L) { L = L?L:U; var targetUrl = 'http://www.myspace.com/Modules/PostTo/Pages/?' + 't=' + encodeURIComponent(T)+ '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L; window.open(targetUrl, 'share','toolbar=0,status=0,width=626,height=436'); } MTVM.util.sonico ={} MTVM.util.sonico.shareIt = function() { if($J.browser.msie == false){MTVM.util.popNewWindow("about:blank","share");} MTVM.util.sonico.share(MTVM.util.socialNetwork.shareUrl, MTVM.util.socialNetwork.mesg); } MTVM.util.sonico.share= function(title, loc) { window.open('http://www.sonico.com/share.php?title='+encodeURIComponent(title)+'&url='+encodeURIComponent(loc),'share','toolbar=0,status=0,width=626,height=436'); } MTVM.util.convertStringToArray = function() //converts space seperated string into an array { } MTVM.util.isUserScreenHDCapable = function() //returns if user can view HD videos or not { if(typeof __isHD != "undefined" && __isHD == true) //__isHD is global var set at top of all vid/playlist/hdhub pages { if(screen.height>=768 && screen.width>=768) { return true; }else{ return false; } }else{ return false; } } MTVM.util.MD5 = function (string) { /* MD5 (Message-Digest Algorithm) * http://www.webtoolkit.info/ **/ function RotateLeft(lValue, iShiftBits) { return (lValue<>>(32-iShiftBits)); } function AddUnsigned(lX,lY) { var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } } function F(x,y,z) { return (x & y) | ((~x) & z); } function G(x,y,z) { return (x & z) | (y & (~z)); } function H(x,y,z) { return (x ^ y ^ z); } function I(x,y,z) { return (y ^ (x | (~z))); } function FF(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function GG(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function HH(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function II(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function ConvertToWordArray(string) { var lWordCount; var lMessageLength = string.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) { lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<>>29; return lWordArray; }; function WordToHex(lValue) { var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) { lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); } return WordToHexValue; }; function Utf8Encode(string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; string = Utf8Encode(string); x = ConvertToWordArray(string); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k=0;k'+addThisTxt+''; document.getElementById('addthis_toolbox').appendChild(a); } MTVM.util.bind = function(scope, fn) { var args = arguments; return function(){fn.apply(scope, args);}; } MTVM.util.isIE = function() { return (navigator.appName.indexOf('msie')>-1 || navigator.appName.indexOf('Microsoft')>-1); } MTVM.util.nextElement = function(elem) { do { elem = elem.nextSibling; } while (elem && elem.nodeType != 1); return elem; } var _void = function(){ return false; } /**********************/ /** CODAParams. **/ /**********************/ MTVM.services.CODAParams = function() { return MTVM.services.CODAParams.prototype.__getInstance(); } MTVM.services.CODAParams.prototype = { instanceOfObj: null, __getInstance: function() { if( !MTVM.services.CODAParams.prototype.instanceOfObj ) { MTVM.services.CODAParams.prototype.instanceOfObj = this; this.__init(); } return MTVM.services.CODAParams.prototype.instanceOfObj; }, __init: function() { this.reporting = {}; this.ads = {}; this.reporting.name = this.__getReportingName(); this.reporting.dynamicAccountSelection = "true"; this.reporting.dynamicAccountList = this.__getDynamicAccountList(); this.reporting.linkInternalFilters = "javascript:,mtvmusic-br,mtvmusica,mtvi.com"; this.reporting.pageName = location.pathname.substring(1); /* this.reporting.searchTermSuccess = MTVM.config.xslParams.searchTermSuccess; this.reporting.searchTermFail = MTVM.config.xslParams.searchTermFail; this.reporting.searchType = MTVM.config.xslParams.searchType; */ this.ads.dartSite = this.__getDartSite() //"music.mtv"; this.ads.keyValues = this.__makeKeyValues(); this.ads.defaultSections = this.__getDefaultSections(); this.ads.defaultContentType = "adj"; this.ads.positionThreshold = ""; this.ads.size = ""; }, /******************* get dynamicAccountList*****************/ __getDynamicAccountList: function() { var list =""; switch(MTVM.config.countryCode) { case "br": list = "rupeshlakhani.me.uk/br=scenic-l,scenic-d,scenic-q"; break; case "la": list = "rupeshlakhani.me.uk/latam=scenic-l,scenic-d,scenic-q"; break; default: list = "rupeshlakhani.me.uk=scenic-l,scenic-d,scenic-q"; break; } return list; }, /******************* GET DARTSITE *****************/ __getDartSite: function() { return MTVM.config.dartSite; }, /******************* GET REPORTING NAME *****************/ __getReportingName: function() { return MTVM.config.reportingSuite; }, /******************* GET DEFAULT SECTION *****************/ __getDefaultSections: function() { //valueString += MTVM.config.xslParams.zones; var zones = ""; var pagePath = location.pathname.substring(1); pagePath = pagePath.replace(/mtv-hive-site-app\//,""); var sections = pagePath.split("/"); for (var i=0; i 1) zones += sections[1] +"/"; else zones += "a/"; return zones; break; case "featured": zones = "featured/"; if (sections!=null && sections.length > 1) zones += sections[1] +"/"; return zones; break; case "charts": zones = "charts/"; if (sections!=null && sections.length > 2){ zones += sections[1] +"/"; zones += sections[2] +"/"; if ("genre" in pageParamsObj) zones += pageParamsObj.genre +"/"; } return zones; break; case "video": zones = "video/"; if (sections!=null && sections.length > 3){ zones += sections[0] +"/"; zones += sections[2] +"/"; zones += sections[3].split(".")[0] +"/"; } return zones; break; */ case "artist": if(sections[3]!=null) //artist VIDEO page { if(typeof __isHD != 'undefined' && __isHD == true) {zones += sections[0]+"/"+sections[1]+"/hd/"+sections[2]+"/";} else {zones += sections[0]+"/"+sections[1]+"/"+sections[2]+"/";} } else //artist bio page { for (var i=0; i-1) { //BLOG index page if(document.location.pathname =="/" || document.location.pathname =="") { zones = "blog/_mn/"+zones; }else { zones = "blog/"+zones; } } return zones; break; } }, /******************* MAKE KEY VALUES *****************/ __makeKeyValues: function() { var valueString = ""; var regex= new RegExp(MTVM.config.playlistMgidPrefix, "g"); valueString +="site_region="+MTVM.config.dartSiteRegion+";" valueString +="art="+MTVM.contextValues.artistAlias+";"; valueString +="gen="+MTVM.contextValues.genre+";"; if (typeof MTVM.contextValues.user_playlist_id == "undefined") MTVM.contextValues.user_playlist_id = ""; valueString +="user_playlist_id="+MTVM.contextValues.user_playlist_id.replace(regex,"")+";"; valueString +="chart_id="+MTVM.contextValues.chart_id+";"; valueString +="mpu="+MTVM.contextValues.mpu+";"; /* switch(MTVM.config.xslParams.pageType) { //video page case "video": valueString = valueString + "!category=float;!category=pop;!category=video;!category=expand;mtype=standard;"; break; //artist page case "artist": switch(MTVM.config.xslParams.typeFilter) { case '1': valueString = valueString + "sec1=music_video;"; break; case '3': valueString = valueString + "sec1=concert;"; break; case '4': valueString = valueString + "sec1=show_clip;"; break; case '8': valueString = valueString + "sec1=show_performance;"; break; case '100': valueString = valueString + "sec1=featured_on;"; break; } break; //search page case "search": if(MTVM.config.xslParams.searchTerm!= "" && MTVM.config.xslParams.searchTerm!=null) { valueString = valueString + "term="+MTVM.config.xslParams.searchTerm+";"; } break; } if(MTVM.config.xslParams.artistName != "" && MTVM.config.xslParams.artistName != null) { var adjustedArtName = MTVM.config.xslParams.artistName.replace( /^(\d)/, "_$1" ); valueString = valueString + "art=" +MTVM.config.xslParams.artistName+";"; } if(MTVM.config.xslParams.genre != "" && MTVM.config.xslParams.genre != null) { valueString = valueString + "gen="+MTVM.config.xslParams.genre+";"; } */ return valueString; } } MTVM.services.Reporting = {} MTVM.services.Reporting.Events = { __PLAYLIST_CREATE__: 'ugc playlist create', __PLAYLIST_PLAY__: 'ugc playlist play', __QUICKLIST_PLAY__: 'ugc quicklist play' } MTVM.services.Reporting.__sendLinkEvent = function(linkName, linkType) { com.mtvi.reporting.Controller.sendLinkEvent ( { linkName:linkName, linkType:linkType } ); } MTVM.services.Reporting.sendPlaylistCreateEvent = function() { MTVM.services.Reporting.__sendLinkEvent(MTVM.services.Reporting.Events.__PLAYLIST_CREATE__, "o"); } MTVM.services.Reporting.sendPlaylistPlayEvent = function() { MTVM.services.Reporting.__sendLinkEvent(MTVM.services.Reporting.Events.__PLAYLIST_PLAY__, "o"); } MTVM.services.Reporting.sendQuicklistPlayEvent = function() { MTVM.services.Reporting.__sendLinkEvent(MTVM.services.Reporting.Events.__QUICKLIST_PLAY__, "o"); } /*****************************/ //CHOICE STREAM /*****************************/ MTVM.services.Reporting.ChoiceStream = { sessionCookie: "", itemId: "", cookieId: "", //should be persistent userId: "", appContext: "", ID_PREFIX: "mtvmusic_video_", REPORTED:{ purchase: false, view:false }, enabled: (function(){ if(MTVM.config.countryCode == "us") {return true;}else{return false;} })() } MTVM.services.Reporting.ChoiceStream.getCookieId = function() { var time = ""; var cookieId = ""; var cookie = MTVM.util.getCookie('CHOICESTREAM_COOKIE'); var sessionCookie = MTVM.util.getCookie('CHOICESTREAM_SESSION'); if(cookie == "" || cookie == null) { if(this.cookieId == null || this.cookieId == "") { time = new Date().getTime(); cookieId = time + "."+MTVM.util.randomize(200000); this.cookieId = cookieId; MTVM.util.setCookie('CHOICESTREAM_COOKIE', cookieId, 5000000); } }else { this.cookieId = cookie; } if(sessionCookie == "" || sessionCookie == null) { if(this.sessionCookie == null || this.sessionCookie == "") { time = new Date().getTime(); sessionCookie = time + "."+MTVM.util.randomize(200000); this.sessionCookie = sessionCookie; MTVM.util.setCookie('CHOICESTREAM_SESSION', sessionCookie); } }else { this.sessionCookie = sessionCookie; } return this.cookieId; } MTVM.services.Reporting.ChoiceStream.reset = function() { this.itemId = ""; this.cookieId = ""; this.REPORTED.purchase = false; this.REPORTED.view = false; this.userId = ""; this.appContext = ""; } MTVM.services.Reporting.ChoiceStream.getUrl =function(){ if(this.enabled) { switch(MTVM.config.serverPlatform) { case "l": return MTVM.config.choiceStream.staging; break; case "d": return MTVM.config.choiceStream.staging; break; case "q": return MTVM.config.choiceStream.staging; break; default: //live return MTVM.config.choiceStream.live; break; } } } MTVM.services.Reporting.ChoiceStream.sendEvent = function(itemId, eventType) { this.itemId = this.ID_PREFIX+itemId; this.userId = MTVM.flux.getUserUcid(); this.appContext = MTVM.contextValues.pageType.toLowerCase(); if(this.enabled) { switch(eventType) { case "view": this.__sendItemViewEvent(); break; case "purchase": this.__sendPurchaseItemEvent(); break; case "cartItemAdd": this.__sendCartItemAddEvent(); break; } } } MTVM.services.Reporting.ChoiceStream.__sendItemViewEvent = function() { var a = null; var c = null; var r = null; try{ if(MTVM.services.Reporting.ChoiceStream.REPORTED.view == false) { a = new csAny.Activity("item_views"); a.setAttribute("item_id", this.itemId); c = new csAny.Context(); c.setApiKey("198f013e3807edc4"); c.setAppcontext(this.appContext); if(this.userId!="" && this.userId !=null){c.setUserId(this.userId);}; // optional; send if user is logged in c.setCookieId(MTVM.services.Reporting.ChoiceStream.getCookieId()); // required r = new csAny.Request(); r.addActivity(a); r.setContext(c); r.send(); MTVM.services.Reporting.ChoiceStream.REPORTED.view = true; } }catch(e) { MTVM.log("MTVM.services.Reporting.ChoiceStream.__sendItemViewEvent failed "+e); } } MTVM.services.Reporting.ChoiceStream.__sendPurchaseItemEvent = function() { var a = null; var c = null; var r = null; try{ if(MTVM.services.Reporting.ChoiceStream.REPORTED.purchase == false) { a = new csAny.Activity("purchase_items"); a.setAttribute("item_id", this.itemId); a.setAttribute("quantity", 1); a.setAttribute("total_price", 0.00); a.setAttribute("purchase_id", this.sessionCookie); a.setAttribute("unit_price", 0.00); c = new csAny.Context(); c.setApiKey("198f013e3807edc4"); c.setAppcontext(this.appContext); if(this.userId!="" && this.userId !=null){c.setUserId(this.userId);}; // optional; send if user is logged in c.setCookieId(MTVM.services.Reporting.ChoiceStream.getCookieId()); // required r = new csAny.Request(); r.addActivity(a); r.setContext(c); r.send(); MTVM.services.Reporting.ChoiceStream.REPORTED.purchase = true; } }catch(e) { MTVM.log("MTVM.services.Reporting.ChoiceStream.__sendPurchaseItemEvent failed "+e); } } MTVM.services.Reporting.ChoiceStream.__sendCartItemAddEvent = function() { var a = null; var c = null; var r = null; try{ a = new csAny.Activity("cart_item_adds"); a.setAttribute("item_id", this.itemId); c = new csAny.Context(); c.setApiKey("198f013e3807edc4"); c.setAppcontext(this.appContext); if(this.userId!="" && this.userId !=null){c.setUserId(this.userId);}; // optional; send if user is logged in c.setCookieId(MTVM.services.Reporting.ChoiceStream.getCookieId()); // required r = new csAny.Request(); r.addActivity(a); r.setContext(c); r.send(); }catch(e) { MTVM.log("MTVM.services.Reporting.ChoiceStream.__sendCartItemAddEvent failed "+e); } } MTVM.services.ui = {} MTVM.services.ui.PromoVideos = function(imageSrcObj) { this.PROMO_VIDEOS_IMAGE_URL = imageSrcObj?imageSrcObj.IMAGE_URL:""; this.PROMO_VIDEOS_LINK_URL = imageSrcObj?imageSrcObj.LINK_URL:""; this.PROMO_VIDEOS_ITEM_TITLE = imageSrcObj?imageSrcObj.ITEM_TITLE:""; this.NUM_OF_PROMO_VIDEOS_IMAGES = this.PROMO_VIDEOS_IMAGE_URL?this.PROMO_VIDEOS_IMAGE_URL.length:0; this.NUM_OF_PROMO_VIDEOS_URLS = this.PROMO_VIDEOS_LINK_URL?this.PROMO_VIDEOS_LINK_URL.length:0; this.DEFAULT_IMAGE_WIDTH = 281; this.initPromoVideos(); } MTVM.services.ui.PromoVideos.prototype = { initPromoVideos: function() { if(this.NUM_OF_PROMO_VIDEOS_URLS > 0) { this.createPromoVideosBox(); } }, createPromoVideosBox: function() { for(var idx=1; idx<=this.NUM_OF_PROMO_VIDEOS_URLS; idx++) { if (this.PROMO_VIDEOS_LINK_URL[idx-1]!=null){ if (this.PROMO_VIDEOS_LINK_URL[idx-1].substring(0,4)=="mgid"){ //if mgid is provided, construct the image utl and the item DOM if (this.PROMO_VIDEOS_IMAGE_URL[idx-1] == "default"){ var imgUrlFull = "http://mtvhive.mtvnimages.com/uri/"+this.PROMO_VIDEOS_LINK_URL[idx-1]+ "?width=281&height=211"; } else { var imgUrlFull = this.PROMO_VIDEOS_IMAGE_URL[idx-1]; } document.write ( "
" ); //based on mgid, construct the item title and hyperlink this.redressPromoItem(this.PROMO_VIDEOS_LINK_URL[idx-1], this.PROMO_VIDEOS_ITEM_TITLE[idx-1], idx); } else { if (this.PROMO_VIDEOS_IMAGE_URL[idx-1] !="0"){ document.write ( "" ); this.formatBlurb(idx); } } } } }, redressPromoItem: function (mgid, title, idx) { $J.getJSON('/sitewide/dataservices/videoInfo/getVideoInfo/?mgid='+mgid, function(data) { if ((title == "" || typeof title === 'undefined') && data.primaryArtistName != "" && data.title != ""){ $J("#blurb"+idx).append(data.primaryArtistName +" - "+ data.title + ""); }else { $J("#blurb"+idx).append(title); } var promoTitleAlias = data.title.toLowerCase(); promoTitleAlias = promoTitleAlias.replace(/[^a-zA-Z 0-9]+/g,''); promoTitleAlias = promoTitleAlias.replace(/ /g,"_"); var promoLinkFull = data.primaryArtistUrl + "/videos/" + data.id + "/" + promoTitleAlias; $J("a#imgLink" + idx).attr("href", promoLinkFull); $J("#promoVideos #blurb"+idx).each(function() { var lineHeight = $J(this).outerHeight( true ); $J(this).css("top", "-"+lineHeight+"px"); }); $J("#promoVideos #blurbBox"+idx).each(function() { var blurbBoxHeight = $J("#promoVideos #blurb"+idx).outerHeight( true ); $J(this).css("height", blurbBoxHeight+"px"); $J(this).css("top", "-"+(blurbBoxHeight*2)+"px"); }); }); }, formatBlurb: function (idx) { $J("#promoVideos #blurb"+idx).each(function() { var lineHeight = $J(this).outerHeight( true ); $J(this).css("top", "-"+lineHeight+"px"); }); $J("#promoVideos #blurbBox"+idx).each(function() { var blurbBoxHeight = $J("#promoVideos #blurb"+idx).outerHeight( true ); $J(this).css("height", blurbBoxHeight+"px"); $J(this).css("top", "-"+(blurbBoxHeight*2)+"px"); }); } } /************************ Marquee START ************************/ MTVM.services.ui.Marquee = function(marqueeItemSrcObj) { this.MARQUEE_IMAGE_URL = marqueeItemSrcObj?marqueeItemSrcObj.IMAGE_URL:""; this.MARQUEE_LINK_URL = marqueeItemSrcObj?marqueeItemSrcObj.LINK_URL:""; this.MARQUEE_ITEM_TITLE = marqueeItemSrcObj?marqueeItemSrcObj.ITEM_TITLE:""; this.NUM_OF_MARQUEE_IMAGES = this.MARQUEE_IMAGE_URL?this.MARQUEE_IMAGE_URL.length:0; this.NUM_OF_MARQUEE_URLS = this.MARQUEE_LINK_URL?this.MARQUEE_LINK_URL.length:0; this.WIDTH = marqueeItemSrcObj?marqueeItemSrcObj.WIDTH:460; this.HEIGHT = marqueeItemSrcObj?marqueeItemSrcObj.HEIGHT:327; this.initMarquee(); } MTVM.services.ui.Marquee.prototype = { initMarquee: function() { if(this.NUM_OF_MARQUEE_URLS > 0) { this.createMarqueeBox(); } }, createMarqueeBox: function() { var DIMENSIONS = "?width="+this.WIDTH+"&height="+this.HEIGHT; for(var idx=1; idx<=this.NUM_OF_MARQUEE_URLS; idx++) { if (this.MARQUEE_LINK_URL[idx-1]!=null){ document.write ( "
  • " + "" + "
  • " ); //move the blurb up to overlay the thumbnail this.formatMarqueeBlurb(idx); } } // Enabling the Marquee var autoscrolling = true; $J('#marqueeVideosBoxWrapper .infiniteCarousel').infiniteCarousel().mouseover(function () { autoscrolling = false; }).mouseout(function () { autoscrolling = true; }); setInterval(function () { if (autoscrolling) { $J('#marqueeVideosBoxWrapper .infiniteCarousel').trigger('next'); } }, 4000); //Position the arrows var arrowHeight = $J("#marqueeVideosBoxWrapper .infiniteCarousel .forward").height(); var arrowPos = Math.ceil((this.HEIGHT-arrowHeight)/2); $J("#marqueeVideosBoxWrapper .infiniteCarousel .arrow").css("top",arrowPos+"px"); }, formatMarqueeBlurb: function (idx) { $J("#marqueeVideos #marqueeBlurb"+idx).each(function() { var lineHeight = $J(this).outerHeight( true ); $J(this).css("top", "-"+lineHeight+"px"); }); $J("#marqueeVideos #marqueeBlurbBox"+idx).each(function() { var marqueeBlurbBoxHeight = $J("#marqueeVideos #marqueeBlurb"+idx).outerHeight( true ); $J(this).css("height", marqueeBlurbBoxHeight+"px"); $J(this).css("top", "-"+(marqueeBlurbBoxHeight*2)+"px"); }); } } /************************ Marquee END ************************/ /************************ hiveMentions START ************************/ MTVM.services.ui.HiveMentions = function(marqueeItemSrcObj) { this.MARQUEE_IMAGE_URL = marqueeItemSrcObj?marqueeItemSrcObj.IMAGE_URL:""; this.MARQUEE_LINK_URL = marqueeItemSrcObj?marqueeItemSrcObj.LINK_URL:""; this.MARQUEE_ITEM_TITLE = marqueeItemSrcObj?marqueeItemSrcObj.ITEM_TITLE:""; this.MARQUEE_ITEM_DESCRIPTION = marqueeItemSrcObj?marqueeItemSrcObj.ITEM_DESCRIPTION:""; this.NUM_OF_MARQUEE_IMAGES = this.MARQUEE_IMAGE_URL?this.MARQUEE_IMAGE_URL.length:0; this.NUM_OF_MARQUEE_URLS = this.MARQUEE_LINK_URL?this.MARQUEE_LINK_URL.length:0; this.WIDTH = marqueeItemSrcObj?marqueeItemSrcObj.WIDTH:460; this.HEIGHT = marqueeItemSrcObj?marqueeItemSrcObj.HEIGHT:327; this.initMarquee(); } MTVM.services.ui.HiveMentions.prototype = { initMarquee: function() { if(this.NUM_OF_MARQUEE_URLS > 0) { this.createMarqueeBox(); } }, createMarqueeBox: function() { var DIMENSIONS = "?width="+this.WIDTH+"&height="+this.HEIGHT; for(var idx=1; idx<=this.NUM_OF_MARQUEE_URLS; idx++) { if (this.MARQUEE_LINK_URL[idx-1]!=null){ var entryHTML = ''; entryHTML += '
  • '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += ' '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += ' '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '

    '; entryHTML += this.MARQUEE_ITEM_TITLE[idx-1] entryHTML += '

    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += this.MARQUEE_ITEM_DESCRIPTION[idx-1].replace('<span class="read_more"><br /> Read More</span>','').replace(/&/g,'&').replace(/…/g,''); entryHTML += '
    '; entryHTML += '
    '; entryHTML += ' Read More'; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
    '; entryHTML += '
  • '; document.write (entryHTML); } } // Enabling the Marquee $J("#hiveMentionsSearchDiv").ready(function(){ $J("#hiveMentionsSearchDiv .infiniteCarousel").infiniteCarousel(); //Position the arrows var arrowHeight = $J("#hiveMentionsSearchDiv .infiniteCarousel .forward").height(); var entryHeight = $J("#hiveMentionsSearchDiv .infiniteCarousel .wp-entry-content-single").height(); var arrowPos = Math.ceil((entryHeight-arrowHeight)/2); $J("#hiveMentionsSearchDiv .infiniteCarousel .arrow").css("top",arrowPos+"px"); }); } } /************************ hiveMentions END ************************/ /* * Hide/Show Thumbnail * */ MTVM.services.ui.thumbFlyover = { event: null, node: null, proc: function(obj, event) { this.event = event; this.node = obj; switch(event.type){ case "mouseover": this.__show(); break; case "mouseout": this.__hide(); break; } }, __hide: function() { for(var i = 0; i< this.node.childNodes.length; i++) { if(this.node.childNodes[i].className == 'videoLinkThumbBg' || this.node.childNodes[i].className == 'videoLinkPlay') { this.node.childNodes[i].style.display = 'none'; } } }, __show: function() { for(var i = 0; i< this.node.childNodes.length; i++) { if(this.node.childNodes[i].className == 'videoLinkThumbBg' || this.node.childNodes[i].className == 'videoLinkPlay') { this.node.childNodes[i].style.display = 'block'; } } } } /** ********************************************************************* */ /** **************************** BUTTONS ******************************* */ /** ********************************************************************* */ MTVM.services.ui.button ={ buttonList: [] } MTVM.services.ui.button.BaseButton = function() { this.buttonProperties = { leftEndSlice:{ content: "", className: "", style: "" }, rightEndSlice:{ content: "", className: "", style: "" }, buttonText:{ content: "", className: "", onclick: "", href: "" }, container:{ className: "", style: "" } } this.BUTTON_HTML = ""; } MTVM.services.ui.button.BaseButton.prototype.__buildButton = function(baseProperties) { try{ this.BUTTON_HTML = ''+ '
    '+ '
    '+(baseProperties.leftEndSlice.content||"")+'
    '+ '
    '; if(baseProperties.buttonText.onclick!=null && baseProperties.buttonText.onclick!="") { this.BUTTON_HTML = this.BUTTON_HTML+ ''+(baseProperties.buttonText.content||"") +''; } else if(baseProperties.buttonText.href!=null && baseProperties.buttonText.href!="") { this.BUTTON_HTML = this.BUTTON_HTML+ ''+(baseProperties.buttonText.content||"") +''; }else { this.BUTTON_HTML = this.BUTTON_HTML+ (baseProperties.buttonText.content||""); } this.BUTTON_HTML = this.BUTTON_HTML+'
    '+ '
    '+(baseProperties.rightEndSlice.content||"")+'
    '+ '
    '+ '
    '; } catch(e) { MTVM.log("MTVM.services.ui.button.BaseButton.prototype.__buildButton: failed "+e, 2); } } MTVM.services.ui.button.BaseButton.prototype.__buildButtonCustomTag = function(baseProperties, tag) { this.tag = tag || "div"; try{ this.BUTTON_HTML = ''+ '<'+this.tag+' style="'+(baseProperties.container.style||"") +'" class="'+(baseProperties.container.className||"") +'">'+ '<'+this.tag+' style="'+(baseProperties.leftEndSlice.style||"") +'" class="'+(baseProperties.leftEndSlice.className||"") +'">'+(baseProperties.leftEndSlice.content||"")+''+ '<'+this.tag+' class="'+(baseProperties.buttonText.className||"") +'">'; if(baseProperties.buttonText.onclick!=null && baseProperties.buttonText.onclick!="") { this.BUTTON_HTML = this.BUTTON_HTML+ ''+(baseProperties.buttonText.content||"") +''; } else if(baseProperties.buttonText.href!=null && baseProperties.buttonText.href!="") { this.BUTTON_HTML = this.BUTTON_HTML+ ''+(baseProperties.buttonText.content||"") +''; }else { this.BUTTON_HTML = this.BUTTON_HTML+ (baseProperties.buttonText.content||""); } this.BUTTON_HTML = this.BUTTON_HTML+''+ '<'+this.tag+' style="'+(baseProperties.rightEndSlice.style||"") +'" class="'+(baseProperties.rightEndSlice.className||"") +'">'+(baseProperties.rightEndSlice.content||"")+''+ '
    '+ ''; } catch(e) { MTVM.log("MTVM.services.ui.button.BaseButton.prototype.__buildButton: failed "+e, 2); } } MTVM.services.ui.button.BaseButton.prototype.__buildButton2 = function(baseProperties) { try{ this.BUTTON_HTML = ''+ ''+ ''+ ''+ ''+ ''+ '
    '+(baseProperties.leftEndSlice.content||"")+''; if(baseProperties.buttonText.onclick!=null && baseProperties.buttonText.onclick!="") { this.BUTTON_HTML = this.BUTTON_HTML+ ''+(baseProperties.buttonText.content||"") +''; } else if(baseProperties.buttonText.href!=null && baseProperties.buttonText.href!="") { this.BUTTON_HTML = this.BUTTON_HTML+ ''+(baseProperties.buttonText.content||"") +''; }else { this.BUTTON_HTML = this.BUTTON_HTML+ (baseProperties.buttonText.content||""); } this.BUTTON_HTML = this.BUTTON_HTML+''+(baseProperties.rightEndSlice.content||"")+'
    '; } catch(e) { MTVM.log("MTVM.services.ui.button.BaseButton.prototype.__buildButton: failed "+e, 2); } } MTVM.services.ui.button.BaseButton.prototype.print = function() { document.write(this.BUTTON_HTML); } /** ********************************************************************* */ /** **************************** BUTTON TYPES *************************** */ /** ********************************************************************* */ /** *** playlist pink ******* */ MTVM.services.ui.button.playlistPink = function(properties){ this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-pink-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-pink-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: "MTVM-playlist-button-pink-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-button-pink-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.playlistPink.prototype = new MTVM.services.ui.button.BaseButton(); /** *** playlist pink ******* */ MTVM.services.ui.button.playlistPlayAllPink = function(properties){ this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-pink-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-pink-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: "MTVM-playlist-button-pink-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-playAll-button-pink-container" } } if(MTVM.Playlist.PlayAll.ENABLED) { this.__buildButton(this.buttonProperties); } } MTVM.services.ui.button.playlistPlayAllPink.prototype = new MTVM.services.ui.button.BaseButton(); /** *** playlist blue ******* */ MTVM.services.ui.button.playlistBlue = function(properties){ this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-blue-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-blue-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: "MTVM-playlist-button-blue-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-button-blue-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.playlistBlue.prototype = new MTVM.services.ui.button.BaseButton(); /** *** playlistPlayAll Blue ******* */ MTVM.services.ui.button.playlistPlayAllBlue = function(properties){ this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-blue-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-blue-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: "MTVM-playlist-button-blue-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-playAll-button-blue-container" } } if(MTVM.Playlist.PlayAll.ENABLED) { this.__buildButton(this.buttonProperties); } } MTVM.services.ui.button.playlistPlayAllBlue.prototype = new MTVM.services.ui.button.BaseButton(); /** *** playlist white ******* */ MTVM.services.ui.button.playlistWhite = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-white-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-white-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-playlist-button-white-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-button-white-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.playlistWhite.prototype = new MTVM.services.ui.button.BaseButton(); /** *** playlist dark ******* */ MTVM.services.ui.button.playlistDark = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-dark-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-dark-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-playlist-button-dark-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-button-dark-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.playlistDark.prototype = new MTVM.services.ui.button.BaseButton(); /** *** playlist dark2 ******* */ MTVM.services.ui.button.playlistDark2 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-playlist-button-dark2-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-playlist-button-dark2-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-playlist-button-dark2-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-playlist-button-dark2-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.playlistDark2.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button 19px height ******* */ MTVM.services.ui.button.white19 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-white19-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-button-white19-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-white19-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-white19-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.white19.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button 32px height ******* */ MTVM.services.ui.button.white32 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-white32-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-button-white32-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-white32-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-white32-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.white32.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button pink gradient34 height ******* */ MTVM.services.ui.button.pinkGradient34 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-pinkGradient34-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-button-pinkGradient34-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-pinkGradient34-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-pinkGradient34-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.pinkGradient34.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button pink gradient19 height ******* */ MTVM.services.ui.button.pinkGradient19 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-pinkGradient19-leftEndSlice", style: "float:left;" }, rightEndSlice:{ content: "", className: "MTVM-button-pinkGradient19-rightEndSlice", style: "float:left;" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-pinkGradient19-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-pinkGradient19-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.pinkGradient19.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button pink gradient16 height ******* */ MTVM.services.ui.button.pinkGradient16 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-pinkGradient16-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-button-pinkGradient16-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-pinkGradient16-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-pinkGradient16-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.pinkGradient16.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button 32px height ******* */ MTVM.services.ui.button.white23 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-white23-leftEndSlice" }, rightEndSlice:{ content: "", className: "MTVM-button-white23-rightEndSlice" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-white23-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-white23-container" } } this.__buildButtonCustomTag(this.buttonProperties, "span"); } MTVM.services.ui.button.white23.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button alternating color section ribbon header 26 height ******* */ MTVM.services.ui.button.altRibbon26 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-altRibbon26-leftEndSlice", style: "float:left;" }, rightEndSlice:{ content: "", className: "MTVM-button-altRibbon26-rightEndSlice", style: "float:left;" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-altRibbon26-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-altRibbon26-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.altRibbon26.prototype = new MTVM.services.ui.button.BaseButton(); /** *** button blue gradient17 height ******* */ MTVM.services.ui.button.blueGradient17 = function(properties) { this.buttonProperties = { leftEndSlice:{ content: "", className: "MTVM-button-blueGradient17-leftEndSlice", style: "float:left;" }, rightEndSlice:{ content: "", className: "MTVM-button-blueGradient17-rightEndSlice", style: "float:left;" }, buttonText:{ content: properties.buttonText.content||"", className: properties.buttonText.className||"MTVM-button-blueGradient17-buttonText", onclick: properties.buttonText.onclick||"", href: properties.buttonText.href||"" }, container:{ className: "MTVM-button-blueGradient17-container" } } this.__buildButton(this.buttonProperties); } MTVM.services.ui.button.blueGradient17.prototype = new MTVM.services.ui.button.BaseButton(); /* Navigation Section */ MTVM.services.ui.showSubNav = function() { switch(MTVM.contextValues.pageType) { case "Quicklist": case "VideoHub": case "Video": case "PlaylistHub": case "HDHub": case "UnpluggedHome": case "PlayAll": case "Hub": case "UserPlaylist": case "UserPlaylistList": case "Search": $J("#mtvhive-navigation-container-bottom").css('display','none'); $J("#top-navigation-buttons-container").css('display','block'); $J("#top-navigation-buttons-watch").css('display','block'); break; case "Read": $J("#mtvhive-navigation-container-bottom").css('display','none'); $J("#top-navigation-buttons-container").css('display','block'); $J("#top-navigation-buttons-read").css('display','block'); break; case "Listen": $J("#mtvhive-navigation-container-bottom").css('display','none'); $J("#top-navigation-buttons-container").css('display','block'); $J("#top-navigation-buttons-read").css('display','block'); break; default: break; } } MTVM.services.ui.selectNav = function() { switch(MTVM.contextValues.pageType) { case "home": //$J(".top-navigation-buttons .top-navigation-button")[0].className = ".top-navigation-button selectedFirst"; break; case "Quicklist": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[3]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; break; /* case "QuicklistEdit": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[3]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[3].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[3].className + " mtvhive-navigation-button-selected"; break; */ case "VideoHub": //put arrow on primary nav //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; $J("#top-navigation-buttons-watch .top-navigation-buttons .top-navigation-button")[0].className = "top-navigation-button selected"; break; case "Alpha": //$J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[2].className + " mtvhive-navigation-button-selected"; //$J("#top-navigation-buttons .top-navigation-button")[1].className = "top-navigation-button selected"; break; case "Read": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; break; case "Listen": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[2].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; break; case "Video": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; break; case "PlaylistHub": //put arrow on primary nav //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; $J("#top-navigation-buttons-watch .top-navigation-buttons .top-navigation-button")[1].className = "top-navigation-button selected"; break; case "Artist": //put arrow on primary nav //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); //$J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[2].className + " mtvhive-navigation-button-selected"; break; case "HDHub": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; $J("#top-navigation-buttons-watch .top-navigation-buttons .top-navigation-button")[2].className = "top-navigation-button selected"; break; case "UnpluggedHome": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; $J("#top-navigation-buttons-watch .top-navigation-buttons .top-navigation-button")[3].className = "top-navigation-button selected"; break; case "Meter": //$J($J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[2]).append('
    '); $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[2].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[0].className + " mtvhive-navigation-button-selected"; break; default: if (MTVM.contextValues.hubAlias != null) { $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className = $J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1].className + " mtvhive-navigation-button-selected"; $J("#top-navigation-buttons-watch .top-navigation-buttons .top-navigation-button").each(function(index, item){ var subNavItem = $J(item); var subNavItemHTML = subNavItem.html(); //console.log(subNavItem) //console.log(subNavItemHTML) if (subNavItemHTML.indexOf('/watch/'+MTVM.contextValues.hubAlias) >= 0){ item.className = "top-navigation-button selected"; } }); } break; } } MTVM.services.ui.DropDown = function(settings){ this.links = settings.links; this.domTarget = settings.domTarget; this.dropDownEle = null; this.dropDownTimer = null; if (this.domTarget != null) this._init(); } MTVM.services.ui.DropDown.instances = new Array(); MTVM.services.ui.DropDown.prototype._init = function(){ this._createListeners(); this._buildDropDown(); } MTVM.services.ui.DropDown.prototype._createListeners = function(target){ var ptr = this; var domTarget = (target || this.domTarget); if(MTVM.util.isIE()){ if(domTarget == this.domTarget){ domTarget.attachEvent('onmouseout', function(e){ptr.dropDownTimer = setTimeout(MTVM.util.bind(ptr, ptr.hideDropDown), 10);}); domTarget.attachEvent('onmouseover', function(e){clearTimeout(ptr.dropDownTimer); ptr.showDropDown(e);}); } }else{ domTarget.addEventListener('mouseover', function(e){ ptr.showDropDown(e);}, false); domTarget.addEventListener('mouseout', function(e){ ptr.hideDropDown(e);}, false); } } MTVM.services.ui.DropDown.prototype.showDropDown = function(e){ e.cancelBubble = true; this.dropDownEle.style.display="block"; //this.killArrow(); this.showTab(); this.highlightArrow(); } MTVM.services.ui.DropDown.prototype.hideDropDown = function(e){ this.dropDownEle.style.display="none"; //this.restoreArrow(); this.hideTab(); this.unhighlightArrow(); } MTVM.services.ui.DropDown.prototype.showTab = function(){ var childNodes = this.domTarget.childNodes; for(var i=0; i-1) { childNodes[i].className = childNodes[i].className.replace('mtvhive-navigation-button-tabOff', ''); } } $J($J(this.domTarget).children("span.mtvhive-navigation-button-link")).children('a').addClass('on'); } MTVM.services.ui.DropDown.prototype.hideTab = function(){ var childNodes = this.domTarget.childNodes; for(var i=0; i-1){ childNodes[i].className= childNodes[i].className+' mtvhive-navigation-button-tabOff '; } } $J($J(this.domTarget).children("span.mtvhive-navigation-button-link")).children('a').removeClass('on'); } MTVM.services.ui.DropDown.prototype.highlightArrow = function(){ if ($J.browser.msie && $J.browser.version.substr(0,1)<7) { //$J(this.domTarget).children("span.mtvhive-navigation-button-link").children("a#mtvhive-navigation-watch").children("img").addClass('highlightedIE6'); $J(this.domTarget).children("span.mtvhive-navigation-button-link").find("img").addClass('highlightedIE6'); }else{ $J(this.domTarget).children("span.mtvhive-navigation-button-link").find("img").addClass('highlighted'); //$J(this.domTarget).children("span.mtvhive-navigation-button-link").children("a#mtvhive-navigation-watch").children("img").addClass('highlighted'); //$J('#mtvhive-navigation-watch img').addClass('highlighted'); } } MTVM.services.ui.DropDown.prototype.unhighlightArrow = function(){ if ($J.browser.msie && $J.browser.version.substr(0,1)<7) { $J(this.domTarget).children("span.mtvhive-navigation-button-link").find("img").removeClass('highlightedIE6'); //$J(this.domTarget).children("span.mtvhive-navigation-button-link").children("a#mtvhive-navigation-watch").children("img").removeClass('highlightedIE6'); }else{ $J(this.domTarget).children("span.mtvhive-navigation-button-link").find("img").removeClass('highlighted'); //$J(this.domTarget).children("span.mtvhive-navigation-button-link").children("a#mtvhive-navigation-watch").children("img").removeClass('highlighted'); } } MTVM.services.ui.DropDown.prototype.killArrow = function(){ for(var i=0; i-1){ arrDiv = document.createElement("div"); arrDiv.innerHTML = ''; arrDiv.className = "mtvhive-navigation-arrow"; for(var i=0; i
    '; div.style.position="absolute"; for(var i=0; iWatch Home', 'Most Viewed', 'Playlists', 'Live HD', 'Unplugged', 'Random'],*/ var tmpObj2 = new MTVM.services.ui.DropDown( { "links":tmpObj2LinkArray, "domTarget":$J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[1] } ); MTVM.services.ui.DropDown.instances.push(tmpObj2); /* var tmpObj2 = new MTVM.services.ui.DropDown( { "links":['The MTV Music Meter', 'My Favorites', 'Up & Coming', 'Indie', 'Hip Hop', 'Nu Folk', 'Electronic', 'VH1 You Oughta Know', 'CMT Top 20', 'MTV Iggy'], "domTarget":$J("#mtvhive-navigation-buttons .mtvhive-navigation-button")[2] } ); MTVM.services.ui.DropDown.instances.push(tmpObj2); */ } MTVM.services.ui.showMyFav = function(){ if (document.getElementById('mtvhive-navigation-mystuff')!= null){ if(document.getElementById('mtvhive-navigation-mystuff').style.visibility != "visible"){ document.getElementById('mtvhive-navigation-mystuff').style.visibility = "visible"; } if (document.getElementById('playlistLinks-myplaylists')!= null){ if(document.getElementById('playlistLinks-myplaylists').style.display == "block" ){ document.getElementById('playlistLinks-myplaylists-divider').style.display = "block"; } } if (document.getElementById('playlistLinks-quicklist')!= null){ if(document.getElementById('playlistLinks-quicklist').style.display == "block" ){ document.getElementById('playlistLinks-quicklist-divider').style.display = "block"; } } } if (document.getElementById('mtvhive-navigation-mystuff-fav')!= null){ document.getElementById('mtvhive-navigation-mystuff-fav').style.display = "block"; } } MTVM.services.ui.hideMyFav = function(){ document.getElementById('mtvhive-navigation-mystuff').style.visibility = "hidden"; document.getElementById('mtvhive-navigation-mystuff-fav').style.display = "none"; document.getElementById('playlistLinks-myplaylists-divider').style.display = "none"; if(document.getElementById('playlistLinks-myplaylists').style.display == "none" && document.getElementById('playlistLinks-quicklist').style.display == "none" ){ document.getElementById('mtvhive-navigation-mystuff').style.visibility = "hidden"; } } MTVM.services.ui.showMyPlaylists = function(){ if (document.getElementById("playlistLinks-myplaylists") != null){ document.getElementById("playlistLinks-myplaylists").style.display = "block"; document.getElementById('playlistLinks-myplaylists-divider').style.display = "block"; document.getElementById('mtvhive-navigation-mystuff').style.display = "block"; document.getElementById('mtvhive-navigation-mystuff').style.visibility = "visible"; if( $J('#mtvhive-navigation-mystuff-fav').length>0 && document.getElementById('mtvhive-navigation-mystuff-fav').style.display == "block" ){ document.getElementById('playlistLinks-myplaylists-divider').style.display = "block"; } if($J('#playlistLinks-quicklist').length >0 && document.getElementById('playlistLinks-quicklist').style.display == "block" ){ document.getElementById('playlistLinks-quicklist-divider').style.display = "block"; } } } MTVM.services.ui.hideMyPlaylists = function(){ document.getElementById('playlistLinks-myplaylists').style.display = "none"; document.getElementById('playlistLinks-myplaylists-divider').style.display = "none"; /* if(document.getElementById('mtvhive-navigation-mystuff-fav').style.display == "none" && document.getElementById('playlistLinks-quicklist').style.display == "none" ){ document.getElementById('mtvhive-navigation-mystuff').style.visibility = "hidden"; } */ } MTVM.services.ui.showFluxEditAccount = function(){ $J("#mtvhive-navigation-loginbar-left").css("display","none"); $J("#mtvhive-navigation-loginbar") .prepend("
    Edit Account
    "); } MTVM.services.ui.mostViewedUrl = function(){ document.location.href="" + MTVM.config.fluxCommunityUrl + "/top100"; } MTVM.services.ui.cleanUpFlux4UserBarDropdown = function(){ // removing profile link jQuery("#mtvhive-navigation-loginbar-content .links .link[title*='Profile']").parent("li").remove(); // remove Legal link if it's a Non-Community-Member dropdown if (jQuery("#mtvhive-navigation-loginbar-content .notMemberMessage").css("display") == "block"){ jQuery("#mtvhive-navigation-loginbar-content .links .link[title*='Legal']").parent("li").remove(); } var userBarWidth = jQuery("#mtvhive-navigation-loginbar-content .flux4Widget .userBar ul.elements .elementContainer .elementContent").width(); var dropdownObj = jQuery("#mtvhive-navigation-loginbar-content .flux4Widget .userBar .myStuffElement .dropdownWrapper"); var dropdownWidth = dropdownObj.width(); if (userBarWidth && userBarWidth){ var newOffset = "-" + (parseInt(dropdownWidth) - parseInt(userBarWidth)) + "px"; jQuery("#mtvhive-navigation-loginbar-content .flux4Widget .userBar .myStuffElement .dropdownWrapper").css("margin-left", newOffset); } } MTVM.services.ui.Flux3ReportAbuse = function(){ Flux.createWidget('AbuseOverlay', { containerId: null }, function (abuseOverlay) { abuseOverlay.show(); }); } MTVM.Playlist.config = { //set in html_page.xsl; during page load playlistMgid:null, userUcid:null } MTVM.Playlist.config.controller = //configuration for MTVN_PL aka playlist api { debug: MTVM.config.playlistDebug, version: MTVM.config.playlistAppVersion, appID: MTVM.config.playlistAppId, playlistHost: MTVM.config.playlistServicesURL, tokenGenURL: 'http://'+MTVM.config.playlistServicesURL+'/token_gen/flux', defaultThumbnail: MTVM.config.serverHostName+'/sitewide/img/default/140-105.jpg', loginSystem: 'flux' } /***************************************************/ /******************** HELPER METHODS ***************/ /***************************************************/ MTVM.Playlist.loadScripts = function() { //load playlist Scripts document.write(''); document.write(''); } MTVM.Playlist.isOwner = function() { if(MTVM.Playlist.config.userUcid == MTVM.flux.getUserUcid()) {return true;} else {return false;} } MTVM.Playlist.getPlaylistType = function() { var playlistType = ""; var widget = null; try{ widget = MTVN_PL.PlaylistManager._widgetLists["_"+MTVN_PL.PlaylistManager._playingWidgetID]; if(widget != null) { if(widget.listID=="quicklist") { playlistType= "quicklist"; } else { switch(widget.playlist.type) { case "transient": playlistType = "transient"; break; default: playlistType = "savedPlaylist"; break; } } } }catch (e){console.log(e);} return playlistType; } MTVM.Playlist.getPlaylistName = function() { var widget = null; var playlistName = ""; try{ if(MTVN_PL.PlaylistManager._playingWidgetID != null) // get name of the playing widget { widget = MTVN_PL.PlaylistManager._widgetLists["_"+MTVN_PL.PlaylistManager._playingWidgetID]; if(widget != null) { if(widget.listID=="quicklist") { playlistName = MTVM.lang.playlist.myQuicklist; } else { playlistName = widget.playlist.name; } } }else { //MTVN_PL.PlaylistManager. } }catch (e){console.log(e);}; return playlistName; } MTVM.Playlist.getCurrentPlaylist = function() { var widget = null; var playlist = null; try{ widget = MTVN_PL.PlaylistManager._widgetLists["_"+MTVN_PL.PlaylistManager._playingWidgetID]; if(widget != null) { playlist = MTVN_PL.PlaylistManager._allPlaylistsByURI[widget.listID]; } }catch (e){console.log(e);} return playlist; } MTVM.Playlist.getPlaylistDate = function(mgid) { var playlist="" var date = null; if(mgid!="" && mgid !=null) { playlist = MTVN_PL.PlaylistManager._allPlaylistsByURI[mgid] } else { playlist = MTVM.Playlist.getCurrentPlaylist(); } if(playlist!=null && playlist!="") { var myDate = new Date( playlist.createdate *1000); date = myDate.getFullYear()+"-"+myDate.getMonth()+"-"+myDate.getDate(); } return date; } MTVM.Playlist.goToListSet = function(ucid) { var address = ""; if(ucid == null || ucid == "") { address = MTVM.config.serverHostName + "playlists/"+MTVM.flux.getUserUcid()+"/"; } else { address = MTVM.config.serverHostName + "playlists/"+ucid+"/"; } document.location = address; } MTVM.Playlist.goToQuicklist = function(ucid) { { document.location = MTVM.config.serverHostName + "playlists/quicklist"; } } //deprecated MTVM.Playlist.buildPlaylistTitle = function() { var playlistName = (MTVM.Playlist.getPlaylistName()?MTVM.Playlist.getPlaylistName():MTVM.lang.playlist.myPlaylist); $J('#playlistTitle').innerHTML = MTVM.lang.playlist.edit+" "+playlistName; } MTVM.Playlist.reloadIframe = function(obj) { var iframe = document.getElementById("widgetIframe"); iframe.src = "http://"+ document.location.hostname + "/sitewide/dataservices/videoDetails/?mgid="+obj.contentURI+"&referrerPlaylistMgid="+MTVM.Playlist.config.playlistMgid+"&referrerUserUcid="+MTVM.Playlist.config.userUcid; } MTVM.Playlist.setCollectionName = function() { try{ if(MTVN_PL.ListSetManager._widgetRegistry[0].listSet!= null) { $J(".MTVN_PL-listset-title").html("Playlists "+MTVM.lang.playlist.by+" "+MTVN_PL.ListSetManager._widgetRegistry[0].listSet[0].user.displayName); } else { $J(".MTVN_PL-listset-title").html(MTVM.lang.playlist.memberPlaylists); } }catch(e){MTVM.log("MTVM.Playlist.setCollectionName"+e, 2)} } /* * Setting MTVM.ContextValues so that moreByArtist widget can pick up the artist alias and video id. * */ MTVM.Playlist.setMTVMParams = function(type, value) { switch(type) { case "artistAlias": MTVM.contextValues.artistAlias = value; break; /* case "artistName": MTVM.contextValues.fullArtistName = value; break; */ case "videoMgid": MTVM.contextValues.vid = value; break; } } MTVM.Playlist.swapItemClass = function(obj, state) { var MOUSE_OVER_CLASS = "MTVN_PL-item-mouseOver"; var tempClassName = ""; switch(state) { case "out": tempClassName = obj.className; tempClassName = tempClassName.replace(MOUSE_OVER_CLASS, ""); obj.className = tempClassName; break; case "over": obj.className = obj.className+" "+MOUSE_OVER_CLASS; break; } } MTVM.Playlist.listenAndUpdateQuicklistCount = function(item) { //console.log(item); MTVM.Playlist.updateQuicklistCount(); MTVM.log("MTVM.playlist: listenAndUpdateQuicklistCount: "); } MTVM.Playlist.updateQuicklistTries = 0; MTVM.Playlist.updateQuicklistCount = function(playlist) { MTVM.Playlist.updateQuicklistTries = MTVM.Playlist.updateQuicklistTries + 1; MTVM.log("MTVM.playlist: updateQuicklistCount: "); var contentLength = 0; var itemCount = 0; if(typeof MTVN_PL != "undefined" ) { itemCount = MTVM.Playlist.updateQuicklistCount.__getCount(); if(itemCount !="") { MTVM.Playlist.updateQuicklistCount.__addToDom(itemCount); MTVN_PL.Controller.addListener(MTVN_PL.Controller.ADD_ITEM, MTVM.Playlist.listenAndUpdateQuicklistCount, this); //rewiring to listenAndUpdateQuicklistCount because ADD_ITEM return track obj isntead of playlist MTVN_PL.Controller.addListener(MTVN_PL.Controller.DELETE_ITEM, MTVM.Playlist.listenAndUpdateQuicklistCount, this); } else { if(MTVM.Playlist.updateQuicklistTries < 20) { setTimeout('MTVM.Playlist.updateQuicklistCount()', 700); }else{ MTVM.Playlist.updateQuicklistCount.__addToDom(0); } MTVN_PL.Controller.addListener(MTVN_PL.Controller.RESOLVE_LIST, MTVM.Playlist.listenAndUpdateQuicklistCount, this); } }else { MTVM.log("MTVN_PL not exist"); } } MTVM.Playlist.updateQuicklistCount.__getCount = function(playlist) { MTVM.log("MTVM.playlist: updateQuicklistCount.__getCount: "); var contentLength = 0; if(typeof playlist != "undefined" && playlist!=null && playlist != "") { contentLength = playlist.contentList.length; } else { if(typeof MTVN_PL.PlaylistManager._allPlaylistsByURI["quicklist"] !="undefined" && MTVN_PL.PlaylistManager._allPlaylistsByURI["quicklist"].contentList.length) { contentLength = MTVN_PL.PlaylistManager._allPlaylistsByURI["quicklist"].contentList.length; }else{ //MTVN_PL.Controller.addListener(MTVN_PL.Controller.RESOLVE_LIST, MTVM.Playlist.listenAndUpdateQuicklistCount, this); } } return contentLength; } MTVM.Playlist.updateQuicklistCount.__addToDom = function(contentLength) { MTVM.log("MTVM.playlist: updateQuicklistCount.__addToDom: "); //console.log("MTVM.playlist: updateQuicklistCount.__addToDom: "+contentLength); var myQuicklistString = MTVM.lang.playlist.myQuicklist; if(typeof $J('#playlistLinks-quicklist')[0] != "undefined" && $J('#playlistLinks-quicklist')[0] !="") // populate DOM with { $J('#playlistLinks-quicklist a').html(myQuicklistString + " ("+contentLength+")"); if(parseInt(contentLength) >0) //show the mystuff tab { document.getElementById('mtvhive-navigation-mystuff').style.display = "block"; document.getElementById('playlistLinks-quicklist').style.display = "block"; document.getElementById('playlistLinks-quicklist-divider').style.display = "block"; /* if(document.getElementById('playlistLinks-myplaylists').style.display == "block" || document.getElementById('mtvhive-navigation-mystuff-fav').style.display == "block") { document.getElementById('playlistLinks-quicklist-divider').style.display = "block"; } if(document.getElementById('playlistLinks-quicklist').style.display == "block") { document.getElementById('playlistLinks-quicklist-divider').style.display = "block"; } */ }else{//hide mystuff tab or just quicklist document.getElementById('playlistLinks-quicklist-divider').style.display = "none"; document.getElementById('playlistLinks-quicklist').style.display = "none"; //nothing is present, hide mystuff tab /* if(document.getElementById('playlistLinks-myplaylists').style.display != "block" && document.getElementById('mtvhive-navigation-mystuff-fav').style.display != "block"){ document.getElementById('mtvhive-navigation-mystuff').style.visibility = "hidden"; } */ if(document.getElementById('playlistLinks-myplaylists').style.display != "block"){ document.getElementById('mtvhive-navigation-mystuff').style.visibility = "hidden"; } } } } MTVM.Playlist.MetaTags = {} MTVM.Playlist.MetaTags.get = function() { } /***************************************************/ /******************** BUTTONS **********************/ /***************************************************/ MTVM.Playlist.Buttons = { newPlaylist: "", rename: "", playPrevious: "", playNext: "", playAll: "", saveAsAPlaylist: "", edit: "", share: "" } MTVM.Playlist.Buttons.getNewPlaylistButton = function(state) { var button = new MTVM.services.ui.button.playlistWhite({buttonText:{content:MTVM.lang.playlist.newPlaylist}}); /*switch(state) { default: button= 'New Playlist'; break; }*/ return button.BUTTON_HTML; } MTVM.Playlist.Buttons.getRenameButton = function(state) { var button = new MTVM.services.ui.button.playlistWhite({buttonText:{content:MTVM.lang.playlist.rename}}); /*switch(state) { default: button= 'Rename'; break; }*/ return button.BUTTON_HTML; } MTVM.Playlist.Buttons.getPlayPreviousButton = function(state) { var button = ""; switch(state) { default: button= ''+MTVM.lang.playlist.playPrevious+''; break; } return button; } MTVM.Playlist.Buttons.getPlayNextButton = function(state) { var button = ""; switch(state) { default: button= ''+MTVM.lang.playlist.playPrevious+''; break; } return button; } MTVM.Playlist.Buttons.getPlayAllButton= function(state) { var button = new MTVM.services.ui.button.playlistBlue({buttonText:{content:MTVM.lang.playlist.playAll}}); switch(state) { /*case "disabled": button= 'Play All'; break; default: button= 'Play All'; break;*/ } return button.BUTTON_HTML; } MTVM.Playlist.Buttons.getSaveAsAPlaylistButton= function(props) { var button = ""; switch(props.style) { case "dark": button= new MTVM.services.ui.button.playlistDark({buttonText:{content:MTVM.lang.playlist.saveAsAPlaylist}}) break; case "dark2": button= new MTVM.services.ui.button.playlistDark2({buttonText:{content:MTVM.lang.playlist.saveAsAPlaylist}}) break; default: button= new MTVM.services.ui.button.playlistWhite({buttonText:{content:MTVM.lang.playlist.saveAsAPlaylist}}) break; } return button.BUTTON_HTML; } MTVM.Playlist.Buttons.getEditButton = function(props) { var button = ""; switch(props.style) { case "dark": button = new MTVM.services.ui.button.playlistDark({buttonText:{content:MTVM.lang.playlist.edit}}); break; case "dark2": button = new MTVM.services.ui.button.playlistDark2({buttonText:{content:MTVM.lang.playlist.edit}}); break; default: if(props.state == 'disabled'){ button = new MTVM.services.ui.button.playlistWhite({buttonText:{content:MTVM.lang.playlist.edit, className:"MTVM-playlist-button-white-buttonText-disabled"}}); }else{ button = new MTVM.services.ui.button.playlistWhite({buttonText:{content:MTVM.lang.playlist.edit}}); } break; } return button.BUTTON_HTML; } MTVM.Playlist.Buttons.getShareButton = function(props) { var button = ""; switch(props.style) { default: button = new MTVM.services.ui.button.playlistDark({buttonText:{content:MTVM.lang.playlist.shareThisPlaylist}}); break; case "dark2": button = new MTVM.services.ui.button.playlistDark2({buttonText:{content:MTVM.lang.playlist.shareThisPlaylist}}); break; case "white": button = new MTVM.services.ui.button.playlistWhite({buttonText:{content:MTVM.lang.playlist.shareThisPlaylist}}); break; } return button.BUTTON_HTML; } MTVM.Playlist.Buttons.getShareButtonEvents = function(playlist) { //var shareUrl = "http://"+document.location.hostname+"/playlists/"+MTVM.Playlist.config.userUcid+"/"+playlist.contentURI; var shareUrl = document.location; var shareOnMouseOut = "addthis_close()"; var shareOnClick = "return addthis_open(this, \'\', \'"+shareUrl+"\', \'MTVHive.com Playlist - "+playlist.name+"\')"; var shareString = ' onclick="'+shareOnClick+'" onmouseout="'+shareOnMouseOut+'" '; return shareString; } /***************************************************/ /************ MESSAGE/TIP SLATE IN PLAYLIST ********/ /***************************************************/ MTVM.Playlist.MessageSlate = function(messageType){ this.MESSAGE_TYPE = messageType; this.QUICKLIST_TIP_MESSAGE = '
    '+ '
    '+ '
    '+MTVM.lang.playlist.quicklistTipTop+':
    '+ '
    '+ '
    '+ '
    '+ '
    '+MTVM.lang.playlist.quicklistTipBot+'
    '+ '
    '; } MTVM.Playlist.MessageSlate.prototype = { getSlate:function(){ //check cookie exists and not null if(this.__checkCookie()) { return ""; } else { //shorten playlist height TODO cannot be done till the box is drawn.. need to rethink return this.__getMessage(); } }, __checkCookie:function(){ var value = MTVM.util.getCookie(this.MESSAGE_TYPE); if(value!=null && value !="") { return true; } else { return false; } }, __getMessage:function() { var mesg = ""; switch(this.MESSAGE_TYPE) { case "quicklist": mesg = this.QUICKLIST_TIP_MESSAGE; break; } return mesg; }, onClickEvent:function(obj, messageType) { if(messageType != null && messageType !="") { }else{ messageType = this.MESSAGE_TYPE; } //make playlist restore to original size TODO $J("#MTVN_PL_quicklist_list_0_items").height( $J("#MTVN_PL_quicklist_list_0_items").height() - $J("#MTVN_PL_messageSlate").height()); //hide slate obj.parentNode.parentNode.style.display = "none"; //set cookie MTVM.util.setCookie(messageType, "read") } } /***************************************************/ /**************** PLAYLIST DETAILS *****************/ /** Shows the Playlist Creator Info and **/ /** creatation date ********/ /***************************************************/ MTVM.Playlist.Details ={} MTVM.Playlist.Details.populate = function() { MTVM.log("MTVM.playlist: Details.populate: "); var personalProfile = ""; if(typeof MTVN_PL != "undefined") { if(MTVN_PL.PlaylistManager._widgetRegistry[MTVM.Playlist.config.playlistMgid] != null) //playlist in dom, populate data { personalProfile = new MTVM.Playlist.Details.PersonalProfile(MTVM.Playlist.config.userUcid); } else //playlist not yet in dom, listen for it { MTVN_PL.Controller.addListener (MTVN_PL.Controller.RESOLVE_LIST, MTVM.Playlist.Details.populate, this); } } } MTVM.Playlist.Details.Date = { __getDateFromParent: function() { MTVM.log("MTVM.playlist: Details.date.__getDateFromParent: "); //var urlParams = MTVM.util.parseUrlParamsToJSON(); var playlist =""; var date =""; playlist = MTVN_PL.PlaylistManager._allPlaylistsByURI[MTVM.Playlist.config.playlistMgid]; if(playlist!=null && playlist!="") { var myDate = new Date(playlist.createdate *1000); if(MTVM.config.countryCode == "us") { date = (myDate.getMonth()+1)+"/"+myDate.getDate()+"/"+myDate.getFullYear(); } else { date = myDate.getDate()+"/"+(myDate.getMonth()+1)+"/"+myDate.getFullYear(); } } return date; }, populate: function() { MTVM.log("MTVM.playlist: Details.date.populate: "); var date = this.__getDateFromParent(); if(date!=null && date!="")//fill in date { //document.getElementById("playlist-createdDate").innerHTML = "on " + date; document.getElementById("playlist-creator").innerHTML += "on " + date; } } } MTVM.Playlist.Details.PersonalProfile = function(userUcid) { MTVM.log("MTVM.playlist: Details.PersonalProfile: "); this.userUcid = userUcid; this.userProfile = null; this.__loadData(); } MTVM.Playlist.Details.PersonalProfile.prototype = { __loadData : function() { var thisPtr = this; try{ $J.ajax({ url: '/sitewide/dataservices/daapiPeople/', type: 'GET', data: "showComments=off&userUcid="+thisPtr.userUcid, dataType: 'json', timeout: 20000, error: function(){ MTVM.log('MTVM.Playlist.Details.PersonalProfile: Error loading AJAX document', 2); }, success: function(json) { thisPtr.__processData(json); } }); } catch(e) { MTVM.log("Playlist Details Personal Profile : loadData failed " + e, 2); this.userProfile = ""; } }, __processData: function(json) { try{ this.userProfile = json; this.__populateDom(); } catch(e) { MTVM.log("Playlist Details Personal Profile: processData failed " + e, 2); this.userProfile = ""; } }, __populateDom: function() { var userTitle = this.userProfile.title?this.userProfile.title:this.userProfile.firstName+this.userProfile.lastName; /* if(document.getElementById("playlist-details") == null || document.getElementById("playlist-details")=="") { //$J("#pageTitle").after('
    '); $J("#videoDetails-playlistBy").html('
    '); } */ //if(this.userProfile != null && this.userProfile != "") if(userTitle != "") { //document.getElementById("playlist-details").style.display = "block"; //document.getElementById("playlist-creator").innerHTML = "Playlist "+MTVM.lang.playlist.createdBy+": "+userTitle+" "; document.getElementById("playlist-creator").innerHTML = ""+userTitle+" "; //document.getElementById("playlist-creator").innerHTML = ""+userTitle+" "; MTVM.Playlist.Details.Date.populate(); document.getElementById("videoDetails-playlistBy").style.display = "block"; } else { //document.getElementById("playlist-details").style.display = "none"; document.getElementById("videoDetails-playlistBy").style.display = "none"; } } } /***************************************************/ /***************************************************/ /***************** ADD BUTTON BUILDER **************/ /***************************************************/ MTVM.Playlist.domRenderButtonWithText = function(mgid){ MTVM.log("MTVM.playlist: domRenderButtonWithText: "); if(typeof jQuery == 'function'){ var addButtonDivId = "playlistAddButtonDiv"; var addButtonDiv = $J("
    ").addClass("left "); addButtonDiv.attr("id", addButtonDivId); addButtonDiv.css("padding","2px 0 0 0px"); addButtonDiv.html(MTVN_PL.AddButtonManager.renderButton(mgid)); var addButtonText = $J("
    ").addClass("left "); addButtonText.css("padding","0 0 0 3px"); addButtonText.html(''+MTVM.lang.playlist.addToPlaylist+''); $J('#playlistAdd').append(addButtonDiv); $J(addButtonDiv).after(addButtonText); } /* var buttonHTML = '
    ' + MTVN_PL.AddButtonManager.renderButton(mgid) + '
    Add to Playlist
    '; */ } /* * * Ad Sponsor Logo Creator * */ MTVM.Playlist.getSponsorLogo = function(module) { var cssClass = MTVM.config.languageCode + "-" +MTVM.config.countryCode; var logo = ""; switch(module) { case "playback": logo = ''+ $J('#MTVM_PL_playbackSponsorLogo a').html() +''; break; default: logo = ''+ $J('#MTVM_PL_sponsorLogo a').html() +''; } return logo; } /***************************************************************/ /***************** Page Reloader *********************/ /***************************************************************/ MTVM.Playlist.reloadPage = function(param) { window.location.reload(); } /***************************************************************/ /***************** Playlist Video Details Reloader *************/ /***************************************************************/ MTVM.Playlist.reloadVideoDetails = function(param) { var reloader =null; if(typeof param =="object") { MTVM.log("MTVM.Playlist.reloadVideoDetails activated: "+param.contentURI); reloader = new MTVM.Playlist.VideoDetailsReloader(param.contentURI); } else { MTVM.log("MTVM.Playlist.reloadVideoDetails activated: "+param); reloader = new MTVM.Playlist.VideoDetailsReloader(param); } } MTVM.Playlist.VideoDetailsReloader = function(playlistVidMgid) { this.reset(); //reset first! this.playlistVidMgid = playlistVidMgid; //listening on the videoDetails ajax call to come back before updating the video details, breadcrumb, contextValues, flux widgets, and carousels MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.reloadAd, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.showAllDetails, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.updateMTVMParams, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.updateBreadcrumb, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.updateVideoInfo, this); //MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.updateShareEmbed, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.showDivs, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.updateMTVMWidgets, this); MTVM.EventsManager.addListener("onVideoDetailsReloaderDataSerivceReady", MTVM.Playlist.VideoDetailsReloader.prototype.updateFluxWidgets, this); MTVM.log("MTVM.Playlist.VideoDetailsReloader activated"); //logging call needs to be placed after fluxevent listeners. possible racing condition. will need to optimize logging later. MTVM.Playlist.VideoDetailsReloader.DataService.get(playlistVidMgid); } /*** RESET Reloader *****/ MTVM.Playlist.VideoDetailsReloader.prototype.reset = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.reset activated", 3); try{ this.hideAllDetails(); MTVM.EventsManager.removeAllListeners("onVideoDetailsReloaderDataSerivceReady"); MTVM.EventsManager.removeAllListeners("onFluxComments3Ready"); MTVM.EventsManager.removeAllListeners("onFluxContentAction2Ready"); MTVM.EventsManager.removeAllListeners("onFluxUsageReady"); }catch(e){ MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.reset failed "+e , 2); } } /*** Show wrapper divs ***/ MTVM.Playlist.VideoDetailsReloader.prototype.showDivs = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.showDivs activated", 3); try{ if(document.getElementById('contentTopRow')!=null && document.getElementById('contentTopRow').style.visibility=="hidden"){ document.getElementById('contentTopRow').style.display="block"; document.getElementById('contentTopRow').style.visibility="visible"; $J('#contentTopRow div').css('visibility', 'visible'); } if(document.getElementById('contentBottomRow')!=null && document.getElementById('contentBottomRow').style.visibility=="hidden"){ document.getElementById('contentBottomRow').style.display="block"; document.getElementById('contentBottomRow').style.visibility="visible"; $J('#contentBottomRow div').css('visibility', 'visible'); } }catch(e){ MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.showDivs failed "+e , 2); } } /*** Update MTVM Carousel Widgets ***/ MTVM.Playlist.VideoDetailsReloader.prototype.updateMTVMWidgets = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateMTVMWidgets activated", 3); var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON var artistAlias = ""; var artistName = ""; var videoId = videoJSON.id; var seriesId = videoJSON.seriesId; var relatedVideos; var moreHDVideos; var playlistsContainerVideo; var moreVideosByArtist; artistName=videoJSON.artists[0].name; artistAlias = videoJSON.artists[0].alias; var updateWidgets = function(json, vid, seriesId) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.updateMTVMWidgets processing data"); try { var moreArtistVideosObj = json.moreVideos; var relatedVideosObj = json.relatedVideos; var playlistsContainingVideoObj = json.playlistContaining; $J("#hdWidgetBlock")[0].innerHTML = ""; $J("#hdWidgetBlock").hide(); if(videoJSON.largestRenditionWidth >= 1280) { $J("#hdWidgetBlock").show(); var HDRelatedVideosObj = json.moreHD; //MTVM.widgets.moreHDVideosWidget = new MTVM.widgets.hdVideoWidgetCarousel("moreHDVideosWidget", {datasource:HDRelatedVideosObj, itemwidth:158, containerwidth: 1040, seriesId:seriesId}); if (HDRelatedVideosObj.aux.videos.length > 0) MTVM.widgets.moreHDVideosWidget = new MTVM.widgets.genericWidgetCarousel("moreHDVideosWidget", {datasource:HDRelatedVideosObj, maxItems: 24, title:"More HD Videos", containerwidth: 1040, wType:"solr", seriesId:seriesId}); else { $J("#hdWidgetBlock")[0].innerHTML = ""; $J("#hdWidgetBlock").hide(); } } $J("#moreByArtistWidget")[0].innerHTML = ""; $J("#moreByArtistWidget").show(); $J("#relatedVideosByArtistWidget")[0].innerHTML = ""; $J("#relatedVideosByArtistWidget").show(); $J("#playlistsContainingVideoWidget")[0].innerHTML = ""; $J("#playlistsContainingVideoWidget").show(); //MTVM.widgets.moreByArtistWidget = new MTVM.widgets.moreByArtistWidgetCarousel("moreByArtistWidget", {datasource:moreArtistVideosObj, containerwidth: 1040, videoId: vid}); if (moreArtistVideosObj.videos.length > 0) MTVM.widgets.moreByArtistWidget = new MTVM.widgets.genericWidgetCarousel("moreByArtistWidget", {datasource:moreArtistVideosObj, title:"More from "+artistName, containerwidth: 1040, wType:"moreBy", videoId: vid}); else $J('#moreByArtistWidget').hide(); //MTVM.widgets.relatedVideosByArtistWidget = new MTVM.widgets.relatedVideoWidgetCarousel("relatedVideosByArtistWidget", {datasource:relatedVideosObj, containerwidth: 1040}); if (relatedVideosObj.aux.videos.length > 0) MTVM.widgets.relatedVideosByArtistWidget = new MTVM.widgets.genericWidgetCarousel("relatedVideosByArtistWidget", {datasource:relatedVideosObj, maxItems: 24, title:"Related Videos", containerwidth: 1040, wType:"solr"}); else $J('#relatedVideosByArtistWidget').hide(); //MTVM.widgets.playlistsContainingVideoWidget = new MTVM.widgets.playlistsContainingWidgetCarousel("playlistsContainingVideoWidget", {datasource:playlistsContainingVideoObj, containerwidth: 1040}); if (playlistsContainingVideoObj.playlists.length > 0) MTVM.widgets.playlistsContainingVideoWidget = new MTVM.widgets.genericWidgetCarousel("playlistsContainingVideoWidget", {datasource:playlistsContainingVideoObj, maxItems: 24, title:"Playlists Containing This Video", containerwidth: 1040, wType:"playlist"}); else $J('#playlistsContainingVideoWidget').hide(); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.updateMTVMWidgets processData failed "+e, 2); } } this.getData = function(videoId, seriesId) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.updateMTVMWidgets loading data: "+videoId); try{ $J.ajax({ url: '/sitewide/dataservices/videoPageWidgetsObject/', type: 'GET', data: "contentURI="+MTVM.config.mgidPrefix+videoId+"&uri="+MTVM.config.mgidPrefix+videoId+"&artistAlias="+artistAlias+"&targetSearch=all&showComments=false&akamaized=y", dataType: 'json', timeout: 10000, error: function(){ MTVM.log('MTVM.Playlist.VideoDetailsReloader.updateMTVMWidgets : Error loading JSON document', 2); }, success: function(data) { updateWidgets(data, videoId, seriesId); } }); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.updateMTVMWidgets failed "+e, 2); } } MTVM.log("MTVM.playlist: MTVM.Playlist.VideoDetailsReloader.updateMTVMWidgets.getWidgetsDS: "+videoId); this.getData(videoId, seriesId); } /*** Reload Ad ***/ MTVM.Playlist.VideoDetailsReloader.prototype.reloadAd = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.reloadAd activated", 3); //var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON } /*** Update MTVM Params/ contextValues, useful for reporting and ad call ***/ MTVM.Playlist.VideoDetailsReloader.prototype.updateMTVMParams = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateMTVMParams activated", 3); var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON; var artistAlias = ""; var artistName = ""; var videoId = videoJSON.id; var genreAlias = videoJSON.primaryGenre.alias; var contentLists = videoJSON.forContextValues.contentLists?videoJSON.forContextValues.contentLists:""; //artist name/alias artistName=videoJSON.artists[0].name; artistAlias = videoJSON.artists[0].alias; MTVM.contextValues.artistAlias = artistAlias; MTVM.contextValues.genre = genreAlias; MTVM.contextValues.vid = videoId; MTVM.contextValues.vid_type = "music_video"; MTVM.contextValues.video ={ albums:"", artists:[ { alphabetizeBy: "", artistAlias: artistAlias, artistId: "", artistName: artistName } ], contentLists: contentLists } } /*** Update Flux widgets: Comments, usage line, contentAction ***/ MTVM.Playlist.VideoDetailsReloader.prototype.updateFluxWidgets = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateFluxWidgets activated "+this.playlistVidMgid); try{ this.destroyFluxWidgets(); this.deployFluxWidgets(); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateFluxWidgets : failed :" + e, 2); } } /*** Destroy flux widgets: Comments, usage line, contentAction ***/ MTVM.Playlist.VideoDetailsReloader.prototype.destroyFluxWidgets = function() { document.getElementById('fluxCommentingWidget').innerHTML = ""; //document.getElementById('videoDetails-contentActionWidget').innerHTML = ""; } /*** Deploy flux widgets: Comments, usage line, contentAction ***/ MTVM.Playlist.VideoDetailsReloader.prototype.deployFluxWidgets = function() { var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON; MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.deployFluxWidgets activated "+this.playlistVidMgid); try{ if(typeof Flux == "object") { /* * Flux 4 Activity Widget * $J('#fluxCommentingWidget').html('
    '); */ Flux.createWidget('Comments', { contentUri: MTVM.config.mgidPrefix+videoJSON.id, containerId: 'fluxCommentingWidget', title: '' } ); /* ### VIEWCOUNT REMOVAL 6/21/11 Flux.createWidget('ContentAction', { contentUri: MTVM.config.mgidPrefix+videoJSON.id, containerId: 'videoDetails-contentActionWidget', layout: 'horizontal', size: 'large', metricsAsPermalink: false, hideShareToGroup: false, items: [ { id: 'viewCount', title: '' } ] }); Flux.createWidget('ContentAction', { contentUri: MTVM.config.mgidPrefix+videoJSON.id, containerId: 'videoDetails-contentActionWidget', layout: 'horizontal', size: 'large', metricsAsPermalink: false, hideShareToGroup: false, items: [ { id: 'viewCount', title: 'views' }, { id: 'commentCount', title: 'comments' }, { id: 'shareCount', title: 'shares' } ] }); */ // commented unless we need to share the video as the playlist updates // UPDATE: injecting video embed widget inside the playlist share widget.... if ((MTVM.contextValues.pageType).toUpperCase() != "QUICKLIST"){ $J('#videoDetails-flux4Share-video').html('
    '); } else if ((MTVM.contextValues.pageType).toUpperCase() == "QUICKLIST") { $J('#videoDetails-flux4Share-quicklist').css('display', 'block'); $J('#videoDetails-flux4Share-quicklist').html('
    '); } /* $J(".flux4Widget").flux4(); $J(waiting).bind("Flux4.coreLoad", function() { Flux4.addEventListener("signIn", function (eventContext, userContext) { MTVM.services.ui.showMyPlaylists(); MTVN_PL.Controller.init(); }); Flux4.addEventListener("signOut", function (eventContext) { MTVM.services.ui.hideMyPlaylists(); MTVN_PL.Controller.init(); }); Flux.loadContext(function(context) { if (context.user) { MTVM.services.ui.showMyPlaylists(); } else { } }); }); */ $J(".flux4Widget").flux4(); /* Adding event listeners to the sign in/sign out events */ $J(waiting).bind("Flux4.coreLoad", function(){ Flux4.addEventListener("signIn", function (eventContext, userContext) { $J.getScript("'+MTVM.config.flux4ContextUrl+'/api/ContextService/Context?communityUcid=B8E6FFFF00F179450002FFFFE6B8", function() { MTVM.services.ui.cleanUpFlux4UserBarDropdown(); MTVM.services.ui.showMyPlaylists(); MTVN_PL.Controller.configure("userLoggedIn", MTVM.flux.isUserLoggedInFlux4()); MTVN_PL.Controller.configure("currentExternUserID", MTVM.flux.getUserUcidFlux4()); MTVN_PL.Controller.configure("isCommunityMember", MTVM.flux.isUserCommunityMemberFlux4()); var playlistFlashDispatcherSwf = ''; var clientBase = "http://"+MTVM.config.playlistServicesURL+"/client/"+MTVM.config.playlistAppVersion; if (navigator.appName.indexOf("Microsoft") != -1) { playlistFlashDispatcherSwf += ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''; } else { playlistFlashDispatcherSwf += ''; } $J("#MTVN_PL-Dispatcher-Container").html(playlistFlashDispatcherSwf); setTimeout("PlaylistDispatcherCheck()", 3000); }); $J.getScript("'+MTVM.config.flux3WidgetsUrl+'/context/short/B8E6FFFF00F179450002FFFFE6B8", function() { }); }); Flux4.addEventListener("signOut", function (eventContext) { $J.getScript("'+MTVM.config.flux4ContextUrl+'/api/ContextService/Context?communityUcid=B8E6FFFF00F179450002FFFFE6B8", function() { MTVM.services.ui.hideMyPlaylists(); MTVN_PL.Controller.configure("userLoggedIn", MTVM.flux.isUserLoggedInFlux4()); MTVN_PL.Controller.configure("currentExternUserID", MTVM.flux.getUserUcidFlux4()); MTVN_PL.Controller.configure("isCommunityMember", MTVM.flux.isUserCommunityMemberFlux4()); MTVN_PL.Controller.getLists({ playlistUserID : "__CURRENT_USER__", sort : "createdate:desc" }); }); $J.getScript("'+MTVM.config.flux3WidgetsUrl+'/context/short/B8E6FFFF00F179450002FFFFE6B8", function() { }); }); if (MTVM.flux.isUserLoggedInFlux4()) { MTVM.services.ui.showMyPlaylists(); } else { Flux.loadContext(function(context) { if (context.user) { MTVM.services.ui.showMyPlaylists(); /* show tab if login again after logout */ } else { } }); } }); } } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.deployFluxWidgets : failed :" + e, 2); } } /*** Update Breadcrumb ***/ MTVM.Playlist.VideoDetailsReloader.prototype.updateBreadcrumb = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateBreadcrumb activated"); var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON var artistAlias = ""; var artistName = ""; var contentUri = videoJSON?videoJSON.contentUri:""; var videoId = videoJSON?videoJSON.id:""; var videoTitle = videoJSON?videoJSON.title:""; var breadcrumb; var playlistType = MTVM.Playlist.getPlaylistType(); var currentPlaylist = MTVM.Playlist.getCurrentPlaylist(); try{ artistName=videoJSON.artists[0].name; artistAlias = videoJSON.artists[0].alias; switch(playlistType) { case "transient": switch((MTVM.contextValues.pageType).toUpperCase()) { case "ARTIST": // breadcrumb =MTVM.Playlist.getPlaylistName()+" ("+currentPlaylist.contentList.length+") » "+videoTitle; breadcrumb =MTVM.Playlist.getPlaylistName(); break; case "PLAYALL": /* if((MTVM.Playlist.PlayAll.currDeployedPlaylist.extraParams.urlParams.t).toUpperCase() == MTVM.Playlist.PlayAll.PLAYALL_TYPES.MORE_BY_ARTIST_WIDGET){ breadcrumb = MTVM.Playlist.getPlaylistName()+" ("+currentPlaylist.contentList.length+") » "+videoTitle; }else{ breadcrumb = MTVM.Playlist.getPlaylistName()+" ("+currentPlaylist.contentList.length+") » "+artistName+" » "+videoTitle; } */ // breadcrumb = MTVM.Playlist.getPlaylistName()+" ("+currentPlaylist.contentList.length+") » "+artistName+" » "+videoTitle; breadcrumb = MTVM.Playlist.getPlaylistName(); break; default: //breadcrumb = MTVM.Playlist.getPlaylistName()+" ("+currentPlaylist.contentList.length+") » "+artistName+" » "+videoTitle; breadcrumb = MTVM.Playlist.getPlaylistName(); break; } break; default: // breadcrumb = MTVM.Playlist.getPlaylistName()+" ("+currentPlaylist.contentList.length+") » "+artistName+" » "+videoTitle; breadcrumb = MTVM.Playlist.getPlaylistName(); break; } //$J('#pageTitle h1.title').html(breadcrumb); $J('#playlist-breadcrumb').html(breadcrumb); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateBreadcrumb : failed :" + e, 2); } } /*** Update Share Embed ***/ MTVM.Playlist.VideoDetailsReloader.prototype.updateShareEmbed = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateShareEmbed activated"); var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON; //artist name/alias artistName=videoJSON.artists[0].name; artistAlias = videoJSON.artists[0].alias; var embedHtml = ''; $J('#embedShare .copyText').html(embedHtml); if(videoJSON.forContextValues.governingAgreementId == 4 && MTVM.config.regionCode == "US") //SONY fix no embed code { $J('#embedShare').css('display', 'none'); }else { $J('#embedShare').css('display', 'block'); } } /*** Update Video Info ***/ MTVM.Playlist.VideoDetailsReloader.prototype.updateVideoInfo = function() { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.updateVideoInfo activated"); var videoJSON = MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON; var addToPlayListButton; var isHD = false; MTVM.util.showVideoDetails(videoJSON.id, MTVM.Playlist.config.userUcid); try{ $J("#buyButtonSeparator").css('display', 'none'); $J("#buyButtonWrapper").css('display', 'none'); //console.log(videoJSON); $J("#playlistAdd").html(""); MTVM.Playlist.domRenderButtonWithText(MTVM.config.mgidPrefix+videoJSON.id+"", "playlistAdd"); if (videoJSON.forContextValues.videoTypeGrouping=='music_video') { $J("#buyButtonSeparator").css('display', 'block'); $J("#buyButtonWrapper").css('display', 'block'); $_WGPlayable.isVideoIdBuyableScenic(videoJSON.id, "track", "buyButtonWrapper"); } $J("#videoDetails-interact").css('display', 'block'); if(videoJSON.largestRenditionWidth >= 1280) { isHD = true; MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.get(videoJSON.seriesId?videoJSON.seriesId:"", videoJSON.episodeId?videoJSON.episodeId:""); } //thumbnail if(isHD && MTVM.config.regionCode=="US") { // document.getElementById("MTVM-goFullScreenWrapper").style.display="block"; if(videoJSON.seriesChannelId == "87") {$J("#videoDetails-thumbnail").html('');} else { $J("#videoDetails-thumbnail").html(''); // $J("#videoDetails-thumbnail").html("\"\""); } //dvd link if(videoJSON.ecomURL!=null && videoJSON.ecomURL!="") {$J("#videoDetails-buyDvd").html(''+MTVM.lang.playlist.buyDvd+'');} //series information if(document.getElementById('videoDetails-series')) { if(MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON.seriesChannelId != null && MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON.seriesChannelId != "") { if(MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON.seriesChannelId =="87") { seriesTitle = MTVM.lang.playlist.seriesPalladia.replace('[SERIESNAME]', MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON.seriesName); } else { seriesTitle = MTVM.lang.playlist.seriesNonPalladia.replace('[SERIESNAME]', MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON.seriesName); seriesTitle = seriesTitle.replace('[SERIESCHANNELNAME]', MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON.seriesChannelName); } //$J('#videoDetails-series .videoDetailsAttrName').html(seriesTitle); $J('#videoDetails-series').html(seriesTitle); document.getElementById("videoDetails-series").style.display = "block"; document.getElementById("videoDetails-palladia").style.display = "block"; } } } else { document.getElementById("MTVM-goFullScreenWrapper").style.display="none"; $J("#videoDetails-thumbnail").html("\"\""); } //artist name $J('#videoDetails-artistName .videoDetailsAttrName').html(''+videoJSON.artists[0].name+''); //song title $J('#videoDetails-artistName .videoDetailsAttrVal').html(''+videoJSON.title+''); //album if(videoJSON.albums.length >0) { $J('#videoDetails-album').css('display', 'block'); if(videoJSON.albums.length && videoJSON.albums.length>1) {$J('#videoDetails-album .videoDetailsAttrVal').html(videoJSON.albums[0].title);} else {$J('#videoDetails-album .videoDetailsAttrVal').html(videoJSON.albums[0].title);} } else{ $J('#videoDetails-album').css('display', 'none'); } //label if(videoJSON.label && videoJSON.label !=" "){ $J('#videoDetails-label').css('display', 'block'); //$J('#videoDetails-label .videoDetailsAttrVal').html(''+videoJSON.label+''); $J('#videoDetails-label .videoDetailsAttrVal').html(videoJSON.label); }else { $J('#videoDetails-label').css('display', 'none'); } //director if(videoJSON.director){ $J('#videoDetails-director').css('display', 'block'); //$J('#videoDetails-director .videoDetailsAttrVal').html(''+videoJSON.director+''); $J('#videoDetails-director .videoDetailsAttrVal').html(videoJSON.director); } else{ $J('#videoDetails-director').css('display', 'none'); } if(videoJSON.forContextValues.description){ $J('#videoDetails-description').css('display', 'block'); $J('#videoDetails-description .videoDetailsAttrVal').html(videoJSON.forContextValues.description); $J('#videoDetails-description-120min .videoDetailsAttrVal').html(videoJSON.forContextValues.description); } else{ $J('#videoDetails-description').css('display', 'none'); } //featuring if(videoJSON.artists && (videoJSON.artists.name == null || videoJSON.artists.name == "") && videoJSON.artists.length >1) { $J('#videoDetails-featuring').css('display', 'block'); $J('#videoDetails-featuring-120min').css('display', 'block'); var featuredArtists =""; for(var i = 1; i'+videoJSON.artists[i].name+''; if(i'+videoJSON.primaryGenre.name+''); }else { $J('#videoDetails-genre').css('display', 'none'); } //change socialnetwork stuff /* try{ MTVM.util.socialNetwork.shareUrl = MTVM.config.serverHostName+"/"+MTVM.lang.urls.artist+"/"+videoJSON.artists[0].alias MTVM.util.socialNetwork.mesg = MTVM.lang.video.socialMesg.replace(/\[ARTISTNAME\]/, MTVM.util.escapeQuotes(videoJSON.artists[0].name)); MTVM.util.socialNetwork.mesg = MTVM.util.socialNetwork.mesg.replace(/\[VIDEONAME\]/, MTVM.util.escapeQuotes(videoJSON.title)); MTVM.util.socialNetwork.embed = "'); break; }else{ $J('#videoDetails-featuredOn').css('display', 'none'); } } } }); }else { for(var i=0; i'); break; }else{ $J('#videoDetails-featuredOn').css('display', 'none'); } } } } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.prototype.getFeaturedOnRockband failed "+e, 2); } } MTVM.Playlist.VideoDetailsReloader.prototype.hideAllDetails = function() { $J('#videoDetails-thumbnail').html(''); $J('#videoDetails-thumbnail').html(''); $J('#videoDetails-series').css('display', 'none'); $J('#videoDetails-nextAiring').css('display', 'none'); $J('#videoDetails').css('display', 'none'); $J('#share').css('display', 'none'); $J('#interact').css('display', 'none'); $J('#contentBottomRow').css('display', 'none'); } MTVM.Playlist.VideoDetailsReloader.prototype.showAllDetails = function() { $J('#videoDetails').css('display', 'block'); $J('#share').css('display', 'block'); $J('#interact').css('display', 'block'); $J('#contentBottomRow').css('display', 'block'); } /*************** VIDEO DataService **************/ MTVM.Playlist.VideoDetailsReloader.DataService = { videoMgid: null, videoJSON: "", get : function(mgid) { MTVM.log("MTVM.playlist: MTVM.Playlist.VideoDetailsReloader.DataService.get: "+mgid); MTVM.Playlist.VideoDetailsReloader.DataService.videoMgid = mgid; MTVM.Playlist.VideoDetailsReloader.DataService.__loadData(mgid); }, __loadData : function(mgid) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.DataService loading data: "+mgid); try{ $J.ajax({ url: '/sitewide/dataservices/videoInfo/getVideoInfo/', type: 'GET', data: "mgid="+mgid+"&showComments=false", dataType: 'json', timeout: 10000, error: function(){ MTVM.log('MTVM.Playlist.VideoDetailsReloader.DataService : Error loading JSON document', 2); }, success: function(data) { MTVM.Playlist.VideoDetailsReloader.DataService.__processData(data); } }); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.DataService failed "+e, 2); } }, __processData: function(json) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.DataService processing data"); try { MTVM.Playlist.VideoDetailsReloader.DataService.videoJSON = json; MTVM.EventsManager.broadcast("onVideoDetailsReloaderDataSerivceReady"); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.DataService processData failed "+e, 2); } } } /*************** Next Airing Show Dataservice **************/ MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice = { showJSON: {}, seriesId: null, channelID: "87", numberOfDays: "30", count: null, get : function(seriesId, episodeId, channelID, numberOfDays) { MTVM.log("MTVM.playlist: MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.get: "+seriesId+" episode:"+episodeId); MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.videoseriesId = seriesId; MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.episodeId = episodeId; if (channelID!=null) MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.channelID = channelID; else MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.channelID = "87"; if (numberOfDays!=null) MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.numberOfDays = numberOfDays; else MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.numberOfDays = "30"; MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.__loadData(seriesId, episodeId); }, __loadData : function(seriesId, episodeId) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice loading data: "+seriesId+" episode:"+episodeId); try{ $J.ajax({ url: '/sitewide/dataservices/videoInfo/getNextAiring/', type: 'GET', data: "seriesId="+seriesId+"&showComments=false&episodeId="+episodeId+"&channelID="+MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.channelID+"&numberOfDays="+MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.numberOfDays, dataType: 'json', timeout: 10000, error: function(){ MTVM.log('MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice : Error loading JSON document: '+e, 2); }, success: function(data) { MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.__processData(data); } }); } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice failed "+e, 2); } }, __processData120Mins: function(json) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice processing data for 120Minutes"); var shownName = ""; try { MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON = json; if(MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode != null && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode != "" && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode != "null") { shownName = MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode; }else { shownName= MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.series; } if(MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date !="" && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date != null && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date !="null") { $J('#videoDetails-120mins-nextAiring').html(shownName+ ". " +MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date+" at "+MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.time+" ET/PT"); document.getElementById("videoDetails-120mins-nextAiring").style.display = "block"; } } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice processData failed "+e, 2); } }, __processData: function(json) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice processing data"); var shownName = ""; try { MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON = json; if(MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode != null && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode != "" && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode != "null") { shownName = MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.episode; }else { shownName= MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.series; } if(MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date !="" && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date != null && MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date !="null" && MTVM.config.regionCode=="US") { $J('#videoDetails-nextAiring .videoDetailsAttrVal').html(shownName+ ". " +MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.date+" at "+MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice.showJSON.time+" ET/PT"); document.getElementById("videoDetails-nextAiring").style.display = "block"; } } catch(e) { MTVM.log("MTVM.Playlist.VideoDetailsReloader.NextAiringDataservice processData failed "+e, 2); } } } /*****************************************/ /************** Play All *****************/ /* 1 - There are 2 Page Modes of PlayAll. STANDALONE - Exists on its own page, the url path begins with /playlists/playAll SUBSECTION (deprecated) - Lives off an existing page, such as artist page, search result page, etc. //this is now not supported due to product decision */ /*****************************************/ MTVM.Playlist.PlayAll ={ ENABLED: false, PAGE_MODES: { STANDALONE: "STANDALONE", //STANDALONE is playAll on its own independent page living under /playlist/playAll url. //SUBSECTION MODE is deprecated SUBSECTION: "SUBSECTION" //SUBSECTION is playAll playlist attached to a preexisting page such as artist, search result. etc. }, PLAYALL_TYPES: { MUSIC_VIDEOS: "MUSIC_VIDEOS", PERFORMANCES: "PERFORMANCES", OTHER_VIDEOS: "OTHER_VIDEOS", HD_VIDEOS: "HD_VIDEOS", INTERVIEWS: "INTERVIEWS", MISC_VIDEOS: "MISC_VIDEOS", COLLABORATIONS: "COLLABORATIONS", RELATED_VIDEOS_BY_ARTIST_WIDGET: "RELATED_VIDEOS_BY_ARTIST_WIDGET", MORE_HD_VIDEOS_WIDGET: "MORE_HD_VIDEOS_WIDGET", MORE_BY_ARTIST_WIDGET: "MORE_BY_ARTIST_WIDGET", HD_PERFORMANCES_WIDGET: "HD_PERFORMANCES_WIDGET", PLAY_ALL_PAGE: "PLAY_ALL_PAGE", HD_ARTIST_BROWSE: "HD_ARTIST_BROWSE", FEATURED: "FEATURED", EDITORIAL: "EDITORIAL", GEN_CAROUSEL: "GEN_CAROUSEL", ALL: "ALL" }, /************ Registry of playAll widgets with following props: widgetId, type and playAll instance. there should only be one widget per one playAllType. ************/ widgetsList: new Array(), currPlayAllType: "", //important. determines what type of play all playlist user will see currPageMode: "", //important. determin what layout to display currDeployedPlaylist: "", /************* Must be called at top of the page. For SUBSECTION mode, it also turns the host page into a fake playlist page immediately. *************/ init:function() { this.__setCurrPageMode(); if(this.isPlayAll()){ document.write('<'+'link rel="STYLESHEET" type="text/css" href="/sitewide/css/playAll.css"'+'/>'); this.deployPlaylist(); } }, /************ Building instances of playAll widgets. Supply it with necessary data. Does NOT automatically display the playlist after build is done. *************/ buildPlaylist: function (props) //build the PlayAll instance and also the button { var widgetId = MTVM.Playlist.PlayAll.widgetsList.length; var newPlayAll = null; props.widgetId = widgetId; try{ newPlayAll = new MTVM.Playlist.PlayAll.Base(props); }catch(e) { MTVM.log("MTVM.Playlist.PlayAll.buildPlaylist ERROR:"+e, 2); } MTVM.Playlist.PlayAll.widgetsList.push(newPlayAll); return MTVM.Playlist.PlayAll.widgetsList[MTVM.Playlist.PlayAll.widgetsList.length-1]; }, /************* Deploys and displays the specified or current playAll playlist. *************/ deployPlaylist: function(widgetId) //user chooses a playAll playlist, deploy the playlist to show { var playAllWidget = null; var artist = ""; try{ if(this.currPageMode == MTVM.Playlist.PlayAll.PAGE_MODES.STANDALONE){ //if not provided with a widgetId, derive playAll type and widget instance from url hash MTVM.Playlist.PlayAll.currPlayAllType = this.__setCurrPlayAllType(); playAllWidget = MTVM.Playlist.PlayAll.widgetsList[0]; //the very FIRST created playAll widget should be the playAll playlist taht is appearing on the standalone mode page }else{ //SUBSECTION MODE -- deprecated playAllWidget = MTVM.Playlist.PlayAll.widgetsList[widgetId]; MTVM.Playlist.PlayAll.currPlayAllType = playAllWidget.playAllType; } if(playAllWidget != null){ this.currDeployedPlaylist = playAllWidget; playAllWidget.showPlaylist(); }else{ this.currDeployedPlaylist = ""; } }catch(e){ MTVM.log("MTVM.Playlist.PlayAll.deployPlaylist ERROR:"+e, 2); } }, __setCurrPlayAllType: function() { var tmpHash = ""; var playAllType = ""; var tmpParams = ""; tmpHash = document.location.hash; switch(this.currPageMode) { case "STANDALONE": tmpParams = MTVM.util.parseUrlParamsToJSON(); playAllType = (tmpParams.t).toUpperCase()||MTVM.Playlist.PlayAll.PLAYALL_TYPES.MUSIC_VIDEOS; break; case "SUBSECTION": playAllType = tmpHash.substring(tmpHash.indexOf("-")+1); break; default: playAllType=""; break; } return playAllType; }, __setCurrPageMode: function() { var tmpHash = ""; var pageMode = ""; tmpHash = document.location.hash; if(tmpHash.indexOf("#playAll-")>-1){ pageMode = this.PAGE_MODES.SUBSECTION; }else if((document.location.pathname).indexOf("playlists/playAll")>-1){ //playAll page pageMode = this.PAGE_MODES.STANDALONE; }else{ pageMode = this.PAGE_MODES.SUBSECTION; } this.currPageMode = pageMode; }, isPlayAll: function() { //get value after hash from URL var tmpHash = ""; var isPlayAll = false; tmpHash = document.location.hash; if(tmpHash.indexOf("#playAll")>-1) { isPlayAll = true; } if((document.location.pathname).indexOf("playlists/playAll")>-1){ //playAll page isPlayAll = true; } return isPlayAll; }, parseURLForValues: function() { var tmpParams = ""; var rawIds = ""; var extraParams = ""; var playAllType = ""; var returnObj = {}; tmpParams = MTVM.util.parseUrlParamsToJSON(); rawIds = tmpParams.i; rawIds = rawIds.replace(/[^0-9]$/, ""); rawIds = rawIds.replace(/^|[^0-9]/g, ","+MTVM.config.mgidPrefix); rawIds = rawIds.replace(/^[^0-9]/, ""); playAllType = (tmpParams.t).toUpperCase()||MTVM.Playlist.PlayAll.PLAYALL_TYPES.MUSIC_VIDEOS; extraParams = { context: tmpParams.c, artistName: tmpParams.a, subType: tmpParams.s||"", term: tmpParams.st?tmpParams.st:"", title: tmpParams.tt } returnObj = { playAllType: playAllType, rawVidIds: rawIds, nodeForInsertion: "pageTitle", extraParams: extraParams } return returnObj; }, /************ Determine if the playAll instance relies on ajaxed in data. ************/ isDatasourceDynamic: function(playAll) { if( playAll.playAllType == MTVM.Playlist.PlayAll.PLAYALL_TYPES.RELATED_VIDEOS_BY_ARTIST_WIDGET || playAll.playAllType == MTVM.Playlist.PlayAll.PLAYALL_TYPES.MORE_HD_VIDEOS_WIDGET || playAll.playAllType == MTVM.Playlist.PlayAll.PLAYALL_TYPES.MORE_BY_ARTIST_WIDGET || playAll.playAllType == MTVM.Playlist.PlayAll.PLAYALL_TYPES.HD_PERFORMANCES_WIDGET || playAll.playAllType == MTVM.Playlist.PlayAll.PLAYALL_TYPES.HD_ARTIST_BROWSE ){ return true; }else{ return false; } }, /************ Prints playAll buttons ************/ printButton: function(props) { var widget = null; for(var i=0; i 1 ){ if((widget.subType == "" || widget.subType == null) && (props.subType == "" || props.subType == null)){ MTVM.services.ui.button.buttonList['playAll-'+widget.playAllType+"-"+widget.subType].print(); break; }else if(widget.subType == props.subType){ MTVM.services.ui.button.buttonList['playAll-'+widget.playAllType+"-"+widget.subType].print(); break; } } } } } /************************ PlayAll Base Object ************************/ MTVM.Playlist.PlayAll.Base = function(props) { this.VIDEO_LIMIT = 80; this.VIDEO_LIMIT_IE = 35; this.playAllType = props.playAllType; this.nodeForInsertion = props.nodeForInsertion||"pageTitle"; this.widgetId = props.widgetId; this.rawVidIds = props.rawVidIds; this.pageType = (MTVM.contextValues.pageType).toUpperCase()||""; this.extraParams = props.extraParams; this.subType = this.extraParams.subType||""; this.buttonId = "playAll-"+this.playAllType+"-"+(this.subType||""); this.playlistTitle = null; this.videoIds = new Array(); this.context = ""; //page context of where the playAll was first initiated this.inited = false; this.__init(); } MTVM.Playlist.PlayAll.Base.prototype.__init = function() { if(this.inited == false){ this.__createButton(); this.__setContext(); this.__setPlaylistTitle(); this.__setVideoIds(); } //only do this at first init this.inited = true; } MTVM.Playlist.PlayAll.Base.prototype.showPlaylist = function() { var ptr = this; if(MTVM.Playlist.PlayAll.isPlayAll() && MTVM.Playlist.PlayAll.currPlayAllType == this.playAllType){ switch(MTVM.Playlist.PlayAll.currPageMode) { case "SUBSECTION": // this mode is deprecated this.__hideOriginalPage(); $J("#"+ptr.nodeForInsertion).ready(function(){ptr.__createPlaylist()}); break; case "STANDALONE": $J("#"+ptr.nodeForInsertion).ready(function(){ptr.__createPlaylist()}); break; } } } MTVM.Playlist.PlayAll.Base.prototype.__setContext = function() { this.context = this.extraParams.context; } MTVM.Playlist.PlayAll.Base.prototype.__setPlaylistTitle = function() { var tmpParams = null; var path = null; var artistName = ""; if(this.extraParams.artistName != null && this.extraParams.artistName !=""){ artistName = decodeURIComponent(unescape(this.extraParams.artistName)); }else{ if(MTVM.contextValues.artist!=null && MTVM.contextValues.artist.artistName!=null){ artistName = MTVM.contextValues.artist.artistName; }else if(MTVM.contextValues.video != null){ artistName = MTVM.contextValues.video.artists[0].artistName; } } try{ if(this.pageType == "SEARCH" || this.context=="search") { this.playlistTitle = escape("\"") + decodeURIComponent(unescape(this.extraParams.term)) + escape("\"")+ " "+ decodeURIComponent(unescape(this.extraParams.title)) + " "; /* switch (MTVM.config.languageCode) { case "en": this.playlistTitle = escape("\"") + decodeURIComponent(unescape(this.extraParams.term)) + escape("\"")+ " "+ MTVM.lang.video.videos + " "; break; default: this.playlistTitle = MTVM.lang.video.videos + " " + escape("\"") + decodeURIComponent(unescape(this.extraParams.term)) + escape("\"")+ " "; break; } */ }else{ switch(this.playAllType) { case MTVM.Playlist.PlayAll.PLAYALL_TYPES.ALL: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.MUSIC_VIDEOS: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " + MTVM.lang.video.musicVideos + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.PERFORMANCES: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " + MTVM.lang.video.livePerformance + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.OTHER_VIDEOS: this.playlistTitle = MTVM.lang.playlist.playAllPage.allOther + " " ; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.HD_VIDEOS: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " + MTVM.lang.video.hd + " " + MTVM.lang.video.videos + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.INTERVIEWS: this.playlistTitle = MTVM.lang.playlist.playAllPage.allInterviews + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.MISC_VIDEOS: this.playlistTitle = MTVM.lang.playlist.playAllPage.allOther + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.COLLABORATIONS: this.playlistTitle = MTVM.lang.playlist.playAllPage.allCollaborations + " - " + artistName + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.FEATURED: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " +decodeURIComponent(unescape(this.subType)).capitalize() + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.RELATED_VIDEOS_BY_ARTIST_WIDGET: this.playlistTitle = MTVM.lang.playlist.playAllPage.videosRelatedTo + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.MORE_HD_VIDEOS_WIDGET: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " + artistName + " " + MTVM.lang.video.hd + " " + MTVM.lang.video.videos + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.MORE_BY_ARTIST_WIDGET: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.HD_PERFORMANCES_WIDGET: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " + MTVM.lang.video.hd + " " + MTVM.lang.video.livePerformance + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.PLAY_ALL_PAGE: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.HD_ARTIST_BROWSE: this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " " + MTVM.lang.video.hd + " " + MTVM.lang.video.videos + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.EDITORIAL: this.playlistTitle = decodeURIComponent(unescape(this.extraParams.title)) + " "; break; case MTVM.Playlist.PlayAll.PLAYALL_TYPES.GEN_CAROUSEL: this.playlistTitle = decodeURIComponent(unescape(this.extraParams.title)) + " "; break; default://needs to be translated. last piece of info this.playlistTitle = MTVM.lang.playlist.playAllPage.all + " "; break; } } }catch(e) { MTVM.log("MTVM.Playlist.PlayAll.Base.prototype.__setPlaylistTitle: failed"+e, 2); } } MTVM.Playlist.PlayAll.Base.prototype.__hideOriginalPage = function() { $J("#contentWrapper div").css("visibility", "hidden"); if(document.getElementById("contentLeft")){ document.getElementById("contentLeft").style.display = "none"; } if(document.getElementById("contentMiddle")){ document.getElementById("contentMiddle").style.display = "none"; } if(document.getElementById("contentRight")){ document.getElementById("contentRight").style.display = "none"; } if(document.getElementById("lenser")){ document.getElementById("lenser").style.display = "none"; } switch(this.pageType) { case "ARTIST": $J('h1.title').ready(function(){ $J('h1.title').siblings('div.left').css('visibility', 'hidden'); //hide playAll button next to breadcrumb }); break; } } MTVM.Playlist.PlayAll.Base.prototype.__setVideoIds = function() { var tmpRawIds = ""; tmpRawIds = this.rawVidIds; tmpRawIds = tmpRawIds.replace(/[^a-zA-Z0-9]$/, ""); this.videoIds = unescape(tmpRawIds).split(','); /* below for limiting ids */ if($J.browser.msie){ this.videoIds = (this.videoIds).slice(0, this.VIDEO_LIMIT_IE); }else{ this.videoIds = (this.videoIds).slice(0, this.VIDEO_LIMIT); } this.rawVidIds = (this.videoIds).join(","); this.rawVidIds = this.rawVidIds + ","; /* above for limiting ids */ } MTVM.Playlist.PlayAll.Base.prototype.__createDOMObjs = function() { var currNode = null; var containerNode = null; var playlistContainerNode = null; var videoPlayerNode = null; var playlistNode = null; var clearFloatNode = null; var ptr = this; //if no lenser, it means we are in non-lenser layout, make div#content visible again if(!document.getElementById("lenser")) {$J('#content').css("visibility", "visible");} if(typeof this.nodeForInsertion == "object"){ currNode = this.nodeForInsertion; }else{ currNode = document.getElementById(this.nodeForInsertion); } containerNode = document.createElement('div'); containerNode.setAttribute('id', "MTVN_PL-playAll-container"); playlistContainerNode = document.createElement('div'); playlistContainerNode.setAttribute('id', "player-playlist-container"); playlistContainerNode.setAttribute('style', "margin:0px auto;"); switch(MTVM.config.swfPlayer.playerVersion){ case "prime": playlistContainerNode.setAttribute('class', "prime"); break; } videoPlayerNode = document.createElement('div'); videoPlayerNode.setAttribute('id', "videoPlayer"); videoPlayerNode.setAttribute('class', "left"); playlistNode = document.createElement('div'); playlistNode.setAttribute('id', "playlist"); playlistNode.setAttribute('class', "left"); clearFloatNode = document.createElement('div'); clearFloatNode.setAttribute('class', "clear"); //put video, playlist, and float-clearing nodes into player-playlist-container playlistContainerNode.appendChild(videoPlayerNode); playlistContainerNode.appendChild(playlistNode); playlistContainerNode.appendChild(clearFloatNode); //put player-playlist container inside the playAll container containerNode.appendChild(playlistContainerNode); //finally, put the big container div for allllll playAll stuff after "pageTitle" or whatever specified with nodeforinsertion $J('#content').append($J(containerNode)); //currNode.parentNode.insertBefore(containerNode, currNode.nextSibling); //have to force the css again, due to IE dom manipulations seems to lose its css classes this.__fixIeCSS(); if($J.browser.msie){ $J(clearFloatNode).css("clear", "both"); } } MTVM.Playlist.PlayAll.Base.prototype.__moveDOMObjs = function(){ var contentTopRowNode = document.getElementById("contentTopRow"); var contentBottomRowNode = document.getElementById("contentBottomRow"); var parentNode = document.getElementById("contentWrapper"); //var adBoxNode = document.getElementById("adBox350"); parentNode.appendChild(contentTopRowNode); parentNode.appendChild(contentBottomRowNode); } MTVM.Playlist.PlayAll.Base.prototype.__fixIeCSS = function() { //have to force the css again, due to IE dom manipulations seems to lose its css classes if($J.browser.msie){ $J("#player-playlist-container").css("marin", "0 auto"); switch(MTVM.config.swfPlayer.playerVersion){ case "prime": $J("#player-playlist-container").addClass('prime'); break; } $J("#videoPlayer").css("float", "left"); $J("#videoPlayer").css("width", "640"); $J("#playlist").css("float", "left"); $J("#playlist").css("width", "640"); $J("div#playlist>div").addClass("MTVN_PL MTVN_PL-list MTVN_PL-playbackPlaylist"); $J("div#playlist>div>div").addClass("MTVN_PL-loading"); } } MTVM.Playlist.PlayAll.Base.prototype.__createPlaylist = function() { var ptr = this; this.__createDOMObjs(); switch(MTVM.Playlist.PlayAll.currPageMode) { case "SUBSECTION": //show the title div again, was in hiding because the title is not in right context $J('#'+ptr.nodeForInsertion+' h1').html(""); $J('#'+ptr.nodeForInsertion).css("visibility", "visible"); $J('#pageTitle').css("visibility", "visible"); $J('#contentTopRow').css("visibility", "hidden");//hide details first since video is not loaded. details will show once video plays this.__moveDOMObjs(); break; case "STANDALONE": $J("#pageTitle").css("visibility", "visible"); $J("#pageTitle h1").css("visibility", "visible"); break; } /* * Create an object to hold the transient list parameters * Assign it a contentURI (used to bind the placeholder DIV to the json response) * Note: If no contentURI is specified then it will default to mgid:playlist:transient:none:0000 */ var transientParams = new MTVN_PL.TransientParamsDO(); transientParams.contentURI = "transientPlaylist12345"; transientParams.listName = this.playlistTitle; transientParams.itemIDs = this.videoIds; MTVN_PL.PlaylistManager.placeTransientList(transientParams, MTVN_PL.PlaybackPlaylist, true, "playlist"); MTVN_PL.VideoHelper.placeVideo("videoPlayer"); this.__fixIeCSS(); MTVN_PL.Controller.addListener (MTVN_PL.Controller.PLAY_ITEM, MTVM.Playlist.reloadVideoDetails, this); } MTVM.Playlist.PlayAll.Base.prototype.__createButton = function() //create all the pretty buttons { var onclick = ""; var href = ""; var artistName = ""; var subType = ""; var searchTerm = ""; //pack on extra search params if(this.pageType == "SEARCH") { searchTerm = this.extraParams.term; } if(this.extraParams.artistName != null && this.extraParams.artistName !=""){ artistName = decodeURIComponent(unescape(this.extraParams.artistName)); }else{ if(MTVM.contextValues.artist!=null && MTVM.contextValues.artist.artistName!=null){ artistName = MTVM.contextValues.artist.artistName; }else if(MTVM.contextValues.video != null){ artistName = MTVM.contextValues.video.artists[0].artistName; } } //depending on pagetype, pack on context value if(this.playAllType == ""){ switch(this.pageType) { case "ARTIST": artist = this.extraParams.artistName?escape(encodeURIComponent(this.extraParams.artistName)):""; break; case "VIDEO": artist = MTVM.contextValues.video.artists[0].artistName?escape(encodeURIComponent(MTVM.contextValues.video.artists[0].artistName)):""; break; case "FEATURED": break; case "HOME": break; case "COMMUNITY": break; case "PLAYLISTHUB": break; case "HDHUB": break; case "UNPLUGGEDHOME": break; case "SEARCH": break; case "PLAYALL": break; default: break; } }else{ //from widgets artist = this.extraParams.data?escape(encodeURIComponent(this.extraParams.data[0].artistName)):""; } var playAllTitleParam = ""; if (this.extraParams.title != null) playAllTitleParam = "&tt="+escape(encodeURIComponent(this.extraParams.title)); href="/playlists/playAll/?i="+this.rawVidIds+"&t="+(this.playAllType).toLowerCase()+"&a="+escape(encodeURIComponent(artistName))+"&c="+(MTVM.contextValues.pageType).toLowerCase()+"&s="+escape(encodeURIComponent(this.subType))+"&st="+escape(encodeURIComponent(searchTerm))+playAllTitleParam; //Building buttons /* MTVM.services.ui.button.buttonList[this.buttonId] = new MTVM.services.ui.button.blueGradient17({ buttonText:{ onclick:onclick, content: '
    '+MTVM.lang.playlist.playAllPage.all.toUpperCase()+'
    ', href:href } }); */ MTVM.services.ui.button.buttonList[this.buttonId] = new MTVM.services.ui.button.altRibbon26({ buttonText:{ onclick:onclick, content: '
    '+MTVM.lang.playlist.playAllPage.all.toUpperCase()+'
    ', href:href } }); } //var coad = new CoAdBrowser("coadTarget"); MTVM.player = new function(){ this.configParams; this.playerMediaHost; this.videoUri; this.playlistUri; this.continuousPlay = true; this.fullEpisode = false; this.player; this.instanceOfMTVMPlayer = null; var coAdInterval; var onNoAdObject; this.init = function(){} this.createVideoPlayer = function(swfPlayerId, flashVars, movieSrc, height) { var playerHeight=height?height:640; document.write(''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''); } this.onPlayerLoaded = function(controller){ player = controller.player; player.addEventListener('NO_AD','MTVM.player.onNoAd'); // Video Startup Reporting player.addEventListener('STATE_CHANGE','MTVNTimerStateCheck'); player.addEventListener('PLAYHEAD_UPDATE', "MTVM.player.onPlayHeadUpdate"); player.addEventListener('STATE_CHANGE', 'MTVM.player.onPlayerStateChange'); player.addEventListener('METADATA','MTVM.player.onMetaData'); } //seek to a specific time (in seconds) this.onMetaData = function ( metadata ){ if(player.getMetadata().isAd == false && MTVM.player.startTime != "") { player.setPlayheadTime(MTVM.player.startTime); } } //stop at a specific time (in seconds) this.onPlayHeadUpdate = function() { if(player.getMetadata().isAd == false && MTVM.player.endTime != "" && player.getPlayheadTime() > MTVM.player.endTime){ player.pause(); } } //for choicestream this.onPlayerStateChange = function(state) { if(state== "stopped") { MTVM.services.Reporting.ChoiceStream.reset(); } } this.onNoAd = function(info) { var adSquare = new MTVM.services.Ads("300x250", 2); adSquare.codaParams.ads.size = adSquare.adSize; com.mtvi.ads.AdManager.setDefaultContentType(adSquare.codaParams.ads.defaultContentType); com.mtvi.ads.AdManager.setDartSite(adSquare.codaParams.ads.dartSite); com.mtvi.ads.AdManager.setKeyValues(adSquare.codaParams.ads.keyValues+adSquare.extraKeyValues); com.mtvi.ads.AdManager.setPositionThreshold(adSquare.adPositionThreshold); com.mtvi.ads.AdManager.setDefaultSections(adSquare.codaParams.ads.defaultSections); var adObject = com.mtvi.ads.AdManager.getAd( { size : adSquare.adSize } ); onNoAdObject = adObject; MTVM.player.noAdSetCoad(); //coAdInterval = setInterval('MTVM.player.noAdSetCoad()', 60000); } this.noAdSetCoad = function() { MTVM.player.setAdSquare(onNoAdObject); //MTVM.player.setCoad(onNoAdObject); } this.setCoad = function(adObject) { var src = adObject.url; var w = adObject.width; var h = adObject.height; coad.updateWindow(src, w, h); } this.setAdSquare = function(adObject) { coad.updateWindow(adObject.getUrl(), 300, 250); } this.isContinuousPlay = function() { return this.continuousPlay; } /* these are for editorial playlist player and should probably be moved to their own instance*/ this.onEdPlayerLoaded = function(controller) { this.player = controller.player; player.addEventListener('NO_AD','MTVM.player.onNoAd'); player.addEventListener('READY','MTVM.player.onReady'); //player.addEventListener('PLAYLIST_COMPLETE','MTVM.player.onPlaylistComplete'); //player.addEventListener('STATE_CHANGE','onStateChange'); } this.onReady = function () { //this is called as each _media item_ is ready var pl = player.getPlaylist(); var currentIndex = pl.index + 1; //player is zero-based; xsl is not this.setNowPlaying(currentIndex); var currentItem = player.getMetadata(); if (!currentItem.isAd) { this.updateBreadCrumb( currentItem.artistName, currentItem.description, currentItem.title ); this.reloadWidgetsIframe( currentItem.guid ); } } this.onStateChange = function ( state ) { if ( state == 'playing') { var md = controller.player.playlistMetadata; //alert(reflect(controller.player.playlistMetadata)); } } this.onPlaylistComplete = function () { //reserved for future use } this.setNowPlaying = function(index) { $J("div.MTVN_PL-items div").removeClass("MTVN_PL-playing"); document.getElementById("MTVN_PL-item"+index).className += " MTVN_PL-playing"; } this.playVideo = function(index) { player.playIndex(index-1); //player is zero-based; xsl is not this.setNowPlaying(index); } this.updateBreadCrumb = function ( artistName, artistId, title ) { var breadCrumbString = this.getBreadCrumb( artistName, artistId, title ); document.getElementById("breadcrumbDetails").innerHTML = breadCrumbString; } this.getBreadCrumb = function ( artistName, artistId, title ) { //var tmpString = "

    "+playlistTitle+" » "; var tmpString = " » "; if (artistName != "MTV") { tmpString += ""; tmpString += artistName; tmpString += " » "; } else { tmpString += artistName; tmpString += " » "; } tmpString += title+" "; //tmpString += "

    "; return tmpString; } this.reloadWidgetsIframe = function ( guid ) { var iframe = document.getElementById("widgetIframe"); iframe.src = "http://"+ document.location.hostname + "/sitewide/dataservices/videoDetails/index.jhtml?mgid="+guid+"&referrerPlaylistMgid="+controller.playerId } this.reflect = function (obj){ var temp = ""; for (var a in obj){ temp += a + " = " + obj[a] + "\n"; } return temp; } } var mtvnSetCoad = MTVM.player.setCoad; /**************************************************************/ /*************************** WIDGETS **************************/ /**************************************************************/ /********************** BASE WIDGET *********************************/ MTVM.widgets.BASE = function(){ this.list = document.createElement('div'); this.carouselInstances = new Array(); this.headerObj = $J("

    ").html("List").addClass("titleSmall"); this.footerObj = $J("
    ").html(""); this.leftArrowDiv = $J("
    ").html("").addClass("carousel-left-arrow-vp left"); this.rightArrowDiv = $J("
    ").html("").addClass("carousel-right-arrow-vp left"); this.carouselDiv = $J("
    ").html("").addClass("horizontal-carousel-vp left lenserBorderBottom"); this.carouselIndex = 0; this.__loadData = function(options) { var options = options || {}; var url = ('url' in options) ? options.url : ''; var ajaxType = ('ajaxType' in options) ? options.ajaxType : 'GET'; var data = ('data' in options) ? options.data : ''; var dataType = ('dataType' in options) ? options.dataType : 'xml'; var timeout = ('timeout' in options) ? options.timeout : 20000; var successHandler = ('successHandler' in options) ? options.successHandler : this.___successHandler; var errorHandler = ('errorHandler' in options) ? options.errorHandler : this.___errorHandler; var datasource = ('datasource' in options) ? options.datasource : null; try{ if (datasource != null) { console.log("Using provided datasource"); successHandler(datasource); }else{ console.log("AJAXING for data"); $J.ajax({ url: url, type: ajaxType, data: data, dataType: dataType, timeout: timeout, error: function(hr) { errorHandler(hr); }, success: function(data) { successHandler(data); } }); } } catch(e){ //MTVM.logger.log("BASE widget __loadData failed: " + e, 2); console.log("BASE widget __loadData failed: " + e); } } this.___errorHandler = function(hr){ //MTVM.logger.log('BASE WIDGET: Error loading XML document', 2); console.log("BASE WIDGET: Error loading XML document. Status: " + hr.status); } this.___successHandler = function(data){ //MTVM.logger.log(data); } this.__clearListHtml = function() { var l = $J(this.list); l.empty(); var container = $J("#"+this.containerDivId); container.empty(); } this.__buildPlayAll = function(data, title){ var rawVidIds = ""; var playlistType = ""; var playAllWidget = null; var anchorNode = null; var buttonNode = null; var clearNode = null; var nodeForInsertion = null; try{ if(document.getElementById("lenser") != null){ nodeForInsertion = "lenser"; }else{ nodeForInsertion = "content"; } //assemble the data if(data != null && data !=""){ for(var i = 0; i"+MTVN_PL.AddButtonManager.renderButton(MTVM.config.mgidPrefix+videoId)+""; } videoTitle = videoTitle.replace(/&/g, '&'); if (videoTitle.length > 40){ videoTitle = MTVM.util.truncateString(videoTitle, 37, 'soft'); } var byName = (hd) ? ""+artistName+"" : ""+artistName+""; if (artistAlias == '') byName = ""+artistName+""; try{ customHtml = ""+ "
    "+videoTitle+""+ playlistAddBtn+ "
    "+MTVM.lang.playlist.by+" "+byName+"
    "+ "
    "; return "
  • "+customHtml+"
  • "; } catch(e) { MTVM.logger.log("__buildHtmlList widget build html list failed " + artistAlias+ " - " + videoId+ " - " + videoTitle+ " - " + imagePath+ " - " + artistName + e, 2); } } } /************************************************************************/ /********************** END BASE WIDGET *********************************/ /************************************************************************/ /************************************************************************/ /***************** PLAYLIST ROLLOVER LIST *******************************/ /************************************************************************/ MTVM.widgets.playlistRolloverList = function(containerDivId, options){ var ptr = this; // self pointer this.containerDivId = containerDivId; this.options = options || {}; var recsDataservice = ('dataservice' in options) ? options.dataservice : '/sitewide/dataservices/playlistRolloverList/'; this.datasource = ('datasource' in options) ? options.datasource : null; this.firstItemTxt = ('firstItemTxt' in options) ? options.firstItemTxt : 'Videos In This Playlist'; this.lastItemLeftTxt = ('lastItemLeftTxt' in options) ? options.lastItemLeftTxt : 'and more videos'; this.lastItemRightTxt = ('lastItemRightTxt' in options) ? options.lastItemRightTxt : 'watch this playlist'; var ajaxParams = 'playlistMGID=' + options.playlistMGID + "&showComments=off"; var arrowDiv = document.createElement("div"); arrowDiv.className = "arrow"; document.getElementById(containerDivId).appendChild(arrowDiv); this.jsonResponse = {}; this.positioning = function(mgid, playlistsContainer){ var mgidRegExp = new RegExp("mgid:playlist:video:[^:]+:(.*)$"); // Find the "videoLinkContainer" corresponding to the selected playlist rollover var videoLinkContainerList = $J('.videoLinkContainer'); var currentVideoLinkContainer; for (var i = 0; i < videoLinkContainerList.length; i++) { var videoLinkChilds = videoLinkContainerList[i].childNodes; var matchedMgidList = mgidRegExp.exec(videoLinkChilds.item(0)); if (matchedMgidList != null) { var matchedMgid = matchedMgidList[1]; if (matchedMgid == mgid) { // Check the correct playlist container of the video container var listaItems = $J(videoLinkContainerList[i]).parents(); if (typeof(playlistsContainer) != "undefined") { for (var j = 0; j < listaItems.length; j++) { if ($J(listaItems[j]).attr("id") == playlistsContainer) { currentVideoLinkContainer = videoLinkContainerList[i]; } } } else { currentVideoLinkContainer = videoLinkContainerList[i]; } } } } // Begin playlistRollover div positioning to container var arrowPosition = {}; var currentPlaylistRollover = $J('#playlistRollover'+mgid); // Begin playlistRollover div repositioning according to browser window right limit var leftPositioning = currentVideoLinkContainer.offsetParent.offsetLeft+currentVideoLinkContainer.offsetLeft+126; var jointWidth = leftPositioning + $J(currentPlaylistRollover).width(); arrowPosition.hor = "left"; if (jointWidth > $J(window).width()) { arrowDiv.innerHTML =''; arrowPosition.hor = "right"; leftPositioning = currentVideoLinkContainer.offsetParent.offsetLeft+currentVideoLinkContainer.offsetLeft-240; }else { arrowDiv.innerHTML =''; } // End playlistRollover div repositioning according to browser window right limit // Begin playlistRollover div repositioning according to browser window bottom limit var topPositioning = currentVideoLinkContainer.offsetParent.offsetTop+currentVideoLinkContainer.offsetTop-(parseInt(currentVideoLinkContainer.clientHeight)/2); var containerTopTmp = currentVideoLinkContainer.offsetParent.offsetTop; var heightToVideoContainer = (containerTopTmp == 0) ? currentVideoLinkContainer.offsetTop : containerTopTmp; var windowHeight = $J(window).height(); var windowOffsetTop = $J(window).scrollTop(); var heightToBottomViewport = windowHeight + windowOffsetTop; var rolloverHeight = currentPlaylistRollover.height(); // Check if the height between container and bottom viewport is enough for the rollover if ((heightToBottomViewport - heightToVideoContainer) < rolloverHeight) { // If it has not enough space, elevate the rollover to be fully visible on viewport //topPositioning -= (rolloverHeight - (heightToBottomViewport - heightToVideoContainer)); } // End playlistRollover div repositioning according to browser window bottom limit currentPlaylistRollover.css('left', leftPositioning+'px'); currentPlaylistRollover.css('top', topPositioning+'px'); arrowPosition.vert = "0px"; if((topPositioning +rolloverHeight) > (heightToVideoContainer)){ arrowPosition.vert = (rolloverHeight - ((topPositioning +rolloverHeight) - (heightToVideoContainer)) +30); }else{ arrowPosition.vert = (rolloverHeight - ((topPositioning +rolloverHeight) - (heightToVideoContainer))); } if((arrowPosition.vert+30) > rolloverHeight){ arrowPosition.vert = rolloverHeight-35; } //change arrow position $J('#playlistRollover'+mgid+' .arrow').css('left', (arrowPosition.hor == "right"?$J(currentPlaylistRollover).width()+21+'px':'4px')); $J('#playlistRollover'+mgid+' .arrow').css('top', arrowPosition.vert+'px'); // End playlistRollover div positioning to container } this.processData = function(json) { try{ var jsonObj = JSON.parse(json); ptr.jsonResponse = json; if(typeof jsonObj.response.responsePayload.contentList != "undefined") { ptr.genDivContAsSpan(jsonObj.response.responsePayload.contentList); // this.genDivContAsUnorderedList(jsonObj.response.responsePayload.contentList); } } catch(e){ MTVM.logger.log("MTVM.widgets.playlistRolloverList widget: processData failed " + e, 2); } } this.genDivContAsSpan = function(jsonList) { var songsList = new Array(); var songSpan, br; songSpan = document.createElement('span'); $J(songSpan).addClass('rolledItem rolledFirst'); songSpan.innerHTML = ' ' + ptr.firstItemTxt; br = document.createElement('br'); $J('#' + ptr.containerDivId).append(songSpan); $J('#' + ptr.containerDivId).append(br); var itemCount = (jsonList.length < 10) ? 0 : jsonList.length - 10; var jsonLength = (jsonList.length < 10) ? jsonList.length : 10; for(var i = 0; i < jsonLength; i++) { var song = ""; song += (i+1 == 10) ? i + 1 : "0" + (i + 1); song += ". " + jsonList[i].data.artist + " - " + jsonList[i].data.title; songsList.push(song); songSpan = document.createElement('span'); $J(songSpan).addClass('rolledItem middleRolled'); br = document.createElement('br'); songSpan.innerHTML = song; $J('#' + ptr.containerDivId).append(songSpan); $J('#' + ptr.containerDivId).append(br); } songSpan = document.createElement('span'); $J(songSpan).addClass('rolledItem lastRolled'); var moreVideosContent = (itemCount == 0) ? '' : '' + ptr.lastItemLeftTxt.replace('[COUNT]', itemCount) + ' | '; songSpan.innerHTML = moreVideosContent + '' + ptr.lastItemRightTxt + ''; $J('#' + ptr.containerDivId).append(songSpan); } this.errorHandler = function(hr){ $J('#' + ptr.containerDivId).hide(); } this.init = function(containerDivId){ var processData = this.processData; var errorXML = this.errorHandler; var datasource = this.datasource; this.__loadData({url:recsDataservice,data:ajaxParams,successHandler:processData,errorHandler:errorXML, dataType: 'html', datasource:datasource}) } this.init(containerDivId); } MTVM.widgets.playlistRolloverList.prototype = new MTVM.widgets.BASE; // inherits /************************************************************************/ /***************** END PLAYLIST ROLLOVER LIST ***************************/ /************************************************************************/ /************************************************************************/ /******************* DISCOVER AND DOWNLOAD *********************/ /************************************************************************/ MTVM.widgets.discoverAndDownload = function(containerDivId, options){ this._dndPopup_ = []; this._dndSongTitle_ = []; this._dndThumbnail_ = []; this.totalShownItems = 0; this.containerDivId = ""; this.maxItemsToShow = 6; this.totalShownItems = 0; this.containerDivId = containerDivId; this.options = options || {}; var ptr = this; // self pointer var ajaxParams =""; var dataserviceUrl = '/sitewide/dataservices/discoverAndDownload/?showComments=off&v=true'; var headerObj = '

    Discover and Download

    Get free mp3s from these new and emerging artists
    '; var footerObj = '
    '; this.__canBeAdded = function() { var result = false; try{ if(this.totalShownItems < this.maxItemsToShow)//check if already at max num of Items { this.totalShownItems++ result = true; } } catch(e) { MTVM.logger.log("MTVM.widgets.discoverAndDownload: canBeAdded Failed " +e); } return result; } this.__buildHtmlList = function(artistArray) { var l = $J(this.list); var customHtml = ""; try{ if($J('#'+this.containerDivId+' ul').length == 0 ) { $J('
      ').html("").appendTo(this.list); } for(var i=0; i"+ ""+ "
      "; $J('
    • ').html(customHtml).appendTo('#'+this.containerDivId+' ul'); } } catch(e) { MTVM.logger.log("MTVM.widgets.discoverAndDownload: widget build html list failed " + e, 2); } } this.processData = function(data) { var title =""; var thumbnail = ""; var onclick =""; var artistArray = new Array(); eval(data); //contains var feed and var mtv try{ ptr.__buildListHtmlHeader(headerObj); for(var i=0; i-1) { onclick = mtv[j].onclick; } } artistArray.push( { title:title, thumbnail:thumbnail, onclick:onclick } ) } ptr.__buildHtmlList(artistArray); ptr.__buildListHtmlFooter(footerObj); if(ptr.totalShownItems == 0) {document.getElementById(ptr.containerDivId).style.display="none";} else {document.getElementById(ptr.containerDivId).style.display="block";} } catch(e){ MTVM.logger.log("MTVM.widgets.discoverAndDownload: processData failed " + e); } } this.init = function(containerDivId) { var l = this.list; var processData = this.processData; this.containerDivId = containerDivId; this.__clearListHtml(); $J(l).appendTo("#"+this.containerDivId); this.__loadData({url:dataserviceUrl,data:ajaxParams,successHandler:processData, dataType:'html'}) } this.init(containerDivId); } MTVM.widgets.discoverAndDownload.prototype = new MTVM.widgets.BASE; // inherits /************************************************************************/ /********************** HIVE MENTIONS WIDGET ***************************/ /************************************************************************/ MTVM.widgets.hiveMentions = function(containerDivId, term, options){ var ptr = this; // self pointer this.containerDivId = containerDivId; this.searchTerm = term; this.options = options || {}; this.entryList = $J('
        '); this.list = this.entryList; this.pagingDiv = $J('
        '); //this.rssURL = ('url' in options) ? options.url : 'http://read.mtvhive-d.mtvi.com/rss2/'; this.lStyle = ('listStyle' in options) ? options.listStyle : "regular"; this.pagination = ('pagination' in options) ? options.pagination : true; this.rssURL = ('url' in options) ? options.url : '/sitewide/dataservices/getblogs/'; this.datasource = ('datasource' in options) ? options.datasource : null; this.perPage = ('perPage' in options) ? options.perPage : 4; this.max = ('max' in options) ? options.max : 100; this.pageStart = ('start' in options) ? options.start : 0; this.reporting = ('reporting' in options) ? options.reporting : false; // for invoking search reporting call this.items = []; this.errorHandler = function(e){ //console.log(e); var l = $J(ptr.list); l.html( '
      • Error occured
      • ' ); } this.nextPage = function(){ if (ptr.pageStart + ptr.perPage < ptr.items.length){ var l = $J(ptr.list); l.empty(); ptr.pagingDiv.empty(); ptr.pageStart = ptr.pageStart + ptr.perPage; ptr.listPage(); } } this.prevPage = function(){ if (ptr.pageStart != 0){ var l = $J(ptr.list); l.empty(); ptr.pagingDiv.empty(); ptr.pageStart = (ptr.pageStart - ptr.perPage < 0) ? 0 : ptr.pageStart - ptr.perPage; ptr.listPage(); } } this.getPagination = function(){ if (this.pageStart != 0){ var previousPageLink = $J('PREVIOUS'); previousPageLink.bind('click', ptr.prevPage); this.pagingDiv.append(previousPageLink); } if (this.pageStart + this.perPage < this.items.length){ var nextPageLink = $J('NEXT'); nextPageLink.bind('click', ptr.nextPage); this.pagingDiv.append(nextPageLink); } var clearDiv = $J('
        '); this.pagingDiv.append(clearDiv); } this.listPage = function(){ var entry = {}; var l = $J(this.list); if (this.items.length == 0){ if (this.lStyle == 'blog'){ l.hide(); $J("#blogMentionBlock").hide(); } else { l.html( '
      • No results found at this time
      • ' ); } } else { for (var i=this.pageStart; i < this.items.length && i < (this.pageStart+this.perPage); i++){ l.html( l.html() + ptr.buildEntry(this.items[i], i) ); } for (var i=this.pageStart; i < this.items.length && i < (this.pageStart+this.perPage); i++){ var entryLink = "#hiveMentionsHPLink" + i; if (ptr.lStyle == 'hp') $J(entryLink).mouseover(function(){ var mouseoverDiv = $J(this).find(".blogEntryOverState"); mouseoverDiv.css('display','block'); mouseoverDiv.css('cursor','pointer'); }); // assign mouseover if (ptr.lStyle == 'hp') $J(entryLink).mouseout(function(){ var mouseoverDiv = $J(this).find(".blogEntryOverState"); mouseoverDiv.css('display','none'); mouseoverDiv.css('cursor','default'); }); // assign mouseout } if (ptr.pagination) ptr.getPagination(); } if (ptr.reporting && ptr.items.length > 0){ // set success param depending on search result // if any blogs are returned set to true **REMOVED SINCE BLOG SEARCH RETURN RESULTS ON PARTIAL SEARCH TERMS** //if (!MTVM.contextValues.searchSuccess) MTVM.contextValues.searchSuccess = true; } if (ptr.reporting){ // for search page reporting, since this widget will render last, send reporting call here. if (MTVM.contextValues.searchSuccess){ com_mtvi_SSDC = { srchterm : MTVM.contextValues.searchTerm, srchtype : "Videos" } } else { com_mtvi_SSDC = { srchfail : MTVM.contextValues.searchTerm, srchtype : "Videos" } } var defaultPageName = com.mtvi.metadata.getDefaultPageName(); if (defaultPageName=="/") { if(document.location.hostname.indexOf('read')>-1) {defaultPageName="blog";} else{defaultPageName="homepage";} }else { if(document.location.hostname.indexOf('read')>-1) {defaultPageName="blog/"+defaultPageName;} } var defaultChannel = com.mtvi.metadata.getDefaultChannel(); if(document.location.hostname.indexOf('read')>-1) {defaultChannel="blog";} //Initialize Controller //won't need cuz it's initialized in mtvm suite, mtvn.btg.Controller.init(); //Send a page call mtvn.btg.Controller.sendPageCall( { pageName: defaultPageName, channel: defaultChannel, hier1: defaultPageName } ); } } this.saveEntries = function(data){ var entry = {}; for (var i=0; i < data.entries.length; i++){ var entryTitle = (data.entries[i].customtitle.length > 0) ? data.entries[i].customtitle : data.entries[i].title ; entry = { "url":data.entries[i].link, "thumbnail":data.entries[i].thumbnail, "title": entryTitle, "description":data.entries[i].description, "pubdate":data.entries[i].pubDate }; ptr.items.push(entry); } ptr.listPage(); } this.getPage = function(dataservice, params, datasource){ this.__loadData({url:dataservice,data:params,successHandler:this.saveEntries,errorHandler:this.errorHandler, dataType: 'json', datasource:datasource}); } this.buildEntry = function(entry, idx){ var entryHTML = ''; if (this.lStyle == 'hp'){ var timeNow = new Date(); timeNow = Date.parse(timeNow); var timeNowInMinutes = (timeNow/1000)/60; var pubDate = entry.pubdate; //console.log(entry.pubdate); pubDate = new Date(pubDate); pubDate = Date.parse(pubDate); var pubDateInMinutes = (pubDate/1000)/60; var timeFromNowInMinutes = timeNowInMinutes - pubDateInMinutes; var timeFromNowString = ""; if (timeFromNowInMinutes < 60){ var pl = (timeFromNowInMinutes!=1) ? "s" : ""; timeFromNowString = Math.floor(timeFromNowInMinutes) + " min"+pl+" ago"; } else if (timeFromNowInMinutes >=60 && timeFromNowInMinutes < 1440){ var hours = (Math.floor(timeFromNowInMinutes / 60)); var pl = (hours!=1) ? "s" : ""; timeFromNowString = hours + " hour"+pl+" ago"; } else if (timeFromNowInMinutes >=1440 && timeFromNowInMinutes < 10080){ var days = (Math.floor((timeFromNowInMinutes / 60) / 24)); var pl = (days!=1) ? "s" : ""; timeFromNowString = days + " day"+pl+" ago"; } else if (timeFromNowInMinutes >=10080 && timeFromNowInMinutes < 43200){ var weeks = (Math.floor(((timeFromNowInMinutes / 60) / 24) / 7)); var pl = (weeks!=1) ? "s" : ""; timeFromNowString = weeks + " week"+pl+" ago"; } else if (timeFromNowInMinutes >=43200){ var months = (Math.floor(((timeFromNowInMinutes / 60) / 24) / 30)); var pl = (months!=1) ? "s" : ""; timeFromNowString = months + " month"+pl+" ago"; } entryHTML += '
      • '; entryHTML += ''; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '+ entry.title + '
        '; entryHTML += ''; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += ''+ entry.title +'
        '; entryHTML += ''+ entry.description.replace('<span class="read_more"><br /> Read More</span>','').replace(/&/g,'&').replace(/…/g,'') +''; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        read more
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
      • '; } else if (this.lStyle == 'blog'){ var pubDate = entry.pubdate; //console.log(entry.pubdate); entryHTML += '
      • '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += ' '+entry.title+''; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '

        '; entryHTML += entry.title; entryHTML += '

        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += ' '; entryHTML += '
        '; //entryHTML += '

        '; entryHTML += entry.description.replace('<span class="read_more"><br /> Read More</span>','').replace(/&/g,'&').replace(/…/g,''); //entryHTML += '
        more'; //entryHTML += '

        '; entryHTML += '
        '; entryHTML += '
        '; entryHTML += ' Read More'; entryHTML += '
        '; entryHTML += '
        '; entryHTML += ' '; entryHTML += '
        '; entryHTML += ''; entryHTML += '
        '; entryHTML += '
      • '; } else { entryHTML += '
      • '; entryHTML += ''; entryHTML += '
        '; entryHTML += '
        '+ entry.title + '
        '; entryHTML += ''; entryHTML += '
        '; entryHTML += '
        '; entryHTML += '
      • '; } //console.log(entryHTML); return entryHTML; } this.init = function(){ this.__clearListHtml(); var container = $J("#"+this.containerDivId); var infiniteCarouselOutter = $J('
        '); var infiniteCarouselInner = $J('
        '); container.append(infiniteCarouselOutter); infiniteCarouselOutter.append(infiniteCarouselInner); infiniteCarouselInner.append(this.list); container.append(this.pagingDiv); var dataservice = this.rssURL; var datasource = this.datasource; var params = 's=' + this.searchTerm; if (this.lStyle=='hp') params += '&p=hp'; this.getPage(dataservice, params, datasource); } this.init(); } MTVM.widgets.hiveMentions.prototype = new MTVM.widgets.BASE; // inherits /************************************************************************/ /********************* END HIVE MENTIONS WIDGET *************************/ /************************************************************************/ /************************************************************************/ /******************* GENERIC CAROUSEL WIDGET ***************************/ /************************************************************************/ MTVM.widgets.genericWidgetCarousel = function(containerDivId, options){ var ptr = this; // self pointer this.mylist = document.createElement('div'); this.list = this.mylist; this.wType = ('wType' in options) ? options.wType : "solr"; // widget types, ie. 'solr', 'playlist', 'dre' this.seq = 1; // the order number of this carousel among all the carousels on the page this.seq = (this.carouselInstances.length % 6 == 0) ? 1 : (this.carouselInstances.length % 6) + 1; this.carouselInstances.push(this); var dataservice = ('dataservice' in options) ? options.dataservice : '/sitewide/dataservices/relatedVideos/hd/'; this.datasource = ('datasource' in options) ? options.datasource : null; this.maxItemsToShow = ('maxItems' in options) ? options.maxItems : 9999; this.title = ('title' in options) ? options.title : ''; // widget header title this.perPage = 6; this.totalShownItems = 0; this.items = []; this.videoId = ('videoId' in options) ? options.videoId : ''; // video id to construct video mgid this.seriesId = ('seriesId' in options) ? options.seriesId : ''; // series id this.containerDivId = containerDivId; this.options = options || {}; var videoData = ('videoData' in options) ? options.videoData : '&targetSearch=all'; // params to pass in the ajax var ajaxParams = 'showComments=off'; ajaxParams += videoData; this.videoTypeGrouping_facet = ('videoTypeGrouping_facet' in options) ? options.videoTypeGrouping_facet : 'all'; // videoTypeGrouping_facet (music_video, live_performance, other,...) this.videoTypeGrouping_facet2 = ('videoTypeGrouping_facet2' in options) ? options.videoTypeGrouping_facet2 : ''; // videoTypeGrouping_facet (music_video, live_performance, other,...) var pageIndicator = '
        '; //var carouselTitle = ''+this.title+''; var carouselTitle = ''; //var headerObj = '

        '+ carouselTitle +' '+pageIndicator+'

        '; var headerObj = '

        '+ carouselTitle +' '+pageIndicator+'

        '; var footerObj = $J("
        ").html("
        ").addClass("clear"); this.leftArrow = $J("
        ").html("").attr("id", containerDivId+"-carousel-left-arrow").addClass("carousel-left-arrow-hdhub left"); this.rightArrow = $J("
        ").html("").attr("id", containerDivId+"-carousel-right-arrow").addClass("carousel-right-arrow-hdhub left"); this.containerWidth = ('containerwidth' in this.options) ? this.options.containerwidth : 1040; this.containerHeight = ('containerheight' in this.options) ? this.options.containerheight : 0; this.itemWidth = ('itemwidth' in this.options) ? this.options.itemwidth : 0; this.itemHeight = ('itemheight' in this.options) ? this.options.itemheight : 0; //this.carouselContainer = $J("
        ").html("").addClass("horizontal-carousel-vp left lenserBorderBottom"); this.lenserBorderBottom = ('borderBottom' in options) ? options.borderBottom : true; this.carouselContainerObj = $J(''); this.carouselContainer = this.carouselContainerObj.html(""); if ( !this.lenserBorderBottom ) this.carouselContainer.css('border-bottom','0'); this.carousel = $J('
          ').html("").addClass("left").css("width",this.containerWidth+"px"); this.lastCarousel = null; this.flipMode = ('flipmode' in this.options) ? this.options.flipmode : 'page'; this.ready = false; this.__canBeAdded = function(vId) { var result = false; if((this.totalShownItems < this.maxItemsToShow) && (vId !="") && vId != this.videoId)//check if already at max num of videos { this.totalShownItems++ result = true; } return result; } this.generateRolloverPlaylist = function(userFluxId, itemMgid) { var mgidRegExp = new RegExp("mgid:playlist:video:[^:]+:(.*)$"); var matches = mgidRegExp.exec(itemMgid); var mgid = matches[1]; var itemUrl = (userFluxId.indexOf("playlists/") >= 0) ? userFluxId+"/"+itemMgid : "/playlists/"+userFluxId+"/"+itemMgid ; // Check if element exists if (!$J('#playlistRollover'+mgid).length) { var playlistRolloverDiv = "
          "; $J(playlistRolloverDiv).appendTo($J('#'+ptr.containerDivId)); eval("MTVM.widgets.playlistRolloverList" + mgid + " = new MTVM.widgets.playlistRolloverList(\"playlistRollover"+mgid+"\""+", {playlistMGID: "+mgid+", firstItemTxt: MTVM.lang.playlist.rolloverFirst, lastItemLeftTxt: MTVM.lang.playlist.rolloverLastLeft, lastItemRightTxt: MTVM.lang.playlist.rolloverLastRight});"); } } this.processVideosInPlaylist = function(json) { var hdVideos = new Array(); var imagePath = ""; var shownVideos = new Array(); try{ //Build carousel structure var l = $J(ptr.list).css("width", "9999px"); ptr.__buildListHtmlHeader(headerObj); l.appendTo(ptr.carouselContainer); ptr.leftArrow.appendTo("#"+containerDivId); ptr.carouselContainer.appendTo("#"+containerDivId); ptr.rightArrow.appendTo("#"+containerDivId); ptr.carousel.appendTo(l); if (typeof json.listTitle != "undefined"){ $J('#'+ptr.containerDivId+'-carousel-title').html(json.listTitle); } if(typeof json.videos != "undefined") { for(var i = 0; i"); $J('#'+ptr.containerDivId+"-carousel-right-arrow").html(""); } if(ptr.totalShownItems == 0) { ptr.errorHandler(); } else { $J(ptr.containerDivId).show(); //ptr.carousel = new MTVM.services.ui.carousel('ul-'+ptr.containerDivId, {itemwidth:158, containerwidth: 1040, size: hdVideos.length, leftTriggerID: ptr.containerDivId+'-carousel-left-arrow', rightTriggerID: ptr.containerDivId+'-carousel-right-arrow'}); ptr.items = hdVideos; ptr.ready = true; } ptr.__buildPlayAll(hdVideos, ptr.title); } catch(e){ MTVM.logger.log("MTVM.widgets.genericWidgetCarousel widget: processData failed " + e, 2); } } this.processDataDreContentList= function(json) { var hdVideos = new Array(); var imagePath = ""; var shownVideos = new Array(); try{ //Build carousel structure var l = $J(ptr.list).css("width", "9999px"); ptr.__buildListHtmlHeader(headerObj); l.appendTo(ptr.carouselContainer); ptr.leftArrow.appendTo("#"+containerDivId); ptr.carouselContainer.appendTo("#"+containerDivId); ptr.rightArrow.appendTo("#"+containerDivId); ptr.carousel.appendTo(l); if (typeof json.listTitle != "undefined"){ $J('#'+ptr.containerDivId+'-carousel-title').html(json.listTitle); } if(typeof json.videos != "undefined") { for(var i = 0; i"); $J('#'+ptr.containerDivId+"-carousel-right-arrow").html(""); } if(ptr.totalShownItems == 0) { ptr.errorHandler(); } else { $J(ptr.containerDivId).show(); //ptr.carousel = new MTVM.services.ui.carousel('ul-'+ptr.containerDivId, {itemwidth:158, containerwidth: 1040, size: hdVideos.length, leftTriggerID: ptr.containerDivId+'-carousel-left-arrow', rightTriggerID: ptr.containerDivId+'-carousel-right-arrow'}); ptr.items = hdVideos; ptr.ready = true; } ptr.__buildPlayAll(hdVideos, ptr.title); } catch(e){ MTVM.logger.log("MTVM.widgets.genericWidgetCarousel widget: processData failed " + e, 2); } } this.processDataIsisVideos= function(json) { var hdVideos = new Array(); var imagePath = ""; var shownVideos = new Array(); try{ //Build carousel structure var l = $J(ptr.list).css("width", "9999px"); if (typeof json.videos[0]!="undefined"){ if (ptr.hd) headerObj = '

          HD videos from '+json.videos[0].artistName +' '+pageIndicator+'

          '; } if (json.videos.length>0) ptr.__buildListHtmlHeader(headerObj); l.appendTo(ptr.carouselContainer); ptr.leftArrow.appendTo("#"+containerDivId); ptr.carouselContainer.appendTo("#"+containerDivId); ptr.rightArrow.appendTo("#"+containerDivId); ptr.carousel.appendTo(l); if(typeof json.videos != "undefined") { for(var i = 0; i"); $J('#'+ptr.containerDivId+"-carousel-right-arrow").html(""); } if(ptr.totalShownItems == 0) { ptr.errorHandler(); } else { $J(ptr.containerDivId).show(); ptr.items = hdVideos; ptr.ready = true; } ptr.__buildPlayAll(hdVideos, ptr.title); } catch(e){ MTVM.logger.log("MTVM.widgets.moreHDVideos widget: processData failed " + e, 2); } } this.processDataSolrMoreBy= function(json) { var hdVideos = new Array(); var imagePath = ""; var shownVideos = new Array(); //ptr.lenserTitle = ('lenserTitle' in options) ? options.lenserTitle : MTVM.lang.video.moreFrom+' '+json.videos[0].artistName+' '+pageIndicator; try{ //Build carousel structure var l = $J(ptr.list).css("width", "9999px"); if (typeof json.videos[0]!="undefined"){ //headerObj = '

          '+ptr.title+' '+pageIndicator+'

          '; //if (ptr.hd) headerObj = '

          HD videos from '+json.videos[0].artistName+' '+pageIndicator+'

          '; if (ptr.hd) headerObj = '

          HD videos from '+json.videos[0].artistName +' '+pageIndicator+'

          '; } if (json.videos.length>0) ptr.__buildListHtmlHeader(headerObj); l.appendTo(ptr.carouselContainer); ptr.leftArrow.appendTo("#"+containerDivId); ptr.carouselContainer.appendTo("#"+containerDivId); ptr.rightArrow.appendTo("#"+containerDivId); ptr.carousel.appendTo(l); if(typeof json.videos != "undefined") { for(var i = 0; i"); $J('#'+ptr.containerDivId+"-carousel-right-arrow").html(""); } if(ptr.totalShownItems == 0) { ptr.errorHandler(); } else { $J(ptr.containerDivId).show(); //ptr.carousel = new MTVM.services.ui.carousel('ul-'+ptr.containerDivId, {itemwidth:158, containerwidth: 1040, size: hdVideos.length, leftTriggerID: ptr.containerDivId+'-carousel-left-arrow', rightTriggerID: ptr.containerDivId+'-carousel-right-arrow'}); ptr.items = hdVideos; ptr.ready = true; } ptr.__buildPlayAll(hdVideos, ptr.title); } catch(e){ MTVM.logger.log("MTVM.widgets.moreHDVideos widget: processData failed " + e, 2); } } this.processDataSolrSearch= function(json) { var hdVideos = new Array(); var imagePath = ""; var shownVideos = new Array(); try{ //Build carousel structure var l = $J(ptr.list).css("width", "9999px"); ptr.__buildListHtmlHeader(headerObj); l.appendTo(ptr.carouselContainer); ptr.leftArrow.appendTo("#"+containerDivId); ptr.carouselContainer.appendTo("#"+containerDivId); ptr.rightArrow.appendTo("#"+containerDivId); ptr.carousel.appendTo(l); if(typeof json.hdSameSeriesAndArtistHDVideos != "undefined") { //get videos from the same series first for(var i = 0; i"); $J('#'+ptr.containerDivId+"-carousel-right-arrow").html(""); } if(ptr.totalShownItems == 0) { ptr.errorHandler(); } else { $J(ptr.containerDivId).show(); //ptr.carousel = new MTVM.services.ui.carousel('ul-'+ptr.containerDivId, {itemwidth:158, containerwidth: 1040, size: hdVideos.length, leftTriggerID: ptr.containerDivId+'-carousel-left-arrow', rightTriggerID: ptr.containerDivId+'-carousel-right-arrow'}); ptr.items = hdVideos; ptr.ready = true; } ptr.__buildPlayAll(hdVideos, ptr.title); } catch(e){ MTVM.logger.log("MTVM.widgets.genericWidgetCarousel widget: processData failed " + e, 2); } } this.processDataPlaylistDataservices= function(json) { var hdVideos = new Array(); try{ //Build carousel structure var l = $J(ptr.mylist).css("width", "9999px"); //l.prepend(headerObj); $J(headerObj).appendTo("#"+ptr.containerDivId); l.appendTo(ptr.carouselContainer); ptr.leftArrow.appendTo("#"+ptr.containerDivId); ptr.carouselContainer.appendTo("#"+ptr.containerDivId); ptr.rightArrow.appendTo("#"+ptr.containerDivId); ptr.carousel.appendTo(l); if(typeof json.playlists != "undefined") { for(var i = 0; i"); $J('#'+ptr.containerDivId+"-carousel-right-arrow").html(""); } if(ptr.totalShownItems == 0) { ptr.errorHandler(); } else { $J(ptr.containerDivId).show(); //ptr.carousel = new MTVM.services.ui.carousel('ul-'+ptr.containerDivId, {itemwidth:158, containerwidth: 1040, size: hdVideos.length, leftTriggerID: ptr.containerDivId+'-carousel-left-arrow', rightTriggerID: ptr.containerDivId+'-carousel-right-arrow'}); ptr.items = hdVideos; ptr.ready = true; } } catch(e){ MTVM.logger.log("MTVM.widgets.genericWidgetCarousel widget: processData failed " + e, 2); } } this.errorHandler = function(hr){ $J('#'+ptr.containerDivId).hide(); } this.flip = function(dir, mode){ //console.log("flipping "+dir); if (typeof mode == 'undefined') mode = this.flipMode; if (this.ready && !this.animating()){ // if the ajax object is ready var currPos = this.carousel.css("margin-left"); var currPosNumber = currPos.replace("px", ''); var items = this.items; if (dir=='left'){ if (this.lastCarousel!=null) this.lastCarousel.remove(); var nextStart = this.carouselIndex - this.perPage; if (nextStart < 0 && (items.length % this.perPage)== 0) nextStart = items.length - this.perPage; else if (nextStart < 0) nextStart = items.length - (items.length % this.perPage); var nextEnd = ((nextStart+this.perPage) > items.length) ? items.length : nextStart+this.perPage; var nextCarousel = $J('
            ').html("").addClass("left").css("width",this.containerWidth+"px").css("marginLeft","-"+this.containerWidth+"px"); this.carousel.before(nextCarousel); for(var i=nextStart; i= items.length) nextStart = 0; var nextEnd = ((nextStart+this.perPage) > items.length) ? items.length : nextStart+this.perPage; var nextCarousel = $J('
              ').html("").addClass("left").css("width",this.containerWidth+"px"); nextCarousel.appendTo(this.mylist); for(var i=nextStart; i= 0) ? userFluxId+"/"+itemMgid : "/playlists/"+userFluxId+"/"+itemMgid ; //var itemUrl = userFluxId+"/"+itemMgid; var html =""; var playlistAddBtn = ""; var customHtml = ""; var tempNode = ""; var containerNode =""; var containerHtml =""; var customHtml =""; var mgidRegExp = new RegExp("mgid:playlist:video:[^:]+:(.*)$"); var matches = mgidRegExp.exec(itemMgid); var mgid = matches[1]; itemTitle = itemTitle.replace(/&/g, '&'); if (itemTitle.length > 40){ //console.log('truncating'); itemTitle = MTVM.util.truncateString(itemTitle, 37, 'soft'); } userFluxId = userFluxId.replace(/\/playlists\//g, ''); try{ customHtml = ""+ "
              " + ""+itemTitle+"
              "+MTVM.lang.playlist.by+" "+userName+""+ "
              "+playlistAddBtn+"
              "; return "
            • "+customHtml+"
            • "; } catch(e) { console.log("MTVM.widgets.playlistsContainingVideo: widget build html list failed " + e, 2); } try{ MTVM.util.generateThumbOverlay(itemMgid, VideoThumbOverlays, ""); }catch(e){ //console.log(e); } } this.init(containerDivId); } MTVM.widgets.genericWidgetCarousel.prototype = new MTVM.widgets.BASE; // inherits /************************************************************************/ /******************* END GENERIC CAROUSEL WIDGET*************************/ /************************************************************************/ MTVM.services.Ads = function(adSize, adPositionThreshold) { this.adSize = adSize; this.adPositionThreshold = (adPositionThreshold?adPositionThreshold:"1"); this.codaParams = (typeof defaultCodaParams != 'undefined') ? defaultCodaParams : new MTVM.services.CODAParams(); this.extraKeyValues = ""; } MTVM.services.Ads.prototype = { addKeyValue: function(kv){ this.extraKeyValues = this.extraKeyValues + kv; }, isHDPlaylist: function() { if(document.location.toString().indexOf("B74ED50101D54EB7000101D54EB7")>-1) { if(document.location.toString().indexOf("mgid")>-1) { return true; } else{return false;} }else{return false;} }, getAd: function() { var _demo =""; var _adkv = this.codaParams.ads.keyValues + this.extraKeyValues + ""; this.codaParams.ads.size = this.adSize; //this.codaParams.ads.positionThreshold = this.adPositionThreshold; somehow this is not feeding the value into the codaParams obj this.getRegionKeyValue(); //region-specific kv additions _demo = this.getDemoValue(); /* // CODA 2 ARIA AD CALL mtvn.btg.config.AdSettings.DoubleClick["adClass"] = 'InternationalAd'; mtvn.btg.config.AdSettings.DoubleClick["contentType"] = this.codaParams.ads.defaultContentType; // 'adj' mtvn.btg.config.AdSettings.DoubleClick["dartSite"] = this.codaParams.ads.dartSite; // 'music.mtv' mtvn.btg.config.AdSettings.DoubleClick["keyValues"] = this.codaParams.ads.keyValues+this.extraKeyValues; // 'site_region=us;art=razorlight;gen=none;user_playlist_id=none;chart_id=none;mpu=1;' mtvn.btg.config.AdSettings.DoubleClick["positionThreshold"] = this.adPositionThreshold; // '1' mtvn.btg.config.AdSettings.DoubleClick["sections"] = this.codaParams.ads.defaultSections; // 'artist/jet_rock_/videos/' mtvn.btg.config.AdSettings.DoubleClick["enabled"] = true; // enabling double click ads mtvn.btg.Controller.init(); */ mtvn.btg.Controller.placeAd ( { size: this.codaParams.ads.size, isReloadable:true, // enable ads to reload every defined (codaParamsInit.ftl) number of seconds region: MTVM.contextValues.userRegion, // esi user region keyword: MTVM.contextValues.search_kw, // the search term if coming through a search page vid: MTVM.contextValues.vid, // video page id vid_type: MTVM.contextValues.vid_type, // video page video content type log: (MTVM.flux.isUserLoggedInFlux() ? 1 : 0).toString(), // if user is logged dcove: 'd', keyValues: _adkv, event: 'none', demo: _demo} // demography from Flux if an user is logged into Flux ) }, setCoad: function(adObject) { var src = adObject.url; var w = adObject.width; var h = adObject.height; coad.updateWindow(src, w, h); }, getRegionKeyValue: function() //region-specific kv additions { //for italy dual sponsorship switch(MTVM.config.countryCode) { case "it": if(window.mtvmItSponsor!=null && window.mtvmItSponsor!="" ){ this.addKeyValue(";adv_sp="+window.mtvmItSponsor+";"); } else { this.addKeyValue(";adv_sp=none;"); } break; } }, getDemoValue: function () //region-specific demo value { var _age = ""; var _demo = "none"; if(MTVM.config.countryCode != "us") { switch(MTVM.flux.getWidgetVersion()) { case "3.0": if(typeof Flux.context !="undefined" && typeof Flux.context.user != "undefined" && Flux.context.user != null) { _age = Flux.context.user.age; } break; case "2.0": _age = Flux.Context.getCurrentUserSettings().UserAge; break; } if(_age == 6) {_demo = "dil";} else if(_age == 7) {_demo = "tommy";} else if (_age == 8) {_demo = "phil";} else if (_age == 9) {_demo = "chuckie";} else if (_age == 10) {_demo = "stu";} else if (_age == 11) {_demo = "chas";} else if (_age == 12) {_demo = "lou";} else if (_age == 13) {_demo = "boris";} else if (_age == 14) {_demo = "bill";} else if (_age == 15) {_demo = "george";} else if (_age == 16) {_demo = "jack";} else if (_age == 17) {_demo = "jimmy";} else if (_age >= 18 && _age < 25) {_demo = "ron";} else if (_age >= 25 && _age < 35) {_demo = "bryan";} else if (_age >= 35 && _age < 45) {_demo = "ed";} else if (_age >= 45 && _age < 55) {_demo = "dan";} else if (_age >= 55 && _age < 65) {_demo = "susan";} else if (_age >= 65) {_demo = "ruth";} else {_demo = "null";} } return _demo; } } MTVM.services.Ads.getSurveyAd = function() { var pagePath = location.pathname.substring(1); pagePath = pagePath.replace(/mtv-hive-site-app\//,""); var sections = pagePath.split("/"); var params = location.search; var getAd = function(){ MTVM.services.Ads.adSurvey = new MTVM.services.Ads("1x2", "btf"); MTVM.services.Ads.adSurvey.addKeyValue("!category=video;pos=btf;research=survey;"); MTVM.services.Ads.adSurvey.getAd(); } switch(sections[0]){ case "playlists": if(sections[1]==null || sections[1]=="") {getAd();} break; case "search": break; case "legal": getAd(); break; case "browse": getAd(); break; case "watch": getAd(); break; case "hd": getAd(); break; case "category": getAd(); break; case "artist": if(typeof sections[2] == "undefined" || (typeof sections[2]!="undefined" && sections[2]!="videos")) { getAd(); } break; } } $J(document).ready(function(){ /* GLOBAL TYPEAHEAD */ /* commenting for now (3/8/2011) if ($J('#searchInputBox').length){ $J("#searchInputBox").autocomplete({ cacheLength: 1, matchSubset: false, position: { my: "left top", at: "left bottom", collision: "none", offset: "-7 0" }, source: function( request, response ) { $J.ajax({ url: "http://search.mtvnservices.com/typeahead/suggest/", dataType: "jsonp", jsonpCallback: "jsonpTypeahead", data: { format: "json", limit: "10", fl: "echonest_id,echonest_artist_name,mtv_alias_id1", siteName: "solr_diogenes", q: request.term }, success: function( data ) { response( $J.map( data.response.docs, function( item ) { return { label: item.echonest_artist_name, value: item.echonest_id, alias: item.mtv_alias_id1 } }), request.term); // passing in request term } }); }, delay:500, minLength: 1, focus: function( event, ui ) { $J("#searchInputBox").val( ui.item.label ); return false; }, select: function( event, ui ) { $J('#mtvhive-navigation-search').submit(); return false; } }).bind( "keydown.autocomplete", function( event ) { // binding an extra keydown event to capture the enter being pressed var keyCode = $J.ui.keyCode; switch( event.keyCode ) { case keyCode.ENTER: case keyCode.NUMPAD_ENTER: case keyCode.TAB: $J('#mtvhive-navigation-search').submit(); break; default: break; } }) // Add a heading to the suggestions dropdown var global_dioSearch = $J('#searchInputBox').data("autocomplete"); global_dioSearch._response = function( content, term ) { if ( content.length ) { content = this._normalize( content ); this._suggest( content ); this.element.data( "menuTerm", term ); this._trigger( "open" ); } else { this._showNoResult( ); // HiveMeter modification: show no result dropdown } this.element.removeClass( "ui-autocomplete-loading" ); } var global_dioSearchMenu = global_dioSearch.menu; //console.log($J(global_dioSearchMenu)) global_dioSearchMenu.element.addClass( "mtvhive-typeahead" ); global_dioSearchMenu.element.addClass( "mtvhive-typeahead-global" ); global_dioSearchMenu.options.blur = function( event, ui ) { // HiveMeter modification: do not repopulate input on suggestion popping up // don't set the value of the text field if it's already correct // this prevents moving the cursor unnecessarily if ( global_dioSearch.menu.element.is(":visible") && ( global_dioSearch.element.val() !== global_dioSearch.term ) ) { //self.element.val( self.term ); } } } */ $J('#searchInputSubmitButton').mousedown(function(event){ //event.stopPropagation(); //event.stopImmediatePropagation(); //event.preventDefault(); //$J('#searchInputBox').focus(); //var ac = $J('#searchInputBox').data("autocomplete"); //if (ac.menu.active){ // ac._trigger("select", "click", { item: ac.menu.active.data( "item.autocomplete") }); //} //return false; $J('#mtvhive-navigation-search').submit(); }); /* END OF GLOBAL TYPEAHEAD */ /* METER TYPEAHEAD */ if ($J('#dioSearchInputBox').length){ $J("#dioSearchInputBox").autocomplete({ cacheLength: 1, matchSubset: false, selectFirst: true, position: { my: "left top", at: "left bottom", collision: "none", offset: "-7 0" }, source: function( request, response ) { $J.ajax({ url: "http://search.mtvnservices.com/typeahead/suggest/", dataType: "jsonp", jsonpCallback: "jsonpTypeahead", data: { format: "json", limit: "10", fl: "echonest_id,echonest_artist_name", siteName: "solr_diogenes", q: request.term }, success: function( data ) { response( $J.map( data.response.docs, function( item ) { return { label: item.echonest_artist_name, value: item.echonest_id } }), request.term); // passing in request term } }); }, delay:500, minLength: 1, focus: function( event, ui ) { //$J("#dioSearchInputBox").val( ui.item.label ); return false; }, open: function() { // when a suggestion pops up check if an enter is already registered, if so trigger submission //console.log("suggestion open") var self = $J(this).data("autocomplete"); var suggestionTerm = $J(this).data("menuTerm"); var currentInputVal = $J(this).val(); var inputSubmitted = $J(this).data("submitted"); //console.log('suggestionTerm:'+suggestionTerm); console.log('currentInputVal:'+currentInputVal); console.log('inputSubmitted:'+inputSubmitted); if (inputSubmitted){ if (suggestionTerm == currentInputVal){ self._trigger("select", "click", { item: self.menu.active.data( "item.autocomplete") }); $J(this).data("submitted",false); }else{ //$J(this).data("submitted",false); } } }, select: function( event, ui ) { var self = $J(this).data("autocomplete"); var suggestionTerm = $J(this).data("menuTerm"); var currentInputVal = $J(this).val(); var inputSubmitted = $J(this).data("submitted"); //console.log('suggestionTerm:'+suggestionTerm); console.log('currentInputVal:'+currentInputVal); console.log('inputSubmitted:'+inputSubmitted); if (suggestionTerm == currentInputVal){ // if the autocomplete term is matching the current value in input if (ui.item.label){ if (DiogenesConfig.useLauncher){ dioLaunchList({'textBody':'search', 'title':DiogenesConfig.searchHeaderText+ui.item.label, 'description':DiogenesConfig.searchDescText}, {"artistId":ui.item.value,"artistName":ui.item.label}); }else{ MTVM.util.launchLoadingDialog(); //var urlSafeArtistName = encodeURIComponent(ui.item.label); var flattendArtistName = dioFlattenArtistNames(ui.item.label); //console.log("redirecting " + currentInputVal + " : " + suggestionTerm + " : " + ui.item.label); var serverHostName = MTVM.config.serverHostName; if(document.location.hostname.indexOf("mtvmusicmeter")>-1){ switch(MTVM.config.serverPlatform) { case "l": serverHostName = "http://www.mtvhive-l.mtvi.com/"; break; case "d": serverHostName = "http://www.mtvmusicmeter-d.mtvi.com/"; break; case "q": serverHostName = "http://www.mtvmusicmeter-q.mtvi.com/"; break; default: //live serverHostName = "http://www.mtvmusicmeter.com/"; break; } } //console.log(flattendArtistName); if (DiogenesConfig != null) //console.log(serverHostName) document.location.href = serverHostName+DiogenesConfig.siteRoot+'artist/' + flattendArtistName + '/' + ui.item.value + '/'; else //document.location.href = serverHostName+'meter/artist/' + flattendArtistName + '/' + ui.item.value + '/'; document.location.href = serverHostName+'artist/' + flattendArtistName + '/' + ui.item.value + '/'; } } } return false; } }).bind( "keydown.autocomplete", function( event ) { // binding an extra keydown event to capture the enter being pressed var self = $J(this).data("autocomplete"); var inputSubmitted = $J(this).data("submitted"); var keyCode = $J.ui.keyCode; switch( event.keyCode ) { case keyCode.BACKSPACE: if (inputSubmitted) $J(this).data("submitted",false); break; case keyCode.ENTER: case keyCode.NUMPAD_ENTER: case keyCode.TAB: //console.log(self.menu.active.data( "item.autocomplete")) if (!inputSubmitted) $J(this).data("submitted",true); // registering the submission being entered //console.log($J(this).data("submitted")) break; default: break; } }) // Add a heading to the suggestions dropdown var ac_dioSearch = $J('#dioSearchInputBox').data("autocomplete"); ac_dioSearch._response = function( content, term ) { if ( content.length ) { content = this._normalize( content ); this._suggest( content ); this.element.data( "menuTerm", term ); this._trigger( "open" ); } else { this._showNoResult( ); // HiveMeter modification: show no result dropdown } this.element.removeClass( "ui-autocomplete-loading" ); } var ac_dioSearchMenu = ac_dioSearch.menu; //console.log($J(ac_dioSearchMenu)) ac_dioSearchMenu.element.addClass( "mtvhive-typeahead" ); ac_dioSearchMenu.options.blur = function( event, ui ) { // HiveMeter modification: do not repopulate input on suggestion popping up // don't set the value of the text field if it's already correct // this prevents moving the cursor unnecessarily if ( ac_dioSearch.menu.element.is(":visible") && ( ac_dioSearch.element.val() !== ac_dioSearch.term ) ) { //self.element.val( self.term ); } } $J('#dioSearchInputSubmitButton').mousedown(function(event){ event.stopPropagation(); event.stopImmediatePropagation(); event.preventDefault(); $J('#dioSearchInputBox').focus(); var ac = $J('#dioSearchInputBox').data("autocomplete"); if (ac.menu.active){ ac._trigger("select", "click", { item: ac.menu.active.data( "item.autocomplete") }); } return false; }); } /* END OF METER TYPEAHEAD */ }); /* END OF ON DOCUMENT READY */