// ==UserScript==
// @name ALcript
// @namespace http://tampermonkey.net/
// @version 1.67
// @description Change stuff on Anilist.co
// @author hoh
// @match https://anilist.co/*
// @grant none
// @downloadURL none
// ==/UserScript==
(function(){
scriptVersion = "1.67";
/*
Aniscripts, sometimes just "the userscript", is modular and contains of several independet functions
The URL matching controller can be found near the bottom of this file.
Due to the dynamic nature of how Anilist pages load, these functions are run on a clock.
Functionallity provided by all of these functions are suplemental, so the clock frequenzies are kept slow to not impact performance.
*/
//a shared style node for all the modules. All classes are prefixed by "hoh" to avoid collisions with native Anilist classes
var style = document.createElement('style');
style.type = 'text/css';
//most of these are used by the notification module
//The default colour is rgb(var(--color-blue)) provided by Anilist, but rgb(var(--color-green)) is preferred for things related to manga
style.innerHTML = `
.hohTime{
position : static;
float : right;
margin-right : 20px;
margin-top : 10px;
margin-left: auto;
}
.hohUnread{
border-right : 8px;
border-color: rgba(var(--color-blue));
border-right-style : solid;
}
.hohNotification{
margin-bottom : 10px;
background : rgb(var(--color-foreground));
border-radius : 4px;
justify-content: space-between;
line-height: 0;
min-height: 72px;
}
.hohNotification *{
line-height: 1.15;
}
.hohUserImageSmall{
display : inline-block;
background-position : 50%;
background-repeat : no-repeat;
background-size : cover;
position : absolute;
}
.hohUserImage{
height : 72px;
width : 72px;
display : inline-block;
background-position : 50%;
background-repeat : no-repeat;
background-size : cover;
position:absolute;
}
.hohMediaImage{
height : 70px;
margin-right : 5px;
}
.hohMessageText{
position : absolute;
margin-top : 30px;
margin-left : 80px;
max-width : 330px;
}
.hohMediaImageContainer{
vertical-align : bottom;
margin-left : 400px;
display : inline;
position: relative;
display: inline-block;
min-height: 70px;
}
.hohMediaImageContainer > a{
height: 70px;
line-height: 0!important;
}
span.hohMediaImageContainer{
line-height: 0!important;
}
.hohCommentsContainer{
margin-top: 5px;
}
.hohCommentsArea{
margin : 10px;
display : none;
padding-bottom : 2px;
margin-top: 5px;
width: 95%;
}
.hohComments{
float : right;
display : none;
margin-top: -30px;
margin-right: 15px;
cursor : pointer;
margin-left: 600px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.hohCombined .hohComments{
display : none!important;
}
.hohQuickCom{
padding : 5px;
background-color : rgb(var(--color-background));
margin-bottom : 5px;
position: relative;
}
.hohQuickComName{
margin-right : 15px;
color : rgb(var(--color-blue));
}
.hohQuickComName::after{
content : ":";
}
.hohQuickComContent{
margin-right: 40px;
display: block;
}
.hohQuickComContent > p{
margin: 1px;
}
.hohQuickComLikes{
position: absolute;
right: 5px;
bottom: 5px;
display: inline-block;
}
.hohSpoiler::before{
color : rgb(var(--color-blue));
cursor : pointer;
background : rgb(var(--color-background));
border-radius : 3px;
content : "Spoiler, click to view";
font-size : 1.3rem;
padding : 0 5px;
}
.hohSpoiler.hohClicked::before{
display : none;
}
.hohSpoiler > span{
display : none;
}
.hohMessageText > span > div.time{
display : none;
}
.hohUnhandledSpecial > div{
margin-top : -20px;
}
.hohMonospace{
font-family: monospace;
}
.hohSocialTabActivityCompressedContainer{
min-width:480px;
}
.hohSocialTabActivityCompressedStatus{
vertical-align: middle;
padding-bottom: 7px;
}
.hohSocialTabActivityCompressedName{
vertical-align: middle;
margin-left: 3px;
}
.hohForumHider{
margin-right: 3px;
cursor: pointer;
font-family: monospace;
}
.hohForumHider:hover{
color: rgb(var(--color-blue));
}
.hohBackgroundCover{
height: 70px;
width: 50px;
display: inline-block;
background-repeat: no-repeat;
background-size: cover;
margin-top: 1px;
line-height: 0;
margin-bottom: 1px;
}
#hohDescription{
width: 280px;
height: 150px;
float: left;
color: rgb(var(--color-blue));
}
.hohStatsTrigger{
cursor: pointer;
border-radius: 3px;
color: rgb(var(--color-text-lighter));
display: block;
font-size: 1.4rem;
margin-bottom: 8px;
padding: 5px 10px;
}
.hohActive{
background: rgba(var(--color-foreground),.8);
color: rgb(var(--color-text));
font-weight: 500;
}
#hohFavCount{
position: absolute;
right: 30px;
color: rgba(var(--color-red));
top: 10px;
font-weight: 400;
}
.hohShamelessLink{
display: block;
margin-bottom: 5px;
}
.hohSlidePlayer{
display: block;
position: relative;
width: 500px;
}
.hohSlide{
position: absolute;
top: 0px;
font-size: 500%;
height: 100%;
display: flex;
align-items: center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
opacity:0.5;
}
.hohSlide:hover{
background-color: rgb(0,0,0,0.4);
cursor: pointer;
opacity:1;
}
.hohRightSlide{
right: 0px;
padding-left: 10px;
padding-right: 20px;
}
.hohLeftSlide{
left: 0px;
padding-left: 20px;
padding-right: 10px;
}
.hohShare{
position: absolute;
right: 12px;
top: 30px;
cursor: pointer;
color: rgb(var(--color-blue-dim));
}
.activity-entry{
position: relative;
}
.hohEmbed{
border-style: solid;
border-color: rgb(var(--color-text));
border-width: 1px;
padding: 15px;
position: relative;
}
.hohEmbed .avatar{
border-radius: 3px;
height: 40px;
width: 40px;
background-position: 50%;
background-repeat: no-repeat;
background-size: cover;
display: inline-block;
}
.hohEmbed .name{
display: inline-block;
height: 40px;
line-height: 40px;
vertical-align: top;
color: rgb(var(--color-blue));
font-size: 1.4rem;
margin-left: 12px !important;
}
.hohEmbed .time{
color: rgb(var(--color-text-lighter));
font-size: 1.1rem;
position: absolute;
right: 12px;
top: 12px;
}
.hohRecsLabel{
color: rgb(var(--color-blue)) !important;
}
.hohRecsItem{
margin-top: 5px;
margin-bottom: 10px;
}
.hohTaglessLinkException{
display: block;
}
.hohTaglessLinkException::after{
content: ""!important;
}
.hohStatValue{
color: rgb(var(--color-blue));
}
.markdown-editor > [title="Image"],
.markdown-editor > [title="Youtube Video"],
.markdown-editor > [title="WebM Video"]{
color: rgba(var(--color-red));
}
.hohBackgroundUserCover{
height: 70px;
width: 70px;
display: inline-block;
background-position: 50%;
background-repeat: no-repeat;
background-size: cover;
margin-top: 1px;
margin-bottom: 1px;
};
`;
document.getElementsByTagName('head')[0].appendChild(style);
//Todo: find out how to parse API headers for an accurate result
document.APIcallsUsed = 0;//this is NOT a reliable way to figure out how many more calls we can use, just a way to set some limit
var pending = {};
var APIcounter = setTimeout(function(){
document.APIcallsUsed = 0;
},60*1000);//reset counter every minute
function lsTest(){//localStorage is great for not having to fetch the api data every time
var test = "test";
try{
localStorage.setItem(test,test);
localStorage.removeItem(test);
return true;
}
catch(e){
return false;
}
};
if(lsTest() === true){
var localStorageAvailable = true;
var aniscriptsUsed = localStorage.getItem("aniscriptsUsed");
if(aniscriptsUsed === null){
aniscriptsUsed = {
keys : []
};
}
else{
aniscriptsUsed = JSON.parse(aniscriptsUsed);
};
localStorage.setItem("aniscriptsUsed",JSON.stringify(aniscriptsUsed));
}
else{
var localStorageAvailable = false;
};
useScripts = {//most modules are turned on by default
notifications : true,
socialTab : true,
favourites : true,
forumComments : true,
staffPages : true,
tagDescriptions : true,
completedScore : true,
moreStats : true,
characterFavouriteCount : true,
usefulLinks : false,
reTweet : false,
reTweetKiller : false,
userRecs : true,
CSSfavs : false,
CSScompactBrowse : false,
CSSSFWmode : false,
CSSmangaGreen: false,
CSSfollowCounter: true,
CSSdecimalPoint: false,
hideLikes: false,
memeScripts: false
};
var forceRebuildFlag = false;
if(localStorageAvailable){
var localStorageItem = localStorage.getItem("hohSettings");
if(localStorageItem != null && localStorageItem != ""){
var useScriptsSettings = JSON.parse(localStorageItem);
for(key in useScriptsSettings){//this is to keep the default settings if the version in local storage is outdated
useScripts[key] = useScriptsSettings[key];
};
};
localStorage.setItem("hohSettings",JSON.stringify(useScripts));
};
try{//looks at the nav
var whoAmI = document.getElementById("nav").children[0].children[1].children[1].href.match(/[a-zA-Z0-9-]*\/$/)[0].slice(0,-1);
}
catch(err){
var whoAmI = "";
};//use later for some scripts
Element.prototype.remove = function(){//more comfy way to remove DOM elements
this.parentElement.removeChild(this);
}
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
for(var i = this.length - 1; i >= 0; i--) {
if(this[i] && this[i].parentElement) {
this[i].parentElement.removeChild(this[i]);
}
}
};
var svgAssets = {
likeIcon : "",
retweetIcon : "↷",
envelope : "✉",
replyIcon : ""
};
var moreStyle = document.createElement('style');
moreStyle.type = 'text/css';
if(useScripts.CSSfavs){
moreStyle.innerHTML += `
.favourites > div > .wrap > div,
.favourites > div > .wrap > a{
/*make the spaces in the grid even*/
margin-bottom: 0px!important;
margin-right: 0px!important;
column-gap: 10px!important;
}
.user .overview{
grid-template-columns: 460px auto!important;
}
.favourites > div > .wrap{
padding: 0px!important;
display: grid;
grid-gap: 10px;
column-gap: 10px!important;
grid-template-columns: repeat(auto-fill,85px);
grid-template-rows: repeat(auto-fill,115px);
background: rgb(0,0,0,0) !important;
width: 470px;
}
.favourite.studio{
cursor: pointer;
min-height: 115px;
font-size: 15px;
display: grid;
grid-gap: 10px;
padding: 2px!important;
padding-top: 8px!important;
background-color: rgba(var(--color-foreground))!important;
text-align: center;
align-content: center;
}
.site-theme-dark .favourite.studio{
background-color: rgb(49,56,68)!important;
}
.favourite.studio::after{
display: inline-block;
background-repeat: no-repeat;
content:"";
margin-left:5px;
background-size: 76px 19px;
width: 76px;
height: 19px;
}
/*adds a logo to most favourite studio entries. Add more if needed */
.favourite.studio[href="/studio/11/MADHOUSE"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Madhouse_studio_logo.svg/300px-Madhouse_studio_logo.svg.png");
}
.favourite.studio[href="/studio/4/BONES"]::after{
background-image: url("https://i.stack.imgur.com/7pRQn.png");
}
.favourite.studio[href="/studio/14/Sunrise"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/8/8c/Sunrise_company_logo.svg/220px-Sunrise_company_logo.svg.png");
}
.favourite.studio[href="/studio/32/Manglobe"]::after{
background-image: url("https://i.stack.imgur.com/alV3I.gif");
}
.favourite.studio[href="/studio/287/David-Production"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/7/75/David_production.jpg/220px-David_production.jpg");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/6/Gainax"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/a/a8/Gainax_logo.svg/220px-Gainax_logo.svg.png");
}
.favourite.studio[href="/studio/150/Sanrio"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Sanrio_logo.svg/220px-Sanrio_logo.svg.png");
}
.favourite.studio[href="/studio/18/Toei-Animation"]::after{
background-image: url("https://i.stack.imgur.com/AjzVI.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/34/Hal-Film-Maker"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Hal_film_maker_logo.gif/220px-Hal_film_maker_logo.gif");
}
.favourite.studio[href="/studio/68/Mushi-Productions"]::after{
background-image: url("https://i.stack.imgur.com/HmYdT.jpg");
}
.favourite.studio[href="/studio/21/Studio-Ghibli"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/c/ca/Studio_Ghibli_logo.svg/220px-Studio_Ghibli_logo.svg.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/13/Studio-4C"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/e/ec/Studio_4C_logo.png");
}
.favourite.studio[href="/studio/2/Kyoto-Animation"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/b/bf/Kyoto_Animation_logo.svg/250px-Kyoto_Animation_logo.svg.png");
}
.favourite.studio[href="/studio/44/Shaft"]::after{
background-image: url("https://i.stack.imgur.com/tuqhK.png");
}
.favourite.studio[href="/studio/803/Trigger"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Trigger_Logo.svg/220px-Trigger_Logo.svg.png");
}
.favourite.studio[href="/studio/7/JC-Staff"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/J.C.Staff_Logo.svg/220px-J.C.Staff_Logo.svg.png");
}
.favourite.studio[href="/studio/102/FUNimation-Entertainment"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Funimation_2016.svg/320px-Funimation_2016.svg.png");
background-size: 76px 15px;
height: 15px;
width: 76px;
}
.favourite.studio[href="/studio/132/PA-Works"]::after{
background-image: url("https://i.stack.imgur.com/7kjSn.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/6145/Science-SARU"]::after{
background-image: url("https://i.stack.imgur.com/zo9Fx.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/22/Nippon-Animation"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/b/b4/Nippon.png/200px-Nippon.png");
}
.favourite.studio[href="/studio/73/TMS-Entertainment"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/TMS_Entertainment_logo.svg/220px-TMS_Entertainment_logo.svg.png");
}
.favourite.studio[href="/studio/65/Tokyo-Movie-Shinsha"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/2/22/Tokyo_Movie_Shinsha.png");
}
.favourite.studio[href="/studio/8/Artland"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/Artland_logo.gif/200px-Artland_logo.gif");
}
.favourite.studio[href="/studio/569/MAPPA"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/0/06/MAPPA_Logo.svg/220px-MAPPA_Logo.svg.png");
}
.favourite.studio[href="/studio/314/White-Fox"]::after{
background-image: url("https://i.stack.imgur.com/lwG1T.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/10/Production-IG"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/5/5a/Production_I.G_Logo.svg/250px-Production_I.G_Logo.svg.png");
}
.favourite.studio[href="/studio/112/Brains-Base"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Brain%27s_Base_logo.png/200px-Brain%27s_Base_logo.png");
}
.favourite.studio[href="/studio/561/A1-Pictures"]::after{
background-image: url("https://i.stack.imgur.com/nBUYo.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/43/ufotable"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/9/91/Ufotable_logo.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/858/Wit-Studio"]::after{
background-image: url("https://i.stack.imgur.com/o3Rro.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/47/Studio-Khara"]::after{
background-image: url("https://i.stack.imgur.com/2d1TT.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/1/Studio-Pierrot"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/1/10/Studio_Pierrot.jpg/220px-Studio_Pierrot.jpg");
}
.favourite.studio[href="/studio/436/AIC-Build"]::after,
.favourite.studio[href="/studio/48/AIC"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/AIC_logo.png/220px-AIC_logo.png");
}
.favourite.studio[href="/studio/3/GONZO"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Gonzo_company.png/220px-Gonzo_company.png");
}
.favourite.studio[href="/studio/300/SILVER-LINK"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Silver_Link_Logo.svg/220px-Silver_Link_Logo.svg.png");
}
.favourite.studio[href="/studio/456/Lerche"]::after{
background-image: url("https://i.stack.imgur.com/gRQPc.png");
}
.favourite.studio[href="/studio/291/CoMix-Wave"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/Cwflogo.png/150px-Cwflogo.png");
}
.favourite.studio[href="/studio/95/Doga-Kobo"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Doga_Kobo_Logo.svg/220px-Doga_Kobo_Logo.svg.png");
}
.favourite.studio[href="/studio/290/Kinema-Citrus"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/c/c0/Kinema_Citrus_logo.png");
background-size: 76px 25px;
height: 25px;
width: 76px;
}
.favourite.studio[href="/studio/333/TYO-Animations"]::after{
background-image: url("https://i.stack.imgur.com/KRqAp.jpg");
background-size: 76px 25px;
height: 25px;
width: 76px;
}
.favourite.studio[href="/studio/41/Satelight"]::after{
background-image: url("https://i.stack.imgur.com/qZVQg.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/6069/Studio-3Hz"]::after{
background-image: url("https://i.stack.imgur.com/eD0oe.jpg");
}
.favourite.studio[href="/studio/911/Passione"]::after{
background-image: url("https://i.stack.imgur.com/YyEGg.jpg");
}
.favourite.studio[href="/studio/418/Studio-Gokumi"]::after{
background-image: url("https://i.stack.imgur.com/w1y22.png");
}
.favourite.studio[href="/studio/51/diomeda"]::after{
background-image: url("https://i.stack.imgur.com/ZHt3T.jpg");
}
.favourite.studio[href="/studio/91/feel"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/0/07/Feel_%28company%29_logo.png/220px-Feel_%28company%29_logo.png");
background-size: 76px 25px;
height: 25px;
width: 76px;
}
.favourite.studio[href="/studio/36/Studio-Gallop"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/3/37/Studio_Gallop.png");
}
.favourite.studio[href="/studio/537/SANZIGEN"]::after{
background-image: url("https://i.stack.imgur.com/CkuqH.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/35/Seven-Arcs"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/a/ac/Seven_Arcs_logo.png");
background-size: 76px 25px;
height: 25px;
width: 76px;
}
.favourite.studio[href="/studio/6222/CloverWorks"]::after{
background-image: url("https://i.stack.imgur.com/9Fvr7.jpg");
}
.favourite.studio[href="/studio/144/Pony-Canyon"]::after{
background-image: url("https://i.stack.imgur.com/9kkew.png");
}
.favourite.studio[href="/studio/493/Aniplex-of-America"]::after,
.favourite.studio[href="/studio/17/Aniplex"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Aniplex_logo.svg/220px-Aniplex_logo.svg.png");
}
.favourite.studio[href="/studio/555/Studio-Chizu"]::after{
background-image: url("http://www.studio-chizu.jp/images/logo.gif");
}
.favourite.studio[href="/studio/37/Studio-DEEN"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Studio_Deen_logo.svg/220px-Studio_Deen_logo.svg.png");
}
.favourite.studio[href="/studio/159/Kodansha"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Kodansha.png/200px-Kodansha.png");
}
.favourite.studio[href="/studio/437/Kamikaze-Douga"]::after{
background-image: url("https://img7.anidb.net/pics/anime/178777.jpg");
}
.favourite.studio[href="/studio/459/Nitroplus"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/thumb/0/09/Nitroplus_logo.png/220px-Nitroplus_logo.png");
}
.favourite.studio[href="/studio/166/Movic"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/f/f3/Movic_logo.png");
}
.favourite.studio[href="/studio/38/Arms"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Arms_Corporation.png/200px-Arms_Corporation.png");
}
.favourite.studio[href="/studio/247/ShinEi-Animation"]::after{
background-image: url("https://i.stack.imgur.com/b2lcL.png");
}
.favourite.studio[href="/studio/6235/SEK-Studio"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Flag_of_North_Korea.svg/125px-Flag_of_North_Korea.svg.png");
background-size: 74px 25px;
height: 25px;
width: 74px;
}
.favourite.studio[href="/studio/58/Square-Enix"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Square_Enix_logo.svg/230px-Square_Enix_logo.svg.png");
}
.favourite.studio[href="/studio/503/Nintendo-Co-Ltd"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Nintendo.svg/220px-Nintendo.svg.png");
}
.favourite.studio[href="/studio/167/Sega"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Sega_logo.svg/200px-Sega_logo.svg.png");
}
.favourite.studio[href="/studio/193/Idea-Factory"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/en/e/eb/Idea_factory.gif");
}
.favourite.studio[href="/studio/6077/Orange"]::after{
background-image: url("http://www.orange-cg.com/img/common/logo.gif");
}
.favourite.studio[href="/studio/309/GoHands"]::after{
background-image: url("https://i.stack.imgur.com/pScIZ.jpg");
}
.favourite.studio[href="/studio/104/Lantis"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/3/39/Lantis_logo.png");
}
.favourite.studio[href="/studio/6071/Studio-Shuka"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/f/fa/Shuka_studio.jpg");
}
.favourite.studio[href="/studio/53/Dentsu"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Dentsu_logo.svg/200px-Dentsu_logo.svg.png");
}
.favourite.studio[href="/studio/143/Mainichi-Broadcasting"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Mainichi_Broadcasting_System_logo.svg/200px-Mainichi_Broadcasting_System_logo.svg.png");
}
.favourite.studio[href="/studio/376/Sentai-Filmworks"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Sentai_Filmworks_Official_Logo.jpg/220px-Sentai_Filmworks_Official_Logo.jpg");
}
.favourite.studio[href="/studio/681/ASCII-Media-Works"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/ASCII_Media_Works_logo.svg/220px-ASCII_Media_Works_logo.svg.png");
}
.favourite.studio[href="/studio/334/Ordet"]::after{
background-image: url("https://i.stack.imgur.com/evr12.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/238/ATX"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/c/c6/AT-X_logo.svg/150px-AT-X_logo.svg.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/66/Key"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Key_Visual_Arts_Logo.svg/167px-Key_Visual_Arts_Logo.svg.png");
background-size: 76px 30px;
height: 30px;
width: 76px;
}
.favourite.studio[href="/studio/145/TBS"]::after{
background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/TBS_logo.svg/200px-TBS_logo.svg.png");
}
.favourite.studio[href="/studio/108/Media-Factory"]::after{
background-image: url("https://i.stack.imgur.com/rR7yU.png");
background-size: 76px 25px;
height: 25px;
width: 76px;
}
.favourite.studio[href="/studio/346/Hoods-Entertainment"]::after{
background-image: url("https://i.stack.imgur.com/p7S0I.png");
}
`;
};
if(useScripts.CSScompactBrowse){
moreStyle.innerHTML += `
.search-page-unscoped.container{
padding-left: 10px;
padding-right: 0px;
}
.search-page-unscoped .description{
display:none;
}
body,.search-page-unscoped .preview-section{
counter-reset: ranking;
}
.search-page-unscoped .data::before {
left:2px;
opacity:0.4;
font-size:70%;
position:absolute;
counter-increment: ranking;
content: counter(ranking);
}
.search-page-unscoped .media-card{
min-width:150px!important;
grid-template-columns: 150px auto!important;
height: 297px!important;
width: 150px !important;
}
.search-page-unscoped .cover .overlay{
padding-left:8px!important;
padding-right:8px!important;
padding-top:4px!important;
}
.search-page-unscoped .grid-wrap > .media-card{
margin-left:30px;
}
.search-page-unscoped .cover{
width:150px;
height:215px;
margin-top:53px;
z-index: 100;
}
.search-page-unscoped .data{
margin-left: -150px;
}
.search-page-unscoped .genres{
min-height:29px;
z-index: 101;
padding: 8px 5px!important;
padding-bottom: 2px !important;
font-size: 1rem!important;
}
.search-page-unscoped .list-edit{
z-index: 101;
}
.search-page-unscoped .airing-countdown{
padding: 5px!important;
}
.search-page-unscoped .grid-wrap{
grid-template-columns: repeat(auto-fill, 150px) !important;
}
.search-page-unscoped .media{
grid-template-columns: repeat(auto-fill, 150px) !important;
width:100%;
}
.search-page-unscoped .overlay .studio{
margin-top: 2px!important;
margin-bottom: -8px!important;
}
.search-page-unscoped .list-status{
width: 20px!important;
height: 20px!important;
}
.search-page-unscoped .media-card:nth-child(5){
display: inline-grid!important;
}
`;
};
if(useScripts.CSSSFWmode){
moreStyle.innerHTML += `
.shadow{
display:none;
}
.banner{
height: 50px!important;
opacity: 0.1;
}
.avatar{
opacity:0.1;
}
.markdown img{
opacity:0.1;
}
.cover{
opacity:0.05!important;
}
img[src*=".gif"]{
display:none;
}
html{
--color-blue: 159, 173, 189!important;
--color-green: 159, 173, 189!important;
}
.favourite{
opacity:0.1;
}
img[src="/img/icons/icon.svg"]{
display: none;
}
.markdown span.youtube{
display: none!important;
}
.genre-overview{
display: none;
}
.progress .bar{
display: none;
}
.scroller div.emoji-spinner{
display: none;
}
.donator-badge{
display: none!important;
}
.list-preview-wrap .section-header:first-child h2:first-child{
display:none;
}
.list-preview-wrap .section-header:first-child::before{
content: "Projects in progress";
}
.category{
background: none!important;
}
`;
};
if(useScripts.CSSfollowCounter){
moreStyle.innerHTML += `
.user-page-unscoped .container{
padding-right: 0px;
padding-left: 10px;
}
.user-social .user-follow > div.wrap{
grid-template-columns: repeat(auto-fill,75px)!important;
grid-template-rows: repeat(auto-fill,75px)!important;
}
body{
counter-reset: followCount;
}
.user-social .user-follow .user{
counter-increment: followCount;
}
.user-social .user-follow .user:nth-child(10n),
.user-social .user-follow .user:last-child{
overflow: visible!important;
}
.user-social .user-follow .user:last-child::after{
content: "Total: " counter(followCount);
position: relative;
left: 85px;
top: -48px;
opacity: 0.5;
}
.user-social .user-follow .user:nth-child(10n)::after{
content: counter(followCount);
position: relative;
left: 85px;
top: -80px;
opacity: 0.5;
}
`;
};
if(useScripts.CSSgreenManga){
moreStyle.innerHTML += `
.activity-manga_list > div > div > div > div > .title{
color: rgba(var(--color-green))!important;
}
`;
};
if(useScripts.CSSdecimalPoint){
moreStyle.innerHTML += `
.medialist.POINT_10_DECIMAL .score[score="10"]::after,
.medialist.POINT_10_DECIMAL .score[score="9"]::after,
.medialist.POINT_10_DECIMAL .score[score="8"]::after,
.medialist.POINT_10_DECIMAL .score[score="7"]::after,
.medialist.POINT_10_DECIMAL .score[score="6"]::after,
.medialist.POINT_10_DECIMAL .score[score="5"]::after,
.medialist.POINT_10_DECIMAL .score[score="4"]::after,
.medialist.POINT_10_DECIMAL .score[score="3"]::after,
.medialist.POINT_10_DECIMAL .score[score="2"]::after,
.medialist.POINT_10_DECIMAL .score[score="1"]::after{
margin-left:-4px;
content: ".0";
}
`;
};
document.getElementsByTagName('head')[0].appendChild(moreStyle);
var queryMediaList = `
query ($name: String!, $listType: MediaType) {
MediaListCollection (userName: $name, type: $listType) {
lists {
entries {
... mediaListEntry
}
}
}
}
fragment mediaListEntry on MediaList {
mediaId
status
progress
progressVolumes
repeat
notes
startedAt {
year
month
day
}
media {
episodes
chapters
volumes
duration
nextAiringEpisode {
episode
}
format
title {
romaji
}
tags {
name
}
}
scoreRaw: score (format: POINT_100)
}
`;
var queryActivity = "query ($id: Int!) { Activity(id: $id) { ... on TextActivity { id userId type replyCount text createdAt user { id name avatar { large } } likes { id name avatar { large } } replies { id text(asHtml: true) createdAt user { id name avatar { large } } likes { id name avatar { large } } } } ... on ListActivity { id userId type status progress replyCount createdAt user { id name avatar { large } } media { coverImage { large } id title { userPreferred } } likes { id name avatar { large } } replies { id text(asHtml: true) createdAt user { id name avatar { large } } likes { id name avatar { large } } } } ... on MessageActivity { id type replyCount createdAt messenger { id name avatar { large } } likes { id name avatar { large } } replies { id text(asHtml: true) createdAt user { id name avatar { large } } likes { id name avatar { large } } } } } }";
var activityCache = {};//reduce API calls even if localStorage is not available.
var handleResponse = function(response){//generic handling of API responses
return response.json().then(function(json){
return response.ok ? json : Promise.reject(json);
});
};
var handleError = function(error){
//alert("Error, check console"); //fixme
console.error(error);
};
var url = 'https://graphql.anilist.co';//Current Anilist API location
var listActivityCall = function(query,variables,callback,vars,cache){
/*
query=graphql request
vars=just values to pass on to the callback function
cache::true use cached data if available
cache::false allways fetch new data
*/
var handleData = function(data){
pending[variables.id] = false;
if(localStorageAvailable){
localStorage.setItem(variables.id + "",JSON.stringify(data));
aniscriptsUsed.keys.push(variables.id);
if(aniscriptsUsed.keys.length > 1000){//don't hog to much of localStorage
for(var i=0;i<10;i++){
localStorage.removeItem(aniscriptsUsed.keys[0]);
aniscriptsUsed.keys.shift();
};
};
localStorage.setItem("aniscriptsUsed",JSON.stringify(aniscriptsUsed));
}
else{
activityCache[variables.id] = data;//still useful even if we don't have localstorage
};
callback(data,vars);
};
var options = {//generic headers provided by API examples
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
query: query,
variables: variables
})
};
if(localStorageAvailable && cache){
var localStorageItem = localStorage.getItem(variables.id + "");
if(!(localStorageItem === null)){
callback(JSON.parse(localStorageItem),vars);
console.log("localStorage cache hit");
return;
};
}
else if(activityCache.hasOwnProperty(variables.id) && cache){
callback(activityCache[variables.id],vars);
console.log("cache hit");
return;
};
fetch(url,options).then(handleResponse).then(handleData).catch(handleError);
++document.APIcallsUsed;
console.log("fetching new data");
};
var generalAPIcall = function(query,variables,callback){//has no cache stuff to worry about
var handleData = function(data){
callback(data,variables);
};
var options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
query: query,
variables: variables
})
};
fetch(url,options).then(handleResponse).then(handleData).catch(handleError);
++document.APIcallsUsed;
console.log("fetching new data");
};
var reTweetCallback = function(data){
var embedList = document.getElementsByClassName("share" + data.data.Activity.id);
for(var i=0;i 10){
embed.innerHTML = "Reached the nesting limit";
embed.classList.remove("share" + data.data.Activity.id);
return;
};
var header = document.createElement("div");
var content = document.createElement("div");
content.innerHTML = data.data.Activity.text;
var uselessMatchData = content.innerText.match(/^(!share|RT)\s+(https:\/\/anilist\.co\/activity\/)?(\d+)/);
if(content.children[0].innerText.match(/^(!share|RT)/)){
if(content.children[0].innerHTML.match(/
/)){
content.children[0].innerHTML = content.children[0].innerHTML.replace(/^(!share|RT).*?
/,"");
}
else{
content.children[0].innerHTML = "";
};
};
content.classList.add("activity-markdown");
header.classList.add("header");
var avatar = document.createElement("a");
avatar.classList.add("avatar");
avatar.style.backgroundImage = "url(" + data.data.Activity.user.avatar.large + ")";
avatar.href = "/user/" + data.data.Activity.user.name;
var name = document.createElement("a");
name.innerText = data.data.Activity.user.name;
name.href = "/user/" + data.data.Activity.user.name;
name.classList.add("name");
header.appendChild(avatar);
header.appendChild(name);
embed.appendChild(header);
embed.appendChild(content);
var actions = document.createElement("div");
var time = document.createElement("time");
actions.classList.add("time");
var postTime = new Date(data.data.Activity.createdAt*1000);
var currentTime = new Date();
actions.appendChild(time);
var fakeActions = document.createElement("div");
actions.classList.add("actions");
actions.appendChild(fakeActions);
time.dateTime = postTime.toISOString();
if(currentTime - postTime < 1000*60*60*24){
if(postTime.getMinutes() < 10){
time.innerText = postTime.getHours() + ":0" + postTime.getMinutes();
}
else{
time.innerText = postTime.getHours() + ":" + postTime.getMinutes();
};
}
else{
time.innerText = postTime.toLocaleDateString() + " " + postTime.getHours() + ":" + postTime.getMinutes();
};
embed.appendChild(actions);
embed.classList.remove("share" + data.data.Activity.id);
if(uselessMatchData){
var embed2 = document.createElement("div");
embed2.innerHTML = "loading...";
embed2.classList.add("share" + uselessMatchData[3]);
embed2.hohLevel = embed.hohLevel + 1;
embed2.classList.add("hohEmbed");
content.appendChild(embed2);
var variables = {id:uselessMatchData[3]};
var query = `
query ($id: Int!) {
Activity(id: $id) {
... on TextActivity {
id
userId
type
replyCount
text(asHtml: true)
createdAt
user {
id
name
avatar {
large
}
}
}
}
}`;
generalAPIcall(query,variables,reTweetCallback);
};
};
};
var reTweet = function(){//legacy, will be removed at some point
var perform = function(){
if(!document.URL.match(/https:\/\/anilist\.co\/(home|user|activity)\/?([a-zA-Z0-9-]+)?\/?$/)){
return;
};
var listOfActs = document.getElementsByClassName("activity-text");
for(var i=0;i/)){
textContent.innerHTML = textContent.innerHTML.replace(/^(!share|RT).*?
/,"");
}
else{
textContent.innerHTML = "";
};
var embed = document.createElement("div");
embed.innerHTML = "loading...";
embed.classList.add("share" + uselessMatchData[3]);
embed.classList.add("hohEmbed");
embed.hohLevel = 0;
textContent.appendChild(embed);
if(textContent.parentNode.children[textContent.parentNode.children.length-1].nodeName == "BLOCKQUOTE"){
textContent.parentNode.children[textContent.parentNode.children.length-1].remove();
};
var variables = {id:uselessMatchData[3]};
var query = `
query ($id: Int!) {
Activity(id: $id) {
... on TextActivity {
id
userId
type
replyCount
text(asHtml: true)
createdAt
user {
id
name
avatar {
large
}
}
}
}
}`;
generalAPIcall(query,variables,reTweetCallback);
};
};
};
};
var tryAgain = function(){//loop the notification script until we leave that page
setTimeout(function(){
perform();
if(document.URL.match(/https:\/\/anilist\.co\/(home|user|activity)\/?([a-zA-Z0-9-]+)?\/?$/)){///https:\/\/anilist\.co\/home\/?/
tryAgain()
}
else{
activeScripts.reTweet = false;
}
},200);
};
activeScripts.reTweet = true;
perform();
tryAgain();
};
var userRecs = function(){
var perform = function(){
if(!document.URL.match(/https:\/\/anilist\.co\/(anime|manga)\/\d*\/[0-9a-zA-Z-]*\/$/)){
return;
};
var pageId = parseInt(document.URL.match(/https:\/\/anilist\.co\/(anime|manga)\/(\d+)/)[2]);
if(userRecsList.hasOwnProperty(pageId) || userRecsList.hasOwnProperty(pageId+"")){
var lastSection = document.getElementsByClassName("grid-section-wrap");
if(lastSection.length){
lastSection = lastSection[lastSection.length-1];
if(lastSection.hasOwnProperty("hohRecs")){
return;
};
lastSection.hohRecs = true;
var recSection = document.createElement("div");
var recsLabel = document.createElement("h2");
recsLabel.innerText = "Recommendations";
recSection.appendChild(recsLabel);
for(var i=0;i 1)
){
listOfActs[i].marked = true;
listOfActs[i].children[0].children[0].children[0].remove();//remove cover image
var elements = listOfActs[i].children[0].children[0].children[0].children;
elements[2].parentNode.insertBefore(elements[2],elements[0]);//move profile picture to the beginning of the line
elements[0].parentNode.parentNode.style.minHeight = "70px";
elements[0].parentNode.classList.add("hohSocialTabActivityCompressedContainer");
elements[0].style.verticalAlign = "bottom";
elements[0].style.marginTop = "0px";
elements[1].classList.add("hohSocialTabActivityCompressedName");
elements[2].classList.add("hohSocialTabActivityCompressedStatus");
listOfActs[i].style.marginBottom = "10px";
};
};
/*add average score to social tab*/
var listOfFollowers = document.getElementsByClassName("follow");
var averageScore = 0;
var averageCount = 0;
for(var i=0;i 1){
this.parentNode.parentNode.parentNode.children[1].style.display = "none";
};
}
else{
this.innerHTML = "[-]";
this.parentNode.parentNode.children[1].style.display = "block";
if(this.parentNode.parentNode.parentNode.children.length > 1){
this.parentNode.parentNode.parentNode.children[1].style.display = "block";
};
};
};
comments[i].children[0].children[0].insertBefore(hider,comments[i].children[0].children[0].children[0]);
};
};
};
var tryAgain = function(){//loop the notification script until we leave that page
setTimeout(function(){
perform();
if(document.URL.match(/https:\/\/anilist\.co\/forum\/thread\/.*/)){
tryAgain()
}
else{
activeScripts.forumComments = false;
}
},100);
};
activeScripts.forumComments = true;
perform();
tryAgain();
};
var enhanceStaff = function(){//currently only adds a favourite count
if(!document.URL.match(/https:\/\/anilist\.co\/staff\/.*/)){
return;
};
var filterGroup = document.getElementsByClassName("content");
if(!filterGroup.length){
setTimeout(function(){
enhanceStaff();
},200);//takes some time to load
return;
};
filterGroup = filterGroup[0];
var favCount = document.createElement("span");
favCount.id = "hohFavCount";
favCount.innerText;
filterGroup.appendChild(favCount);
var variables = {id: document.URL.match(/\/staff\/(\d+)\//)[1]};
var query = "query($id: Int!){Staff(id: $id){favourites}}";
var favCallback = function(data){
var favButton = document.getElementsByClassName("favourite");
if(data.data.Staff.favourites == 0 && favButton[0].classList.contains("isFavourite")){//safe to assume
document.getElementById("hohFavCount").innerText = data.data.Staff.favourites+1;
}
else{
document.getElementById("hohFavCount").innerText = data.data.Staff.favourites;
};
if(favButton.length){
favButton[0].onclick = function(){
var favCount = document.getElementById("hohFavCount");
if(this.classList.contains("isFavourite")){
favCount.innerText = Math.max(parseInt(favCount.innerText)-1,0);//0 or above, just to avoid looking silly
}
else{
favCount.innerText = parseInt(favCount.innerText)+1;
};
};
};
};
generalAPIcall(query,variables,favCallback);
};
//todo: link the relevant status post
var addCompletedScores = function(){
var perform = function(){
if(!document.URL.match(/https:\/\/anilist\.co\/(home|user|activity)\/?([a-zA-Z0-9-]+)?\/?$/)){
return;
};
var status = document.getElementsByClassName("status");
for(var i=0;i";
}
else if(data.data.MediaList.score == 2){
suffix = "";
}
else if(data.data.MediaList.score == 1){
suffix = "";
};
}
else if(
data.data.MediaList.user.mediaListOptions.scoreFormat == "POINT_5"
){
suffix = " " + data.data.MediaList.score + "";
}
for(var j=0;j= this.parentNode.imageList.length-1){
this.style.display = "none";
};
};
var leftSlide = document.createElement("div");
leftSlide.innerText = "◀";
leftSlide.classList.add("hohLeftSlide");
leftSlide.classList.add("hohSlide");
leftSlide.style.display = "none";
leftSlide.onclick = function(){
this.parentNode.children[2].style.display = "flex";
this.parentNode.indeks--;
this.parentNode.children[0].src = this.parentNode.imageList[this.parentNode.indeks];
if(this.parentNode.indeks <= 0){
this.style.display = "none";
};
};
slidePlayer.appendChild(leftSlide);
slidePlayer.appendChild(rightSlide);
status2[i].appendChild(slidePlayer);
status2[i].classList.remove("markdown-spoiler");
};
};
};
};
var tryAgain = function(){//loop the notification script until we leave that page
setTimeout(function(){
perform();
if(document.URL.match(/https:\/\/anilist\.co\/(home|user)\/?/)){
tryAgain()
}
else{
activeScripts.completedScore = false;
}
},1000);
};
activeScripts.completedScore = true;
perform();
tryAgain();
};
var enhanceTags = function(){//show tag definition in drop down menu when adding tags
var perform = function(){
if(!document.URL.match(/https:\/\/anilist\.co\/(anime|manga)\/.*/)){
return;
};
var possibleTagContainers = document.getElementsByClassName("el-select-dropdown__list");
var bestGuess = false;
for(var i=0;i 100){//horrible test, but we have not markup to go from. Assumes the tag dropdown is the only one with more than 100 children
bestGuess = i;
};
};
if(bestGuess == false){
return;
};
if(possibleTagContainers[bestGuess].hasOwnProperty("hohMarked")){
return;
}
else{
possibleTagContainers[bestGuess].hohMarked = true;
};
var superBody = document.getElementsByClassName("el-dialog__body")[0];
var descriptionTarget = document.createElement("span");
descriptionTarget.id = "hohDescription";
superBody.insertBefore(descriptionTarget,superBody.children[2]);
for(var i=0;i 1
&& notifications[i].classList[1] != "hasMedia"
){ //"notification unread" classlist
active.unread = true;
}
else{
active.unread = false;
};
active.type = "special"; //by default every activity is some weird thing we are displaying as-is
active.link = "aaa";//fixme
if(//check if we can query that
notifications[i].children.length >= 1
&& notifications[i].children[1].children.length
&& notifications[i].children[1].children[0].children.length
&& notifications[i].children[1].children[0].children[0].children.length
){
//
active.directLink = notifications[i].children[1].children[0].children[0].href
active.text = notifications[i].children[1].children[0].children[0].innerHTML;
active.textName = notifications[i].children[1].children[0].children[0].childNodes[0].textContent;
active.textSpan = notifications[i].children[1].children[0].children[0].childNodes[1].textContent;
active.link = notifications[i].children[1].children[0].children[0].href.match(/[0-9]+/)[0];
var testType = notifications[i].children[1].children[0].children[0].children[0].textContent;
if(testType == " liked your activity."){
active.type = "likeActivity";
}
else if(testType == " replied to your activity."){
active.type = "replyActivity";
}
else if(testType == " sent you a message."){
active.type = "messageActivity";
}
else if(testType == " liked your activity reply."){
active.type = "likeReplyActivity";
}
else if(testType == " mentioned you in their activity."){
active.type = "mentionActivity";
}
//
};
if(active.type == "special"){
if(
notifications[i].children.length >= 1
&& notifications[i].children[1].children.length
&& notifications[i].children[1].children[0].children.length >= 2
&& notifications[i].children[1].children[0].children[1].textContent == " started following you."
){
active.type = "followActivity";
active.directLink = notifications[i].children[1].children[0].children[0].href
active.text = notifications[i].children[1].children[0].children[0].innerHTML;
active.textName = notifications[i].children[1].children[0].children[0].textContent;
active.textSpan = notifications[i].children[1].children[0].children[1].textContent;
}
else if(
notifications[i].children.length >= 1
&& notifications[i].children[1].children.length
&& notifications[i].children[1].children[0].children.length >= 4
&& notifications[i].children[1].children[0].children[3].textContent == " aired."
){
active.type = "airingActivity";
active.directLink = notifications[i].children[1].children[0].children[0].href
active.text = notifications[i].children[1].children[0].innerHTML;
}
else{
active.text = notifications[i].children[1].innerHTML;
};
};
if(
notifications[i].children.length > 1
&& notifications[i].children[1].children.length > 1
){
active.time = notifications[i].children[1].children[1].innerHTML;
}
else{
active.time = document.createElement("span");
};
active.image = notifications[i].children[0].style.backgroundImage;
active.href = notifications[i].children[0].href;
activities.push(active);
};
if(activities.length == prevLength && forceRebuildFlag == false){
if(retries == 0){
return 0;
}
else{
retries--;
};
}
else{
prevLength = activities.length;
retries = 3;
forceRebuildFlag = false;
};
if(document.getElementById("hohNotifications")){
document.getElementById("hohNotifications").remove();
};
var newContainer = document.createElement("div");
newContainer.id = "hohNotifications";
var notificationsContainer = document.getElementsByClassName("notifications");
if(!notificationsContainer.length){
return;
}
else{
notificationsContainer = notificationsContainer[0];
};
notificationsContainer.insertBefore(newContainer,notificationsContainer.firstChild);
for(var i=0;i 5){
timeHideFlag = true;
}
else if(document.getElementById("hohNotifications").offsetWidth < 800 && counter > 2){
timeHideFlag = true;
};
if(counter == 1){
while(
i + counter < activities.length
&& activities[i + counter].type == "likeActivity"
&& activities[i + counter].link == activities[i].link
){//several people likes one of your activities
var miniImageWidth = 40;
var miniImage = document.createElement("a");
miniImage.classList.add("hohUserImageSmall");
miniImage.href = activities[i + counter].href;
miniImage.style.backgroundImage = activities[i + counter].image;
miniImage.style.height = miniImageWidth + "px";
miniImage.style.width = miniImageWidth + "px";
miniImage.style.marginLeft = (72 + (counter-1)*miniImageWidth) + "px";
newNotification.appendChild(miniImage);
counter++;
};
if(counter > 1){
text.style.marginTop = "45px";
activities[i].textName += " +";
};
}
else{
newNotification.classList.add("hohCombined");
};
text.href = activities[i].directLink;
var textName = document.createElement("span");
var textSpan = document.createElement("span");
textName.innerHTML = activities[i].textName;
textSpan.innerHTML = activities[i].textSpan;
textName.style.color = "rgb(var(--color-blue))";
text.appendChild(textName);
if(activityCounter > 1){
textSpan.innerHTML = " liked your activities.";
};
text.appendChild(textSpan);
i += counter -1;
}
else if(activities[i].type == "replyActivity"){
var fakeNotNotImage = document.createElement("img");
var notNotImage = document.createElement("a");
notNotImage.href = activities[i].directLink;
fakeNotNotImage.classList.add("hohMediaImage");
fakeNotNotImage.classList.add(activities[i].link);
notNotImage.appendChild(fakeNotNotImage);
notNotImageContainer.appendChild(notNotImage);
var counter = 1;
while(
i + counter < activities.length
&& activities[i + counter].type == "replyActivity"
&& activities[i + counter].link == activities[i].link
){
var miniImageWidth = 40;
var miniImage = document.createElement("a");
miniImage.classList.add("hohUserImageSmall");
miniImage.href = activities[i + counter].href;
miniImage.style.backgroundImage = activities[i + counter].image;
miniImage.style.height = miniImageWidth + "px";
miniImage.style.width = miniImageWidth + "px";
miniImage.style.marginLeft = (72 + (counter-1)*miniImageWidth) + "px";
newNotification.appendChild(miniImage);
counter++;
};
if(counter > 1){
text.style.marginTop = "45px";
activities[i].textName += " +";
};
text.href = activities[i].directLink;
var textName = document.createElement("span");
var textSpan = document.createElement("span");
textName.innerHTML = activities[i].textName;
textSpan.innerHTML = activities[i].textSpan;
textName.style.color = "rgb(var(--color-blue))";
text.appendChild(textName);
text.appendChild(textSpan);
i += counter -1;
}
else if(
activities[i].type == "messageActivity"
|| activities[i].type == "likeReplyActivity"
|| activities[i].type == "mentionActivity"
){
var fakeNotNotImage = document.createElement("img");
var notNotImage = document.createElement("a");
notNotImage.href = activities[i].directLink;
fakeNotNotImage.classList.add("hohMediaImage");
fakeNotNotImage.classList.add(activities[i].link);
notNotImage.appendChild(fakeNotNotImage);
notNotImageContainer.appendChild(notNotImage);
text.href = activities[i].directLink;
var textName = document.createElement("span");
var textSpan = document.createElement("span");
textName.innerHTML = activities[i].textName;
textSpan.innerHTML = activities[i].textSpan;
textName.style.color = "rgb(var(--color-blue))";
text.appendChild(textName);
text.appendChild(textSpan);
}
else if(activities[i].type == "airingActivity"){
//text.href = activities[i].directLink;
var textSpan = document.createElement("span");
textSpan.innerHTML = activities[i].text;
text.appendChild(textSpan);
}
else if(activities[i].type == "followActivity"){
text.href = activities[i].directLink;
var textName = document.createElement("span");
var textSpan = document.createElement("span");
textName.innerHTML = activities[i].textName;
textSpan.innerHTML = activities[i].textSpan;
textName.style.color = "rgb(var(--color-blue))";
text.appendChild(textName);
text.appendChild(textSpan);
}
else{//display as-is
var textSpan = document.createElement("span");
textSpan.classList.add("hohUnhandledSpecial");
textSpan.innerHTML = activities[i].text;
text.appendChild(textSpan);
};
var time = document.createElement("div");
time.classList.add("hohTime");
time.innerHTML = activities[i].time;
var commentsContainer = document.createElement("div");
commentsContainer.classList.add("hohCommentsContainer");
commentsContainer.classList.add("b" + activities[i].link);//possible replies
var comments = document.createElement("a");
comments.classList.add("hohComments");
comments.innerHTML = "comments+";
comments.onclick = function(){
if(this.innerText == "comments+"){
this.innerHTML = "comments-";
this.parentNode.children[1].style.display = "inline-block";
var query = queryActivity;
var variables = {
id: +this.parentNode.classList[1].substring(1)
};
var vars = {};
var commentCallback = function(data,vars){
var listOfComments = document.getElementsByClassName("b" + data.data.Activity.id);
for(var k=0;k 1){
quickComLikes.innerHTML = data.data.Activity.replies[l].likes.length + "♥";
}
else if(data.data.Activity.replies[l].likes.length){
quickComLikes.innerHTML = "♥";
};
for(var m=0;m+";
this.parentNode.children[1].style.display = "none";
};
};
comments.classList.add("link");
var commentsArea = document.createElement("div");
commentsArea.classList.add("hohCommentsArea");
commentsContainer.appendChild(comments);
commentsContainer.appendChild(commentsArea);
newNotification.appendChild(notImage);
newNotification.appendChild(text);
newNotification.appendChild(notNotImageContainer);
if(!timeHideFlag){
newNotification.appendChild(time);
};
newNotification.appendChild(commentsContainer);
newContainer.appendChild(newNotification);
};
for(var i=0;document.APIcallsUsed < 90;i++){//heavy
if(!activities.length || i >= activities.length){//loading is difficult to predict. There may be nothing there when this runs
break;
};
var imageCallBack = function(data,vars){
var type = data.data.Activity.type;
var extra = 0;
for(var j=0;j 1){
quickComLikes.innerHTML = data.data.Activity.replies[l].likes.length + "♥";
}
else if(data.data.Activity.replies[l].likes.length){
quickComLikes.innerHTML = "♥";
};
for(var m=0;m 1
){
matched = true;
if(favSection[0].children[listLocation].children[1].children.length == 25){
var addMoreFavs = function(data){
if(data.data.User.favourites.anime.edges.length == 0){//user only has exactly 25 favs
return;
};
for(var i=0;i 100){
retlObj.scoreRaw = 100;
}
if(!retlObj.media.episodes && retlObj.media.nextAiringEpisode){
retlObj.media.episodes = retlObj.media.nextAiringEpisode.episode - 1;
}
retl.push(retlObj);
};
};
return retl.sort(function(a,b){
return a.mediaId - b.mediaId;
});
};
var compatCheck = function(list,name,target){
var query = queryMediaList;
var variables = {
name: name,
listType: "ANIME"
};
var targetLocation = document.getElementById(target);
if(!targetLocation){
return;
};
targetLocation.innerText = "loading...";
targetLocation.style.marginTop = "5px";
var secondCallback = function(data,variables){
var targetLocation = document.getElementById(target);
if(!targetLocation){
return;
};
var list2 = returnList(data);
for(var i=1;i 1.1){
differenceSpan.style.color = "red";
};
targetLocation.innerText = "";
targetLocation.appendChild(differenceSpan);
var countSpan = document.createElement("span");
countSpan.innerText = " based on " + list3.length + " shared entries. Lower is better. 0.8 - 1.1 is common";
targetLocation.appendChild(countSpan);
//console.log(list3.sort((b,a)=>a.sdiff - b.sdiff));
};
generalAPIcall(query,variables,secondCallback);
};
var addMoreStats = function(){
if(!document.URL.match(/\/stats$/)){
return;
};
var filterGroup = document.getElementsByClassName("filter-group");
if(!filterGroup.length){
setTimeout(function(){
addMoreStats();
},200);//takes some time to load
return;
};
filterGroup = filterGroup[0];
var hohStatsTrigger = document.createElement("span");
hohStatsTrigger.classList.add("hohStatsTrigger");
hohStatsTrigger.innerText = "Script & More stats";
hohStatsTrigger.onclick = function(){
hohStatsTrigger.classList.add("hohActive");
var otherActive = document.getElementsByClassName("active");
for(var j=0;j";
databaseStats.appendChild(totalAnime);
var totalManga = document.createElement("p");
totalManga.innerHTML = "Total manga: ";
databaseStats.appendChild(totalManga);
var totalUsers = document.createElement("p");
totalUsers.innerHTML = "Registered users: ";
databaseStats.appendChild(totalUsers);
var bigQuery = document.createElement("div");
bigQuery.style.display = "none";//in dev
var bigQueryButton = document.createElement("button");
bigQuery.appendChild(bigQueryButton);
var bigQueryInput = document.createElement("select");
var bigQueryInputOption1 = document.createElement("option");
var bigQueryInputOption2 = document.createElement("option");
var bigQueryInputOption3 = document.createElement("option");
bigQueryInput.appendChild(bigQueryInputOption1);
bigQueryInput.appendChild(bigQueryInputOption2);
bigQueryInput.appendChild(bigQueryInputOption3);
bigQuery.appendChild(bigQueryInput);
var bigQueryExplanation = document.createElement("span");
bigQueryExplanation.innerText = "get stats for the most popular shows";
bigQuery.appendChild(bigQueryExplanation);
databaseStats.appendChild(bigQuery);
var scriptStatsHead = document.createElement("h1");
scriptStatsHead.innerText = "Script";
var scriptStats = document.createElement("div");
var sVersion = document.createElement("p");
sVersion.innerHTML = "Version: " + scriptVersion + "";
scriptStats.appendChild(sVersion);
var sHome = document.createElement("p");
sHome.innerHTML = "Homepage: https://greasyfork.org/en/scripts/370473-aniscripts";
scriptStats.appendChild(sHome);
var sInstructions = document.createElement("p");
sInstructions.innerText = "Some changes requires reloading the page.";
scriptStats.appendChild(sInstructions);
var scriptSettings = document.createElement("div");
if(localStorageAvailable){
for(var j=0;j longestDuration.time){
longestDuration.time = entryDuration;
longestDuration.name = list[i].media.title.romaji;
longestDuration.status = list[i].status;
longestDuration.rewatch = list[i].repeat;
longestDuration.id = list[i].mediaId;
};
if(list[i].scoreRaw == 0){
continue;
};
if(median == 0){
median = list[i+Math.floor((list.length-i)/2)].scoreRaw;
};
amount++;
sumEntries += list[i].scoreRaw;
if(list[i].scoreRaw == previouScore){
runLength++;
if(runLength > maxRunLength){
maxRunLength = runLength;
maxRunLengthScore = list[i].scoreRaw;
};
}
else{
runLength = 1;
previouScore = list[i].scoreRaw;
};
sumWeight += (list[i].media.duration|0)*(list[i].media.episodes|0);
sumEntriesWeight += list[i].scoreRaw*(list[i].media.duration|0)*(list[i].media.episodes|0);
};
list.sort(function(a,b){return a.mediaId - b.mediaId});
if(amount != 0){//no scores
addStat(
"Average score: ",
(Math.round(100*sumEntries/amount)/100).toFixed(2)
);
addStat(
"Average score: ",
(Math.round(100*sumEntriesWeight/sumWeight)/100).toFixed(2),
" (weighted by duration)"
);
addStat("Median score: ",median);
addStat("Most common score: ",maxRunLengthScore);
var singleText = (100*longestDuration.time/sumDuration).toFixed(2) + "% is ";
singleText += "" + longestDuration.name + "";
if(longestDuration.rewatch == 0){
if(longestDuration.status == "COMPLETED"){}
else if(longestDuration.status == "CURRENT"){singleText += ". Currently watching."}
else if(longestDuration.status == "PAUSED"){singleText += ". On hold."}
else if(longestDuration.status == "DROPPED"){singleText += ". Dropped."};
}
else{
if(longestDuration.status == "COMPLETED"){
if(longestDuration.rewatch == 1){
singleText += ". Rewatched once.";
}
else if(longestDuration.rewatch == 2){
singleText += ". Rewatched twice.";
}
else{
singleText += ". Rewatched " + longestDuration.rewatch + " times.";
};
}
else if(longestDuration.status == "CURRENT" || status == "REPEATING"){
if(longestDuration.rewatch == 1){
singleText += ". First rewatch in progress.";
}
else if(longestDuration.rewatch == 2){
singleText += ". Second rewatch in progress.";
}
else{
singleText += ". Rewatch number " + longestDuration.rewatch + " in progress.";
};
}
else if(longestDuration.status == "PAUSED"){
if(longestDuration.rewatch == 1){
singleText += ". First rewatch on hold.";
}
else if(longestDuration.rewatch == 2){
singleText += ". Second rewatch on hold.";
}
else{
singleText += ". Rewatch number " + longestDuration.rewatch + " on hold.";
};
}
else if(longestDuration.status == "DROPPED"){
if(longestDuration.rewatch == 1){
singleText += ". Dropped on first rewatch.";
}
else if(longestDuration.rewatch == 2){
singleText += ". Dropped on second rewatch.";
}
else{
singleText += ". Dropped on rewatch number " + longestDuration.rewatch + ".";
};
};
};
addStat(
"Time watched: ",
(sumDuration/(60*24)).toFixed(2),
" days (" + singleText + ")"
);
};
//
var TVepisodes = 0;
var TVepisodesLeft = 0;
for(var i=0;i largestValue){
largestValue = distribution[format][status];
};
};
};
var yAxisLimit = Math.ceil(largestValue/Math.pow(10,(largestValue+"").length-1))*Math.pow(10,(largestValue+"").length-1);
var chartHeight = margins.height - margins.chartTextBottom - margins.bottom - margins.top;
ctx.fillStyle = "rgb(133,150,165)";
ctx.strokeStyle = "rgb(133,150,165)";
ctx.textAlign = "end";
ctx.fillText(yAxisLimit,margins.left + 20,margins.top);
ctx.fillText(0,margins.left + 20,margins.top + chartHeight);
ctx.fillText(yAxisLimit/2,margins.left + 20,margins.top + chartHeight/2);
var chartCellWidth = 100;
ctx.textAlign = "center";
ctx.fillText("TV",margins.left + 20 + chartCellWidth/2,margins.top + chartHeight + 20);
ctx.fillText("Movie",margins.left + 20 + chartCellWidth/2 + 1*chartCellWidth,margins.top + chartHeight + 20);
ctx.fillText("OVA",margins.left + 20 + chartCellWidth/2 + 2*chartCellWidth,margins.top + chartHeight + 20);
ctx.fillText("ONA",margins.left + 20 + chartCellWidth/2 + 3*chartCellWidth,margins.top + chartHeight + 20);
ctx.fillText("TV-Short",margins.left + 20 + chartCellWidth/2 + 4*chartCellWidth,margins.top + chartHeight + 20);
ctx.fillText("Special",margins.left + 20 + chartCellWidth/2 + 5*chartCellWidth,margins.top + chartHeight + 20);
ctx.fillText("Music",margins.left + 20 + chartCellWidth/2 + 6*chartCellWidth,margins.top + chartHeight + 20);
ctx.beginPath();
ctx.lineWidth = 0.5;
ctx.moveTo(margins.left + 25,Math.round(margins.top-5));
ctx.lineTo(margins.width - margins.right,Math.round(margins.top-5));
ctx.moveTo(margins.left + 25,Math.round(margins.top-5 + chartHeight));
ctx.lineTo(margins.width - margins.right,Math.round(margins.top-5 + chartHeight));
ctx.moveTo(margins.left + 25,Math.round(margins.top-5 + chartHeight/2));
ctx.lineTo(margins.width - margins.right,Math.round(margins.top-5 + chartHeight/2));
ctx.stroke();
ctx.textAlign = "start";
ctx.fillText("Completed",margins.left+65,margins.top + chartHeight + 50);
ctx.fillText("Current",margins.left+65+chartCellWidth,margins.top + chartHeight + 50);
ctx.fillText("Paused",margins.left+65+chartCellWidth*2,margins.top + chartHeight + 50);
ctx.fillText("Dropped",margins.left+65+chartCellWidth*3,margins.top + chartHeight + 50);
ctx.fillText("Planning",margins.left+65+chartCellWidth*4,margins.top + chartHeight + 50);
var barWidth = 10;
ctx.fillStyle = distributionColours["COMPLETED"];
ctx.fillRect(margins.left+50,margins.top + chartHeight + 40,10,10);
ctx.fillRect(Math.round(margins.left + chartCellWidth/2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV"]["COMPLETED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 1*chartCellWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MOVIE"]["COMPLETED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 2*chartCellWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["OVA"]["COMPLETED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 3*chartCellWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["ONA"]["COMPLETED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 4*chartCellWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV_SHORT"]["COMPLETED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 5*chartCellWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["SPECIAL"]["COMPLETED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 6*chartCellWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MUSIC"]["COMPLETED"]|0));
ctx.fillStyle = distributionColours["CURRENT"];
ctx.fillRect(margins.left+50+chartCellWidth,margins.top + chartHeight + 40,10,10);
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV"]["CURRENT"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 1*chartCellWidth + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MOVIE"]["CURRENT"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 2*chartCellWidth + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["OVA"]["CURRENT"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 3*chartCellWidth + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["ONA"]["CURRENT"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 4*chartCellWidth + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV_SHORT"]["CURRENT"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 5*chartCellWidth + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["SPECIAL"]["CURRENT"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 6*chartCellWidth + barWidth),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MUSIC"]["CURRENT"]|0));
ctx.fillStyle = distributionColours["PAUSED"];
ctx.fillRect(margins.left+50+chartCellWidth*2,margins.top + chartHeight + 40,10,10);
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV"]["PAUSED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 1*chartCellWidth + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MOVIE"]["PAUSED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 2*chartCellWidth + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["OVA"]["PAUSED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 3*chartCellWidth + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["ONA"]["PAUSED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 4*chartCellWidth + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV_SHORT"]["PAUSED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 5*chartCellWidth + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["SPECIAL"]["PAUSED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 6*chartCellWidth + barWidth*2),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MUSIC"]["PAUSED"]|0));
ctx.fillStyle = distributionColours["DROPPED"];
ctx.fillRect(margins.left+50+chartCellWidth*3,margins.top + chartHeight + 40,10,10);
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV"]["DROPPED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 1*chartCellWidth + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MOVIE"]["DROPPED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 2*chartCellWidth + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["OVA"]["DROPPED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 3*chartCellWidth + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["ONA"]["DROPPED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 4*chartCellWidth + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV_SHORT"]["DROPPED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 5*chartCellWidth + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["SPECIAL"]["DROPPED"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 6*chartCellWidth + barWidth*3),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MUSIC"]["DROPPED"]|0));
ctx.fillStyle = distributionColours["PLANNING"];
ctx.fillRect(margins.left+50+chartCellWidth*4,margins.top + chartHeight + 40,10,10);
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV"]["PLANNING"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 1*chartCellWidth + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MOVIE"]["PLANNING"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 2*chartCellWidth + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["OVA"]["PLANNING"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 3*chartCellWidth + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["ONA"]["PLANNING"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 4*chartCellWidth + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["TV_SHORT"]["PLANNING"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 5*chartCellWidth + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["SPECIAL"]["PLANNING"]|0));
ctx.fillRect(Math.round(margins.left + chartCellWidth/2 + 6*chartCellWidth + barWidth*4),Math.round(margins.top + chartHeight - 5),barWidth,(-chartHeight/yAxisLimit)*(distribution["MUSIC"]["PLANNING"]|0));
if(oldestYear < 2100){
var joinedAnilist = document.createElement("p");
joinedAnilist.innerText = "First logged anime: " + oldestYear + "-" + oldestMonth + "-" + oldestDay + ". (users can change start dates)";
personalStats.appendChild(joinedAnilist);
};
var customTags = [];
for(var i=0;i 1){
var randomData = "data-v-e2beaf26";
var customTagsHead = document.createElement("h1");
customTagsHead.innerText = "Custom Tags";
var customTagsTable = document.createElement("div");
customTagsTable.classList.add("table");
customTagsTable.setAttribute(randomData,"");
var headerRow = document.createElement("div");
headerRow.classList.add("header");
headerRow.classList.add("row");
headerRow.setAttribute(randomData,"");
var headerRowTag = document.createElement("div");
var headerRowCount = document.createElement("div");
var headerRowScore = document.createElement("div");
headerRowTag.innerText = "Tag";
headerRowCount.innerText = "Count";
headerRowScore.innerText = "Mean Score";
headerRowTag.setAttribute(randomData,"");
headerRowCount.setAttribute(randomData,"");
headerRowScore.setAttribute(randomData,"");
headerRow.appendChild(headerRowTag);
headerRow.appendChild(headerRowCount);
headerRow.appendChild(headerRowScore);
customTagsTable.appendChild(headerRow);
for(var i=0;i 100){
retlObj.scoreRaw = 100;
};
retl.push(retlObj);
};
};
return retl.sort(function(a,b){
return a.mediaId - b.mediaId;
});
};
var list = returnList(data);
for(var i=1;i 365*24*60*60*1000){
console.log("remind hoh to update the commonUnfinishedManga list");
};
var unfinishedLookup = function(mediaId,mode,mediaStatus){
if(mediaStatus == "FINISHED"){
return 0;//it may have finished since the list was updated
};
if(commonUnfinishedManga.hasOwnProperty(mediaId)){
if(mode == "chapters"){
return commonUnfinishedManga[mediaId].chapters;
}
else{
return commonUnfinishedManga[mediaId].volumes;
};
}
else{
return 0;//not in our list
};
};
for(var i=0;i