User:Bluemorpho/common.js

//audioplayer start var audioplayerz = document.getElementsByClassName("audio-lilia"); var audioPlayer = function { var audioplayerx = this; var audioplayery = audioplayerx.getElementsByTagName("audio")[0]; if (audioplayery.paused) { var audio = document.getElementsByTagName('audio'), audioplayeri = audio.length; while (audioplayeri--) { audio[audioplayeri].pause; audio[audioplayeri].currentTime = 0; }		var audioplayerj = document.getElementsByClassName("audio-lilia playing"); while(audioplayerj.length > 0) { audioplayerj[0].className = 'audio-lilia'; }	   audioplayery.play; audioplayerx.className = "audio-lilia playing"; audioplayery.addEventListener("timeupdate", audioUpdate, false); audioplayery.addEventListener("canplaythrough", function {			audioplayerd = audioplayery.duration;		}, false); } else { audioplayery.pause; audioplayery.currentTime = 0; audioplayerx.className = "audio-lilia"; } }; function audioUpdate { if (this.currentTime == audioplayerd) { this.parentElement.className = "audio-lilia" this.removeEventListener('timeupdate', audioUpdate, false); } } for (var audioplayeri = 0; audioplayeri < audioplayerz.length; audioplayeri++) { audioplayerz[audioplayeri].addEventListener('click', audioPlayer, false); }

$('.audio-lilia a.new').parent.addClass('no-audio');

//story stuff

var cardStickyHeight = $('.card-pair-stick').outerHeight + 20; var charArray = [ "Riddle", "Ace", "Deuce", "Cater", "Trey", "Leona", "Jack", "Ruggie", "Azul", "Jade", "Floyd", "Kalim", "Jamil", "Vil", "Epel", "Rook", "Idia", "Ortho", "Malleus", "Silver", "Sebek", "Lilia", "Crowley", "Trein", "Crewel", "Vargas", "Sam", "Grim", ];

///??????? maybe something to do with images, def need to update for twst function tagRenders { const renders = $('.storytable img[data-image-name*="Render"]'); renders.each(function {       var filename = $(this).attr('data-image-name');        var name = "";        var squareFileName = "";        if (filename.includes(chName)) {            charArray.forEach(function(chName) { name = chName; });       } else {            name = "NPC";            $(this).closest('td').css("--render", render);        }

///??????? something to assign the specific chara colors var colorClass = 'pi-theme-' + name.toLowerCase + '-color' cell.parent.addClass(colorClass); }); }

//button to show other color options function color{ $('body').toggleClass('story-color'); setPreference('color', $('body').hasClass('story-color')); }

//fills table with color button function colorFill{ $('body').toggleClass('story-colorFill'); setPreference('colorFill', $('body').hasClass('story-colorFill')); }

//fills table with light color button function colorShadow{ $('body').toggleClass('story-colorShadow'); setPreference('colorShadow', $('body').hasClass('story-colorShadow')); } `