NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Cracked.com Enhancer // @namespace http://userscripts.org/users/208041 // @description Cracked.com Enhancer // @include http://www.cracked.com/ // @version 0.3.2 // @author jgjake2 // @homepage http://userscripts.org:8080/scripts/show/130728 // @authorURL http://userscripts.org:8080/scripts/show/130728 // @authorFacebook https://www.facebook.com/jgjake2 // @authorTwitter https://twitter.com/Eric_A_Gardner // @updateURL http://userscripts.org:8080/scripts/source/130728.meta.js // @downloadURL http://userscripts.org:8080/scripts/source/130728.user.js // @include /cracked\.com\/?(?:photoplasty|blog\/|video_|article_|forums|[^\/\?#]+.html)?/ // @include /cracked\.com\/?.*?(?:CCE_First_Run|CCEReloaded\=\d+)/ // @run-at document-start // @unwrap // @grant none // @history (0.3.2) Preparing for jMOD Release // @history (0.3.2) Added Script Update Notifications // @history (0.3.2) Performance Updates // @history (0.3.1) Added Quick-Fixes To Articles // @history (0.3.1) General Script Improvements // @history (0.3.1) Logging Improvements // @history (0.3.0) Complete Rerelease // @history (0.2.6) Faster and takes up less memory // @history (0.2.6) Settings UI improvements // @history (0.2.6) Fixed issue with video covering up the navigation popups // @history (0.2.6) Log improvements // @history (0.2.6) Added update notification system // @history (0.2.6) Minor bug fixes // ==/UserScript== if (self != window.top) return false; // Don't run in frames if(typeof unsafeWindow === "undefined") unsafeWindow = window; if(typeof(window.unsafeWindow) === "undefined") window.unsafeWindow = window; if(typeof unsafeWindow.COMSCORE === "undefined") unsafeWindow.COMSCORE = {beacon: function(){}}; // Quick Fix /** @const */ var MODULE_COUNT = 4; /** @const */ var DEBUG = 'RELEASE'; /** @const */ var DEBUG_SRC = 'GoogleSVN'; /** @const */ var USE_ANALYTICS = true; //BETA //LOCAL //RELEASE //GoogleSVN function getTimeSinceDOMLoad(){ if(window.performance && window.performance.timing) return (Date.now() - window.performance.timing.domLoading); return undefined; } if(DEBUG == "BETA") console.time('CCE Page Load'); if(DEBUG == "BETA") console.time('CCE Script Load'); /** @const */ var CCEVideoJs = '\ /*jgjake2 script mod*/\ jQuery.effects||function(r,i){function e(j){var f;if(j&&j.constructor==Array&&j.length==3){return j}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(j)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(j)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(j)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(j)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(/rgba\(0, 0, 0, 0\)/.exec(j)){return d.transparent}return d[r.trim(j).toLowerCase()]}function x(k,j){var f;do{f=r.curCSS(k,j);if(f!=""&&f!="transparent"||r.nodeName(k,"body")){break}j="backgroundColor"}while(k=k.parentNode);return e(f)}function c(){var m=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,j={},f,l;if(m&&m.length&&m[0]&&m[m[0]]){for(var k=m.length;k--;){f=m[k];if(typeof m[f]=="string"){l=f.replace(/\-(\w)/g,function(o,n){return n.toUpperCase()});j[l]=m[f]}}}else{for(f in m){if(typeof m[f]==="string"){j[f]=m[f]}}}return j}function b(k){var j,f;for(j in k){f=k[j];if(f==null||r.isFunction(f)||j in w||/scrollbar/.test(j)||!/color/i.test(j)&&isNaN(parseFloat(f))){delete k[j]}}return k}function v(l,j){var f={_:0},k;for(k in j){if(l[k]!=j[k]){f[k]=j[k]}}return f}function h(l,j,f,k){if(typeof l=="object"){k=j;f=null;j=l;l=j.effect}if(r.isFunction(j)){k=j;f=null;j={}}if(typeof j=="number"||r.fx.speeds[j]){k=f;f=j;j={}}if(r.isFunction(f)){k=f;f=null}j=j||{};f=f||j.duration;f=r.fx.off?0:typeof f=="number"?f:f in r.fx.speeds?r.fx.speeds[f]:r.fx.speeds._default;k=k||j.complete;return[l,j,f,k]}function g(f){if(!f||typeof f==="number"||r.fx.speeds[f]){return true}if(typeof f==="string"&&!r.effects[f]){return true}return false}r.effects={};r.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(j,f){r.fx.step[f]=function(k){if(!k.colorInit){k.start=x(k.elem,f);k.end=e(k.end);k.colorInit=true}k.elem.style[f]="rgb("+Math.max(Math.min(parseInt(k.pos*(k.end[0]-k.start[0])+k.start[0],10),255),0)+","+Math.max(Math.min(parseInt(k.pos*(k.end[1]-k.start[1])+k.start[1],10),255),0)+","+Math.max(Math.min(parseInt(k.pos*(k.end[2]-k.start[2])+k.start[2],10),255),0)+")"}});var d={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},a=["add","remove","toggle"],w={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};r.effects.animateClass=function(l,j,f,k){if(r.isFunction(f)){k=f;f=null}return this.queue(function(){var q=r(this),p=q.attr("style")||" ",n=b(c.call(this)),o,m=q.attr("class");r.each(a,function(s,t){l[t]&&q[t+"Class"](l[t])});o=b(c.call(this));q.attr("class",m);q.animate(v(n,o),{queue:false,duration:j,easding:f,complete:function(){r.each(a,function(s,t){l[t]&&q[t+"Class"](l[t])});if(typeof q.attr("style")=="object"){q.attr("style").cssText="";q.attr("style").cssText=p}else{q.attr("style",p)}k&&k.apply(this,arguments);r.dequeue(this)}})})};r.fn.extend({_addClass:r.fn.addClass,addClass:function(l,j,f,k){return j?r.effects.animateClass.apply(this,[{add:l},j,f,k]):this._addClass(l)},_removeClass:r.fn.removeClass,removeClass:function(l,j,f,k){return j?r.effects.animateClass.apply(this,[{remove:l},j,f,k]):this._removeClass(l)},_toggleClass:r.fn.toggleClass,toggleClass:function(m,j,f,l,k){return typeof j=="boolean"||j===i?f?r.effects.animateClass.apply(this,[j?{add:m}:{remove:m},f,l,k]):this._toggleClass(m,j):r.effects.animateClass.apply(this,[{toggle:m},j,f,l])},switchClass:function(m,j,f,l,k){return r.effects.animateClass.apply(this,[{add:j,remove:m},f,l,k])}});r.extend(r.effects,{version:"1.8.13",save:function(k,j){for(var f=0;f<j.length;f++){j[f]!==null&&k.data("ec.storage."+j[f],k[0].style[j[f]])}},restore:function(k,j){for(var f=0;f<j.length;f++){j[f]!==null&&k.css(j[f],k.data("ec.storage."+j[f]))}},setMode:function(j,f){if(f=="toggle"){f=j.is(":hidden")?"show":"hide"}return f},getBaseline:function(k,j){var f;switch(k[0]){case"top":f=0;break;case"middle":f=0.5;break;case"bottom":f=1;break;default:f=k[0]/j.height}switch(k[1]){case"left":k=0;break;case"center":k=0.5;break;case"right":k=1;break;default:k=k[1]/j.width}return{x:k,y:f}},createWrapper:function(k){if(k.parent().is(".ui-effects-wrapper")){return k.parent()}var j={width:k.outerWidth(true),height:k.outerHeight(true),"float":k.css("float")},f=r("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});k.wrap(f);f=k.parent();if(k.css("position")=="static"){f.css({position:"relative"});k.css({position:"relative"})}else{r.extend(j,{position:k.css("position"),zIndex:k.css("z-index")});r.each(["top","left","bottom","right"],function(m,l){j[l]=k.css(l);if(isNaN(parseInt(j[l],10))){j[l]="auto"}});k.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return f.css(j).show()},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(l,j,f,k){k=k||{};r.each(j,function(n,m){unit=l.cssUnit(m);if(unit[0]>0){k[m]=unit[0]*f+unit[1]}});return k}});r.fn.extend({effect:function(l){var j=h.apply(this,arguments),f={options:j[1],duration:j[2],callback:j[3]};j=f.options.mode;var k=r.effects[l];if(r.fx.off||!k){return j?this[j](f.duration,f.callback):this.each(function(){f.callback&&f.callback.call(this)})}return k.call(this,f)},_show:r.fn.show,show:function(j){if(g(j)){return this._show.apply(this,arguments)}else{var f=h.apply(this,arguments);f[1].mode="show";return this.effect.apply(this,f)}},_hide:r.fn.hide,hide:function(j){if(g(j)){return this._hide.apply(this,arguments)}else{var f=h.apply(this,arguments);f[1].mode="hide";return this.effect.apply(this,f)}},__toggle:r.fn.toggle,toggle:function(j){if(g(j)||typeof j==="boolean"||r.isFunction(j)){return this.__toggle.apply(this,arguments)}else{var f=h.apply(this,arguments);f[1].mode="toggle";return this.effect.apply(this,f)}},cssUnit:function(k){var j=this.css(k),f=[];r.each(["em","px","%","pt"],function(m,l){if(j.indexOf(l)>0){f=[parseFloat(j),l]}});return f}});r.easing.jswing=r.easing.swing;r.extend(r.easing,{def:"easeOutQuad",swing:function(m,j,f,l,k){return r.easing[r.easing.def](m,j,f,l,k)},easeInQuad:function(m,j,f,l,k){return l*(j/=k)*j+f},easeOutQuad:function(m,j,f,l,k){return -l*(j/=k)*(j-2)+f},easeInOutQuad:function(m,j,f,l,k){if((j/=k/2)<1){return l/2*j*j+f}return -l/2*(--j*(j-2)-1)+f},easeInCubic:function(m,j,f,l,k){return l*(j/=k)*j*j+f},easeOutCubic:function(m,j,f,l,k){return l*((j=j/k-1)*j*j+1)+f},easeInOutCubic:function(m,j,f,l,k){if((j/=k/2)<1){return l/2*j*j*j+f}return l/2*((j-=2)*j*j+2)+f},easeInQuart:function(m,j,f,l,k){return l*(j/=k)*j*j*j+f},easeOutQuart:function(m,j,f,l,k){return -l*((j=j/k-1)*j*j*j-1)+f},easeInOutQuart:function(m,j,f,l,k){if((j/=k/2)<1){return l/2*j*j*j*j+f}return -l/2*((j-=2)*j*j*j-2)+f},easeInQuint:function(m,j,f,l,k){return l*(j/=k)*j*j*j*j+f},easeOutQuint:function(m,j,f,l,k){return l*((j=j/k-1)*j*j*j*j+1)+f},easeInOutQuint:function(m,j,f,l,k){if((j/=k/2)<1){return l/2*j*j*j*j*j+f}return l/2*((j-=2)*j*j*j*j+2)+f},easeInSine:function(m,j,f,l,k){return -l*Math.cos(j/k*(Math.PI/2))+l+f},easeOutSine:function(m,j,f,l,k){return l*Math.sin(j/k*(Math.PI/2))+f},easeInOutSine:function(m,j,f,l,k){return -l/2*(Math.cos(Math.PI*j/k)-1)+f},easeInExpo:function(m,j,f,l,k){return j==0?f:l*Math.pow(2,10*(j/k-1))+f},easeOutExpo:function(m,j,f,l,k){return j==k?f+l:l*(-Math.pow(2,-10*j/k)+1)+f},easeInOutExpo:function(m,j,f,l,k){if(j==0){return f}if(j==k){return f+l}if((j/=k/2)<1){return l/2*Math.pow(2,10*(j-1))+f}return l/2*(-Math.pow(2,-10*--j)+2)+f},easeInCirc:function(m,j,f,l,k){return -l*(Math.sqrt(1-(j/=k)*j)-1)+f},easeOutCirc:function(m,j,f,l,k){return l*Math.sqrt(1-(j=j/k-1)*j)+f},easeInOutCirc:function(m,j,f,l,k){if((j/=k/2)<1){return -l/2*(Math.sqrt(1-j*j)-1)+f}return l/2*(Math.sqrt(1-(j-=2)*j)+1)+f},easeInElastic:function(o,j,f,n,m){o=1.70158;var l=0,k=n;if(j==0){return f}if((j/=m)==1){return f+n}l||(l=m*0.3);if(k<Math.abs(n)){k=n;o=l/4}else{o=l/(2*Math.PI)*Math.asin(n/k)}return -(k*Math.pow(2,10*(j-=1))*Math.sin((j*m-o)*2*Math.PI/l))+f},easeOutElastic:function(o,j,f,n,m){o=1.70158;var l=0,k=n;if(j==0){return f}if((j/=m)==1){return f+n}l||(l=m*0.3);if(k<Math.abs(n)){k=n;o=l/4}else{o=l/(2*Math.PI)*Math.asin(n/k)}return k*Math.pow(2,-10*j)*Math.sin((j*m-o)*2*Math.PI/l)+n+f},easeInOutElastic:function(o,j,f,n,m){o=1.70158;var l=0,k=n;if(j==0){return f}if((j/=m/2)==2){return f+n}l||(l=m*0.3*1.5);if(k<Math.abs(n)){k=n;o=l/4}else{o=l/(2*Math.PI)*Math.asin(n/k)}if(j<1){return -0.5*k*Math.pow(2,10*(j-=1))*Math.sin((j*m-o)*2*Math.PI/l)+f}return k*Math.pow(2,-10*(j-=1))*Math.sin((j*m-o)*2*Math.PI/l)*0.5+n+f},easeInBack:function(n,j,f,m,l,k){if(k==i){k=1.70158}return m*(j/=l)*j*((k+1)*j-k)+f},easeOutBack:function(n,j,f,m,l,k){if(k==i){k=1.70158}return m*((j=j/l-1)*j*((k+1)*j+k)+1)+f},easeInOutBack:function(n,j,f,m,l,k){if(k==i){k=1.70158}if((j/=l/2)<1){return m/2*j*j*(((k*=1.525)+1)*j-k)+f}return m/2*((j-=2)*j*(((k*=1.525)+1)*j+k)+2)+f},easeInBounce:function(m,j,f,l,k){return l-r.easing.easeOutBounce(m,k-j,0,l,k)+f},easeOutBounce:function(m,j,f,l,k){return(j/=k)<1/2.75?l*7.5625*j*j+f:j<2/2.75?l*(7.5625*(j-=1.5/2.75)*j+0.75)+f:j<2.5/2.75?l*(7.5625*(j-=2.25/2.75)*j+0.9375)+f:l*(7.5625*(j-=2.625/2.75)*j+0.984375)+f},easeInOutBounce:function(m,j,f,l,k){if(j<k/2){return r.easing.easeInBounce(m,j*2,0,l,k)*0.5+f}return r.easing.easeOutBounce(m,j*2-k,0,l,k)*0.5+l*0.5+f}})}(jQuery);(function(a){a.effects.shake=function(b){return this.queue(function(){var u=a(this),n=["position","top","bottom","left","right"];a.effects.setMode(u,b.options.mode||"effect");var t=b.options.direction||"left",s=b.options.distance||20,d=b.options.times||3,r=b.duration||b.options.duration||140;a.effects.save(u,n);u.show();a.effects.createWrapper(u);var q=t=="up"||t=="down"?"top":"left",p=t=="up"||t=="left"?"pos":"neg";t={};var o={},m={};t[q]=(p=="pos"?"-=":"+=")+s;o[q]=(p=="pos"?"+=":"-=")+s*2;m[q]=(p=="pos"?"-=":"+=")+s*2;u.animate(t,r,b.options.easing);for(s=1;s<d;s++){u.animate(o,r,b.options.easing).animate(m,r,b.options.easing)}u.animate(o,r,b.options.easing).animate(t,r/2,b.options.easing,function(){a.effects.restore(u,n);a.effects.removeWrapper(u);b.callback&&b.callback.apply(this,arguments)});u.queue("fx",function(){u.dequeue()});u.dequeue()})}})(jQuery);$(document).ready(function(){var a=(function(){var e=$(".social .btnFavorites");var d=e.attr("data-content-type");var b=e.attr("data-content-id");function c(f){return"/favorite/?action="+f+"&content_type="+d+"&content_id="+b}e.hover(function(){if(e.hasClass("on")!=true){e.addClass("hover")}},function(){if(e.hasClass("on")!=true){e.removeClass("hover")}});return{add:function(){$.get(c("add"),function(f){if(f.indexOf("false")!=-1){e.removeClass("off").removeClass("hover").addClass("on")}})},remove:function(){$.get(c("del"),function(f){if(f.indexOf("false")!=-1){e.removeClass("on").removeClass("hover").addClass("off")}})},toggle:function(){if(e.hasClass("off")){a.add()}else{a.remove()}}}})();$(".social .btnFavorites").on("click",function(){if(!isLoggedIn()){GlobalPendingActions.add("favorite",function(){a.toggle()});$("#LoginButton").click();return false}else{a.toggle()}})});\ var CKJWPlayer=(function(){\ var h=false;\ var c=false;\ var d=null;\ var b="hide";\ var g="hide";\ var e=null;\ var f=5;\ var a=true;\ return{getAdapSessionView:function(){var j=1;var l=dmjs.cookies.readCookie("ck_adap");if(l!==null){l=l.split("|");j=parseInt(l[0])+1;var k=new Date();var i=l[1]-Math.round(k.getTime()/1000);var m=l[1];dmjs.cookies.eraseCookie("ck_adap");dmjs.cookies.createCookieWithSec("ck_adap",j+"|"+m,i)}else{var k=new Date();var m=Math.round(k.setTime(k.getTime()+(3600*1000))/1000);dmjs.cookies.createCookieWithSec("ck_adap","1|"+m,3600)}return j},init:function(i){var k="cdn-i.dmdentertainment.com";if(CK_env=="staging"){k="i.dmdentertainment.com"}if(typeof h!=="undefined"){h=i}this.play_src=$("#dmjwplayer").attr("src");var j=this;var l={adaptvjw5:{key:"DemandMediacracked",companionId:"companion_div",file:escape($("#dmjwplayer").attr("src")),vid:$("#dmjwplayer").attr("data-content_id"),title:$("#dmjwplayer").attr("data-title"),keywords:"",description:"",categories:$("#dmjwplayer").attr("data-category"),context:this.getAdapSessionView()}};l["http://"+k+"/DMVideoPlayer/jwplayer_"+CK_env+"/plugins/omnitureplugin/omnitureplugin.swf"]={};jwplayer("dmjwplayer").setup({flashplayer:"http://"+k+"/DMVideoPlayer/jwplayer_"+CK_env+"/player.swf",skin:"/ui/shared/scripts/jwplayer/skins/billy.zip",autostart:true,playlist:this._getPlaylist(),plugins:l,events:{onComplete:this.onComplete,onPlay:this.onPlay,onPause:this.showPostPlateSection,},demand_site_id:"CRCC",wa_vemb:"0",sitename:"cracked.com",video_title:$("#dmjwplayer").attr("data-title"),demand_content_id:$("#dmjwplayer").attr("data-content_id"),demand_cat:$("#dmjwplayer").attr("data-category"),comscore_c3:$("#dmjwplayer").attr("data-comscore_c3")});jwplayer("dmjwplayer").getPlugin("controlbar").onShow(this.onControlBarShow);jwplayer("dmjwplayer").getPlugin("controlbar").onHide(this.onControlBarHide);$(".videoPostPlate .close").click(this.onPostPlateClose);$(".videoPostPlateMenu li").click(function(){CKJWPlayer.selectPostPlateSection(this)});$(".videoDockButtons").hover(this.onDockButtonsMouseOver,this.onDockButtonsMouseOut);$(".videoDockButtons li").click(function(){var m=$(this).attr("class");if(m=="lowerlights"){onPlayerDimLights();return}jwplayer().pause(true);CKJWPlayer.showPostPlateSection(m)});$(".videoPostPlateRelatedItem").hover(function(){$(this).addClass("on")},function(){$(this).removeClass("on")});$(".leftRail .share, #cdShare").click(function(){if($(this).attr("id")=="cdShare"){CKJWPlayer.toggleContPlay()}CKJWPlayer.showPostPlateSection("share")});$("#cdReplay, .leftRail .replay").click(function(){CKJWPlayer.replayVideo()});$(".cdWrap .cdNumbers, .cdWrap .cpl, .cdWrap input, .leftRail .cpl, .leftRail input").click(function(){CKJWPlayer.toggleContPlay()})},selectPostPlateSection:function(i){if($(i).hasClass("lowerlights")){onPlayerDimLights();return}if(!$(i).hasClass("current")){var j=$(i).attr("class");this.showPostPlateSection(j)}},showPostPlateSection:function(i){$(".videoDockButtons").hide();CKJWPlayer.hideCountdown();if(typeof i==="undefined"){i="related"}$(".videoPostPlateMenu").removeClass("related share embed lowerlights").addClass(i);$(".videoPostPlateMenu li").removeClass("current");$(".videoPostPlateMenu li."+i).addClass("current");if(i!="lowerlights"){$(".videoPostPlateSection").hide();$(".videoPostPlateBG, .videoPostPlate, .videoPostPlateSection."+i).show()}this.play_started=false},showDockButtons:function(){$(".videoDockButtons").show().removeClass("hidden")},hideDockButtons:function(){$(".videoDockButtons").hide().addClass("hidden")},onDockButtonsMouseOver:function(){CKJWPlayer.dockbuttons_state="show"},onDockButtonsMouseOut:function(){CKJWPlayer.dockbuttons_state="hide";if(CKJWPlayer.controlbar_state=="hide"){CKJWPlayer.hideDockButtons()}},onPostPlateClose:function(){$(".videoPostPlateBG, .videoPostPlate").hide();$(".videoDockButtons").show();jwplayer().pause(false)},onControlBarShow:function(){CKJWPlayer.controlbar_state="show";if(CKJWPlayer.play_started&&$(".videoDockButtons").hasClass("hidden")){CKJWPlayer.showDockButtons()}},onControlBarHide:function(){CKJWPlayer.controlbar_state="hide";if(CKJWPlayer.play_started&&CKJWPlayer.dockbuttons_state=="hide"){CKJWPlayer.hideDockButtons()}},\ onComplete:function(){\ if(CKJWPlayer.play_started==true){\ CKJWPlayer.play_started=false;\ $(".videoPostPlate .close").hide();\ if(typeof unsafeWindow === "undefined") unsafeWindow = window;\ if(typeof jMOD === "undefined") jMOD = unsafeWindow.jMOD;\ var tmp=parseInt(jMOD.prefs.getPrefProperty("ContinuousPlay", "value"));\ if(tmp==1){\ CKJWPlayer.showCountdown()\ }else{\ CKJWPlayer.showPostPlateSection()\ }\ }\ },\ hidePostPlate:function(){$(".videoPostPlateSection").hide();$(".videoPostPlateBG").hide();$("#dmjwplayer_wrapper").hide();$(".videoPostPlate").hide();$(".countdownSplash").show();CKJWPlayer.hideDockButtons()},showCountdown:function(){CKJWPlayer.hidePostPlate();CKJWPlayer.startCountdown()},hideCountdown:function(){$(".countdownSplash").hide()},startCountdown:function(){if(a==true){CKJWPlayer.resetCounter();e=setInterval(function(){CKJWPlayer.updateCountDown()},1000)}},\ resetCounter:function(){\ if(typeof unsafeWindow === "undefined") unsafeWindow = window;\ if(typeof jMOD === "undefined") jMOD = unsafeWindow.jMOD;\ var tmp=parseInt(jMOD.prefs.getPrefProperty("VideoTimeoutLength", "value"));\ f=(typeof tmp === "undefined" ? 5 : tmp);\ clearInterval(e);\ $(".cdNumbers").html("0"+f)\ },\ pauseCountdown:function(){CKJWPlayer.resetCounter();CKJWPlayer.toggleContPlay()},\ updateCountDown:function(){if(f==-1){CKJWPlayer.resetCounter();window.location=$(".cdWrap .nextTitle").attr("data-url")}else{$(".cdNumbers").html("0"+f);f--}},\ replayVideo:function(){CKJWPlayer.resetCounter();CKJWPlayer.hidePostPlate();CKJWPlayer.hideCountdown();$("#dmjwplayer_wrapper").fadeIn();jwplayer("dmjwplayer").play(true)},toggleContPlay:function(){if(a==true){CKJWPlayer.resetCounter();a=false;$(".videoPostPlateSection .leftRail input[name=contPlay]").attr("checked",false);$(".cdWrap input[name=contPlay]").attr("checked",false);CKJWPlayer.showPostPlateSection()}else{a=true;$(".videoPostPlateSection .leftRail input[name=contPlay]").attr("checked",true);$(".cdWrap input[name=contPlay]").attr("checked",true);if(jwplayer("dmjwplayer").getState()!="PAUSED"){}}},onPlay:function(){var i=jwplayer().getPlaylistItem();if(i.file==CKJWPlayer.play_src){CKJWPlayer.play_started=true}},_getPlaylist:function(){var i=[];if(h!=false){}i.push({file:this.play_src});return i},}})();\ var videoAPI=(function(){var a=false;return{VIDEO_FOLD:600,setComplete:function(){a=true},unsetComplete:function(){a=false},getCompleteStatus:function(){return a},checkFold:function(){if(parseInt($(window).scrollTop())>videoAPI.VIDEO_FOLD){CKJWPlayer.pauseCountdown()}},pauseCountdown:function(){CKJWPlayer.pauseCountdown()},restartCountdown:function(){CKJWPlayer.startCountdown()}}})();\ if(typeof jwplayer!="undefined"){jwplayer("dmjwplayer").onComplete(function(){plItem=jwplayer("dmjwplayer").getPlaylistItem();if(plItem.ovaPlaylistIndex==0){videoAPI.setComplete();setTimeout(function(){videoAPI.checkFold()},3000)}})}\ var onCompanionAdShow=function(a){$(".Ad300x250").hide()};if($("html").hasClass("vidSeries")){var lights=(function(){$("#Ad300").css("position","relative");return{calcBounds:function(){var a=$(document).height();var b=$(window).width();if(CrackedJS.isMobileBrowser()){b=$(document).width()}$("#dark").css("width",b);$("#dark").css("height",a)},down:function(){$(".mainFrameModule").css("zIndex",0);$(".section-main").css("zIndex",10);$("#dark").addClass("on");$("#dark").removeClass("off");lights.calcBounds();$("#dark").css("opacity",0);$("#dark").stop(1,1).animate({opacity:0.8},500)},up:function(){$("#PrimaryContent").css("zIndex",5);$("#NavAndTools").css("zIndex",100);$("#videoPlayer").css("zIndex",5);$("#Ad300").css("zIndex",0);$("#dark").css("opacity",0.8);$("#dark").stop(1,1).animate({opacity:0},500);setTimeout(function(){$("#dark").addClass("off");$("#dark").removeClass("on")},510)},toggle:function(){if($("#dark").hasClass("on")){lights.up()}else{lights.down()}}}})();var onPlayerDimLights=function(){lights.toggle()};$("#lightsButton").mouseup(function(){onPlayerDimLights()});$(window).resize(function(){if($("#dark").hasClass("on")||$("#dark").hasClass("off")){lights.calcBounds()}})}$(document).ready(function(){if(typeof jwplayer!="undefined"){CKJWPlayer.init(true)}if($("#videoPlayer").html()!=null){setTimeout(function(){var d=$(".breadCrumbs").offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:d+20},500)},500)}$(".addCommentBtn").click(function(d){d.preventDefault();setTimeout(function(){var e=$("#Comments").offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:e-10},500);setTimeout(function(){$(".commentTextArea").focus()},600)},1500)});$(".embedInput").click(function(){this.select()});$(".showMoreBtn").click(function(){if($(".videoSummary").hasClass("collapsed")){$(".videoSummary").removeClass("collapsed");$(".showMoreBtn").attr("value","Show Less")}else{$(".videoSummary").addClass("collapsed");$(".showMoreBtn").attr("value","Show More")}});if(CrackedJS.isMobileBrowser()){var b="iphone";if(navigator.userAgent.match(/(iPad)/i)){b="ipad"}var c=videoPath+b+".mp4";var a=\'<video height="375" width="666" controls="controls" src="\'+c+\'"></video>\';$("#videoPlayer").html(a)}$(window).scroll(function(d){if((parseInt($(window).scrollTop())>videoAPI.VIDEO_FOLD)&&(videoAPI.getCompleteStatus()==true)){videoAPI.pauseCountdown()}else{if((parseInt($(window).scrollTop())<videoAPI.VIDEO_FOLD)&&(videoAPI.getCompleteStatus()==true)){videoAPI.restartCountdown()}}})});$("#videoPlayer").hover(function(){$(".videoDockButtons").removeClass("hidden").show()},function(){$(".videoDockButtons").addClass("hidden").hide()});var VideoJS=(function(){var a=1;var f=930;var b=0;var e=$("#videoSlides ul");var c=$("#videoSlides ul li");var d=c.length;return{init:function(){if($("#videoWrapper").hasClass("index")){this.updateSlideInfo(a);this.updateSlideDots(a)}},previousSlide:function(){if(a>=2){a--}else{a=d}this.seekToSlide(a)},nextSlide:function(){if(a<=d-1){a++}else{a=1}this.seekToSlide(a)},seekToSlide:function(g){finalpos=-1*((g-1)*f);$("#videoSlides ul").stop(1,1).animate({left:finalpos},800,"easeOutCirc");a=g;this.updateSlideInfo(g);this.updateSlideDots(g)},updateSlideInfo:function(g){$("#videoSlideInfo").css("display","block");$("#slideMask").stop(1,1).animate({opacity:0},200);$("#videoSlideInfo").stop(1,1).animate({opacity:0},200);$(".watchNow").stop(1,1).animate({opacity:0},200);setTimeout(function(){var j=$(c[g-1]).find("span");$("#videoSlideInfo h3.series").html(j.attr("data-series"));var k=\'<a href="\'+j.attr("data-url")+\'">\'+j.attr("data-title")+"</a>";$("#videoSlideInfo h3.title").html(k);$("#videoSlideInfo .byline").html(j.html());$("#videoSlideInfo date").html(j.attr("data-date"));$("#videoSlideInfo .views").html(j.attr("data-views")+" views");$("#videoSlideInfo .watchNow").attr("href",j.attr("data-url"));var i=$("#videoSlideInfo").css("height");$("#videoSlideInfo").stop(1,1).animate({opacity:1},800);var h=80;if($("#videoSlideInfo h3.series").html()!=""){h=113;$("#videoSlideInfo .byline").css("display","none");$("#videoSlideInfo date").addClass("redux")}else{$("#videoSlideInfo .byline").css("display","inline");$("#videoSlideInfo date").removeClass("redux")}$("#slideMask").css("height",h);$("#slideMask").stop(1,1).animate({opacity:0.8,},800);$(".watchNow").stop(1,1).animate({opacity:1},200)},300)},updateSlideDots:function(h){$("#slideDots ul li").removeClass("on");var g="#slideDots ul #dot"+h;$(g).addClass("on")}}})();var TabJS=(function(){var a=".CK-tabs li.contentTab";var b=".CK-blocks li.contentBlock";return{init:function(){$(".CK-tabWrapper").each(function(){if($(this).find("li.contentTab").length==1){$(this).find("li.contentTab").addClass("single")}});TabJS.addListeners()},addListeners:function(){$(a).click(function(){var e=$(this);var c=1;var d=$(this).parent().parent().parent();$(d).find(".contentTab").each(function(){$(this).removeClass("on");if($(this).html()==$(e).html()){clickedIndex=c}else{c++}});$(e).addClass("on");TabJS.showTab(clickedIndex,e)})},showTab:function(f,e){var d=$(e).parent().parent().parent();$(d).find(b).each(function(){$(this).hide().removeClass("on")});var g=b+":nth-child("+f+")";var c=d.find(g);$(c).show().addClass("on")}}})();var VideoPlaylistJS={buttonWidth:34,itemWidth:302,init:function(){if($("#PrimaryContent").attr("data-url")!=null){var a=$("#PrimaryContent").attr("data-url").replace("video_","video_playlist_");$.get(a,function(b){$("#videoPlaylistWrapper").remove();$("#PrimaryContent").append(b);TabJS.init();if((dmjs.cookies.readCookie("plState")==null)||(dmjs.cookies.readCookie("plState")=="expanded")){VideoPlaylistJS.expand()}$("#contentPlaylist #playlistButtonLeft[data-init!=\'true\']").attr("data-init","true").click(function(){VideoPlaylistJS.paginateBack()});$("#contentPlaylist #playlistButtonRight[data-init!=\'true\']").attr("data-init","true").click(function(){VideoPlaylistJS.paginateForward()});$("#playlistCollapse").click(function(){VideoPlaylistJS.toggle()});$(".playlistItem").hover(function(){$(this).addClass("playingHover")},function(){$(this).removeClass("playingHover")})})}},paginateBack:function(){var e=$("#videoPlaylistContainer .videoPlaylist.on .sliderWrapper");var b=$(window).width()-2*this.buttonWidth;var d=Math.abs(parseInt($(e).css("left")));var a=d%this.itemWidth;var c=a+this.itemWidth;if(e.width()>b){if(d<this.itemWidth){$(e).animate({left:0},200)}else{$(e).animate({left:"+="+c},200,function(){})}}},paginateForward:function(){var d=$("#videoPlaylistContainer .videoPlaylist.on .sliderWrapper");var b=$(window).width()-2*this.buttonWidth;var c=Math.abs(parseInt($(d).css("left")));var a=parseInt($(d).width())-(c+b);if(d.width()>b){if(a<this.itemWidth){$(d).animate({left:"-="+a},200,function(){})}else{$(d).animate({left:"-="+this.itemWidth},200,function(){})}}},toggle:function(){if($("#videoPlaylistWrapper").hasClass("expanded")){VideoPlaylistJS.collapse()}else{VideoPlaylistJS.expand()}},expand:function(){$("#videoPlaylistWrapper").removeClass("collapsed");$("#videoPlaylistWrapper").addClass("expanded");dmjs.cookies.createCookie("plState","expanded",5)},collapse:function(){$("#videoPlaylistWrapper").removeClass("expanded");$("#videoPlaylistWrapper").addClass("collapsed");dmjs.cookies.createCookie("plState","collapsed",5)}};$(document).ready(function(){VideoJS.init();TabJS.init();VideoPlaylistJS.init();$(window).resize(function(){VideoJS.init()});$("#videoWrapper").hover(function(){$("#previousBigButton").css("display","block");$("#nextBigButton").css("display","block")},function(){$("#previousBigButton").css("display","none");$("#nextBigButton").css("display","none")});$("#discoveryWrap").hover(function(){$("#previousBigButton").css("display","block");$("#nextBigButton").css("display","block")},function(){$("#previousBigButton").css("display","none");$("#nextBigButton").css("display","none")});if($("#seriesLanding")){if(document.getElementsByTagName("html")[0].getAttribute("branded")=="true"){$("#seriesBanner").hide()}}$("#discovery1").click(function(){if($("#videoWrapper").hasClass("index")){VideoJS.previousSlide()}});$("#discovery2").click(function(){if($("#videoWrapper").hasClass("index")){VideoJS.nextSlide()}});$("#slideDots ul li").click(function(){VideoJS.seekToSlide($(this).attr("id").substr(3,1))});$("#vsPollSubmit").click(function(){if(!isLoggedIn()){GlobalPendingActions.add("vsPollSubmit",function(){vsPollSubmit()});$("#LoginButton").click();return false}else{vsPollSubmit()}});var e=0;var a=6;var d=[];var c=$(".videoSeriesModule .tabs .tab");var b=$(".videoSeriesModule .tabContent");c.click(function(f){var g=$(this);c.addClass("inactive");g.removeClass("inactive");b.addClass("inactive");if(g.hasClass("videoCastCrew")===true){b.filter(".videoCastCrew").removeClass("inactive")}else{if(g.hasClass("videoPageThumbs")===true){b.filter(".videoPageThumbs").removeClass("inactive")}else{if(g.hasClass("enterContest")===true){b.filter(".enterContest").removeClass("inactive")}else{$(".videoSeriesModule .season-"+$(this).data("seasonNum")).removeClass("inactive")}}}});b.filter(".videoCastCrew").children().filter(":odd").addClass("last");if($(".videos-recent h3").length>0){if((($(".videos-recent h3").html()).replace(/^\s+|\s+$/g,"").toLowerCase()=="recommended videos")||(($(".videos-recent h3").html()).replace(/^\s+|\s+$/g,"").toLowerCase()=="recent videos")){$(".videosRecentListWrapper img").lazyImage()}}});function vsPollSubmit(){var d=$("#vsPoll input[name=agreePoll]:checked").val();var c=$("#poll_id").val();var b="video";var a=$("#poll_id").attr("data-content_id");if(d!=null){$.get("/poll/",{action:"vote",poll_id:c,poll_value_id:d,content_type:b,content_id:a},function(e){$("#vsPoll .checklist").find(".radio").replaceWith(\'<span class="voteInt"></span>\');for(value in e.poll["values"]){value=e.poll["values"][value];$("#vsPoll li."+value.value).find(".voteInt").html(value.percentage+"%")}$("#vsPollSubmit").css("display","none");$("#vsPoll #total span").html(e.poll["total"]);$("#vsPoll #total").css("display","block")},"json")}else{alert("Please select someone before you vote")}}setTimeout(function(){var d=document.createElement("script");var c=document.getElementsByTagName("script")[0];d.src=document.location.protocol+"//dnn506yrbagrg.cloudfront.net/pages/scripts/0013/7212.js?"+Math.floor(new Date().getTime()/3600000);d.async=true;d.type="text/javascript";c.parentNode.insertBefore(d,c)},1);'; unsafeWindow.jMOD_Configuration = { 'PREFS_STORAGE_NAME': 'Prefs', 'DEBUG': DEBUG, 'DEBUG_SRC': DEBUG_SRC, }; unsafeWindow.jMOD_GM_API_Configuration = { 'VERBOSITY_LEVEL': (DEBUG == 'BETA' ? 5 : 0), 'STORAGE_PREFIX':"CCE_", 'HIDDEN_LOG_CLASSES': [], 'DISABLED_LOG_FUNCTIONS': [] }; function getCookie(name){ var re = new RegExp(name + "=([^;]+)"); var value = re.exec(unsafeWindow.document.cookie); return (value != null) ? unescape(value[1]) : null; } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toGMTString(); unsafeWindow.document.cookie = cname + "=" + cvalue + "; " + expires; } function getUsername(){ var un_cookie_name = 'CCE_Username'; var un_cookie = getCookie(un_cookie_name); if(un_cookie != null && un_cookie != '') return un_cookie; var el = document.querySelector('.topHeader .url.hello'); if(el == null) return null; var o = (el.innerHTML).replace('Hello, ', ''); setCookie(un_cookie_name, o, 30); return o; } /** * @param {string} js * @param {string} src * @param {string} id */ function addScript(js, src, id){ if(heads = document.getElementsByTagName('head')) { var newScript = document.createElement('script'); if(typeof js != "undefined" && js != ''){ try { newScript.innerHTML = js; } catch (x) { newScript.innerText = js; } } if(typeof src != "undefined" && src != ''){ try{newScript.src = src;}catch(x){} } if(typeof id !== "undefined"){ try{newScript.id = id;}catch(x){} } newScript.type = 'text/javascript'; try{heads[0].appendChild(newScript);}catch(x){} } return null; } jMOD = unsafeWindow.jMOD = { initalized: false, DEBUG: DEBUG, DEBUG_SRC: DEBUG_SRC, MODULE_COUNT: MODULE_COUNT, GM_API: { 'getValue': function(){} }, GM_info: {}, Script: { 'BaseURL': { 'LOCAL': { 'BETA': 'http://127.0.0.1/src/js/bin/', 'RELEASE': 'http://127.0.0.1/Release/' }, 'GoogleSVN': { 'BETA': 'https://crackedcomenhancer.googlecode.com/svn/trunk/src/js/bin/', 'RELEASE': 'https://crackedcomenhancer.googlecode.com/svn/trunk/Release/' }, 'AWS': { 'BETA': 'http://127.0.0.1/src/js/bin/', 'RELEASE': 'https://crackedcomenhancer.googlecode.com/svn/trunk/Release/' } }, 'getBaseURL': function(){ var src = this.BaseURL[jMOD['DEBUG_SRC']]; switch(jMOD['DEBUG']){ case 'BETA': return src.BETA; break; case 'RELEASE': return this.CombinePath(src.RELEASE, jMOD['GM_info'].version); break; } }, 'parseURL': function(url){ var o = { 'href': url, }; var patt1 = /https?:\/\/([^/]+)(.*?)$/i; var tmp = patt1.exec(url); o['host'] = tmp[1]; var patt2 = /([^\?]+)(.*?)$/i; var tmp2 = patt2.exec(tmp[2]); o['pathname'] = tmp2[1]; o['args'] = tmp2[2]; var patt3 = /\/([^\/]+)$/; var tmp3 = patt3.exec(tmp2[1]); if(tmp3 == null) o['filename'] = ""; else o['filename'] = tmp3[1]; //o['pathname'] = tmp[2]; return o; }, 'ModuleFolderName': 'Modules', 'CombinePath': function(part1, part2){ var tString1 = ''; var tString2 = ''; if(part1.substring(part1.length - 1, part1.length) == '/') tString1 = part1.substring(0, part1.length - 1); else tString1 = part1; if(part2.substring(0, 1) == '/') tString2 = part2.substring(1, part2.length); else tString2 = part2; return tString1 + '/' + tString2; }, 'getModuleFolder': function(){ var base = this.getBaseURL(); return this.CombinePath(base, this.ModuleFolderName); }, 'getModulePath': function(mInfo){ var mFolder = this.getModuleFolder(); return this.CombinePath(mFolder, mInfo.info.scriptName); }, 'addScript': function(js, src, id, info){ if(USE_ANALYTICS == true && typeof js === "undefined"){ var urlParts = this.parseURL(src); var title = urlParts.filename; var userTimingCategory = 'jMod'; var timingVariableName = DEBUG + ':' + DEBUG_SRC; var userTimingTime = getTimeSinceDOMLoad(); var userTimingLabel = ''; if(title == 'all_include.js'){ userTimingLabel = 'jMod_Added'; } else if(/_Module\.js/.test(title)){ var moduleNamePatt = /[^_]+_(.*?)_Module\.js/i; var ret = moduleNamePatt.exec(title); userTimingLabel = ret[1] + '_Module_Added'; } else { userTimingLabel = 'Other'; } if(typeof info !== "undefined"){ if(typeof info['title'] !== "undefined") title = info['title']; if(typeof info['user_timing_category'] !== "undefined") userTimingCategory = info['user_timing_category']; if(typeof info['user_timing_variable_name'] !== "undefined") userTimingLabel = info['user_timing_variable_name']; if(typeof info['user_timing_time'] !== "undefined") userTimingTime = info['user_timing_time']; } //this.addScriptFile_GA(src, id); //console.log('title: ' + title); jMOD['Analytics']['loadScript']({ 'document_title': escape(title), //Required 'document_referrer': escape(window.location.href), //Required 'document_path': escape(src), //Required 'user_timing_category': userTimingCategory, //Required 'user_timing_variable_name': timingVariableName, //Required 'user_timing_time': userTimingTime, //Required 'user_timing_label': userTimingLabel, }); } else addScript(js, src, id); }, 'addScriptFile_GA': function(path, id){ addScript_GA(path, id); }, 'addScriptFile': function(fileName){ var base = this.getBaseURL(); var script = this.CombinePath(base, fileName); var patt = /[^\.]+/i; var f = 'CCE_' + patt.exec(fileName)[0]; this.addScript(undefined, script, f); }, 'addModule': function(mInfo){ var mFolder = this.getModuleFolder(); var mPath = this.CombinePath(mFolder, mInfo.info.scriptName); var info = { 'title': mInfo.info.scriptName, 'user_timing_category': 'jMod', 'user_timing_label': mInfo.getName() + '_Module_Added', 'user_timing_time': getTimeSinceDOMLoad() }; this.addScript(undefined, mPath, 'CCE_' + mInfo.info.name, info); } } }; jMOD['GM_info_Str'] = GM_info.scriptMetaStr; for(var key in GM_info.script){ jMOD['GM_info'][key] = GM_info.script[key]; } jMOD['Analytics'] = { 'TrackingID': 'UA-52342643-1', 'page_load_time': 0, 'Local_URL': 'http://127.0.0.1/src/ScriptAnalytics.php?', 'AWS_URL': 'http://ec2-54-88-143-164.compute-1.amazonaws.com/ScriptAnalytics.php?', 'getURL': function(){ if(DEBUG_SRC == 'LOCAL'){ return this.Local_URL; } else { return this.AWS_URL; } }, 'parameters': { 'tracking_id' : 'tid', 'gaUUID' : 'cid', 'type' : 't', 'ip_override' : 'uip', 'anonymize_ip' : 'aip', 'user_agent' : 'ua', //ua=Opera%2F9.80%20%28Windows%20NT%206.0%29%20Presto%2F2.12.388%20Version%2F12.14 'session_control' : 'sc', 'screen_name' : 'cd', //cd=High%20Scores 'document_title' : 'dt', //dt=Settings 'application_name' : 'an', //an=My%20App 'application_id' : 'aid', //aid=com.company.app 'application_version' : 'av', //av=1.2 'application_installer_id' : 'aiid', //aiid=com.platform.vending 'document_host_name' : 'dh', //dh=foo.com 'document_location_url' : 'dl', //dl=http%3A%2F%2Ffoo.com%2Fhome%3Fa%3Db 'document_referrer' : 'dr', //dr=http%3A%2F%2Fexample.com 'document_path' : 'dp', //dp=%2Ffoo 'screen_resolution' : 'sr', //sr=800x600 'viewport_size' : 'vp', //vp=123x456 'page_load_time' : 'plt', 'user_language' : 'ul', 'non_interaction_hit' : 'ni', //ni=1 'user_id' : 'uid', 'flash_version' : 'fl', 'campaign_name' : 'cn', 'campaign_source' : 'cs', 'campaign_medium' : 'cm', 'campaign_keyword' : 'ck', 'campaign_content' : 'cc', 'campaign_id' : 'ci', 'user_timing_category' : 'utc', 'user_timing_variable_name' : 'utv', 'user_timing_time' : 'utt', 'user_timing_label' : 'utl', 'dns_time' : 'dns', 'page_download_time' : 'pdt', 'redirect_response_time' : 'rrt', 'tcp_connect_time' : 'tcp', 'server_response_time' : 'srt', 'exception_description' : 'exd', 'is_exception_fatal' : 'exf', 'dimension1' : 'cd1', 'dimension2' : 'cd2', 'dimension3' : 'cd3', 'queue_time' : 'qt', 'cache_buster' : 'z', 'do_not_load_content' : 'dnlc' }, 'makeParameterString2': function(name, value){ return this.parameters[name] + '=' + value; }, 'makeParameterString': function(name, value){ return name + '=' + value; }, 'genUUID': function(){ var d = new Date().getTime(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = (d + Math.random()*16)%16 | 0; d = Math.floor(d/16); return (c=='x' ? r : (r&0x7|0x8)).toString(16); }); return uuid; }, 'getUUID': function(){ var uuid = getCookie('_gaUUID'); if(uuid == null || uuid == ''){ var newID = this.genUUID(); setCookie('_gaUUID', newID, 365); return newID; } return uuid; }, 'count': 0, 'crossDomainPost': function(url){ addScript(undefined, url, 'cdp_' + this.count); this.count++; }, 'getOptionalArgs': function(){ var args = []; var e = window; var a = 'inner'; if(!('innerWidth' in window)){ a = 'client'; e = document.documentElement || document.body; } var viewPort = {width: parseInt(e[a+'Width']), height: parseInt(e[a+'Height'])}; var winSize = {width: parseInt(window.screen.width), height: parseInt(window.screen.height)}; args.push('viewport_size=' + viewPort.width + 'x' + viewPort.height); args.push('screen_resolution=' + winSize.width + 'x' + winSize.height); if(this.page_load_time > 0){ args.push('page_load_time=' + this.page_load_time); this.page_load_time = 0; } //args.push('refresh_content_cache=true'); return args; }, 'sendMessage': function(type, args){ var argStr = this.makeParameterString('tracking_id', this.TrackingID); argStr += '&v=1'; argStr += '&' + this.makeParameterString('type', type); argStr += '&' + this.makeParameterString('gaUUID', this.getUUID()); for(var key in args){ if (args.hasOwnProperty(key)) argStr += '&' + this.makeParameterString(key, args[key]); } var oArgs = this.getOptionalArgs(); for(var key in oArgs){ if (oArgs.hasOwnProperty(key)) argStr += '&' + this.makeParameterString(key, oArgs[key]); } argStr += '&' + this.makeParameterString('cache_buster', Math.floor((Math.random() * 1000000000000) + 1)); var tURL = this.getURL(); var newPath = tURL + argStr; this.crossDomainPost(newPath); }, 'loadScript': function(args){ args['non_interaction_hit'] = '1'; args['get_content'] = '1'; return this.sendMessage('pageview', args); /* jMOD['Analytics']['loadScript']({ 'document_title': '', //Required 'document_referrer', '', //Required 'document_path': '/foo.html', //Required 'user_timing_category': 'jMod', //Required 'user_timing_variable_name': 'jMod_Loaded', //Required 'user_timing_time': 500, //Required 'user_timing_label': '', }); */ }, 'sendPageHitMessage': function(args){ return this.sendMessage('pageview', args); /* jMOD['Analytics']['sendPageHitMessage']({ 'document_title': '', //Required 'document_referrer', '', //Required 'document_path': '/foo.html' //Required }); */ }, 'sendTimingMessage': function(args){ //args['content_type'] = 'text/plain'; //args['do_not_load_content'] = '1'; //args['user_timing_label'] = DEBUG + ':' + DEBUG_SRC; args['user_timing_variable_name'] = DEBUG + ':' + DEBUG_SRC; return this.sendMessage('timing', args); /* jMOD['Analytics']['sendTimingMessage']({ 'user_timing_category': 'jMod', //Required 'user_timing_variable_name': 'jMod_Loaded', //Required 'user_timing_time': 500, //Required 'user_timing_label': '', 'document_title': '', //Required 'document_referrer', '', //Required 'document_host_name': '', 'document_location_url', '', 'document_path': '/foo.html' //Required }); */ }, 'sendExceptionMessage': function(args){ return this.sendMessage('exception', args); } }; jMOD['ParseMeta'] = function(data_arr){ var o = {}; var patt = /@([\S]+)\s+(.*?)$/i; for(var i = 0; i < data_arr.length; i++){ if(patt.test(data_arr[i])){ var r = patt.exec(data_arr[i]); if(typeof o[r[1]] === "undefined"){ o[r[1]] = r[2]; } else { if(typeof o[r[1]] !== "string"){ o[r[1]].push(r[2]); } else { tmp = o[r[1]]; o[r[1]] = []; o[r[1]].push(tmp); o[r[1]].push(r[2]); } } } } console.log(o); return o; } function CheckPageType(){ var base = jMOD.Script.getBaseURL(); var script = jMOD.Script.CombinePath(base, 'all_include.js'); jMOD['Analytics']['sendTimingMessage']({ 'user_timing_category': 'jMod', //Required 'user_timing_label': 'jMod_Loaded', //Required 'user_timing_time': getTimeSinceDOMLoad(), //Required 'document_title': 'all_include.js', //Required 'document_referrer': escape(window.location.href), //Required 'document_path': escape(script) //Required }); var types = jMOD['Modules'].checkPageTypes(document.URL); jMOD['Modules']['loadModules'](types); } function waitForJquery(callback, count){ var c = (typeof count === "undefined" ? 0 : count); if(typeof unsafeWindow.$ !== "undefined" || c >= 50){ callback(); } else { setTimeout(waitForJquery, 20, callback, c + 1); } } jMOD['onModuleAdded'] = function(){ if(jMOD['Modules']['addedModules'].length == 1){ jMOD['log']['UpdateAllPtrs'](); jMOD['Update'].CheckForUpdate(); } if(jMOD['Modules']['addedModules'].length >= MODULE_COUNT){ if(DEBUG == "BETA") console.timeEnd('All_Include'); waitForJquery(CheckPageType); } } jMOD['onAllModulesRegistered'] = function(){ if(DEBUG == "BETA") console.timeEnd('CCE Script Load'); } jMOD['jMODLoaded'] = function(){ if(DEBUG == "BETA") console.log('jMODLoaded'); jMOD['Events'].addListener('AllModulesRegistered', jMOD['onAllModulesRegistered']); jMOD['Events'].addListener('ModuleAdded', jMOD['onModuleAdded']); } var Require = { 'CCE_Requirements_Added' : false, 'CCE_Video_Fix' : false }; function ReplaceScript(target, data){ var parent = target.parentNode; var newNode = document.createElement('script'); newNode.innerHTML = eval(data); parent.replaceChild(newNode, target); } function RemoveEventListener_BeforeScriptExec(){ window.removeEventListener('beforescriptexecute', BeforeScriptExec, true); }; function BeforeScriptExec(e){ try{ if(!Require.CCE_Requirements_Added){ Require.CCE_Requirements_Added = true; if(DEBUG == "BETA") console.time('All_Include'); //jMOD['Script']['addScriptFile'](DEBUG_SRC == 'LOCAL' ? 'COMPRESSED_all_include.js' : 'all_include.js'); jMOD['Script']['addScriptFile'](DEBUG_SRC == 'LOCAL' ? 'all_include.js' : 'all_include.js'); //jMOD['Script']['addScriptFile'](DEBUG_SRC == 'LOCAL' && DEBUG =='BETA' ? 'all_include.php' : 'all_include.js'); } else if(!Require.CCE_Video_Fix){ var video_patt = /^http\:\/\/(?:www\.)?cracked.com\/video_/i; if(!video_patt.test(window.location.href)){ Require.CCE_Video_Fix = true; } else { var patt = new RegExp(/http:\/\/i.crackedcdn\.com\/ui\/mashed\/video-.*?\.js/i); if(e.target.src.search(patt) != -1){ e.preventDefault(); e.stopPropagation(); try{ ReplaceScript(e.target, CCEVideoJs); } catch(err) { console.log(err); } Require.CCE_Video_Fix = true; } } } else { RemoveEventListener_BeforeScriptExec(); } }catch(e){} } window.addEventListener('beforescriptexecute', BeforeScriptExec, true); function isjModLoaded(){ if(typeof jMOD['PREFS_CLASS'] === "undefined") return false; if(typeof jMOD['Modules'] === "undefined") return false; return true; } function onPageLoaded(){ $ = unsafeWindow.$; if(jMOD['initalized'] == false){ jMOD['Analytics']['page_load_time'] = getTimeSinceDOMLoad(); if(DEBUG == "BETA") console.timeEnd('CCE Page Load'); if(DEBUG == "BETA") console.log('onPageLoaded'); if(!isjModLoaded()){ console.log('Error loading all_include!'); USE_ANALYTICS = false; jMOD['USE_ANALYTICS'] = false; jMOD['Script']['addScriptFile'](DEBUG_SRC == 'LOCAL' ? 'all_include.js' : 'all_include.js'); setTimeout(onPageLoaded, 1500); return false; } getUsername(); jMOD['initalized'] = true; } } if (window.addEventListener) window.addEventListener('load', onPageLoaded, false); else if (window.attachEvent) window.attachEvent('onload', onPageLoaded );