Преглед на файлове

100-point scores -> decimal scores.

master
Ben Kurtovic преди 10 години
родител
ревизия
4fcbb93cf9
променени са 2 файла, в които са добавени 12 реда и са изтрити 12 реда
  1. +10
    -10
      main.js
  2. +2
    -2
      manifest.json

+ 10
- 10
main.js Целия файл

@@ -28,10 +28,10 @@ function get_edit_id_from_href(href) {
} }


function get_scores_from_element(elem) { function get_scores_from_element(elem) {
var score_100 = parseInt(elem.val());
var score_10 = Math.round(score_100 / 10.);
if (isNaN(score_100) || score_100 < 1 || score_100 > 100) {
alert("Invalid score: must be an integer between 1 and 100.");
var score_100 = Math.round(elem.val() * 10) / 10;
var score_10 = Math.round(elem.val());
if (isNaN(score_100) || score_100 < 1 || score_100 > 10) {
alert("Invalid score: must be a decimal between 1.0 and 10.0.");
return null; return null;
} }
return [score_100, score_10]; return [score_100, score_10];
@@ -229,7 +229,7 @@ function hook_list() {
else { else {
var current = parseInt($(elem).text()); var current = parseInt($(elem).text());
if (!isNaN(current)) if (!isNaN(current))
$(elem).text(current * 10);
$(elem).text(current + ".0");
} }


$("#scorediv" + anime_id) $("#scorediv" + anime_id)
@@ -273,10 +273,10 @@ function hook_anime(anime_id) {


if (!is_new && score === null) { if (!is_new && score === null) {
var old_score = parseInt(old_input.val()); var old_score = parseInt(old_input.val());
score = old_score == 0 ? "" : old_score * 10;
score = old_score == 0 ? "" : old_score + ".0";
} }


old_input.after($("<span> / 100</span>"))
old_input.after($("<span> / 10.0</span>"))
.after($("<input>") .after($("<input>")
.attr("type", "text") .attr("type", "text")
.attr("id", "myinfo_score") .attr("id", "myinfo_score")
@@ -302,7 +302,7 @@ function hook_add() {
var old_input = $("select[name='score']"); var old_input = $("select[name='score']");
var old_submit = $("input[type='button'][onclick='checkValidSubmit(1)']"); var old_submit = $("input[type='button'][onclick='checkValidSubmit(1)']");


old_input.after($("<span> / 100</span>"))
old_input.after($("<span> / 10.0</span>"))
.after($("<input>") .after($("<input>")
.attr("type", "text") .attr("type", "text")
.attr("id", "score_input") .attr("id", "score_input")
@@ -329,10 +329,10 @@ function hook_edit(anime_id) {


if (score === null) { if (score === null) {
var old_score = parseInt(old_input.val()); var old_score = parseInt(old_input.val());
score = old_score == 0 ? "" : old_score * 10;
score = old_score == 0 ? "" : old_score + ".0";
} }


old_input.after($("<span> / 100</span>"))
old_input.after($("<span> / 10.0</span>"))
.after($("<input>") .after($("<input>")
.attr("type", "text") .attr("type", "text")
.attr("id", "score_input") .attr("id", "score_input")


+ 2
- 2
manifest.json Целия файл

@@ -1,10 +1,10 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "100-Point Scores for MyAnimeList",
"name": "Decimal Scores for MyAnimeList",
"version": "0.1", "version": "0.1",


"description": "Gives you finer control over MyAnimeList.net scores.", "description": "Gives you finer control over MyAnimeList.net scores.",
"short_name": "MAL 100",
"short_name": "MAL Decimal",
"icons": {}, "icons": {},


"content_scripts": [{ "content_scripts": [{


Зареждане…
Отказ
Запис