PageSourceSearch

https://libertv.com/wp-content/themes/libertv/library/js/scripts.js?ver=1.4

js libertv.com collected 2026-09-24 14:15:51 UTC 14,581 bytes, 502 lines download raw bytes

1/* imgsizer (flexible images for fluid sites) */
2var imgSizer={Config:{imgCache:[],spacer:"/path/to/your/spacer.gif"},collate:function(aScope){var isOldIE=(document.all&&!window.opera&&!window.XDomainRequest)?1:0;if(isOldIE&&document.getElementsByTagName){var c=imgSizer;var imgCache=c.Config.imgCache;var images=(aScope&&aScope.length)?aScope:document.getElementsByTagName("img");for(var i=0;i<images.length;i++){images[i].origWidth=images[i].offsetWidth;images[i].origHeight=images[i].offsetHeight;imgCache.push(images[i]);c.ieAlpha(images[i]);images[i].style.width="100%";}
3if(imgCache.length){c.resize(function(){for(var i=0;i<imgCache.length;i++){var ratio=(imgCache[i].offsetWidth/imgCache[i].origWidth);imgCache[i].style.height=(imgCache[i].origHeight*ratio)+"px";}});}}},ieAlpha:function(img){var c=imgSizer;if(img.oldSrc){img.src=img.oldSrc;}
4var src=img.src;img.style.width=img.offsetWidth+"px";img.style.height=img.offsetHeight+"px";img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')"
5img.oldSrc=src;img.src=c.Config.spacer;},resize:function(func){var oldonresize=window.onresize;if(typeof window.onresize!='function'){window.onresize=func;}else{window.onresize=function(){if(oldonresize){oldonresize();}
6func();}}}}
7
8// add twitter bootstrap classes and color based on how many times tag is used
9function addTwitterBSClass(thisObj) {
10  var title = jQuery(thisObj).attr('title');
11  if (title) {
12    var titles = title.split(' ');
13    if (titles[0]) {
14      var num = parseInt(titles[0]);
15      if (num > 0)
16      	jQuery(thisObj).addClass('label label-default');
17      if (num == 2)
18        jQuery(thisObj).addClass('label label-info');
19      if (num > 2 && num < 4)
20        jQuery(thisObj).addClass('label label-success');
21      if (num >= 5 && num < 10)
22        jQuery(thisObj).addClass('label label-warning');
23      if (num >=10)
24        jQuery(thisObj).addClass('label label-important');
25    }
26  }
27  else
28  	jQuery(thisObj).addClass('label');
29  return true;
30}
31
32// as the page loads, call these scripts
33jQuery(document).ready(function($) {
34
35	// modify tag cloud links to match up with twitter bootstrap
36	$("#tag-cloud a").each(function() {
37	    addTwitterBSClass(this);
38	    return true;
39	});
40	
41	$("p.tags a").each(function() {
42		addTwitterBSClass(this);
43		return true;
44	});
45	
46	$("ol.commentlist a.comment-reply-link").each(function() {
47		$(this).addClass('btn btn-success btn-mini');
48		return true;
49	});
50	
51	$('#cancel-comment-reply-link').each(function() {
52		$(this).addClass('btn btn-danger btn-mini');
53		return true;
54	});
55	
56	$('article.post').hover(function(){
57		$('a.edit-post').show();
58	},function(){
59		$('a.edit-post').hide();
60	});
61	
62	// Input placeholder text fix for IE
63	// $('[placeholder]').focus(function() {
64	//   var input = $(this);
65	//   if (input.val() == input.attr('placeholder')) {
66	// 	input.val('');
67	// 	input.removeClass('placeholder');
68	//   }
69	// }).blur(function() {
70	//   var input = $(this);
71	//   if (input.val() == '' || input.val() == input.attr('placeholder')) {
72	// 	input.addClass('placeholder');
73	// 	input.val(input.attr('placeholder'));
74	//   }
75	// }).blur();
76	
77	// Prevent submission of empty form
78	$('[placeholder]').parents('form').submit(function() {
79	  $(this).find('[placeholder]').each(function() {
80		var input = $(this);
81		if (input.val() == input.attr('placeholder')) {
82		  input.val('');
83		}
84	  })
85	});
86	
87	// $('#s').focus(function(){
88	// 	if( $(window).width() < 940 ){
89	// 		$(this).animate({ width: '200px' });
90	// 	}
91	// });
92	
93	// $('#s').blur(function(){
94	// 	if( $(window).width() < 940 ){
95	// 		$(this).animate({ width: '100px' });
96	// 	}
97	// });
98			
99	$('.alert-message').alert();
100	
101	$('.dropdown-toggle').dropdown();
102	
103	
104	
105	jQuery('.video_cat_filter').click(function () {
106			jQuery('.loader').show();
107			var term_id = jQuery(this).data('term-id');
108			jQuery('.video_cat_filter').removeClass('active');
109			//jQuery(this).addClass('active');
110			jQuery('[data-term-id="' + term_id + '"]').addClass('active');
111            jQuery.ajax({
112                url: woocommerce_params.ajax_url,
113                type: 'post',
114                data: {
115                    action: 'get_video_cat_listing',
116					cat_id: term_id
117                },
118                success: function (response) {
119                    jQuery('.video-block').html(response);
120					jQuery('.loader').hide();
121                }
122            });
123
124        });
125		
126		jQuery(document).on('click','.more-videos-btn',function(){
127				var obj = jQuery(this);
128				obj.css('width','215px');
129				jQuery(this).html(jQuery('.loader').html());
130				var term_id = jQuery(this).data('term-id');
131				var pageing = jQuery(this).data('pageing');
132				jQuery.ajax({
133					url: woocommerce_params.ajax_url,
134					type: 'post',
135					data: {
136						action: 'get_video_cat_listing',
137						cat_id: term_id,
138						paged: pageing
139					},
140					success: function (response) {
141						jQuery('.video-block').append(response);
142						obj.parent().remove();
143					}
144				});
145			
146		})
147		
148		
149		jQuery(document).on('click','.more-cat-videos-btn',function(){
150				var obj = jQuery(this);
151				obj.css('width','215px');
152				jQuery(this).html(jQuery('.loader').html());
153				var term_id = jQuery(this).data('term-id');
154				var pageing = jQuery(this).data('pageing');
155				jQuery.ajax({
156					url: woocommerce_params.ajax_url,
157					type: 'post',
158					data: {
159						action: 'get_inner_video_cat_listing',
160						cat_id: term_id,
161						paged: pageing
162					},
163					success: function (response) {
164						jQuery('.video-block-cat').append(response);
165						obj.parent().remove();
166					}
167				});
168			
169		})
170		
171		jQuery(document).on('click','.load_more_activity_reply',function(){
172				var obj = jQuery(this);
173				obj.css('width','215px');
174				jQuery(this).html(jQuery('.loader').html());
175			
176				jQuery.ajax({
177					url: woocommerce_params.ajax_url,
178					type: 'post',
179					data: {
180						action: 'load_more_activity_reply',
181					},
182					success: function (response) {
183						jQuery('.reply_contener').append(response);
184						obj.parent().remove();
185					}
186				});
187			
188		})
189		
190		jQuery(document).on('click','.load_more_updates',function(){
191				var obj = jQuery(this);
192				obj.css('width','215px');
193				jQuery(this).html(jQuery('.loader').html());
194				var pageing = jQuery(this).data('paged');
195				jQuery.ajax({
196					url: woocommerce_params.ajax_url,
197					type: 'post',
198					data: {
199						action: 'load_more_updates',
200						paged: pageing
201					},
202					success: function (response) {
203						jQuery('.james-says-update').append(response);
204						obj.parent().remove();
205					}
206				});
207			
208		})
209		
210		
211		jQuery(document).on('click','.load_more_premium_content',function(){
212				var obj = jQuery(this);
213				var ids = obj.attr('id');
214			
215				var tot = obj.attr('data-total-count');
216			
217				//obj.css('width','215px');
218				//jQuery(this).html(jQuery('.loader').html());
219				obj.text('Loading...');
220				
221				jQuery.ajax({
222					url: woocommerce_params.ajax_url,
223					type: 'post',
224					data: {
225						action: 'load_premium_content',
226						ids: ids,
227						tot:tot
228					},
229					dataType: "json",
230					success: function (response) {
231						obj.text('Load More');
232						jQuery('.premium_content_wrapper').append(response.output);
233						obj.attr('id','['+response.id+']');
234						if(response.btn_class)
235							{
236						obj.addClass(response.btn_class);		
237							}
238					}
239				});
240			
241		})
242		
243		
244		
245	jQuery(document).on('click','.load_more_inner_premium_content',function(){
246				var obj = jQuery(this);
247				var cur_page = obj.data('paged');
248				var tot = obj.data('total-count');
249				var term_id = jQuery(this).data('term-id');
250				
251				jQuery(this).html(jQuery('.loader').html());
252				obj.find('img').css('width','25px');
253				var pageing = jQuery(this).data('paged');
254				jQuery.ajax({
255					url: woocommerce_params.ajax_url,
256					type: 'post',
257					data: {
258						action: 'load_inner_premium_content',
259						paged: pageing,
260						cat_id: term_id
261					},
262					success: function (response) {
263						
264						jQuery('.premium_content_wrapper').append(response);
265						obj.attr('data-paged',(cur_page+1));
266						if(parseInt(tot / 6) < (cur_page+1) )
267							obj.parent().remove();
268					}
269				});
270			
271		})	
272		
273		
274		
275	jQuery('.premium_video_cat_filter').click(function () {
276			jQuery('.loader').show();
277			var term_id = jQuery(this).data('term-id');
278			jQuery('.video_cat_filter').removeClass('active');
279			//jQuery(this).addClass('active');
280			jQuery('[data-term-id="' + term_id + '"]').addClass('active');
281            jQuery.ajax({
282                url: woocommerce_params.ajax_url,
283                type: 'post',
284                data: {
285                    action: 'cat_premium_content',
286					cat_id: term_id
287                },
288                success: function (response) {
289                    jQuery('.premium-content-view').html(response);
290					jQuery('.loader').hide();
291                }
292            });
293
294        });	
295		
296		
297		
298	var uploader = new plupload.Uploader({
299		runtimes : 'html5,flash,silverlight,html4',
300		browse_button: 'browse-profile-photo',          // this can be an id of a DOM element or the DOM element itself
301		file_data_name: 'docdirect_uploader',
302		multi_selection : false,
303		flash_swf_url : 'https://libertv.wpengine.com/wp-content/themes/libertv/images/plupload/Moxie.swf',
304        silverlight_xap_url : 'https://libertv.wpengine.com/wp-content/themes/libertv/images/plupload/Moxie.xap',
305		multipart_params : {
306			"type" : "profile_image",
307		},
308		url: wc_add_to_cart_params.ajax_url + "?action=libertiv_image_uploader",
309		filters: {
310			mime_types : [
311				{ title : 'Image files', extensions : "jpg,jpeg,gif,png" }
312			],
313			max_file_size: '4mb',
314			prevent_duplicates: true
315		},
316		rename: true,
317		resize : {
318            width : 140,
319            height : 140,
320            quality : 90,
321            crop: true // crop to exact dimensions
322        },
323		
324	});
325	 
326	 uploader.init();
327	
328	//On Complete Uplaod
329	uploader.bind('FileUploaded', function ( up, file, ajax_response ) {
330		
331		var response = jQuery.parseJSON( ajax_response.response );
332		console.log(response);
333		if ( response.success ) {
334			jQuery('#browse-profile-loader').hide();
335			jQuery('.profile-img').find('.avatar').attr('src', response.url);
336		}
337	});
338	
339	 uploader.bind('FilesAdded', function(up, files) {
340		var html = '';
341		var profileThumb = "";
342		plupload.each(files, function(file) {
343			//Do something duraing upload
344		});
345		up.refresh();
346		uploader.start();
347	});
348	
349	uploader.bind('UploadProgress', function(up, file) {
350		
351		jQuery('#browse-profile-loader').show();
352		
353	});
354	
355	jQuery('#browse-profile-photo1').click(function(){
356		var obj = jQuery(this);
357		if(confirm("Are you sure to remove profile image.")){
358			
359			jQuery.ajax({
360					url: woocommerce_params.ajax_url,
361					type: 'post',
362					data: {
363						action: 'remove_profile_image',
364					},
365					success: function (response) {
366						var response = jQuery.parseJSON( response )
367						jQuery('.profile-img').find('.avatar').prop('src',response.url);
368					}
369				});
370			
371		}
372		
373	})
374	
375														   
376	jQuery(document).on('click','.make-like',function(){
377		var obj = jQuery(this);
378		jQuery.ajax({
379			url: woocommerce_params.ajax_url,
380			type: 'post',
381			data: {
382				action: 'manage_favorite_count',
383				post_id: obj.data('post-id'),
384			},
385			success: function (response) {
386				var response = jQuery.parseJSON( response )
387				if(response.success == true){
388					obj.parent().find('.count-like').html(response.cnt);
389				}
390			}
391		});
392		
393	})
394	
395	
396	jQuery('#bill_to_same_shipping').change(function(){
397	
398		if (jQuery(this).is(":checked")){
399	
400			jQuery('#billing_first_name').val(jQuery('#shipping_first_name').val());
401			jQuery('#billing_last_name').val(jQuery('#shipping_last_name').val());
402			jQuery('#billing_company').val(jQuery('#shipping_company').val());
403			jQuery('#billing_address_1').val(jQuery('#shipping_address_1').val());
404			jQuery('#billing_address_2').val(jQuery('#shipping_address_2').val());
405			jQuery('#billing_city').val(jQuery('#shipping_city').val());
406			jQuery('#billing_state').val(jQuery('#shipping_state').val());
407			jQuery('#billing_postcode').val(jQuery('#shipping_postcode').val());
408			
409			jQuery( 'div.woocommerce-shipping-fields' ).slideUp();
410			
411		}
412		else
413        {
414			jQuery( 'div.woocommerce-shipping-fields' ).slideDown();
415		}
416	})
417	
418	
419	jQuery("#myCarousel,#myCarousel2").on("touchstart", function(event){
420        var xClick = event.originalEvent.touches[0].pageX;
421		jQuery(this).one("touchmove", function(event){
422			var xMove = event.originalEvent.touches[0].pageX;
423			if( Math.floor(xClick - xMove) > 5 ){
424				jQuery(this).carousel('next');
425			}
426			else if( Math.floor(xClick - xMove) < -5 ){
427				jQuery(this).carousel('prev');
428			}
429		});
430		jQuery(".carousel").on("touchend", function(){
431				$(this).off("touchmove");
432		});
433	});
434	
435	
436	jQuery('#menu-tab-menu li').each(function(){
437		console.log("test"); 
438		if(jQuery(this).hasClass('active'))
439		{
440			var ht = jQuery(this).html();
441			jQuery('.dropdown-menu-block .dropdown-toggle').html(ht);
442		}
443		
444	})
445	
446	jQuery('#mepr-account-nav span').each(function(){
447		console.log("test"); 
448		if(jQuery(this).hasClass('mepr-active-nav-tab'))
449		{
450			var ht = jQuery(this).html();
451			jQuery('.dropdown-menu-block .dropdown-toggle').html(ht);
452		}
453		
454	})
455	
456	
457	jQuery(document).on('click','.load_more_forum_reply',function(){
458		var obj = jQuery(this);
459				obj.css('width','215px');
460				jQuery(this).html(jQuery('.loader').html());
461			
462				jQuery.ajax({
463					url: woocommerce_params.ajax_url,
464					type: 'post',
465					data: {
466						action: 'load_more_topics',
467					},
468					success: function (response) {
469						jQuery('.reply_contener').append(response);
470						obj.parent().remove();
471					}
472				});
473		
474	})
475	
476	//jQuery('.order-summary-view .woocommerce-checkout-payment').html('');
477	
478	jQuery( document ).ajaxComplete(function( event, xhr, settings ) {
479		console.log(settings.url);
480        if ( settings.url === "https://libertv.com/?wc-ajax=update_order_review" ) {
481            jQuery('.order-summary-view .woocommerce-checkout-payment').html('');
482        }
483    });
484	
485	/* Email Notification Changes*/ 
486	jQuery("#mepr_phone").after("<span style='font-size:12px;color: #ccc;'>(<em>
486We use this to send text message notifications if you opt-in.</em>)</span>");
487	
488	jQuery('#mepr_subscribe_for_notification-subscribe_newsletter').on('change',function(){
489		
490		if(jQuery(this).is(':checked')){
491			jQuery('.mepr_mepr_notification_frequency,.mepr_mepr_type_of_post').show();
492		}
493		else{
494			jQuery('.mepr_mepr_notification_frequency,.mepr_mepr_type_of_post').hide();
495		}
496		
497	})
498	
499	/* Email Notification Changes*/ 
500	
501 
502});

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.