User:ExValkyrie/common.js

var charArray = [ "Kohaku Oukawa", "Aira Shiratori", "Tomoya Mashiro", "Yuta Aoi", "Hinata Aoi", "Tori Himemiya", "Hiiro Amagi", "Mitsuru Tenma", "Midori Takamine", "Hajime Shino", "Sora Harukawa", "Tetora Nagumo", "Shinobu Sengoku", "Tsukasa Suou", "Mao Isara", "Arashi Narukami", "Natsume Sakasaki", "Tatsumi Kazehaya", "Mika Kagehira", "Hokuto Hidaka", "Ibara Saegusa", "Yuzuru Fushimi", "Adonis Otogari", "Jun Sazanami", "Koga Oogami", "HiMERU", "Subaru Akehoshi", "Mayoi Ayase", "Makoto Yuuki", "Souma Kanzaki", "Wataru Hibiki", "Kuro Kiryu", "Eichi Tenshouin", "Kaoru Hakaze", "Izumi Sena", "Shu Itsuki", "Nagisa Ran", "Niki Shiina", "Ritsu Sakuma", "Chiaki Morisawa", "Keito Hasumi", "Kanata Shinkai", "Tsumugi Aoba", "Hiyori Tomoe", "Madara Mikejima", "Leo Tsukinaga", "Nazuna Nito", "Rei Sakuma", "Rinne Amagi", "Akiomi Kunugi", "Jin Sagami", "Seiya Hidaka", "Anzu", "Gatekeeper" ]; var renderMaximized = false;

var imported = document.createElement('script'); imported.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js'; document.head.appendChild(imported); var icons = document.createElement('link'); icons.href = 'https://fonts.googleapis.com/icon?family=Material+Icons+Round'; icons.rel = 'stylesheet'; document.head.appendChild(icons); /* var cssStyle = document.createElement('link'); cssStyle.href = 'https://jeaoq.github.io/enstars-wiki/story-options.css'; cssStyle.rel = 'stylesheet'; document.head.appendChild(cssStyle);*/

$('.mw-parser-output .storyNavBar:first-child > tbody > tr > *:nth-child(2)').after(' question_answer   text_fields 14px16px18px21px <th class="story-bookmark"><a href="#bookmark" onclick="bookmark;"> bookmark_border </a> '); $(document.querySelector('.storyNavBar')).addClass('storyTopNav'); tagRenders; storyOptionsFontSize('16');

function tagRenders { $('body').addClass('render-minimized'); const renders = $('img[data-image-name*="Render"]'); console.log("Add name labels - jeaoq"); renders.each(function {       var filename = $(this).attr('alt');        var name = "";        charArray.forEach(function(chName) { if (filename.includes(chName)) { name = chName; }       });        console.log(filename + " -> " + name);        var circleFileName = "https://ensemble-stars.fandom.com/wiki/Special:Redirect/file/"+name+" Circle.png";        var squareFileName = "https://ensemble-stars.fandom.com/wiki/Special:Redirect/file/"+name.substr(0, name.indexOf(" "))+" ES.png";        $(this)        .wrap(" ")        .parent('.character-render-full')        .attr('data-char-name', name)        ;        const cri = document.createElement('div');        cri.setAttribute('class', 'character-render-icon');        cri.setAttribute('alt', name);        cri.innerHTML = '<img src="'+squareFileName+'">';        $(cri).insertBefore( $(this).parent );        var colorClass = 'pi-theme-' + name.substr(0, name.indexOf(" ")).toLowerCase + '-color'        $(this).parent.parent.parent.parent.parent.addClass(colorClass);    });

}

function resizeImg{ renderMaximized = !renderMaximized; console.log("Maximize Story " + renderMaximized); if(renderMaximized){ $('body').removeClass('render-minimized'); $('body').addClass('render-maximized'); $('.story-resize-img a').html(' question_answer '); }   else{ $('body').removeClass('render-maximized'); $('body').addClass('render-minimized'); $('.story-resize-img a').html(' menu_book '); } }

function storyOptionsFontSize(val) { document.documentElement.style.setProperty('--story-font-size', val + 'px'); $('[id|="sf"]').removeClass("currentFontSize"); $('#sf-'+val).addClass("currentFontSize"); }

var bookmarks = document.createElement('script'); bookmarks.src = 'https://jeaoq.github.io/enstars-wiki/bookmarks.js'; document.head.appendChild(bookmarks);