function test(){console.log('success');}
function prettyBytes(num){var exponent,unit,neg=num<0,units=['B','kB','MB','GB','TB','PB','EB','ZB','YB'];if(neg)num=-num;if(num<1)return(neg?'-':'')+num+' B';exponent=Math.min(Math.floor(Math.log(num)/Math.log(1000)),units.length-1);num=Number((num/Math.pow(1000,exponent)).toFixed(2));unit=units[exponent];return(neg?'-':'')+num+' '+unit;}
var navHidden=true;function toggleSideMenu(){if(navHidden){$('#nav-side-menu').css('left','0');$('#nav-side-menu>.side-toggle').css('left','199px');$('#nav-side-menu>.side-toggle>.side-menu-hidden').addClass('hidden');$('#nav-side-menu>.side-toggle>.side-menu-visible').removeClass('hidden');navHidden=false;}else{$('#nav-side-menu').css('left','-205px');$('#nav-side-menu>.side-toggle').css('left','-1px');$('#nav-side-menu>.side-toggle>.side-menu-hidden').removeClass('hidden');$('#nav-side-menu>.side-toggle>.side-menu-visible').addClass('hidden');navHidden=true;}}
var useSPA=true;function spaDisable(){useSPA=false;}
var plyr=null;var webtorrent=null;function spaChangePage(url,save){$('#loader-container').show();if(!navHidden)toggleSideMenu();$.post({url:url,data:{'csrfmiddlewaretoken':Cookies.get('csrftoken')},success:function(result){if(result.success){if(plyr!==null){plyr.destroy();plyr=null;}
if(webtorrent!==null){webtorrent.destroy();webtorrent=null;}
$('#main-content').empty();$('.modal-backdrop').remove();$('[id^="IL_"]').remove();if(typeof result.url!=='undefined')url=result.url;url=url.split('?')[0];if(save)window.history.pushState({'url':url},'',url);var title='BitChute';if(typeof result.title!=='undefined')title=result.title;$(document).attr('title',title);var canonical=url;if(typeof result.canonical!=='undefined')canonical=result.canonical;$('#canonical').attr('href',canonical);var meta=metaDefault();if(typeof result.meta!=='undefined')meta=result.meta;metaPopulate(meta);$('#main-content').html(result.html);var hash=url.split('#');if(hash.length>1)$('html, body').scrollTop($('#'+hash[1]).offset().top);else window.scrollTo(0,0);$('[data-toggle="tooltip"]').tooltip({container:'body',trigger:'hover'});fixTabNabbing();}else $('#error_modal').modal('show');},error:function(){$('#error_modal').modal('show');},complete:function(){$('#loader-container').fadeOut(1000);}});}
function spaReloadPage(){spaChangePage(window.location.href,false);}
function spaAttachEvents(){if(useSPA){$('.spa').off('click.spa').on('click.spa',function(event){if(event.ctrlKey||event.shiftKey||event.metaKey||(event.button&&event.button==1))return;event.preventDefault();var url=$(this).attr('href');if(url!=window.location.pathname||$(this).hasClass('force')){window.history.replaceState({'url':window.location.href},'',window.location.href);spaChangePage(url,true);}else spaChangePage(url,false);});window.onpopstate=function(event){if(event.state)spaChangePage(event.state.url,false);};}}
function metaDefault(){return{'url':'https://www.bitchute.com/','title':'BitChute is a peer-to-peer social video platform.','description':'BitChute aims to put creators first and provide them with a service that they can use to flourish and express their ideas freely.','type':'article','image':'https://rest.s3for.me/bcimg/site/bitchutecheesy.jpg','image_secure_url':'https://rest.s3for.me/bcimg/site/bitchutecheesy.jpg','image_width':'720','image_height':'380','oembed':'','display_id':'',};}
function metaExtract(){return{'url':$('meta[property="og:url"]').attr('content'),'title':$('meta[property="og:title"]').attr('content'),'description':$('meta[property="og:description"]').attr('content'),'type':$('meta[property="og:type"]').attr('content'),'image':$('meta[property="og:image"]').attr('content'),'image_secure_url':$('meta[property="og:image:secure_url"]').attr('content'),'image_width':$('meta[property="og:image:width"]').attr('content'),'image_height':$('meta[property="og:image:height"]').attr('content'),'oembed':$('#oembed').attr('href'),'display_id':$('#display_id').html(),};}
function metaPopulate(data){$('meta[name="description"]').attr('content',data.description);$('meta[name="twitter:url"]').attr('content',data.image);$('meta[name="twitter:title"]').attr('content',data.title);$('meta[name="twitter:description"]').attr('content',data.description);$('meta[name="twitter:image:src"]').attr('content',data.image);$('meta[name="twitter:image:width"]').attr('content',data.image_width);$('meta[name="twitter:image:height"]').attr('content',data.image_height);$('meta[property="og:url"]').attr('content',data.url);$('meta[property="og:title"]').attr('content',data.title);$('meta[property="og:description"]').attr('content',data.description);$('meta[property="og:type"]').attr('content',data.type);$('meta[property="og:image"]').attr('content',data.image);$('meta[property="og:image:secure_url"]').attr('content',data.image_secure_url);$('meta[property="og:image:width"]').attr('content',data.image_width);$('meta[property="og:image:height"]').attr('content',data.image_height);$('#oembed').attr('href',data.oembed);$('#display_id').html(data.display_id);}
function clipboardInit(elem){var clipboard=new ClipboardJS(elem);clipboard.on('success',function(e){toastr.success('Copied to clipboard');});clipboard.on('error',function(e){toastr.success('Failed to copy to clipboard');});}
announcementcookie={dismiss:function(){var date=new Date();date.setTime(date.getTime()+(7*86400000));var expires="; expires="+date.toGMTString();document.cookie="announcement=on"+expires+"; path=/";},timeout:function(){var date=new Date();date.setTime(date.getTime()+3600000);var expires="; expires="+date.toGMTString();document.cookie="announcement=on"+expires+"; path=/";},check:function(){var name="announcement=";var list=document.cookie.split(';');for(var index=0;index<list.length;index++){var cookie=list[index];while(cookie.charAt(0)==' ')
cookie=cookie.substring(1,cookie.length);if(cookie.indexOf(name)===0)
return true;}
return false;},}
function showAnnouncement(){if(!announcementcookie.check()){$('#announcement').removeClass('hidden');$('#nav-top-menu').css('top','65px')
$('#nav-side-menu').css('top','125px');$('#nav-side-menu>.side-toggle').css('top','125px')
$('#nav-menu-buffer').css('padding-top','126px');$('#announcement').css('top','0');}}
function hideAnnouncement(csrf){$('#nav-top-menu').css('top','0');$('#nav-side-menu').css('top','60px')
$('#nav-side-menu>.side-toggle').css('top','60px')
$('#nav-menu-buffer').css('padding-top','61px');$('#announcement').css('top','-115px');announcementcookie.dismiss();$.post('/api/preference/announcement/',{'csrfmiddlewaretoken':csrf,'action':'disable'});}
function toggleSubscription(id,csrf){$.post('/channel/'+id+'/sub/',{'csrfmiddlewaretoken':csrf},function(result){if(result.success){$('#subscriber_count').text(result.count);$('#sub-btn-'+id).text(result.state);if(result.state=='Subscribed'){$('#sub-btn-'+id).removeClass('btn-danger').addClass('btn-default');$('#notify-'+id+'-on').addClass('hidden');$('#notify-'+id+'-off').removeClass('hidden');$('#notify-'+id+'-sub').addClass('hidden');if(result.is_notify){$('#notify-'+id+'-on').removeClass('hidden');$('#notify-'+id+'-off').addClass('hidden');$('#notify-'+id+'-sub').addClass('hidden');}else{$('#notify-'+id+'-on').addClass('hidden');$('#notify-'+id+'-off').removeClass('hidden');$('#notify-'+id+'-sub').addClass('hidden');}}else{$('#sub-btn-'+id).removeClass('btn-default').addClass('btn-danger');$('#notify-'+id+'-on').addClass('hidden');$('#notify-'+id+'-off').addClass('hidden');$('#notify-'+id+'-sub').removeClass('hidden');}}});}
function toggleNotification(id,csrf){$.post('/channel/'+id+'/notify/',{'csrfmiddlewaretoken':csrf},function(result){if(result.success){if(result.is_notify){$('#notify-'+id+'-on').removeClass('hidden');$('#notify-'+id+'-off').addClass('hidden');$('#notify-'+id+'-sub').addClass('hidden');}else{$('#notify-'+id+'-on').addClass('hidden');$('#notify-'+id+'-off').removeClass('hidden');$('#notify-'+id+'-sub').addClass('hidden');}}});}
function toggleLike(video,csrf){var value=0;if($('#video-like').hasClass('active')){value=parseInt($('#video-like-count').text(),10)-1;$('#video-like-count').text(value);$('#video-like-on').addClass('hidden');$('#video-like-off').removeClass('hidden');$('#video-like').removeClass('active');}else{value=parseInt($('#video-like-count').text(),10)+1;$('#video-like-count').text(value);$('#video-like-on').removeClass('hidden');$('#video-like-off').addClass('hidden');$('#video-like').addClass('active');if($('#video-dislike').hasClass('active')){value=parseInt($('#video-dislike-count').text(),10)-1;$('#video-dislike-count').text(value);$('#video-dislike-on').addClass('hidden');$('#video-dislike-off').removeClass('hidden');$('#video-dislike').removeClass('active');}}
$.post('/video/'+video+'/vote/',{'type':'Like','csrfmiddlewaretoken':csrf},function(result){});}
function toggleDislike(video,csrf){var value=0;if($('#video-dislike').hasClass('active')){value=parseInt($('#video-dislike-count').text(),10)-1;$('#video-dislike-count').text(value);$('#video-dislike-on').addClass('hidden');$('#video-dislike-off').removeClass('hidden');$('#video-dislike').removeClass('active');}else{value=parseInt($('#video-dislike-count').text(),10)+1;$('#video-dislike-count').text(value);$('#video-dislike-on').removeClass('hidden');$('#video-dislike-off').addClass('hidden');$('#video-dislike').addClass('active');if($('#video-like').hasClass('active')){value=parseInt($('#video-like-count').text(),10)-1;$('#video-like-count').text(value);$('#video-like-on').addClass('hidden');$('#video-like-off').removeClass('hidden');$('#video-like').removeClass('active');}}
$.post('/video/'+video+'/vote/',{'type':'Dislike','csrfmiddlewaretoken':csrf},function(result){});}
function renderContentRestrictionMap(countries){$('.svgMap-map-wrapper').remove();var values={};countries.split(',').map(function(e){values[e]={state:1}});new svgMap({targetElementID:'content-restriction-map',data:{data:{state:{name:'State',format:'Blocked',thresholdMin:0,thresholdMin:1}},applyData:'state',values:values},noDataText:'No restrictions',colorMin:'#EF4136',colorMax:'#EF4136',colorNoData:'#30A247'});}
$(document).ready(function(){$('#nav-menu').removeClass('transparent');$('#main-content').removeClass('transparent');$('#loader-container').fadeOut(1000);toastr.options.timeOut=1500;toastr.options.progressBar=true;toastr.options.positionClass='toast-bottom-right';$('[data-toggle="tooltip"]').tooltip({container:'body',trigger:'hover'});fixTabNabbing();});function fixTabNabbing(){$('body').on('click','a[target="_blank"]',function(e){var link=e.currentTarget;link&&link.tagName.toUpperCase()=='A'&&link.setAttribute('rel','noopener noreferrer');})}
var scrollerListWidth=function(){var listWidth=0;$('.nav-tabs-list li').each(function(){listWidth+=$(this).outerWidth();});return listWidth;};var scrollerWidth=function(){return $('.tab-scroll-inner').outerWidth();};var scrollerPosition=function(){return-$('.nav-tabs-list').position().left;};function scrollerCheck(position){if(scrollerWidth()>scrollerListWidth()){$('.nav-tabs-list').animate({left:"+="+position+"px"},'slow',function(){});position=0;}
if(position>0){$('.tab-scroll-left').fadeIn('slow');}
else{$('.tab-scroll-left').fadeOut('slow');}
if(scrollerWidth()+position<scrollerListWidth()){$('.tab-scroll-right').fadeIn('slow');}
else{$('.tab-scroll-right').fadeOut('slow');}}
function scrollerAttachEvents(){$('.tab-scroll-right').click(function(){if(scrollerWidth()+scrollerPosition()<scrollerListWidth()){var offset=scrollerListWidth()-scrollerPosition();if(offset>scrollerWidth()){var temp=0;offset=0;$('.nav-tabs-list li').each(function(index){if(temp<scrollerPosition()){temp+=$(this).outerWidth();}
else if(offset+$(this).outerWidth()<scrollerWidth()){offset+=$(this).outerWidth();}});}
$('.nav-tabs-list').animate({left:"-="+offset+"px"},'slow',function(){});scrollerCheck(scrollerPosition()+offset);}});$('.tab-scroll-left').click(function(){if(scrollerPosition()>0){var offset=scrollerPosition();if(offset>scrollerWidth()){$('.nav-tabs-list li').each(function(index){if(offset>scrollerWidth()){offset-=$(this).outerWidth();}});}
$('.nav-tabs-list').animate({left:"+="+offset+"px"},'slow',function(){});scrollerCheck(scrollerPosition()-offset);}});scrollerCheck(scrollerPosition());}
$(window).on('resize',function(e){scrollerCheck(scrollerPosition());});