//======================================================================================================= // AV CLUB MAIN JS //======================================================================================================= function safeFormat(input){ input = input.replace("'","'"); return input; } function safeFormatSlashes(input){ input = input.replace("'","G"); return input; } function stripParagraph(inputString){ stringStart = inputString.substring(0,3); stringMiddle = inputString.substring(inputString.length-4,3); stringEnd = inputString.substring(inputString.length-4); if(stringStart == "

" && stringEnd == "

"){ outputString = stringMiddle; } else { outputString = inputString; } return outputString; } function fadeInElement(element,duration,delay){ var el = document.getElementById(element); el.style.display = 'none'; if(delay != null || delay > 0){ setTimeout("new Effect.Appear('"+element+"', { duration:"+duration+"})",delay); } else { new Effect.Appear(element,{duration:duration}); } } //------------------------------------------------------------------------------------------------------- // Check File Status //------------------------------------------------------------------------------------------------------- function isFile(str){ var O= AJ(); if(!O) return false; try{ O.open("HEAD", str, false); O.send(null); return (O.status==200) ? true : false; } catch(er){ return false; } } function AJ(){ var obj; if (window.XMLHttpRequest){ obj= new XMLHttpRequest(); } else if (window.ActiveXObject) { try{ obj= new ActiveXObject('MSXML2.XMLHTTP.3.0'); } catch(er){ obj=false; } } return obj; } //------------------------------------------------------------------------------------------------------- // Build Video Player //------------------------------------------------------------------------------------------------------- function Player(){ video_base_url = "http://www.theavclub.tv/episodes/video/"; thumb_base_url = "http://www.theavclub.tv/episodes/thumbnail/"; this.playerDiv = arguments[0]; this.overlayDiv = arguments[1]; this.thumbsDiv = arguments[2]; this.infoBarDiv = arguments[3]; } Player.prototype.infoBarText = function(){ var info_text = arguments[0]; var hover_title = arguments[1]; if(info_text){ if(info_text == "play"){ var infoBarCode = "Click to Play: \""+hover_title+"\""; } else { var infoBarCode = info_text; } } else { if(playing){ var infoBarCode = "Now Playing: \""+active_title+"\""; } else { if(active_title){ var infoBarCode = "Selected: \""+active_title+"\""; } else { var infoBarCode = "Select a Video"; } } } $(this.infoBarDiv).innerHTML = infoBarCode; self.status = infoBarCode; } Player.prototype.thumb = function(){ playing = false; active_video = arguments[0]; active_title = arguments[1]; var thumbnail = ""; var overlay = "
Click to Play
"; //overlay += "Click to Play"; $(this.overlayDiv).innerHTML = overlay; $(this.playerDiv).innerHTML = thumbnail; } Player.prototype.play = function(){ playing = true; //this.infoBarText(); video_test = video_base_url+active_video+".m4v"; if(isFile(video_test)){ video_ext = ".m4v"; var filetype = "video/mp4"; } else { video_ext = ".mov"; var filetype = "video/quicktime"; } var movie = video_base_url+active_video+video_ext; var classid = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"; var codebase = "http://www.apple.com/qtactivex/qtplugin.cab"; var standby = "Loading Quicktime"; var playerCode = ''; playerCode += '' playerCode += '' playerCode += '' playerCode += "" + ""; $(this.overlayDiv).innerHTML = ""; $(this.playerDiv).innerHTML = playerCode; } Player.prototype.nextThumbs = function(){ if(page+1=0){ var thumbsCode = buildThumbs(); $(this.thumbsDiv).innerHTML = thumbsCode; } else { page= 0;; } } buildThumb = function (){ var video_id = arguments[0]; var video_title = arguments[1]; var index = arguments[2]; var thumb_url = thumb_base_url+video_id+"_small.jpg"; var thumb = ""; var delay = 80*index; setTimeout("new Effect.Appear('thumb_"+index+"', { duration: .5 })",delay); return(thumb); } activateAndPlay = function(){ active_video = arguments[0]; active_title = arguments[1]; player.play(); } function nextOver(){ player.infoBarText('Next group of videos'); } function nextOut(){ player.infoBarText(); } function previousOver(){ player.infoBarText('Previous group of videos'); } function previousOut(){ player.infoBarText(); } buildThumbs = function(){ total_thumbs = 5; var thumb_index = total_thumbs*page; var content = ""; if(page>0){ content += "
"; } else { content += "
"; } content += "
"; for(var i=thumb_index;i"+member+""; document.write(code); }