Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove Google Analytics URL mod so Ghostery doesn't redirect.

  • Loading branch information...
commit 92543fe54fb49fbdeafadc3e65972f5c032b4eff 1 parent 09425bb
@meloncholy authored
View
4 public/javascripts/jquery.ui.vg.js
@@ -603,7 +603,9 @@ $.ui.widget.subclass("ui.vgStart",
// Analytics async tracking (remove #! so it shows up)
if (_gaq !== undefined)
{
- _gaq.push(['_link', location.href.replace(/#!/, "")]);
+ // This breaks Ghostery and doesn't seem to work anyway...
+ //_gaq.push(['_link', location.href.replace(/#!/, "")]);
+ _gaq.push(['_link', location.href]);
}
}
});
View
2  public/javascripts/jquery.ui.vg.min.js
@@ -6,4 +6,4 @@
* Includes some code written by others; see dev source for details.
* Version 0.1
*/
-$.ui.widget.subclass("ui.vgStart",{options:{title:"Video Gallery",titlePost:" | Video Gallery",prettyLink:"video/",searchTracker:false,searchDelay:250,resizeTracker:false,resizeDelay:250,suggestTracker:false,suggestDelay:50,suggestAjax:null,hashTracker:false,hashDelay:1000,autosuggestUrl:"search/autosuggest/",filterHeight:123,searchTxt:"",prevSearchTxt:"",prevHash:null,activeFilters:false,hiddenFilters:false,filterChange:false,slideInTime:200,slideOutTime:100,slideOutDelay:100,logoUrl:"images/theme/logo-big.png",bgUrl:"images/theme/bg.jpg",$crumbs:null,$results:null,$video:null,$contact:null,$suggest:null,$filters:null,$searchBox:null,$searchInput:null,$autosuggest:null,$filters:null,$alert:null,alertClass:".Alert",resultsClass:".Results",videoClass:".Video",relatedVideosClass:".RelatedVideos",feedbackClass:".Feedback",searchBoxClass:".Search",searchInputClass:".SearchInput",autosuggestClass:".Autosuggest",filtersClass:".Filters",contentClass:".Content"},_create:function(){var b;var d=this.options;var c=this;var a;d.$crumbs=$(document).vgCrumbs();d.$alert=$(d.alertClass).vgAlert({$results:$(d.resultsClass),$video:$(d.videoClass)});d.$results=$(d.resultsClass).vgResults({$alert:d.$alert});d.$video=$(d.videoClass).vgVideo({$crumbs:d.$crumbs,showResults:function(){c._showResults();return this},relatedVideosClass:d.relatedVideosClass,prettyLink:d.prettyLink});d.$crumbs.vgCrumbs("setVideo",d.$video);b=parseInt(d.$results.css("marginBottom"));d.$contact=$(d.feedbackClass).vgContact({footerHeight:b,prettyLink:d.prettyLink});d.$suggest=$(d.feedbackClass).vgSuggest({footerHeight:b,prettyLink:d.prettyLink});d.$searchBox=$(d.searchBoxClass);d.$searchInput=$(d.searchInputClass);d.$autosuggest=$(d.autosuggestClass);d.$filters=$(d.filtersClass);d.$crumbs.vgCrumbs("clearVideos");$(window).resize(function(){c.resizeDelay()});d.$results.scroll(this.scrollDelay).scroll();d.$searchInput.keydown(function(f){c._tabCapture(f)}).keyup(function(f){c.searchDelay(f)}).val("");$(window).hashchange(function(){c._hashChange()}).hashchange();$(".ToggleFilters, #filtersLink").click(function(){if(d.activeFilters){c._hideFilters()}else{c._showFilters()}return false});$(document).keydown(function(g){var f=location.href.split("#!")[1]||location.href.split("#%21")[1];if(g.which==27){if(f.substring(0,8)=="contact/"){location.hash="#!"}else{if(f.substring(0,d.prettyLink.length)==d.prettyLink){if(d.$suggest.vgSuggest("visible")){d.$suggest.vgSuggest("hide")}else{location.hash="#!"}}}}});$("#searchButton").click(function(){if(d.$searchInput.val()!=""&&!d.activeFilters){d.searchTxt=d.$searchInput.val();c.searchDelay()}});$("#browseButton").click(function(){if(!$(this).hasClass("Disabled")){d.$searchInput.val("");d.$autosuggest.text("");d.searchTxt="";if(d.hashTracker){clearTimeout(d.hashTracker)}c.search(true)}});this.element.bind("slide",function(f){d.filterChange=true;c.search(true)});$("input[type=text], textarea").live("focus",function(){var e=this;setTimeout(function(){e.select()},50)});$("input[type=text].ReadOnly").live("keypress",function(){return false});$(".SearchLink").live("click",function(f){c._searchSpellcheck(f);return false});$(".FiltersLink").live("click",function(){c._hideFilters();return false});$(".Results .Box, .Video .SimilarVideos li").live("hover",function(g){var f=$(this);if(g.type=="mouseenter"){if(f.find(".SlideBackground").length==0){f.find("span").append("<span />").children().addClass("SlideBackground")}f.find(".SlideBackground").clearQueue().animate({top:"0"},d.slideInTime)}else{f.find(".SlideBackground").clearQueue().delay(d.slideOutDelay).animate({top:"100%"},d.slideOutTime)}});a=new Image();a.src=d.logoUrl;$(a).load(function(){$(a).unbind("load").load(function(){$(".Background").css("backgroundImage",'url("'+d.bgUrl+'")').fadeIn(500);delete a});a.src=d.bgUrl})},_showResults:function(a){var b=this.options;if(typeof(a)==="undefined"){a=false}if(b.$searchBox.hasClass("Home")){if(a){$(".Logo").fadeOut(50).addClass("Small").fadeIn(50);b.$searchBox.animate({marginTop:"-=100"},100,function(){var c=$(this);c.css("marginTop","");setTimeout(function(){c.addClass("Top")},500)}).removeClass("Home").find("#contact").fadeIn(300);b.$results.fadeIn(300)}else{b.$searchBox.removeClass("Home").addClass("Top").find("#contact").show();$(".Logo").addClass("Small");b.$results.show()}}return this},search:function(a){var d=this.options;var c;var b;this._showResults(a);d.$crumbs.vgCrumbs("clearVideos");c=this._buildFilters();this._searchHash();b=d.$searchInput.val();document.title=(b==""?(d.activeFilters?"Search":"Browse"):b+" - Search")+d.titlePost;d.$results.vgResults("search",b,c)},_searchHash:function(){var a;var b=this.options;a="#!search/"+encodeURIComponent(b.searchTxt);if(b.activeFilters){$(".Slider").each(function(){var d=$(this).attr("id");var c=this.value();if(c!==null){a+="+"+d+"="+c}})}if(a=="#!search/"){a="#!browse/"}if(a=="#!"+location.href.split("#!")[1]){if(b.hashTracker){clearTimeout(b.hashTracker)}return}if(b.prevSearchTxt!=""&&b.searchTxt.substring(0,b.prevSearchTxt.length)==b.prevSearchTxt){if($.browser.webkit){if(b.hashTracker){clearTimeout(b.hashTracker)}b.hashTracker=setTimeout(function(){location.hash=a},b.hashDelay)}else{location.replace(location.href.slice(0,-location.href.split("#!")[1].length-2)+a)}}else{location.hash=a}b.prevSearchTxt=b.searchTxt},_buildFilters:function(){var a=new Object();var b=this.options;if(b.activeFilters){$(".Slider").each(function(){a[$(this).attr("id")]=this.value()});return a}return null},resizeDelay:function(){var a=this.options;if(a.resizeTracker){clearTimeout(a.resizeTracker)}a.resizeTracker=setTimeout(function(){if(a.visible){a.$video.css("left",$(window).width()+"px")}else{a.$video.find(a.contentClass).css("minHeight",($(window).height()-a.padding)+"px")}a.$results.vgResults("loadBatch",true)},a.resizeDelay)},_searchSpellcheck:function(a){this.options.$searchInput.val($(a.currentTarget).text());this.searchDelay()},_showFilters:function(){var b=this.options;var a=this;b.activeFilters=true;b.$filters.animate({height:"+="+b.filterHeight+"px"},200);b.$results.animate({top:"+="+b.filterHeight+"px"},200);$("#browseButton").addClass("Disabled");if(b.$video.vgVideo("visible")){b.$video.vgVideo("hide");this.search()}$(".Slider").each(function(){if(this.value()!=null){a.search();return false}})},_hideFilters:function(){var b=this.options;var a=this;if(!b.hiddenFilters){b.$filters.animate({height:"-="+b.filterHeight+"px"},200)}b.$results.animate({top:"-="+b.filterHeight+"px"},200);$("#browseButton").removeClass("Disabled");b.activeFilters=false;b.hiddenFilters=false;$(".Slider").each(function(){if(this.value()!=null){a.search();return false}})},suggestVideo:function(){var b=this.options;var a;if(b.suggestAjax!=null){b.suggestAjax.abort()}a=this._buildFilters();b.suggestAjax=$.post(b.autosuggestUrl,{search:b.$searchInput.val(),filters:a},function(c){b.suggestAjax=null;if(b.$searchInput.val()==""){return}c=typeof c=="object"?c:$.parseJSON(c);b.$autosuggest.html(c.autosuggest)})},_tabCapture:function(a){var b=this.options;if(a.keyCode==9&&b.$searchInput.val()!=b.$autosuggest.text()&&b.$autosuggest.text()!=""){b.$searchInput.val(b.$autosuggest.text());a.preventDefault()}},searchDelay:function(a){var c=this.options;var b=this;if(c.$searchInput.val()==""||a!==undefined&&(a.keyCode==13||a.keyCode==27)){c.$autosuggest.text("");if(a!==undefined&&a.keyCode==13){c.$alert.vgAlert("show",true)}}if(c.searchTxt==c.$searchInput.val()){return}if(c.$autosuggest.text().substring(0,c.$searchInput.val().length)!=c.$searchInput.val()){c.$autosuggest.text("");if(c.suggestTracker){clearTimeout(c.suggestTracker)}c.suggestTracker=setTimeout(function(){b.suggestVideo()},c.suggestDelay)}if(a===undefined||(c.$searchInput.val()!=c.searchTxt&&c.$searchInput.val()!="")){c.searchTxt=c.$searchInput.val();if(c.hashTracker){clearTimeout(c.hashTracker)}if(c.searchTracker){clearTimeout(c.searchTracker)}if(a===undefined){this.search(true)}else{c.searchTracker=setTimeout(function(){b.search(true)},c.searchDelay)}}if(c.$searchInput.val()==""){if(c.searchTracker){clearTimeout(c.searchTracker)}if(c.suggestTracker){clearTimeout(c.suggestTracker)}}},_hashChange:function(){var a=location.href.split("#!")[1]||location.href.split("#%21")[1];var f=location.hash;var e;var d;var g=this.options;var c;if(g.hiddenFilters){g.hiddenFilters=false;g.$filters.css({height:"+="+g.filterHeight+"px",marginBottom:0+"px"})}if(f=="#!"){document.title=g.title;g.$video.vgVideo("hide");g.$contact.vgContact("hide");if(g.prevHash!=null){location.hash=g.prevHash}else{location.hash=""}}if(f==""){document.title=g.title;g.$video.vgVideo("hide");g.$contact.vgContact("hide");if(!g.$searchBox.hasClass("Home")){g.$searchBox.removeClass("Top").addClass("Home").find("#contact").hide();$(".Logo").removeClass("Small");g.$results.hide()}}else{if(g.$searchBox.hasClass("Home")){g.$searchBox.removeClass("Home").addClass("Top").find("#contact").show();$(".Logo").addClass("Small");g.$results.show()}if(a!==undefined){if(a.substring(0,g.prettyLink.length)==g.prettyLink){g.$contact.vgContact("hide");if(g.activeFilters){g.hiddenFilters=true;g.$filters.css({height:"-="+g.filterHeight+"px"})}g.$video.vgVideo("show",a)}else{if(a.substring(0,8)=="contact/"){g.$video.vgVideo("hide");g.$contact.vgContact("show")}else{if(a.substring(0,7)=="search/"){g.$video.vgVideo("hide");g.$contact.vgContact("hide");g.prevHash=location.hash;e=a.substring(7).split("+");c=decodeURIComponent(e[0]);if(c!=g.searchTxt){g.$searchInput.val(c)}for(var b=1;b<e.length;b++){d=e[b].split("=");$("#"+d[0])[0].value(d[1])}if(e.length>1&&!g.activeFilters){this._showFilters()}else{if(e.length==1&&g.activeFilters&&!g.filterChange){this._hideFilters()}}this.searchDelay()}else{if(a.substring(0,7)=="browse/"){g.$video.vgVideo("hide");g.$contact.vgContact("hide");if(g.activeFilters&&!g.filterChange){this._hideFilters()}g.$searchInput.val("");g.$autosuggest.text("");g.searchTxt="";if(g.prevHash!=location.hash){this.search()}g.prevHash=location.hash}}}}g.filterChange=false}}if(_gaq!==undefined){_gaq.push(["_link",location.href.replace(/#!/,"")])}}});$.ui.widget.subclass("ui.vgCrumbs",{_thisCrumbs:null,options:{$video:null,activeVideoClass:".ActiveVideo"},_create:function(){_thisCrumbs=this},setVideo:function(a){_thisCrumbs.options.$video=a;return this},checkVideos:function(){return $.cookie("vgcrumbs").split(";")[1]=="true"},getVideoClass:function(){var a=$.cookie("vgcrumbs");if(a!==null){return a.split(";")[0]}if($(window).width()>1500){return"Large"}else{if($(window).width()>1000){return"Medium"}}return"Small"},clearVideos:function(){var a=_thisCrumbs.options.$video;$.cookie("vgcrumbs",a.vgVideo("videoClass")+";false",{path:"/"})},setVideoSize:function(){var a=_thisCrumbs.options.$video;var b=$.cookie("vgcrumbs").split(";")[1];$.cookie("vgcrumbs",a.vgVideo("videoClass")+";"+b,{path:"/"})}});$.ui.widget.subclass("ui.vgAlert",{options:{$results:null,$video:null,$notices:null,current:0,error:false,warning:false,visible:false,fadeTime:500,animateTime:200,alertHeight:30},_init:function(){this.options.$notices=this.element.append("<div/><div/>").children()},error:function(a){if(typeof(a)=="undefined"){return this.options.error}else{this.options.error=a;return this}},warning:function(a){if(typeof(a)=="undefined"){return this.options.warning}else{this.options.warning=a;return this}},show:function(c){var e;var d;var b=true;var a=false;var g=this.options;var f=this;if(g.error){b=g.$notices.eq(g.current).html()==$("<div/>").html(g.error).html()}else{if(c&&g.warning){b=g.$notices.eq(g.current).html()==$("<div/>").html(g.warning).html()}else{a=true}}if((g.error||c&&g.warning)&&!(b&&g.visible)){if(g.error){e=g.error;d="Error"}else{if(g.warning){e=g.warning;d="Warning"}}if(!g.visible){g.$results.animate({marginTop:"+="+g.alertHeight+"px"},g.animateTime);g.$video.animate({marginTop:"+="+g.alertHeight+"px"},g.animateTime);this.element.animate({height:g.alertHeight+"px"},g.animateTime)}g.$notices.eq(g.current).fadeOut(g.fadeTime,function(){g.$notices.eq(g.current=(g.current+1)%2).html(e).removeClass().addClass(d).fadeIn(g.fadeTime)});g.error=g.warning=false;g.visible=true}else{if(a&&g.visible){g.$notices.eq(g.current).fadeOut(g.fadeTime,function(){g.$results.animate({marginTop:"-="+g.alertHeight+"px"},g.animateTime);g.$video.animate({marginTop:"-="+g.alertHeight+"px"},g.animateTime);f.element.animate({height:"0"},g.animateTime)});g.visible=false}else{if(b&&g.visible){g.error=g.warning=false}}}}});$.ui.widget.subclass("ui.vgResults",{options:{$crumbs:null,searchUrl:"search/",batchUrl:"search/batch/",$alert:null,$scrollPane:null,scrollDelay:250,loadDelay:500,scrollTracker:false,scrollTime:250,scrollVideoOffset:2,batchSize:20,batchGroup:5,offset:0,curPos:-1,count:0,batches:0,upperBound:0,lowerBound:0,extraBound:0,scrollPaneClass:".ScrollPane",batchClass:".Batch",boxClass:".Box",emptyClass:".Empty",activeClass:".Active",activeChild:null,searchAjax:null},_create:function(){},_init:function(){var b=this;var a=this.options;a.$scrollPane=$("<div/>").addClass(a.scrollPaneClass.substring(1));this.element.append(this.options.$scrollPane).scrollTop(0).scrollLeft(0);this.setBounds();$(window).resize(function(){b.setBounds()});this.element.scroll(function(){b._scrollDelay()}).scroll()},search:function(a,b){var d=this;var c=this.options;if(c.searchAjax!=null){c.searchAjax.abort()}c.searchAjax=$.post(this.options.searchUrl,{search:a,filters:b},function(e){c.searchAjax=null;d.results(typeof e=="object"?e:$.parseJSON(e))})},results:function(b){var d=this.options;var a=d.$alert;var c=this;d.$scrollPane.empty();d.offset=0;d.curPos=-1;d.count=b.count;d.batches=Math.ceil(d.count/d.batchSize);if(a!==null){if(b.error){a.vgAlert("error",b.error)}if(b.warning){a.vgAlert("warning",b.warning)}a.vgAlert("show",false)}while(d.count>0&&d.offset<=b.videoIdx){this._addBatch()}d.$scrollPane.children(d.batchClass+":first").nextUntil(d.batchClass).remove().end().replaceWith(b.html);d.$scrollPane.children().slice(b.videoIdx,b.videoIdx+1).addClass(d.activeClass.substring(1));this.loadBatch();setTimeout(function(){c.active(b.videoIdx,false)},d.scrollDelay)},setBounds:function(){var c=this.options;var b;var a;if(this.element.parent(":visible").length==0){b=this.element.parent().css("visibility","hidden").show();a=this.element.height();b.hide().css("visibility","visible")}else{a=this.element.height()}c.upperBound=a;c.lowerBound=-a;c.extraBound=2*a},_addBatch:function(){var e=this.options;var c;for(var d=0;d<e.batchGroup&&e.offset<e.count;d++){c=$("<a/>").data("offset",e.offset++).addClass(e.boxClass.substring(1)+" "+e.batchClass.substring(1)+" "+e.emptyClass.substring(1));for(var a=1;a<e.batchSize&&e.offset++<e.count;a++){c=c.after('<a class="'+e.boxClass.substring(1)+'"></a>')}e.$scrollPane.append(c)}},_scrollDelay:function(){var b=this;var a=this.options;if(a.scrollTracker){clearTimeout(a.scrollTracker)}a.scrollTracker=setTimeout(function(){b.loadBatch()},a.scrollDelay)},loadBatch:function(a){var d=this.options;var c=this.element[0];var b=this.element.scrollTop();a=typeof(a)=="undefined"?false:a;if(d.curPos!=b||a){d.curPos=b;d.$scrollPane.children(d.emptyClass).each(function(h,g){var f=$(g);var k=f.position().top;var j;var e;if(d.lowerBound>k||k>d.upperBound){return}$.post(d.batchUrl,{offset:f.data("offset")},function(i){i=typeof i=="object"?i:$.parseJSON(i);if(i.html!==undefined){j=f.nextUntil(d.batchClass);e=j.filter(d.activeClass).index();j.remove().end().replaceWith(i.html);if(e!=-1){d.$scrollPane.children().slice(e,e+1).addClass(d.activeClass.substring(1))}else{if(d.activeChild!=null){d.$scrollPane.children(d.activeChild).addClass(d.activeClass.substring(1))}}}if(d.$alert!==null){if(i.error){d.$alert.vgAlert("error",i.error)}if(i.warning){d.$alert.vgAlert("warning",i.warning)}d.$alert.vgAlert("show",true)}})});if(d.offset<d.count&&c.scrollTop>0&&c.scrollHeight-c.scrollTop<d.extraBound){this._addBatch()}}},active:function(b,e){var j;var f;var g=this.options;var h=g.$scrollPane;var c=this.element;var a;var d;var i;e=e===undefined?true:e;if(b===undefined){return g.$scrollPane.children(g.activeClass)}else{if(h.children().length==0||b==0){return}g.activeChild=null;if(e){h.children().removeClass(g.activeClass.substring(1))}if(this._isInt(b)){a=h.children().slice(b,b+1);i=Math.max(b-g.scrollVideoOffset,0)}else{a=h.children(b);if(a.length==0){g.activeChild=b;return}i=Math.max(h.children(b).index()-g.scrollVideoOffset,0)}a.addClass(g.activeClass.substring(1));d=h.children().slice(i,i+1);if(c.filter(":visible").length==0){c.css("visibility","hidden").show();j=a.position().top;f=d.position().top+c.scrollTop();c.hide().css("visibility","visible")}else{j=a.position().top;f=d.position().top+c.scrollTop()}if(j<0||j>c.height()){setTimeout(function(){c.animate({scrollTop:f},g.scrollTime)},g.loadDelay)}}},_isInt:function(a){var b=parseInt(a);if(isNaN(b)){return false}return a==b&&a.toString()==b.toString()}});$.ui.widget.subclass("ui.vgDialog",{options:{prettyLink:null,visible:false,padding:150,childClass:".ActiveVideo, .Content",otherChildClass:null,submitClass:"#submit",closeClass:".Close",oldTitle:"",slideTime:400,fadeTime:400,slideVertically:true},show:function(){throw"Please implement show() in subclass."},hide:function(){var a=this.options;if(a.visible&&a.oldTitle!=""){document.title=a.oldTitle}this.slideOut()},slideFadeIn:function(a){var c=this;var b=this.options;if(typeof(a)==="undefined"){a=true}if(!b.visible){if(b.slideVertically){this.element.css("top",$(window).height()+"px").show().animate({top:"0"},b.slideTime,function(){if(a){c.fadeIn()}})}else{this.element.css("left",$(window).width()+"px").show().animate({left:"0"},b.slideTime,function(){if(a){c.fadeIn()}})}}return this},slideIn:function(){this.slideFadeIn(false);return this},fadeIn:function(a){var d=this.options;var c=this.element.children(d.childClass);var b=d.otherChildClass==null?null:this.element.children(d.otherChildClass);a=typeof a=="undefined"?function(){}:a;if(c.css("position")!="absolute"){c.css("minHeight",($(window).height()-d.padding)+"px")}c.fadeIn(d.fadeTime,function(){if(b!=null){b.fadeIn(d.fadeTime)}a()});d.visible=true},slideOut:function(){var b=this;var a=this.options;if(a.visible){if(a.slideVertically){this.element.animate({top:$(window).height()+"px"},a.slideTime,function(){b.element.hide()}).children(a.childClass).fadeOut(a.fadeTime).siblings(a.otherChildClass).fadeOut(a.fadeTime)}else{this.element.animate({left:$(window).width()+"px"},a.slideTime,function(){b.element.hide()}).children(a.childClass).fadeOut(a.fadeTime).siblings(a.otherChildClass).fadeOut(a.fadeTime)}a.visible=false}return this},visible:function(a){var b=this.options;if(typeof(a)==="undefined"){return b.visible}else{b.visible=a}}});$.ui.vgDialog.subclass("ui.vgFeedback",{options:{footerHeight:0,footerHtml:null,showUrl:null,submitUrl:null,clearUrl:false},_init:function(){this.options.footerHtml=this.element.html()},_showAjax:function(a){var c=this;var b=this.options;this.options.oldTitle=document.title;a=typeof a=="object"?a:$.parseJSON(a);document.title=a.title;this.element.html(a.html).validateForm().find(b.submitClass).click(function(d){return c._submitDialog(d)});$(b.closeClass).click(function(){c.hide();return b.clearUrl});this.slideFadeIn();return false},_submitDialog:function(a){throw"Please implement _submitDialog() in subclass."},_showSubmitResults:function(a){var c=this;var b=this.options;a=typeof a=="object"?a:$.parseJSON(a);document.title=a.title;this.element.children(b.childClass).fadeOut(b.fadeTime).end().html(a.html).children(b.childClass).fadeIn(b.fadeTime).find(b.closeClass).click(function(){c.hide();return b.clearUrl})},show:function(){var a=this;$.post(this.options.showUrl,function(b){a._showAjax(b)})},slideFadeIn:function(){this.element.css("top",this.element.offset().top+"px");this._super()},slideOut:function(){var b=this.options;var a=this;if(b.visible){this.element.animate({top:$(window).height()-b.footerHeight+"px"},b.slideTime,function(){a.element.hide()}).children(b.childClass).fadeOut(b.fadeTime,function(){a.element.css("top","").html(b.footerHtml).fadeIn(b.fadeTime)});b.visible=false}else{this.element.fadeIn(b.fadeTime)}}});$.ui.vgFeedback.subclass("ui.vgContact",{options:{showUrl:"feedback/contact/",submitUrl:"feedback/submit_contact/",clearUrl:true},_submitDialog:function(a){var b=this;if(!a.currentTarget.checkForm()){return false}$.post(this.options.submitUrl,{comment:$("#comment").val(),author:$("#author").val(),email:$("#email").val()},function(c){b._showSubmitResults(c)});return false}});$.ui.vgFeedback.subclass("ui.vgSuggest",{options:{showUrl:"feedback/name/",submitUrl:"feedback/submit_name/"},_create:function(){var a=this;$(".SuggestName").live("click",function(){a.show();return false})},_submitDialog:function(a){var b=this;if(!a.currentTarget.checkForm()){return false}$.post(this.options.submitUrl,{url:$("#url").val(),name:$("#name").val(),suggestion:$("#suggestion").val(),comment:$("#comment").val(),author:$("#author").val(),email:$("#email").val()},function(c){b._showSubmitResults(c)});return false},show:function(){var b=this;var a=this.options;$.post(a.showUrl,{url:location.hash.substring(a.prettyLink.length+2),name:$(".VideoName").html()},function(c){b._showAjax(c)});return false}});$.ui.vgDialog.subclass("ui.vgVideo",{options:{$crumbs:null,contentClass:".Content",relatedVideosClass:".RelatedVideos",allVideoClasses:"Small Medium Large",videoSizes:{large:{width:1280,height:720,bitrate:2048},medium:{width:854,height:480,bitrate:1024},small:{width:640,height:360,bitrate:768},mobile:{width:320,height:180,bitrate:384}},slideTime:250,embedSizeDelay:1500,embedSizeFadeTime:200,similarFadeTime:{fadeOut:50,fadeIn:500},resizeTime:300,videoChangeTime:600,slideVertically:false,showResults:null,$content:null,videosCache:new Array(),relatedVideosCache:new Array(),$relatedVideos:null,showUrl:"video/load/",videoClass:null,visible:false,embedSizeTracker:false,otherChildClass:".RelatedVideos",videoAjax:null},_create:function(){var a=this.options;a.videoClass=a.$crumbs.vgCrumbs("getVideoClass");a.$relatedVideos=$(a.relatedVideosClass).vgResults({$alert:null});a.$content=this.element.find(a.contentClass)},_showAjax:function(b,d){var g=this.options;var a=g.$relatedVideos;var f;var c=new Object();var e=g.visible;d=typeof d=="object"?d:$.parseJSON(d);document.title=d.title;g.videosCache[b]={html:d.html,title:d.title,image:d.image,url:d.url,video:d.video};g.$content.html(d.html);this._setupVideo(d.image,d.url,d.video);f={left:a.position().left,right:parseInt(a.css("right"))};this.fadeIn(function(){a.show().animate({left:f.left+"px",right:f.right+"px"},g.slideTime)});if(e){g.$content.nudgeFadeIn(g.videoChangeTime)}c.count=d.count;c.html=d.relatedHtml;c.videoIdx=d.videoIdx;if(!e){g.relatedVideosCache[b]=c;a.vgResults("results",c,null)}return this},_setupVideo:function(d,a,c){var f=this;var b=this.element;var e=this.options;if(!b.hasClass(e.videoClass)){b.removeClass(e.allVideoClasses).addClass(e.videoClass)}b.find("#shareToggleLink").click(function(g){f._sectionToggle(".ShareToggle","#shareToggleLink .Button")});b.find("#embedToggleLink").click(function(g){f._sectionToggle(".EmbedToggle","#embedToggleLink")});b.find(".EmbedSize li").hover(function(g){f._showEmbedSize(g)},function(g){f._hideEmbedSize(g)}).click(function(g){f._changeEmbedSize(g)});b.find("#vidEmbedSize").click(function(g){f._hideEmbedSize(g)});b.find(".ShareToggle, .EmbedToggle").data("visible",false);b.find("input[type=text], textarea").focus(function(){var g=this;setTimeout(function(){g.select()},50)});b.find(".VideoActions li:not(#shareToggleLink)").click(function(g){f._resizeVideo(g)});b.find("#shortLink").click(function(g){f._shareLinkToggle(g)});this._setupVideoPlayer(d,a,c);return this},_shareLinkToggle:function(b){var a=this.element.find("#shareLink");if(b.currentTarget.checked){a.val(a.data("shortLink"))}else{a.val(a.data("longLink"))}},_setupVideoPlayer:function(d,b,c){var a=this.options.videoSizes;jwplayer("videoPlayer").setup({flashplayer:"player.swf",image:d,allowfullscreen:true,provider:"http",levels:[{bitrate:a.large.bitrate,file:b+"/l-"+c,width:a.large.width},{bitrate:a.medium.bitrate,file:b+"/m-"+c,width:a.medium.width},{bitrate:a.small.bitrate,file:b+"/s-"+c,width:a.small.width},{bitrate:a.mobile.bitrate,file:b+"/i-"+c,width:a.mobile.width}]})},show:function(a){var d=this.options;var b=d.videosCache;var c=this;d.showResults();if(d.visible){d.$content.css("opacity",0);d.$content.parent().scrollTop(0);d.$relatedVideos.vgResults("active","#video-"+a.substring(d.prettyLink.length).replace("/","-"))}else{d.oldTitle=document.title}if(b[a]){document.title=b[a].title;d.$content.html(b[a].html);if(d.visible){d.$content.nudgeFadeIn(d.videoChangeTime)}this._setupVideo(b[a].image,b[a].url,b[a].video);if(d.relatedVideosCache[a]&&!d.visible){d.$relatedVideos.vgResults("results",d.relatedVideosCache[a],null)}this.slideFadeIn();if(d.videoAjax!=null){d.videoAjax.abort();d.videoAjax=null}}else{this.slideIn();if(d.videoAjax!=null){d.videoAjax.abort()}d.videoAjax=$.post(d.showUrl+a.substring(d.prettyLink.length),function(e){d.videoAjax=null;c._showAjax(a,e)})}},_showEmbedSize:function(b){var a=$(b.currentTarget);var d=this;var c=this.options;if(!c.embedSizeTracker){c.embedSizeTracker=setTimeout(function(){var f=a.data("width");var e=a.data("height");$("#vidEmbedSize").css({width:f+"px",height:e+"px",left:(d.element.width()-f)/2+"px",fontSize:Math.round(f/6)+"px",paddingTop:Math.round(e/2.3)+"px",top:Math.max(a.position().top-e,10)+"px"}).fadeIn(c.embedSizeFadeTime);clearTimeout(c.embedSizeTracker);c.embedSizeTracker=false},c.embedSizeDelay)}},_hideEmbedSize:function(){var a=this.options;clearTimeout(a.embedSizeTracker);a.embedSizeTracker=false;$("#vidEmbedSize").fadeOut(a.embedSizeFadeTime)},_changeEmbedSize:function(c){var d=this.options;var a=$(c.currentTarget);var b=$("#shareEmbed");$(".EmbedSize li").removeClass("Active");a.addClass("Active");b.val(b.val().replace(/width="[0-9]+"/,'width="'+a.data("width")+'"').replace(/height="[0-9]+"/,'height="'+a.data("height")+'"'));clearTimeout(d.embedSizeTracker);d.embedSizeTracker=false},_sectionToggle:function(a,b){$(b).toggleClass("Selected");$(a).slideFadeToggle(500)},_resizeVideo:function(i){var g=this.options;var h=this;var c=$(i.currentTarget).data("videoSize");var b=g.$content;var f=b.find("#videoPlayer");var a=b.find(".SimilarVideos ul");var j;var d;j=g.videoClass=c.charAt(0).toUpperCase()+c.slice(1);g.$crumbs.vgCrumbs("setVideoSize");if(this.element.hasClass(j)){return}d=j=="Large"||(j=="Medium"&&this.element.hasClass("Small"));f.css("visibility","hidden");a.fadeOut(g.similarFadeTime.fadeOut,function(){if(!d){h.element.removeClass("Small Medium Large").addClass(j);a.fadeIn(g.similarFadeTime.fadeIn)}});b.animate({width:g.videoSizes[c].width+"px"},g.resizeTime).find(".VideoContainer img").animate({width:g.videoSizes[c].width+"px",height:g.videoSizes[c].height+"px"},g.resizeTime,function(){f.resize(g.videoSizes[c].width,g.videoSizes[c].height).css("visibility","visible");if(d){h.element.removeClass("Small Medium Large").addClass(j);a.fadeIn(g.similarFadeTime.fadeIn)}});g.$relatedVideos.animate({right:g.videoSizes[c].width+b.position().left*2+"px"},g.resizeTime)},videoClass:function(a){var b=this.options;if(typeof(a)==="undefined"){return b.videoClass}else{b.videoClass=a}}});
+$.ui.widget.subclass("ui.vgStart",{options:{title:"Video Gallery",titlePost:" | Video Gallery",prettyLink:"video/",searchTracker:false,searchDelay:250,resizeTracker:false,resizeDelay:250,suggestTracker:false,suggestDelay:50,suggestAjax:null,hashTracker:false,hashDelay:1000,autosuggestUrl:"search/autosuggest/",filterHeight:123,searchTxt:"",prevSearchTxt:"",prevHash:null,activeFilters:false,hiddenFilters:false,filterChange:false,slideInTime:200,slideOutTime:100,slideOutDelay:100,logoUrl:"images/theme/logo-big.png",bgUrl:"images/theme/bg.jpg",$crumbs:null,$results:null,$video:null,$contact:null,$suggest:null,$filters:null,$searchBox:null,$searchInput:null,$autosuggest:null,$filters:null,$alert:null,alertClass:".Alert",resultsClass:".Results",videoClass:".Video",relatedVideosClass:".RelatedVideos",feedbackClass:".Feedback",searchBoxClass:".Search",searchInputClass:".SearchInput",autosuggestClass:".Autosuggest",filtersClass:".Filters",contentClass:".Content"},_create:function(){var b;var d=this.options;var c=this;var a;d.$crumbs=$(document).vgCrumbs();d.$alert=$(d.alertClass).vgAlert({$results:$(d.resultsClass),$video:$(d.videoClass)});d.$results=$(d.resultsClass).vgResults({$alert:d.$alert});d.$video=$(d.videoClass).vgVideo({$crumbs:d.$crumbs,showResults:function(){c._showResults();return this},relatedVideosClass:d.relatedVideosClass,prettyLink:d.prettyLink});d.$crumbs.vgCrumbs("setVideo",d.$video);b=parseInt(d.$results.css("marginBottom"));d.$contact=$(d.feedbackClass).vgContact({footerHeight:b,prettyLink:d.prettyLink});d.$suggest=$(d.feedbackClass).vgSuggest({footerHeight:b,prettyLink:d.prettyLink});d.$searchBox=$(d.searchBoxClass);d.$searchInput=$(d.searchInputClass);d.$autosuggest=$(d.autosuggestClass);d.$filters=$(d.filtersClass);d.$crumbs.vgCrumbs("clearVideos");$(window).resize(function(){c.resizeDelay()});d.$results.scroll(this.scrollDelay).scroll();d.$searchInput.keydown(function(f){c._tabCapture(f)}).keyup(function(f){c.searchDelay(f)}).val("");$(window).hashchange(function(){c._hashChange()}).hashchange();$(".ToggleFilters, #filtersLink").click(function(){if(d.activeFilters){c._hideFilters()}else{c._showFilters()}return false});$(document).keydown(function(g){var f=location.href.split("#!")[1]||location.href.split("#%21")[1];if(g.which==27){if(f.substring(0,8)=="contact/"){location.hash="#!"}else{if(f.substring(0,d.prettyLink.length)==d.prettyLink){if(d.$suggest.vgSuggest("visible")){d.$suggest.vgSuggest("hide")}else{location.hash="#!"}}}}});$("#searchButton").click(function(){if(d.$searchInput.val()!=""&&!d.activeFilters){d.searchTxt=d.$searchInput.val();c.searchDelay()}});$("#browseButton").click(function(){if(!$(this).hasClass("Disabled")){d.$searchInput.val("");d.$autosuggest.text("");d.searchTxt="";if(d.hashTracker){clearTimeout(d.hashTracker)}c.search(true)}});this.element.bind("slide",function(f){d.filterChange=true;c.search(true)});$("input[type=text], textarea").live("focus",function(){var e=this;setTimeout(function(){e.select()},50)});$("input[type=text].ReadOnly").live("keypress",function(){return false});$(".SearchLink").live("click",function(f){c._searchSpellcheck(f);return false});$(".FiltersLink").live("click",function(){c._hideFilters();return false});$(".Results .Box, .Video .SimilarVideos li").live("hover",function(g){var f=$(this);if(g.type=="mouseenter"){if(f.find(".SlideBackground").length==0){f.find("span").append("<span />").children().addClass("SlideBackground")}f.find(".SlideBackground").clearQueue().animate({top:"0"},d.slideInTime)}else{f.find(".SlideBackground").clearQueue().delay(d.slideOutDelay).animate({top:"100%"},d.slideOutTime)}});a=new Image();a.src=d.logoUrl;$(a).load(function(){$(a).unbind("load").load(function(){$(".Background").css("backgroundImage",'url("'+d.bgUrl+'")').fadeIn(500);delete a});a.src=d.bgUrl})},_showResults:function(a){var b=this.options;if(typeof(a)==="undefined"){a=false}if(b.$searchBox.hasClass("Home")){if(a){$(".Logo").fadeOut(50).addClass("Small").fadeIn(50);b.$searchBox.animate({marginTop:"-=100"},100,function(){var c=$(this);c.css("marginTop","");setTimeout(function(){c.addClass("Top")},500)}).removeClass("Home").find("#contact").fadeIn(300);b.$results.fadeIn(300)}else{b.$searchBox.removeClass("Home").addClass("Top").find("#contact").show();$(".Logo").addClass("Small");b.$results.show()}}return this},search:function(a){var d=this.options;var c;var b;this._showResults(a);d.$crumbs.vgCrumbs("clearVideos");c=this._buildFilters();this._searchHash();b=d.$searchInput.val();document.title=(b==""?(d.activeFilters?"Search":"Browse"):b+" - Search")+d.titlePost;d.$results.vgResults("search",b,c)},_searchHash:function(){var a;var b=this.options;a="#!search/"+encodeURIComponent(b.searchTxt);if(b.activeFilters){$(".Slider").each(function(){var d=$(this).attr("id");var c=this.value();if(c!==null){a+="+"+d+"="+c}})}if(a=="#!search/"){a="#!browse/"}if(a=="#!"+location.href.split("#!")[1]){if(b.hashTracker){clearTimeout(b.hashTracker)}return}if(b.prevSearchTxt!=""&&b.searchTxt.substring(0,b.prevSearchTxt.length)==b.prevSearchTxt){if($.browser.webkit){if(b.hashTracker){clearTimeout(b.hashTracker)}b.hashTracker=setTimeout(function(){location.hash=a},b.hashDelay)}else{location.replace(location.href.slice(0,-location.href.split("#!")[1].length-2)+a)}}else{location.hash=a}b.prevSearchTxt=b.searchTxt},_buildFilters:function(){var a=new Object();var b=this.options;if(b.activeFilters){$(".Slider").each(function(){a[$(this).attr("id")]=this.value()});return a}return null},resizeDelay:function(){var a=this.options;if(a.resizeTracker){clearTimeout(a.resizeTracker)}a.resizeTracker=setTimeout(function(){if(a.visible){a.$video.css("left",$(window).width()+"px")}else{a.$video.find(a.contentClass).css("minHeight",($(window).height()-a.padding)+"px")}a.$results.vgResults("loadBatch",true)},a.resizeDelay)},_searchSpellcheck:function(a){this.options.$searchInput.val($(a.currentTarget).text());this.searchDelay()},_showFilters:function(){var b=this.options;var a=this;b.activeFilters=true;b.$filters.animate({height:"+="+b.filterHeight+"px"},200);b.$results.animate({top:"+="+b.filterHeight+"px"},200);$("#browseButton").addClass("Disabled");if(b.$video.vgVideo("visible")){b.$video.vgVideo("hide");this.search()}$(".Slider").each(function(){if(this.value()!=null){a.search();return false}})},_hideFilters:function(){var b=this.options;var a=this;if(!b.hiddenFilters){b.$filters.animate({height:"-="+b.filterHeight+"px"},200)}b.$results.animate({top:"-="+b.filterHeight+"px"},200);$("#browseButton").removeClass("Disabled");b.activeFilters=false;b.hiddenFilters=false;$(".Slider").each(function(){if(this.value()!=null){a.search();return false}})},suggestVideo:function(){var b=this.options;var a;if(b.suggestAjax!=null){b.suggestAjax.abort()}a=this._buildFilters();b.suggestAjax=$.post(b.autosuggestUrl,{search:b.$searchInput.val(),filters:a},function(c){b.suggestAjax=null;if(b.$searchInput.val()==""){return}c=typeof c=="object"?c:$.parseJSON(c);b.$autosuggest.html(c.autosuggest)})},_tabCapture:function(a){var b=this.options;if(a.keyCode==9&&b.$searchInput.val()!=b.$autosuggest.text()&&b.$autosuggest.text()!=""){b.$searchInput.val(b.$autosuggest.text());a.preventDefault()}},searchDelay:function(a){var c=this.options;var b=this;if(c.$searchInput.val()==""||a!==undefined&&(a.keyCode==13||a.keyCode==27)){c.$autosuggest.text("");if(a!==undefined&&a.keyCode==13){c.$alert.vgAlert("show",true)}}if(c.searchTxt==c.$searchInput.val()){return}if(c.$autosuggest.text().substring(0,c.$searchInput.val().length)!=c.$searchInput.val()){c.$autosuggest.text("");if(c.suggestTracker){clearTimeout(c.suggestTracker)}c.suggestTracker=setTimeout(function(){b.suggestVideo()},c.suggestDelay)}if(a===undefined||(c.$searchInput.val()!=c.searchTxt&&c.$searchInput.val()!="")){c.searchTxt=c.$searchInput.val();if(c.hashTracker){clearTimeout(c.hashTracker)}if(c.searchTracker){clearTimeout(c.searchTracker)}if(a===undefined){this.search(true)}else{c.searchTracker=setTimeout(function(){b.search(true)},c.searchDelay)}}if(c.$searchInput.val()==""){if(c.searchTracker){clearTimeout(c.searchTracker)}if(c.suggestTracker){clearTimeout(c.suggestTracker)}}},_hashChange:function(){var a=location.href.split("#!")[1]||location.href.split("#%21")[1];var f=location.hash;var e;var d;var g=this.options;var c;if(g.hiddenFilters){g.hiddenFilters=false;g.$filters.css({height:"+="+g.filterHeight+"px",marginBottom:0+"px"})}if(f=="#!"){document.title=g.title;g.$video.vgVideo("hide");g.$contact.vgContact("hide");if(g.prevHash!=null){location.hash=g.prevHash}else{location.hash=""}}if(f==""){document.title=g.title;g.$video.vgVideo("hide");g.$contact.vgContact("hide");if(!g.$searchBox.hasClass("Home")){g.$searchBox.removeClass("Top").addClass("Home").find("#contact").hide();$(".Logo").removeClass("Small");g.$results.hide()}}else{if(g.$searchBox.hasClass("Home")){g.$searchBox.removeClass("Home").addClass("Top").find("#contact").show();$(".Logo").addClass("Small");g.$results.show()}if(a!==undefined){if(a.substring(0,g.prettyLink.length)==g.prettyLink){g.$contact.vgContact("hide");if(g.activeFilters){g.hiddenFilters=true;g.$filters.css({height:"-="+g.filterHeight+"px"})}g.$video.vgVideo("show",a)}else{if(a.substring(0,8)=="contact/"){g.$video.vgVideo("hide");g.$contact.vgContact("show")}else{if(a.substring(0,7)=="search/"){g.$video.vgVideo("hide");g.$contact.vgContact("hide");g.prevHash=location.hash;e=a.substring(7).split("+");c=decodeURIComponent(e[0]);if(c!=g.searchTxt){g.$searchInput.val(c)}for(var b=1;b<e.length;b++){d=e[b].split("=");$("#"+d[0])[0].value(d[1])}if(e.length>1&&!g.activeFilters){this._showFilters()}else{if(e.length==1&&g.activeFilters&&!g.filterChange){this._hideFilters()}}this.searchDelay()}else{if(a.substring(0,7)=="browse/"){g.$video.vgVideo("hide");g.$contact.vgContact("hide");if(g.activeFilters&&!g.filterChange){this._hideFilters()}g.$searchInput.val("");g.$autosuggest.text("");g.searchTxt="";if(g.prevHash!=location.hash){this.search()}g.prevHash=location.hash}}}}g.filterChange=false}}if(_gaq!==undefined){_gaq.push(["_link",location.href])}}});$.ui.widget.subclass("ui.vgCrumbs",{_thisCrumbs:null,options:{$video:null,activeVideoClass:".ActiveVideo"},_create:function(){_thisCrumbs=this},setVideo:function(a){_thisCrumbs.options.$video=a;return this},checkVideos:function(){return $.cookie("vgcrumbs").split(";")[1]=="true"},getVideoClass:function(){var a=$.cookie("vgcrumbs");if(a!==null){return a.split(";")[0]}if($(window).width()>1500){return"Large"}else{if($(window).width()>1000){return"Medium"}}return"Small"},clearVideos:function(){var a=_thisCrumbs.options.$video;$.cookie("vgcrumbs",a.vgVideo("videoClass")+";false",{path:"/"})},setVideoSize:function(){var a=_thisCrumbs.options.$video;var b=$.cookie("vgcrumbs").split(";")[1];$.cookie("vgcrumbs",a.vgVideo("videoClass")+";"+b,{path:"/"})}});$.ui.widget.subclass("ui.vgAlert",{options:{$results:null,$video:null,$notices:null,current:0,error:false,warning:false,visible:false,fadeTime:500,animateTime:200,alertHeight:30},_init:function(){this.options.$notices=this.element.append("<div/><div/>").children()},error:function(a){if(typeof(a)=="undefined"){return this.options.error}else{this.options.error=a;return this}},warning:function(a){if(typeof(a)=="undefined"){return this.options.warning}else{this.options.warning=a;return this}},show:function(c){var e;var d;var b=true;var a=false;var g=this.options;var f=this;if(g.error){b=g.$notices.eq(g.current).html()==$("<div/>").html(g.error).html()}else{if(c&&g.warning){b=g.$notices.eq(g.current).html()==$("<div/>").html(g.warning).html()}else{a=true}}if((g.error||c&&g.warning)&&!(b&&g.visible)){if(g.error){e=g.error;d="Error"}else{if(g.warning){e=g.warning;d="Warning"}}if(!g.visible){g.$results.animate({marginTop:"+="+g.alertHeight+"px"},g.animateTime);g.$video.animate({marginTop:"+="+g.alertHeight+"px"},g.animateTime);this.element.animate({height:g.alertHeight+"px"},g.animateTime)}g.$notices.eq(g.current).fadeOut(g.fadeTime,function(){g.$notices.eq(g.current=(g.current+1)%2).html(e).removeClass().addClass(d).fadeIn(g.fadeTime)});g.error=g.warning=false;g.visible=true}else{if(a&&g.visible){g.$notices.eq(g.current).fadeOut(g.fadeTime,function(){g.$results.animate({marginTop:"-="+g.alertHeight+"px"},g.animateTime);g.$video.animate({marginTop:"-="+g.alertHeight+"px"},g.animateTime);f.element.animate({height:"0"},g.animateTime)});g.visible=false}else{if(b&&g.visible){g.error=g.warning=false}}}}});$.ui.widget.subclass("ui.vgResults",{options:{$crumbs:null,searchUrl:"search/",batchUrl:"search/batch/",$alert:null,$scrollPane:null,scrollDelay:250,loadDelay:500,scrollTracker:false,scrollTime:250,scrollVideoOffset:2,batchSize:20,batchGroup:5,offset:0,curPos:-1,count:0,batches:0,upperBound:0,lowerBound:0,extraBound:0,scrollPaneClass:".ScrollPane",batchClass:".Batch",boxClass:".Box",emptyClass:".Empty",activeClass:".Active",activeChild:null,searchAjax:null},_create:function(){},_init:function(){var b=this;var a=this.options;a.$scrollPane=$("<div/>").addClass(a.scrollPaneClass.substring(1));this.element.append(this.options.$scrollPane).scrollTop(0).scrollLeft(0);this.setBounds();$(window).resize(function(){b.setBounds()});this.element.scroll(function(){b._scrollDelay()}).scroll()},search:function(a,b){var d=this;var c=this.options;if(c.searchAjax!=null){c.searchAjax.abort()}c.searchAjax=$.post(this.options.searchUrl,{search:a,filters:b},function(e){c.searchAjax=null;d.results(typeof e=="object"?e:$.parseJSON(e))})},results:function(b){var d=this.options;var a=d.$alert;var c=this;d.$scrollPane.empty();d.offset=0;d.curPos=-1;d.count=b.count;d.batches=Math.ceil(d.count/d.batchSize);if(a!==null){if(b.error){a.vgAlert("error",b.error)}if(b.warning){a.vgAlert("warning",b.warning)}a.vgAlert("show",false)}while(d.count>0&&d.offset<=b.videoIdx){this._addBatch()}d.$scrollPane.children(d.batchClass+":first").nextUntil(d.batchClass).remove().end().replaceWith(b.html);d.$scrollPane.children().slice(b.videoIdx,b.videoIdx+1).addClass(d.activeClass.substring(1));this.loadBatch();setTimeout(function(){c.active(b.videoIdx,false)},d.scrollDelay)},setBounds:function(){var c=this.options;var b;var a;if(this.element.parent(":visible").length==0){b=this.element.parent().css("visibility","hidden").show();a=this.element.height();b.hide().css("visibility","visible")}else{a=this.element.height()}c.upperBound=a;c.lowerBound=-a;c.extraBound=2*a},_addBatch:function(){var e=this.options;var c;for(var d=0;d<e.batchGroup&&e.offset<e.count;d++){c=$("<a/>").data("offset",e.offset++).addClass(e.boxClass.substring(1)+" "+e.batchClass.substring(1)+" "+e.emptyClass.substring(1));for(var a=1;a<e.batchSize&&e.offset++<e.count;a++){c=c.after('<a class="'+e.boxClass.substring(1)+'"></a>')}e.$scrollPane.append(c)}},_scrollDelay:function(){var b=this;var a=this.options;if(a.scrollTracker){clearTimeout(a.scrollTracker)}a.scrollTracker=setTimeout(function(){b.loadBatch()},a.scrollDelay)},loadBatch:function(a){var d=this.options;var c=this.element[0];var b=this.element.scrollTop();a=typeof(a)=="undefined"?false:a;if(d.curPos!=b||a){d.curPos=b;d.$scrollPane.children(d.emptyClass).each(function(h,g){var f=$(g);var k=f.position().top;var j;var e;if(d.lowerBound>k||k>d.upperBound){return}$.post(d.batchUrl,{offset:f.data("offset")},function(i){i=typeof i=="object"?i:$.parseJSON(i);if(i.html!==undefined){j=f.nextUntil(d.batchClass);e=j.filter(d.activeClass).index();j.remove().end().replaceWith(i.html);if(e!=-1){d.$scrollPane.children().slice(e,e+1).addClass(d.activeClass.substring(1))}else{if(d.activeChild!=null){d.$scrollPane.children(d.activeChild).addClass(d.activeClass.substring(1))}}}if(d.$alert!==null){if(i.error){d.$alert.vgAlert("error",i.error)}if(i.warning){d.$alert.vgAlert("warning",i.warning)}d.$alert.vgAlert("show",true)}})});if(d.offset<d.count&&c.scrollTop>0&&c.scrollHeight-c.scrollTop<d.extraBound){this._addBatch()}}},active:function(b,e){var j;var f;var g=this.options;var h=g.$scrollPane;var c=this.element;var a;var d;var i;e=e===undefined?true:e;if(b===undefined){return g.$scrollPane.children(g.activeClass)}else{if(h.children().length==0||b==0){return}g.activeChild=null;if(e){h.children().removeClass(g.activeClass.substring(1))}if(this._isInt(b)){a=h.children().slice(b,b+1);i=Math.max(b-g.scrollVideoOffset,0)}else{a=h.children(b);if(a.length==0){g.activeChild=b;return}i=Math.max(h.children(b).index()-g.scrollVideoOffset,0)}a.addClass(g.activeClass.substring(1));d=h.children().slice(i,i+1);if(c.filter(":visible").length==0){c.css("visibility","hidden").show();j=a.position().top;f=d.position().top+c.scrollTop();c.hide().css("visibility","visible")}else{j=a.position().top;f=d.position().top+c.scrollTop()}if(j<0||j>c.height()){setTimeout(function(){c.animate({scrollTop:f},g.scrollTime)},g.loadDelay)}}},_isInt:function(a){var b=parseInt(a);if(isNaN(b)){return false}return a==b&&a.toString()==b.toString()}});$.ui.widget.subclass("ui.vgDialog",{options:{prettyLink:null,visible:false,padding:150,childClass:".ActiveVideo, .Content",otherChildClass:null,submitClass:"#submit",closeClass:".Close",oldTitle:"",slideTime:400,fadeTime:400,slideVertically:true},show:function(){throw"Please implement show() in subclass."},hide:function(){var a=this.options;if(a.visible&&a.oldTitle!=""){document.title=a.oldTitle}this.slideOut()},slideFadeIn:function(a){var c=this;var b=this.options;if(typeof(a)==="undefined"){a=true}if(!b.visible){if(b.slideVertically){this.element.css("top",$(window).height()+"px").show().animate({top:"0"},b.slideTime,function(){if(a){c.fadeIn()}})}else{this.element.css("left",$(window).width()+"px").show().animate({left:"0"},b.slideTime,function(){if(a){c.fadeIn()}})}}return this},slideIn:function(){this.slideFadeIn(false);return this},fadeIn:function(a){var d=this.options;var c=this.element.children(d.childClass);var b=d.otherChildClass==null?null:this.element.children(d.otherChildClass);a=typeof a=="undefined"?function(){}:a;if(c.css("position")!="absolute"){c.css("minHeight",($(window).height()-d.padding)+"px")}c.fadeIn(d.fadeTime,function(){if(b!=null){b.fadeIn(d.fadeTime)}a()});d.visible=true},slideOut:function(){var b=this;var a=this.options;if(a.visible){if(a.slideVertically){this.element.animate({top:$(window).height()+"px"},a.slideTime,function(){b.element.hide()}).children(a.childClass).fadeOut(a.fadeTime).siblings(a.otherChildClass).fadeOut(a.fadeTime)}else{this.element.animate({left:$(window).width()+"px"},a.slideTime,function(){b.element.hide()}).children(a.childClass).fadeOut(a.fadeTime).siblings(a.otherChildClass).fadeOut(a.fadeTime)}a.visible=false}return this},visible:function(a){var b=this.options;if(typeof(a)==="undefined"){return b.visible}else{b.visible=a}}});$.ui.vgDialog.subclass("ui.vgFeedback",{options:{footerHeight:0,footerHtml:null,showUrl:null,submitUrl:null,clearUrl:false},_init:function(){this.options.footerHtml=this.element.html()},_showAjax:function(a){var c=this;var b=this.options;this.options.oldTitle=document.title;a=typeof a=="object"?a:$.parseJSON(a);document.title=a.title;this.element.html(a.html).validateForm().find(b.submitClass).click(function(d){return c._submitDialog(d)});$(b.closeClass).click(function(){c.hide();return b.clearUrl});this.slideFadeIn();return false},_submitDialog:function(a){throw"Please implement _submitDialog() in subclass."},_showSubmitResults:function(a){var c=this;var b=this.options;a=typeof a=="object"?a:$.parseJSON(a);document.title=a.title;this.element.children(b.childClass).fadeOut(b.fadeTime).end().html(a.html).children(b.childClass).fadeIn(b.fadeTime).find(b.closeClass).click(function(){c.hide();return b.clearUrl})},show:function(){var a=this;$.post(this.options.showUrl,function(b){a._showAjax(b)})},slideFadeIn:function(){this.element.css("top",this.element.offset().top+"px");this._super()},slideOut:function(){var b=this.options;var a=this;if(b.visible){this.element.animate({top:$(window).height()-b.footerHeight+"px"},b.slideTime,function(){a.element.hide()}).children(b.childClass).fadeOut(b.fadeTime,function(){a.element.css("top","").html(b.footerHtml).fadeIn(b.fadeTime)});b.visible=false}else{this.element.fadeIn(b.fadeTime)}}});$.ui.vgFeedback.subclass("ui.vgContact",{options:{showUrl:"feedback/contact/",submitUrl:"feedback/submit_contact/",clearUrl:true},_submitDialog:function(a){var b=this;if(!a.currentTarget.checkForm()){return false}$.post(this.options.submitUrl,{comment:$("#comment").val(),author:$("#author").val(),email:$("#email").val()},function(c){b._showSubmitResults(c)});return false}});$.ui.vgFeedback.subclass("ui.vgSuggest",{options:{showUrl:"feedback/name/",submitUrl:"feedback/submit_name/"},_create:function(){var a=this;$(".SuggestName").live("click",function(){a.show();return false})},_submitDialog:function(a){var b=this;if(!a.currentTarget.checkForm()){return false}$.post(this.options.submitUrl,{url:$("#url").val(),name:$("#name").val(),suggestion:$("#suggestion").val(),comment:$("#comment").val(),author:$("#author").val(),email:$("#email").val()},function(c){b._showSubmitResults(c)});return false},show:function(){var b=this;var a=this.options;$.post(a.showUrl,{url:location.hash.substring(a.prettyLink.length+2),name:$(".VideoName").html()},function(c){b._showAjax(c)});return false}});$.ui.vgDialog.subclass("ui.vgVideo",{options:{$crumbs:null,contentClass:".Content",relatedVideosClass:".RelatedVideos",allVideoClasses:"Small Medium Large",videoSizes:{large:{width:1280,height:720,bitrate:2048},medium:{width:854,height:480,bitrate:1024},small:{width:640,height:360,bitrate:768},mobile:{width:320,height:180,bitrate:384}},slideTime:250,embedSizeDelay:1500,embedSizeFadeTime:200,similarFadeTime:{fadeOut:50,fadeIn:500},resizeTime:300,videoChangeTime:600,slideVertically:false,showResults:null,$content:null,videosCache:new Array(),relatedVideosCache:new Array(),$relatedVideos:null,showUrl:"video/load/",videoClass:null,visible:false,embedSizeTracker:false,otherChildClass:".RelatedVideos",videoAjax:null},_create:function(){var a=this.options;a.videoClass=a.$crumbs.vgCrumbs("getVideoClass");a.$relatedVideos=$(a.relatedVideosClass).vgResults({$alert:null});a.$content=this.element.find(a.contentClass)},_showAjax:function(b,d){var g=this.options;var a=g.$relatedVideos;var f;var c=new Object();var e=g.visible;d=typeof d=="object"?d:$.parseJSON(d);document.title=d.title;g.videosCache[b]={html:d.html,title:d.title,image:d.image,url:d.url,video:d.video};g.$content.html(d.html);this._setupVideo(d.image,d.url,d.video);f={left:a.position().left,right:parseInt(a.css("right"))};this.fadeIn(function(){a.show().animate({left:f.left+"px",right:f.right+"px"},g.slideTime)});if(e){g.$content.nudgeFadeIn(g.videoChangeTime)}c.count=d.count;c.html=d.relatedHtml;c.videoIdx=d.videoIdx;if(!e){g.relatedVideosCache[b]=c;a.vgResults("results",c,null)}return this},_setupVideo:function(d,a,c){var f=this;var b=this.element;var e=this.options;if(!b.hasClass(e.videoClass)){b.removeClass(e.allVideoClasses).addClass(e.videoClass)}b.find("#shareToggleLink").click(function(g){f._sectionToggle(".ShareToggle","#shareToggleLink .Button")});b.find("#embedToggleLink").click(function(g){f._sectionToggle(".EmbedToggle","#embedToggleLink")});b.find(".EmbedSize li").hover(function(g){f._showEmbedSize(g)},function(g){f._hideEmbedSize(g)}).click(function(g){f._changeEmbedSize(g)});b.find("#vidEmbedSize").click(function(g){f._hideEmbedSize(g)});b.find(".ShareToggle, .EmbedToggle").data("visible",false);b.find("input[type=text], textarea").focus(function(){var g=this;setTimeout(function(){g.select()},50)});b.find(".VideoActions li:not(#shareToggleLink)").click(function(g){f._resizeVideo(g)});b.find("#shortLink").click(function(g){f._shareLinkToggle(g)});this._setupVideoPlayer(d,a,c);return this},_shareLinkToggle:function(b){var a=this.element.find("#shareLink");if(b.currentTarget.checked){a.val(a.data("shortLink"))}else{a.val(a.data("longLink"))}},_setupVideoPlayer:function(d,b,c){var a=this.options.videoSizes;jwplayer("videoPlayer").setup({flashplayer:"player.swf",image:d,allowfullscreen:true,provider:"http",levels:[{bitrate:a.large.bitrate,file:b+"/l-"+c,width:a.large.width},{bitrate:a.medium.bitrate,file:b+"/m-"+c,width:a.medium.width},{bitrate:a.small.bitrate,file:b+"/s-"+c,width:a.small.width},{bitrate:a.mobile.bitrate,file:b+"/i-"+c,width:a.mobile.width}]})},show:function(a){var d=this.options;var b=d.videosCache;var c=this;d.showResults();if(d.visible){d.$content.css("opacity",0);d.$content.parent().scrollTop(0);d.$relatedVideos.vgResults("active","#video-"+a.substring(d.prettyLink.length).replace("/","-"))}else{d.oldTitle=document.title}if(b[a]){document.title=b[a].title;d.$content.html(b[a].html);if(d.visible){d.$content.nudgeFadeIn(d.videoChangeTime)}this._setupVideo(b[a].image,b[a].url,b[a].video);if(d.relatedVideosCache[a]&&!d.visible){d.$relatedVideos.vgResults("results",d.relatedVideosCache[a],null)}this.slideFadeIn();if(d.videoAjax!=null){d.videoAjax.abort();d.videoAjax=null}}else{this.slideIn();if(d.videoAjax!=null){d.videoAjax.abort()}d.videoAjax=$.post(d.showUrl+a.substring(d.prettyLink.length),function(e){d.videoAjax=null;c._showAjax(a,e)})}},_showEmbedSize:function(b){var a=$(b.currentTarget);var d=this;var c=this.options;if(!c.embedSizeTracker){c.embedSizeTracker=setTimeout(function(){var f=a.data("width");var e=a.data("height");$("#vidEmbedSize").css({width:f+"px",height:e+"px",left:(d.element.width()-f)/2+"px",fontSize:Math.round(f/6)+"px",paddingTop:Math.round(e/2.3)+"px",top:Math.max(a.position().top-e,10)+"px"}).fadeIn(c.embedSizeFadeTime);clearTimeout(c.embedSizeTracker);c.embedSizeTracker=false},c.embedSizeDelay)}},_hideEmbedSize:function(){var a=this.options;clearTimeout(a.embedSizeTracker);a.embedSizeTracker=false;$("#vidEmbedSize").fadeOut(a.embedSizeFadeTime)},_changeEmbedSize:function(c){var d=this.options;var a=$(c.currentTarget);var b=$("#shareEmbed");$(".EmbedSize li").removeClass("Active");a.addClass("Active");b.val(b.val().replace(/width="[0-9]+"/,'width="'+a.data("width")+'"').replace(/height="[0-9]+"/,'height="'+a.data("height")+'"'));clearTimeout(d.embedSizeTracker);d.embedSizeTracker=false},_sectionToggle:function(a,b){$(b).toggleClass("Selected");$(a).slideFadeToggle(500)},_resizeVideo:function(i){var g=this.options;var h=this;var c=$(i.currentTarget).data("videoSize");var b=g.$content;var f=b.find("#videoPlayer");var a=b.find(".SimilarVideos ul");var j;var d;j=g.videoClass=c.charAt(0).toUpperCase()+c.slice(1);g.$crumbs.vgCrumbs("setVideoSize");if(this.element.hasClass(j)){return}d=j=="Large"||(j=="Medium"&&this.element.hasClass("Small"));f.css("visibility","hidden");a.fadeOut(g.similarFadeTime.fadeOut,function(){if(!d){h.element.removeClass("Small Medium Large").addClass(j);a.fadeIn(g.similarFadeTime.fadeIn)}});b.animate({width:g.videoSizes[c].width+"px"},g.resizeTime).find(".VideoContainer img").animate({width:g.videoSizes[c].width+"px",height:g.videoSizes[c].height+"px"},g.resizeTime,function(){f.resize(g.videoSizes[c].width,g.videoSizes[c].height).css("visibility","visible");if(d){h.element.removeClass("Small Medium Large").addClass(j);a.fadeIn(g.similarFadeTime.fadeIn)}});g.$relatedVideos.animate({right:g.videoSizes[c].width+b.position().left*2+"px"},g.resizeTime)},videoClass:function(a){var b=this.options;if(typeof(a)==="undefined"){return b.videoClass}else{b.videoClass=a}}});
View
4 public/javascripts/jquery.ui.vg.start.js
@@ -603,7 +603,9 @@ $.ui.widget.subclass("ui.vgStart",
// Analytics async tracking (remove #! so it shows up)
if (_gaq !== undefined)
{
- _gaq.push(['_link', location.href.replace(/#!/, "")]);
+ // This breaks Ghostery and doesn't seem to work anyway...
+ //_gaq.push(['_link', location.href.replace(/#!/, "")]);
+ _gaq.push(['_link', location.href]);
}
}
});

0 comments on commit 92543fe

Please sign in to comment.
Something went wrong with that request. Please try again.