// ==UserScript==
// @name Fanfiction.net ratio
// @namespace https://greasyfork.org/users/728828
// @version 1.3
// @description Adds score ratio to fanfics
// @author 1233Echo
// @match https://www.fanfiction.net/*
// @grant none
// @license MIT
// @downloadURL https://update.greasyfork.icu/scripts/420402/Fanfictionnet%20ratio.user.js
// @updateURL https://update.greasyfork.icu/scripts/420402/Fanfictionnet%20ratio.meta.js
// ==/UserScript==
// My first and probably last script
// Shout out to Min "AO3: Kudos/hits ratio" for inspiring this script
// PERCENT Score color brakets
var percent_green = 75;
var percent_yellow = 50;
var percent_orange = 25;
// NORMAL Score color brakets
var normal_green = 1000;
var normal_yellow = 500;
var normal_orange = 250;
// Colors of the Ratio div
var border_color = "#cdcdcd";
var green_color = "#b7e1cd";
var yellow_color = "#fce8b2";
var orange_color = "#f8d8ba";
var red_color = "#f4c7c3";
// Calculate score based on genre popularity
var genre_popularity = true;
// Calculate score based on rating popularity
var rating_popularity = true;
// Gives score up to 100% based on ratio formula
var percentage_score = true;
(function($) {
var i;
var ratio_equa;
var genre_list;
var genre_popu;
var ratin_popu;
var ratin_list;
var proce_scor;
if (localStorage.getItem("ratio_settings") === null) {
ratio_equa = "(10*reviews/Math.log(words))/5";
genre_popu = genre_popularity;
genre_list = [
{name : "Adventure", value : 0.87},
{name : "Angst", value : 0.91},
{name : "Crime", value : 0.99},
{name : "Drama", value : 0.84},
{name : "Family", value : 0.95},
{name : "Fantasy", value : 0.98},
{name : "Friendship", value : 0.92},
{name : "Horror", value : 0.99},
{name : "Humor", value : 0.78},
{name : "Hurt", value : 0.91},
{name : "Mystery", value : 0.98},
{name : "Parody", value : 0.98},
{name : "Poetry", value : 0.99},
{name : "Romance", value : 0.40},
{name : "Sci-Fi", value : 1.00},
{name : "Spiritual", value : 1.00},
{name : "Supernatual", value : 0.98},
{name : "Suspense", value : 0.99},
{name : "Tragedy", value : 0.96},
{name : "Western", value : 1.00}
];
ratin_popu = rating_popularity;
ratin_list = [
{name : "K", value : 1.00, id : "K"},
{name : "K+", value : 1.00, id : "Kp"},
{name : "T", value : 1.00, id : "T"},
{name : "M", value : 3.00, id : "M"},
];
proce_scor = percentage_score;
}
else{
var ratio_settings = localStorage.getItem('ratio_settings');
var obj = JSON.parse(ratio_settings);
ratio_equa = obj[0];
genre_popu = obj[1];
genre_list = obj[2];
ratin_popu = obj[3];
ratin_list = obj[4];
proce_scor = obj[5]
}
var button = $('').text("Ratio");
var btn = $('span[class="btn"]');
btn.after(button ,'\n');
$("#ratio-settings").css("margin-left","10px");
$("#ratio-settings").css("width","39.8px");
$("#ratio-settings").click(function(){
Settings();
});
Ratio();
function Settings(){
function Check_color(a, b, c){
if($(a).is(":checked")){
$(b).css('color','#04761c');
$(c).show();
}else{
$(b).css('color','#c00000');
$(c).hide();
}
}
function Genre_input(){
$('.span_a').after("
")
for(i=0; i
"+genre_list[i].name+"
\
");
}
}
function Rating_input(){
$('.span_b').after("")
for(i=0; i
"+ratin_list[i].name+"
\
");
}
}
function Procent_input(){
$('.span_c').after("")
$('#arc').append("
\
")
}
var modal = ("
\
\
\
\
Ratio\
Formula\
\
\
?
\
\
Score\
with genre popularity\
Genre \
\
Score\
with rating popularity\
Rating \
\
Score\
with percent setting\
Percent \