PageSourceSearch

https://www.wrchd.com/wp-content/themes/wrchd/scripts/scripts.js

js wrchd.com collected 2026-10-06 13:16:49 UTC 11,720 bytes, 269 lines download raw bytes

1var main = function() {
2// -- READY : START
3	var templateUrl = "/wp-content/themes/wrchd";
4	$.ajaxSetup({ cache: false });
5	
6	$('.responsiveMenuButton').on('click',function(){
7		responsiveMenu();
8 	});
9	
10 	$('.iconClose').click(function() {
11		$('.responsiveMenuButton').attr('data-click-state', 0)
12		$('.pageDim').hide();
13		//$('body').stop(true,false).animate({marginLeft: '0'});
14		$('.responsiveMenu').stop(true,false).animate({right: '-320'},100);
15	});
16 
17	function responsiveMenu() {
18		if($(this).attr('data-click-state') == 1) 
19		{
20		$('.responsiveMenuButton').attr('data-click-state', 0)
21		$('.pageDim').hide();
22		//$('body').stop(true,false).animate({marginLeft: '0'});
23		$('.responsiveMenu').stop(true,false).animate({right: '-320'},100);
24		} else {
25		$('.responsiveMenuButton').attr('data-click-state', 1)
26		$('.pageDim').show();
27		//$('body').stop(true,false).animate({marginLeft: '-320px'});
28		$('.responsiveMenu').stop(true,false).animate({"right": '0'},100);
29		};
30	};
31	
32	if(window.screen.width > 980 && window.screen.height > 940)
33        {
34			$('.videoFrame').mouseover(function() {
35				$('.quickWatch', this).show();
36				$('.videoThumb', this).css("opacity","0.3");
37			});
38			
39			$('.videoFrame').mouseout(function() {
40				$('.quickWatch').hide();
41				$('.videoThumb').css("opacity","1.0");
42			});
43		}
44    else{}
45
46	// -- INSTANT VIDEO BUTTON
47	$('.quickWatch a').click(function() {
48		$('.instantVideoOverlay').show();
49		var videoid = $(this).attr("data-videoid");
50		var videourl = $(this).attr("data-videourl");
51		var videotitle = $(this).attr("data-videotitle");
52		var category = $(this).attr("data-category");
53		
54		$('.instantVideoOverlayVideoTitle').text(videotitle);
55		$('.instantVideoOverlayVideo').html('<iframe id="quickWatchPlayer" width="630" height="354" src="https://www.youtube.com/embed/'+ videoid +'?autoplay=1&vq=hd720?enablejsapi=1?wmode=transparent?&showinfo=0" frameborder="0" allowfullscreen></iframe>');
56		$('.instantVideoOverlaySharing').html('<a href="https://www.facebook.com/sharer/sharer.php?u='+videourl+'" class="fb" target="_blank">
56SHARE</a><a href="https://twitter.com/home?status=I\'m watching '+videotitle+' '+videourl+' &#64;wrchd" class="tw" target="_blank">TWEET</a><a href="https://plus.google.com/share?url='+videourl+'" class="gplus" target="_blank">SHARE</a><a href="http://www.stumbleupon.com/submit?url='+videourl+'" class="stumbleupon" target="_blank">STUMBLE</a>');
57		
58		// -- BANNER
59		$.ajax({url: templateUrl + "/instantVideoBanner.php?templateUrl=" + templateUrl ,async: true}).done(function(result) {
60    		$('.instantVideoOverlayPromotion').html(result);
61		});
62		
63		// -- RELATED VIDEOS
64		$.ajax({url: templateUrl + "/related.php?category=" + category ,async: true, beforeSend: function () { $(".instantVideoOverlayRelated").addClass('loading'); },
65        complete: function () { $(".instantVideoOverlayRelated").removeClass('loading'); } }).done(function(result) {
66			$('.instantVideoOverlayRelated').html(result);
67		});
68	});
69	
70	// -- INSTANT VIDEO CLOSE
71	$('.instantVideoOverlayClose').click(function() {
72		$('.instantVideoOverlay, .pageOverlay, .submitVideoOverlay').hide();	
73		$('#quickWatchPlayer').remove();
74		$('.instantVideoOverlayRelated').empty();
75	});		
76	
77	// -- EMAIL NOTIFICATION
78	if($('.emailNotification').attr('data-status') != 1) {
79		$('.notification').stop().delay('3000').fadeTo('fast',1);
80	}
81	
82	$('.emailNotification').click(function() {
83		$('.pageOverlay').show();
84		$('.notification').fadeOut();
85		
86		if($('.emailNotification').attr('data-status') != 1) {
87			$.ajax({url: templateUrl + "/setCookie.php",async: true}).done(function(result) {});
88		}
89	});
90	
91	// -- SUBMIT A VIDEO
92	$('#submitVideo, .submitVideo').click(function() {
93		$('.responsiveMenuButton').attr('data-click-state', 0)
94		$('.responsiveMenu').stop(true,false).animate({right: '-320'},100);
95		$('.pageDim').hide();
96		$('.submitVideoOverlay').show();
97	});
98	
99	// -- DON'T ALLOW BLANK SPACE IN VIDEO FIELD
100	$('#videoIDSubmitVideoOverlay').on('keypress', function(e) {
101        if (e.which == 32)
102            return false;
103    });
104	
105	// -- SUBMIT A VIDEO OVERLAY
106    $('#submitVideoForm').submit(function() {
107			$('.submitVideoBoxMessage').show();
108        	var processing = '<span class="yellow"><img src="' + templateUrl + '/img/squares-loading.gif" /><br /><br />Processing your submission...</span>';
109			var error = '<span class="red"><img src="' + templateUrl + '/img/icon-error.png" /><br /><br />Error occurred, please try again.</span>';
110			var complete = '<span class="green"><img src="' + templateUrl + '/img/icon-done.png" /><br /><br />Thank you! We will review your submission.</span>';
111			var exists = '<span class="red"><img src="' + templateUrl + '/img/icon-error.png" /><br /><br />This video has been submitted to WRCHD already.</span>';
112			var errorf = '<span class="red"><img src="' + templateUrl + '/img/icon-error.png" /><br /><br />All fields are required!</span>';
113			var erroryt = '<span class="red"><img src="' + templateUrl + '/img/icon-error.png" /><br /><br />Video is not available on YouTube. Please double check the video ID.</span>';
114            $("#submitVideoMessageOverlay").html(processing);
115			
116			$('.formFadeout, .submitVideoBox p').css('opacity','0');
117            $.ajax({
118                url: '/submit-video/', 
119                data: $('#submitVideoForm').serialize(),
120                type: 'POST',
121                success: function(msg) {
122                    if(msg=="fail"){$("#submitVideoMessageOverlay").html(errorf); $('.okbuttons').show(); }
123					else if (msg=="not found") {$("#submitVideoMessageOverlay").html(complete); $('.okbuttons').show(); $('#videoTitleSubmitVideoOverlay, #videoIDSubmitVideoOverlay, #videoDescriptionSubmitVideoOverlay').val("");}
124					else if (msg=="found") {$("#submitVideoMessageOverlay").html(exists); $('.okbuttons').show(); $('#videoTitleSubmitVideoOverlay, #videoIDSubmitVideoOverlay, #videoDescriptionSubmitVideoOverlay').val(""); }
125					else if (msg=="not on youtube") {$("#submitVideoMessageOverlay").html(erroryt); $('.okbuttons').show(); }
126					else {$("#submitVideoMessageOverlay").html(error); $('.okbuttons').show(); }
127                }
128            });
129			
130			return false;
131	});
132	
133	$('#submitVideoMessageButton').click(function() {
134			$('.submitVideoBoxMessage').hide();
135			 $('.formFadeout, .submitVideoBox p').css('opacity','1.0');
136		});
137	
138	// -- SHARING BUTTONS - OPEN WINDOW
139	$('a.gplus, a.fb, a.tw, a.stumbleupon').click(function(e) {
140        e.preventDefault();
141        window.open($(this).attr('href'), 'fbShareWindow', 'height=450, width=550, top=' + ($(window).height() / 2 - 275) + ', left=' + ($(window).width() / 2 - 225) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
142        return false;
143    });
144	
145	// -- HOMEPAGE TABS
146	$('.tab').click(function() {
147		$('.tab').removeClass('current');
148		$(this).addClass('current');
149        var tab_id = $(this).attr('data-tab');
150		$('.tab-content').removeClass('active');
151		$("#"+tab_id).addClass('active');
152	});
153
154	// -- FEATURED SLIDER - NEXT
155	$('.right').click(function() {
156		var currentSlide = $('.currentslide');
157		var nextSlide =  currentSlide.next();
158		
159		if(nextSlide.length === 0) 
160		{nextSlide = $('.featuredBlock').first();}
161		
162		nextSlide.fadeIn(500).addClass('currentslide');
163		currentSlide.fadeOut(500).removeClass('currentslide');
164	});
165	
166	// -- FEATURED SLIDER - PREVIOUS
167	$('.left').click(function() {
168		var currentSlide = $('.currentslide');
169		var nextSlide =  currentSlide.prev();
170		
171		if(nextSlide.length === 0) 
172		{nextSlide = $('.featuredBlock').last();}
173		
174		nextSlide.fadeIn(500).addClass('currentslide');
175		currentSlide.fadeOut(500).removeClass('currentslide');
176	});
177	
178	// -- NEWSLETTERS PAGE OVERLAY
179    $('#newslettersPageOverlay').submit(function() {
180        if (!valid_email_address($("#emailPageOverlay").val()))
181        {
182            $("#newslettersMessagePageOverlay").html('<span class="red">Invalid email address!</span>');
183        }
184        else
185        {
186            $("#newslettersMessagePageOverlay").html('<span class="yellow">Processing your request...</span>');
187            $.ajax({
188                url: '/subscribe/index.php', 
189                data: $('#newslettersPageOverlay').serialize(),
190                type: 'POST',
191                success: function(msg) {
192                    if(msg=="success")
193                    {
194                        $("#emailPageOverlay").val("");
195                        $("#newslettersMessagePageOverlay").html('<span class="green">
195Please check your email to verify your subscription. Thank you!</span>');
196                    }
197                    else
198                    {
199                      $("#newslettersMessagePageOverlay").html('<span class="green">You are already subscribed!</span>');  					  
200                    }
201                }
202            });
203        }
204        return false;
205	});
206
207	// -- NEWSLETTERS FOOTER
208    $('#newslettersFooter').submit(function() {
209        if (!valid_email_address($("#email").val()))
210        {
211            $("#newslettersMessage").html('<span class="red">Invalid email address!</span>');
212        }
213        else
214        {
215            $("#newslettersMessage").html('<span class="yellow">Processing your request...</span>');
216            $.ajax({
217                url: '/subscribe/index.php', 
218                data: $('#newslettersFooter').serialize(),
219                type: 'POST',
220                success: function(msg) {
221                    if(msg=="success")
222                    {
223                        $("#email").val("");
224                        $("#newslettersMessage").html('<span class="green">Please check your email to verify your subscription. Thank you!</span>');
225                    }
226                    else
227                    {
228                      $("#newslettersMessage").html('<span class="green">You are already subscribed!</span>');  					  
229                    }
230                }
231            });
232        }
233        return false;
234	});
235	
236	// -- RALLYFACTS CUSTOM TWEET BUTTON
237	!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
238	
239	// -- VALIDATE EMAIL ADDRESS
240	function valid_email_address(email)
241	{
242		var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
243		return pattern.test(email);
244	}
245	
246	// -- CHECK FOR ADBLOCKER
247	window.onload = function() {
248        setTimeout(function() {
249          var ad = document.querySelector("ins.adsbygoogle");
250          if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
251            ad.style.cssText = 'display:block !important';
252            //ad.innerHTML = "You seem to blocking Google AdSense ads in your browser.";
253			//alert('You seem to blocking Google AdSense ads in your browser.');
254			var message = '<div class="adblocker-message"><span class="alert">AD BLOCKER DETECTED!</span><br /><br /><br /><span>Please support our work and consider disabling AdBlocker for our site.</span></div>';
255			document.getElementById("sidebarBanner1").innerHTML = message;
256			document.getElementById("sidebarBanner2").innerHTML = message;
257			document.getElementById("sidebarBanner3").innerHTML = message;
258			document.getElementById("contentBanner1").innerHTML = message;
259			document.getElementById("contentBanner2").innerHTML = message;
260			document.getElementById("contentBanner3").innerHTML = message;
261			document.getElementById("overlayBanner").innerHTML = message;
262			document.getElementById("footerBanner").innerHTML = message;
263          }
264        }, 2000); 
265      }; 
266		
267	
268// -- READY : END	
269};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.