';
} else {
shareline = '';
}
document.getElementById('poptextcontentdiv2').innerHTML = document.getElementById(whichtext).innerHTML + '
' + shareline;
if(whichtext=="moviesholder") { document.getElementById('poptextcontentdiv2').innerHTML = document.getElementById('poptextcontentdiv2').innerHTML.replace(/wallmore/g,"wallmoreB"); }
document.getElementById('poptextwrapperdiv2').style.display = 'block';
resizePopTextDiv2();
document.getElementById('poptextbgdiv2').style.display = 'block';
document.body.classList.add('stopbodyscroll');
}
function popTextOpen3(whichtext) {
document.getElementById('poptextdiv3').scrollTop = 0;
shareline = "
";
// Special case for sharebookmark
if(whichtext=="sharebookmark") { document.getElementById('poptextcontentdiv3').innerHTML = document.getElementById("sharebookmark").innerHTML.replace("sharelinkinput1","sharelinkinput2") + shareline; }
else { document.getElementById('poptextcontentdiv3').innerHTML = document.getElementById(whichtext).innerHTML + shareline; }
document.getElementById('poptextwrapperdiv3').style.display = 'block';
resizePopTextDiv3();
document.getElementById('poptextbgdiv3').style.display = 'block';
// document.body.classList.add('stopbodyscroll');
}
function sharelineCopy(whichtext) {
popTextOpen3('sharebookmark');
document.getElementById('sharelinkinput2').value=sharedomain+'/#'+whichtext+'-bm';
document.getElementById('sharelinkinput2').select();
document.execCommand('copy');
document.getElementById('sharelinkinput2').blur()
}
function resizePopTextDiv1(){
var screenheight = window.innerHeight;
document.getElementById('poptextdiv1').setAttribute("style","max-height:"+screenheight+"px");
var poptextdivheight = document.getElementById('poptextdiv1').offsetHeight;
var diverence = screenheight-poptextdivheight;
if((diverence)>55) {
document.getElementById('popTextClosebuttondiv1').setAttribute("style","top:-30px");
document.getElementById('poptextdiv1').style.borderRadius = "8px";
} else {
document.getElementById('popTextClosebuttondiv1').setAttribute("style","top:-2px");
document.getElementById('poptextdiv1').style.borderRadius = "0";
}
document.getElementById('poptextdownbuttondiv1').setAttribute("style","bottom:20px");
if((document.getElementById('poptextdiv1').scrollHeight-poptextdivheight)<155) { document.getElementById('poptextdownbuttondiv1').style.display="none"; }
}
function resizePopTextDiv2(){
var screenheight = window.innerHeight;
document.getElementById('poptextdiv2').setAttribute("style","max-height:"+screenheight+"px");
var poptextdivheight = document.getElementById('poptextdiv2').offsetHeight;
var diverence = screenheight-poptextdivheight;
if((diverence)>55) {
document.getElementById('popTextClosebuttondiv2').setAttribute("style","top:-30px");
document.getElementById('poptextdiv2').style.borderRadius = "8px";
} else {
document.getElementById('popTextClosebuttondiv2').setAttribute("style","top:-2px");
document.getElementById('poptextdiv2').style.borderRadius = "0";
}
document.getElementById('poptextdownbuttondiv2').setAttribute("style","bottom:20px");
if((document.getElementById('poptextdiv2').scrollHeight-poptextdivheight)<155) { document.getElementById('poptextdownbuttondiv2').style.display="none"; }
}
function resizePopTextDiv3(){
var screenheight = window.innerHeight;
document.getElementById('poptextdiv3').setAttribute("style","max-height:"+screenheight+"px");
var poptextdivheight = document.getElementById('poptextdiv3').offsetHeight;
var diverence = screenheight-poptextdivheight;
if((diverence)>55) {
document.getElementById('popTextClosebuttondiv3').setAttribute("style","top:-30px");
document.getElementById('poptextdiv3').style.borderRadius = "8px";
} else {
document.getElementById('popTextClosebuttondiv3').setAttribute("style","top:-2px");
document.getElementById('poptextdiv3').style.borderRadius = "0";
}
document.getElementById('poptextdownbuttondiv3').setAttribute("style","bottom:20px");
if((document.getElementById('poptextdiv3').scrollHeight-poptextdivheight)<155) { document.getElementById('poptextdownbuttondiv3').style.display="none"; }
}
function popTextClose1() {
document.getElementById('poptextdiv1').scrollTop = 0;
document.getElementById('poptextwrapperdiv1').style.display = 'none';
document.getElementById('poptextbgdiv1').style.display = 'none';
document.getElementById('poptextdownbuttondiv1').style.display="block";
document.body.classList.remove('stopbodyscroll');
}
function popTextClose2() {
document.getElementById('poptextdiv2').scrollTop = 0;
document.getElementById('poptextwrapperdiv2').style.display = 'none';
document.getElementById('poptextbgdiv2').style.display = 'none';
document.getElementById('poptextdownbuttondiv2').style.display="block";
//Only remove stopbodyscroll in popTextClose2 if it's the only poptext open
if(document.getElementById('poptextbgdiv1').style.display!=='block') {
document.body.classList.remove('stopbodyscroll');
}
}
function popTextClose3() {
document.getElementById('poptextdiv3').scrollTop = 0;
document.getElementById('poptextwrapperdiv3').style.display = 'none';
document.getElementById('poptextbgdiv3').style.display = 'none';
document.getElementById('poptextdownbuttondiv3').style.display="block";
//document.body.classList.remove('stopbodyscroll'); --> This will be done in popTextClose1 or popTextClose2
}
function popTextDown(whichtext) {
var element = document.getElementById('poptextdiv'+whichtext);
element.scrollBy({
top: 300,
left: 0,
behavior: 'smooth'
});
}
function detectTextEnd(whichtext) {
var element = document.getElementById('poptextdiv'+whichtext);
if ((element.scrollHeight - element.scrollTop === element.clientHeight) && (element.scrollTop > 0))
{
document.getElementById('poptextdownbuttondiv'+whichtext).style.color="var(--darkcolor)";
}
}
// POPUP VIDEO SCRIPT:
function playVid(format,videoid,var3,var4) {
var videowarning2 = document.getElementById("videowarningdiv").innerHTML;
if(videowarning2=="on") {
popTextOpen3('videowarningpopdiv');
document.getElementById('popTextClosebuttondiv3').style.display='none';
document.getElementById("poptextdiv3").innerHTML = document.getElementById("poptextdiv3").innerHTML.replace('warningplaceholder',videowarningtext);
if(format=="loc") { document.getElementById('poptextdiv3').innerHTML = document.getElementById('poptextdiv3').innerHTML.replace(/continuebuttonplaceholder/g,'videoLocDivOpen\(\''+videoid+'\',\''+var3+'\'\)');
} else if(format=="you") { document.getElementById('poptextdiv3').innerHTML = document.getElementById('poptextdiv3').innerHTML.replace(/continuebuttonplaceholder/g,'videoYouDivOpen\(\''+videoid+'\',\''+var3+'\',\''+var4+'\'\)');
} else if(format=="vim") { document.getElementById('poptextdiv3').innerHTML = document.getElementById('poptextdiv3').innerHTML.replace(/continuebuttonplaceholder/g,'videoVimDivOpen\(\''+videoid+'\',\''+var3+'\'\)'); }
// document.body.classList.remove('stopbodyscroll'); // We instead removed it on popTextOpen3()
return
}
if(format=="loc") { videoLocDivOpen(videoid,var3); } // var 3 on local videos is the creditstring
else if(format=="you") { videoYouDivOpen(videoid,var3,var4); } // var 3 and 4 on youtubes is the start and end time
else if(format=="vim") { videoVimDivOpen(videoid,var3); } // var 3 on vimeo is the start time
}
function videoLocDivOpen(videoname,creditstringdiv) {
// Special warning for some videos
if(videoname=="genocide" || videoname=="slavery") {
alert("This video may be particularly offensive to some people. If starting a website in your community, please remember that you can replace/remove any videos.");
}
var shareline;
if("_namesofvideoswithnosharelink".indexOf(videoname) < 1) {
shareline = '
';
} else {
shareline = '';
}
document.getElementById('videodiv').innerHTML = document.getElementById('videodiv').innerHTML.replace("",shareline);
document.getElementById('videonamediv').innerHTML = videoname;
document.getElementById('creditstringdiv').innerHTML = creditstringdiv;
var myvideo = document.getElementById("myvideo");
// By default, videos will simply be served from the /vids/ directory.
// If you have a high volume site and use a CDN for videos, set the code below to your CDN location.
// Using an .htaccess or edge rule to block hotlinking will encourage everyone to use their own storage.
if(sharedomain=="www.plantbasedsf.org")
{ myvideo.src = "https://vids.plantbasedsf.org/" + videoname + ".mp4"; }
else { myvideo.src = "vids/" + videoname + ".mp4"; }
document.getElementById('videodiv').style.display = 'block';
document.getElementById('videobgdiv').style.display = 'block';
myvideo.addEventListener('canplay',videoVisible,false);
myvideo.addEventListener('ended',popShowCredits,false);
myvideo.play();
}
function warningOverrideOn() {
document.getElementById('videowarningoverridediv').innerHTML = document.getElementById('videowarningdiv').innerHTML;
document.getElementById('videowarningdiv').innerHTML='off';
}
function warningOverrideOff() {
document.getElementById('videowarningdiv').innerHTML = document.getElementById('videowarningoverridediv').innerHTML;
}
function videoVisible() {
document.getElementById('myvideo').style.visibility = 'visible';
document.getElementById('videodiv').style.background = 'transparent';
document.getElementById('fullscreenlink').style.display = 'inline';
document.getElementById('sharelocalvideo').style.display = 'block';
}
function videoDivClose() {
document.getElementById("myvideo").style.visibility = 'hidden';
/* Using videoresetdiv because pause() and currentTime() interferred with resetting videodiv BG | myvideo.pause(); myvideo.currentTime='0'; */
document.getElementById('videodiv').style.display = 'none';
document.getElementById('videodiv').innerHTML = document.getElementById('videoresetdiv').innerHTML.replace("myvideoreset","myvideo");
document.getElementById('videodiv').style.background = "#000 url('pics/loading.gif') top left no-repeat";
document.getElementById('videoxdiv').style.display = 'none';
if(document.getElementById('creditsdiv').style.display==="none") { document.getElementById('videobgdiv').style.display = 'none'; }
document.getElementById("videoxiframe").src="about:blank";
document.getElementById("videoxdiv").innerHTML=document.getElementById("videoxresetdiv").innerHTML.replace("videoxiframereset","videoxiframe");
}
function blurVideo() {
if(document.getElementById('blurlink').innerHTML=="Blur") {
document.getElementById('myvideo').style.filter = 'blur(25px)';
document.getElementById('videoxiframe').style.filter = 'blur(25px)';
document.getElementById('blurlink').innerHTML="Unblur";
document.getElementById('blurlinkx').innerHTML="Unblur";
} else {
document.getElementById('myvideo').style.filter = 'blur(0px)';
document.getElementById('videoxiframe').style.filter = 'blur(0px)';
document.getElementById('blurlink').innerHTML="Blur";
document.getElementById('blurlinkx').innerHTML="Blur";
}
}
function popShowCredits() {
document.getElementById('myvideo').style.visibility = 'hidden';
document.getElementById('videodiv').style.display = 'none';
document.getElementById('videodiv').innerHTML = document.getElementById('videoresetdiv').innerHTML.replace("myvideoreset","myvideo");
document.getElementById('videodiv').style.background = "#000 url('pics/loading.gif') top left no-repeat";
videonamediv = document.getElementById("videonamediv").innerHTML;
creditstringdiv = document.getElementById("creditstringdiv").innerHTML;
var endtitle = "Footage credits";
if(creditstringdiv.includes('add')) { endtitle = "Additional Information"; } else if(creditstringdiv.includes('rel')) { endtitle = "Related material"; }
var creditstring = "
×
"+endtitle+": ";
var creditlen = 1;
if(creditstringdiv.includes('pra')) { creditstring = creditstring + "A Prayer For Compassion "; creditlen = creditlen+1; }
if(creditstringdiv.includes('ath')) { creditstring = creditstring + "Athlegan.com "; creditlen = creditlen+1; }
if(creditstringdiv.includes('arm')) { creditstring = creditstring + "AnimalRecoveryMission "; creditlen = creditlen+1; }
if(creditstringdiv.includes('swi')) { creditstring = creditstring + "Switch4Good.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('bil')) { creditstring = creditstring + "Bill Maher / HBO "; creditlen = creditlen+1; }
if(creditstringdiv.includes('bla')) { creditstring = creditstring + "BlackVegansRock.com "; creditlen = creditlen+1; }
// Do not use an abbreviation starting with "bm" as it would conflict with the bookmark function
if(creditstringdiv.includes('cnn')) { creditstring = creditstring + "CNN "; creditlen = creditlen+1; }
if(creditstringdiv.includes('cor')) { creditstring = creditstring + "The Corporation "; creditlen = creditlen+1; }
if(creditstringdiv.includes('cow')) { creditstring = creditstring + "Cowspiracy "; creditlen = creditlen+1; }
if(creditstringdiv.includes('dav')) { creditstring = creditstring + "Full Presentation "; creditlen = creditlen+1; }
if(creditstringdiv.includes('dea')) { creditstring = creditstring + "Death on a Factory Farm "; creditlen = creditlen+1; }
if(creditstringdiv.includes('dem')) { creditstring = creditstring + "Democracy Now "; creditlen = creditlen+1; }
if(creditstringdiv.includes('dom')) { creditstring = creditstring + "Dominion "; creditlen = creditlen+1; }
if(creditstringdiv.includes('dxe')) { creditstring = creditstring + "DXE.io "; creditlen = creditlen+1; }
if(creditstringdiv.includes('ear')) { creditstring = creditstring + "Earthlings "; creditlen = creditlen+1; }
if(creditstringdiv.includes('eat')) { creditstring = creditstring + "Eating You Alive "; creditlen = creditlen+1; }
if(creditstringdiv.includes('foo')) { creditstring = creditstring + "Food Inc. (2008) "; creditlen = creditlen+1; }
if(creditstringdiv.includes('for')) { creditstring = creditstring + "Forks Over Knives "; creditlen = creditlen+1; }
if(creditstringdiv.includes('gam')) { creditstring = creditstring + "The Game Changers "; creditlen = creditlen+1; }
if(creditstringdiv.includes('gla')) { creditstring = creditstring + "Glass Walls "; creditlen = creditlen+1; }
if(creditstringdiv.includes('gmo')) { creditstring = creditstring + "GMO/Autism Graph "; creditlen = creditlen+1; }
if(creditstringdiv.includes('aut')) { creditstring = creditstring + "Glyph/Autism Study "; creditlen = creditlen+1; } /* Archived: https://archive.is/NWIHP */
if(creditstringdiv.includes('gre')) { creditstring = creditstring + "GreatVeganAthletes.com "; creditlen = creditlen+1; }
if(creditstringdiv.includes('hop')) { creditstring = creditstring + "HOPE – Matters "; creditlen = creditlen+1; }
if(creditstringdiv.includes('inv')) { creditstring = creditstring + "Invisible Vegan "; creditlen = creditlen+1; }
if(creditstringdiv.includes('led')) { creditstring = creditstring + "Led Zeppelin →"Down by the Seaside" "; creditlen = creditlen+1; }
if(creditstringdiv.includes('liv')) { creditstring = creditstring + "LiveKindly.co "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mad')) { creditstring = creditstring + "Mad Cowboy "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mat')) { creditstring = creditstring + "The Matrix "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mer')) { creditstring = creditstring + "Mercy For Animals "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mf2')) { creditstring = creditstring + "MFA Facebook "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mf3')) { creditstring = creditstring + "MFA Instagram "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mf4')) { creditstring = creditstring + "MFA Pinterest "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mf5')) { creditstring = creditstring + "MFA Twitter "; creditlen = creditlen+1; }
if(creditstringdiv.includes('mf6')) { creditstring = creditstring + "MFA Youtube "; creditlen = creditlen+1; }
if(creditstringdiv.includes('net')) { creditstring = creditstring + "Instagram/Netas.Truth "; creditlen = creditlen+1; }
if(creditstringdiv.includes('pbn')) { creditstring = creditstring + "PlantBasedNews.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('phi')) { creditstring = creditstring + "Philip Wollen "; creditlen = creditlen+1; }
if(creditstringdiv.includes('pla')) { creditstring = creditstring + "PlantPure Nation "; creditlen = creditlen+1; }
if(creditstringdiv.includes('pro')) { creditstring = creditstring + "PlantricianProject.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('nut')) { creditstring = creditstring + "NutritionStudies.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('nu2')) { creditstring = creditstring + "NutritionFacts.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('nu3')) { creditstring = creditstring + "NutritionFacts.org →Reverse disease quote "; creditlen = creditlen+1; } /* ARCHIVE: https://archive.is/brO5G */
if(creditstringdiv.includes('mrr')) { creditstring = creditstring + "Full Interview "; creditlen = creditlen+1; }
if(creditstringdiv.includes('wal')) { creditstring = creditstring + "Pink Floyd: →The Wall (1982) "; creditlen = creditlen+1; }
if(creditstringdiv.includes('sea')) { creditstring = creditstring + "Seaspiracy - New! "; creditlen = creditlen+1; }
// Do not use an abbreviation starting with "sh" as it would conflict with the second bookmark function
if(creditstringdiv.includes('tku')) { creditstring = creditstring + "Trying to Kill Us "; creditlen = creditlen+1; }
if(creditstringdiv.includes('uni')) { creditstring = creditstring + "Unity "; creditlen = creditlen+1; }
if(creditstringdiv.includes('veg')) { creditstring = creditstring + "VegNews.com "; creditlen = creditlen+1; }
if(creditstringdiv.includes('cod')) { creditstring = creditstring + "What Cody Saw "; creditlen = creditlen+1; }
if(creditstringdiv.includes('vic')) { creditstring = creditstring + "VICE on HBO "; creditlen = creditlen+1; }
if(creditstringdiv.includes('wha')) { creditstring = creditstring + "What The Health "; creditlen = creditlen+1; }
if(creditstringdiv.includes('wik')) { creditstring = creditstring + "Wikimedia.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('aoc')) { creditstring = creditstring + "Atheist Perspective "; creditlen = creditlen+1; }
// These are credits for perception.mp4 that should come after main MFA credits
if(creditstringdiv.includes('ani')) { creditstring = creditstring + "Animal Salvation "; creditlen = creditlen+1; }
if(creditstringdiv.includes('de2')) { creditstring = creditstring + "Death on a Factory Farm "; creditlen = creditlen+1; }
if(creditstringdiv.includes('do2')) { creditstring = creditstring + "Dominion "; creditlen = creditlen+1; }
if(creditstringdiv.includes('ea2')) { creditstring = creditstring + "Earthlings "; creditlen = creditlen+1; }
if(creditstringdiv.includes('pet')) { creditstring = creditstring + "PETA.org "; creditlen = creditlen+1; }
// These are for signs and design videos
if(creditstringdiv.includes('joe')) { creditstring = creditstring + "Joey Carbstrong "; creditlen = creditlen+1; }
if(creditstringdiv.includes('spr')) { creditstring = creditstring + "Spray Example "; creditlen = creditlen+1; }
if(creditstringdiv.includes('gea')) { creditstring = creditstring + "Geany.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('ink')) { creditstring = creditstring + "Inkscape.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('gim')) { creditstring = creditstring + "GIMP.org "; creditlen = creditlen+1; }
if(creditstringdiv.includes('pos')) { creditstring = creditstring + "PosteRazor "; creditlen = creditlen+1; }
creditstring = creditstring + " All recommendations \
Replay \
Share \
Close ";
document.getElementById('creditsdiv').innerHTML = creditstring;
document.getElementById('creditsdiv2').innerHTML = creditstring; /* Makes back button possible */
document.getElementById('creditsdiv').style.display = 'block';
document.body.classList.add('stopbodyscroll');
}
function popShowImageCredits(whichfilm) {
popShowCredits();
document.getElementById('videobgdiv').style.display = 'block';
swapCredits1(whichfilm);
document.getElementById('back2all').innerHTML = "
All recommendations ";
}
function swapCredits1(whichone) {
var movieinfo = document.getElementById(whichone).innerHTML;
var brposition = movieinfo.indexOf("
10) { movieinfo = movieinfo.substring(0,brposition); }
movieinfo = movieinfo.replace("","
");
movieinfo = movieinfo + " ";
movieinfo = movieinfo.replace(/
/g," ");
movieinfo = "
×
" + movieinfo;
document.getElementById('creditsdiv').innerHTML = movieinfo + "
Back to credits Close ";
}
function swapCredits2() {
document.getElementById('creditsdiv').innerHTML = document.getElementById('creditsdiv2').innerHTML;
}
function closeCredits() {
document.getElementById('creditsdiv').style.display = 'none';
document.getElementById('videobgdiv').style.display = 'none';
document.body.classList.remove('stopbodyscroll');
}
// Full screen for local videos
function openFullscreen() {
var elem = document.getElementById("myvideo");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) { /* Firefox */
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE/Edge */
elem.msRequestFullscreen();
}
}
function closeFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) { /* Firefox */
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) { /* IE/Edge */
document.msExitFullscreen();
}
}
// POPUP EXTERNAL VIDEO SCRIPT:
function videoYouDivOpen(videoxid,videoxstart,videoxend) {
var shareline;
if("ids-of-youtubes-to-override-share-link-".indexOf(videoxid) < 1) {
shareline = '
';
} else {
shareline = '';
}
document.getElementById('videoxdiv').innerHTML = document.getElementById('videoxdiv').innerHTML + shareline;
if("ids-of-youtubes-to-include-subtitles-1Q5CXN7soQg".indexOf(videoxid) > 1) { videoxend = videoxend+"&cc_load_policy=1"; }
document.getElementById("videoxiframe").src = "https://www.youtube.com/embed/" + videoxid + "?autoplay=1&start=" + videoxstart + "&end=" + videoxend;
document.getElementById('videoxdiv').style.display = 'block';
document.getElementById('videobgdiv').style.display = 'block';
}
function videoVimDivOpen(videoxid,videoxstart) {
var shareline;
if("ids-of-vimeos-to-override-share-link-".indexOf(videoxid) < 1) {
shareline = '
';
} else {
shareline = '';
}
document.getElementById('videoxdiv').innerHTML = document.getElementById('videoxdiv').innerHTML + shareline;
var videoxsrc = "https://player.vimeo.com/video/" + videoxid + "?autoplay=1&title=1&byline=1";
if(videoxstart != '0') { videoxsrc = videoxsrc+"#t="+videoxstart; }
document.getElementById("videoxiframe").src = videoxsrc;
document.getElementById('videoxdiv').style.display = 'block';
document.getElementById('videobgdiv').style.display = 'block';
}
// Full screen for external videos
function openFullscreenX() {
var elem = document.getElementById("videoxiframe");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) { /* Firefox */
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE/Edge */
elem.msRequestFullscreen();
}
}
// SHARE LINK CONFIRMATION DURING VIDEO
function copyConfirmation(wording) {
document.getElementById("copyconfirmationdiv").innerText=wording+" copied to clipboard";
document.getElementById("copyconfirmationdiv").style.display="inline-block";
setTimeout(function () {
document.getElementById("copyconfirmationdiv").style.opacity="0";
}, 3000);
setTimeout(function () {
document.getElementById("copyconfirmationdiv").style.display="none";
document.getElementById("copyconfirmationdiv").style.opacity="1";
}, 4000);
}
// RANDOMIZE MODERN VOICES
function randomizeVoices() {
document.getElementById("modernvoices").innerText = document.getElementById("modernvoices").innerText.replace(" ","x");
var voicearray = document.getElementById("modernvoicescontainer").innerHTML.split("\n");
for(let i = voicearray.length - 1; i > 0; i--){
const j = Math.floor(Math.random() * i);
const temp = voicearray[i];
voicearray[i] = voicearray[j];
voicearray[j] = temp;
}
var newvoices = "";
for(var k = 0; k < voicearray.length; k++){
newvoices = newvoices+voicearray[k]+" ";
}
document.getElementById("modernvoices").innerHTML = newvoices;
}
// SHOW IFRAME WITH EXTERNAL CONTENT
function showExternal(whatpage) {
document.getElementById("externalframe").src=whatpage;
popTextOpen1("externaldiv");
}
// TOGGLE IFRAME WITH RESTAURANTS/RECIPES
function toggleExternal(whichpage) {
if(document.getElementById('externaliframediv').style.display=="none") {
document.getElementById('externaliframe').contentWindow.location.replace(whichpage);
document.getElementById('externaliframediv').style.display="block";
document.body.classList.add('stopbodyscroll');
} else {
document.getElementById('externaliframediv').style.display="none";
document.getElementById('externaliframe').contentWindow.location.replace("about:blank");
document.body.classList.remove('stopbodyscroll');
}
}
// DOWNLOAD FILES DISPLAY
function downloadShow(whichdownload) {
document.getElementById('downloadmain').style.display='none';
document.getElementById('downloadfont').style.display='none';
document.getElementById('downloadpics').style.display='none';
document.getElementById('downloadvids').style.display='none';
document.getElementById(whichdownload).style.display='block';
}
// IF USING A CDN, SET sharedomain BELOW TO YOUR DOMAIN IN ORDER TO RE-WRITE THE LINKS
// IF REMOVING THIS FUNCTION, BE SURE TO REMOVE THE downloadCdnVidLinks() CALL FROM index.html
function downloadCdnVidLinks() {
// If using a CDN for vids, update download links
if(sharedomain=="www.plantbasedsf.org") {
document.getElementById('downloadvids').innerHTML = document.getElementById('downloadvids').innerHTML.replace(/href=\"vids/g,"onclick=\"window.alert(\'Right click to download\');return false;\" href=\"https:\/\/vids.plantbasedsf.org");
document.getElementById('downloadvids').innerHTML = document.getElementById('downloadvids').innerHTML.replace("https://vids.plantbasedsf.org/background.mp4","vids/background.mp4");
}
}
// SHARE/COPY TO EMAIL
function copy2clipboard() {
document.getElementById('shareform').style.display='block';
document.getElementById('shareinput').select();
document.execCommand('copy');
document.getElementById('shareclipboardspan').innerHTML='
Copied to clipboard: ';
document.getElementById('sharefbfollow').style.display='none';
document.getElementById('sharethanks').style.display='block';
}
// EXPERIMENTING WITH PUTTING RESTAURANTS ON INDEX PAGE
function pageJump(clickfromdiv,clicktoanchor) {
document.getElementById(clicktoanchor).scrollIntoView({ behavior: "smooth" });
}
function NopageJump(clickfromdiv,clicktoanchor) {
var bodyRect = document.body.getBoundingClientRect(),
gotoRect = document.getElementById(clicktoanchor).getBoundingClientRect(),
gotoY = gotoRect.top - bodyRect.top,
fromDivId = clickfromdiv.parentNode.id;
fromDivHt = document.getElementById(fromDivId).offsetHeight;
//offset = gotoY - fromDivHt - (document.getElementById('nav1').offsetHeight+document.getElementById('nav2').offsetHeight);
offset = gotoY - fromDivHt;
document.getElementById('restaurantsdiv').scrollTo({
top: offset,
left: 0,
behavior: 'smooth'
})
}
// ESCAPE TO CLOSE EITHER VIDEO
window.document.onkeydown = function(e) {
if (!e) {
e = event;
}
if (e.keyCode == 27) {
videoDivClose();
}
}
// OPEN SHIRT/STICKER DETAIL IN NEW WINDOW
function showShirt(shirtname,shirtnum) {
window.open('https://shop.spreadshirt.com/vshirts/'+shirtname+'?idea='+shirtnum);
}
function showSticker(stickerid,stickerformat) {
window.open('https://shop.spreadshirt.com/vshirts/'+stickerid+'?productType=1459&appearance='+stickerformat+'&size=167');
}
// UPDATE KILL COUNT (Based on http://considerveganism.com/counter/ )
function updateKillCount() {
var millisecondsPerYear = 365 * 24 * 60 * 60 * 1000;
var killCountStart = document.getElementById("killcountstartdiv").innerHTML;
var killCountSnap = new Date().getTime();
var animalsKilledPerYear = {
"chickens": 61171973510,
"pigs": 1451856889.38,
"turkeys": 618086890,
"cattle": 298799160.08,
"wild_fish": 970000000000,
"farmed_fish": 38000000000,
"total_fish": 1008000000000,
"ducks": 2887594480,
"rabbits": 1171578000,
"geese": 687147000,
"sheep": 536742256.33,
"goats": 438320370.99,
"rodents": 70371000,
"other_birds": 59656000,
"buffalo": 25798819,
"horses": 4863367,
"donkeys": 3213400,
"camels": 3243266.03,
"not_chickenspigsturkeyscows": 5888527959.35,
"total_land": 69429244408.81,
};
for (var subset in animalsKilledPerYear) {
var numKilled = animalsKilledPerYear[subset];
var countElement = document.getElementById("akc-" + subset);
if (countElement) {
countElement.innerHTML = Math.round((killCountSnap - killCountStart) / millisecondsPerYear * numKilled).toLocaleString();
}
}
document.getElementById("minutesagospan").innerHTML = ((killCountSnap - killCountStart) / (1000 * 60)).toFixed(1);
}