Leech-O-Meter

Warning indicator for Wanikani when learning common leeches.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==UserScript==
// @name         Leech-O-Meter
// @namespace    hitechbunny
// @version      0.0.1
// @description  Warning indicator for Wanikani when learning common leeches.
// @match        https://www.wanikani.com/lesson/session
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $('#lesson').append("<div id='leech-o-meter' style='position: absolute; top: 206px; right: 11px; text-align: right; padding-left: 0.3em; padding-right: 0.3em; font-size: 2em; background-color: yellow; opacity: 0.25;'>⚠ Leech</div>");

    var last_characters = null;
    var last_type = null;

    var leech_indicator = {'vocabulary | 力': 'mild', 'vocabulary | 大した': 'mild', 'vocabulary | 八つ': 'mild', 'vocabulary | 人口': 'mild', 'vocabulary | 土': 'yellow', 'vocabulary | 八日': 'mild', 'vocabulary | 出す': 'mild', 'vocabulary | 女子': 'mild', 'vocabulary | 上手': 'mild', 'vocabulary | 大いに': 'mild', 'kanji | 出': 'mild', 'kanji | 丁': 'mild', 'vocabulary | 王子': 'mild', 'vocabulary | 日': 'mild', 'vocabulary | 六日': 'mild', 'kanji | 了': 'mild', 'vocabulary | 六つ': 'mild', 'vocabulary | 内': 'mild', 'vocabulary | 生': 'mild', 'vocabulary | 公用': 'mild', 'vocabulary | 左右': 'mild', 'vocabulary | 生む': 'mild', 'vocabulary | 用いる': 'mild', 'vocabulary | 少ない': 'mild', 'vocabulary | 外れる': 'mild', 'kanji | 少': 'mild', 'vocabulary | 人生': 'mild', 'vocabulary | 名字': 'yellow', 'vocabulary | 一代': 'yellow', 'vocabulary | 早々': 'mild', 'vocabulary | 名人': 'mild', 'vocabulary | 先日': 'mild', 'vocabulary | 年中': 'mild', 'vocabulary | 大気': 'mild', 'vocabulary | 他': 'mild', 'vocabulary | 主人': 'mild', 'vocabulary | 気に入る': 'mild', 'vocabulary | 一文字': 'mild', 'kanji | 去': 'mild', 'vocabulary | 主に': 'mild', 'vocabulary | 先': 'mild', 'vocabulary | 作用': 'yellow', 'vocabulary | 〜年来': 'yellow', 'vocabulary | 行う': 'yellow', 'vocabulary | 一生': 'yellow', 'vocabulary | 万人': 'yellow', 'vocabulary | 本来': 'mild', 'vocabulary | 近日': 'mild', 'vocabulary | 何月': 'mild', 'vocabulary | 近年': 'mild', 'vocabulary | 音': 'mild', 'vocabulary | 仕草': 'mild', 'vocabulary | 正直': 'yellow', 'vocabulary | 土地': 'mild', 'vocabulary | 直行': 'mild', 'vocabulary | 活用': 'mild', 'vocabulary | 年次': 'mild', 'vocabulary | 羊毛': 'mild', 'kanji | 画': 'mild', 'vocabulary | 〜札': 'yellow', 'vocabulary | 失う': 'yellow', 'vocabulary | 近々': 'mild', 'vocabulary | 見当たる': 'mild', 'vocabulary | 欠ける': 'mild', 'vocabulary | 考古学': 'mild', 'vocabulary | 先回り': 'mild', 'vocabulary | 氏': 'mild', 'vocabulary | 氏名': 'mild', 'kanji | 組': 'mild', 'vocabulary | 近く': 'mild', 'kanji | 由': 'mild', 'vocabulary | 末': 'mild', 'kanji | 欠': 'mild', 'kanji | 未': 'mild', 'vocabulary | 社会': 'mild', 'vocabulary | 人形': 'mild', 'vocabulary | 大空': 'mild', 'kanji | 末': 'mild', 'vocabulary | 欠点': 'mild', 'vocabulary | 形': 'mild', 'vocabulary | 生地': 'yellow', 'vocabulary | 出所': 'yellow', 'vocabulary | 交じる': 'yellow', 'vocabulary | 人数': 'yellow', 'vocabulary | 入場': 'yellow', 'vocabulary | 助手': 'yellow', 'vocabulary | 究明': 'yellow', 'vocabulary | 入所': 'mild', 'vocabulary | 交わる': 'mild', 'vocabulary | 数える': 'mild', 'vocabulary | 化ける': 'mild', 'vocabulary | 身': 'mild', 'vocabulary | 向こう': 'mild', 'vocabulary | 場合': 'mild', 'vocabulary | 当たり前': 'mild', 'vocabulary | 数': 'mild', 'kanji | 身': 'mild', 'vocabulary | 見直す': 'mild', 'vocabulary | 対外': 'mild', 'vocabulary | 当てる': 'mild', 'vocabulary | 助力': 'mild', 'vocabulary | 住人': 'mild', 'vocabulary | 欠かす': 'yellow', 'vocabulary | 大事': 'yellow', 'vocabulary | 発表': 'mild', 'vocabulary | 用事': 'mild', 'vocabulary | 具合': 'mild', 'vocabulary | 通す': 'mild', 'vocabulary | 付く': 'mild', 'kanji | 負': 'mild', 'vocabulary | 対談': 'mild', 'vocabulary | 相談': 'mild', 'vocabulary | 相手': 'mild', 'vocabulary | 発見': 'mild', 'vocabulary | 付近': 'mild', 'vocabulary | 部首': 'mild', 'vocabulary | 不自由': 'mild', 'vocabulary | 予定': 'mild', 'kanji | 送': 'mild', 'kanji | 和': 'mild', 'vocabulary | 表': 'mild', 'vocabulary | 表す': 'mild', 'vocabulary | 早速': 'red', 'vocabulary | 近所': 'yellow', 'vocabulary | 作業': 'yellow', 'vocabulary | 運ぶ': 'yellow', 'vocabulary | 配る': 'mild', 'vocabulary | 算数': 'mild', 'vocabulary | 線路': 'mild', 'vocabulary | 開発': 'mild', 'vocabulary | 親しい': 'mild', 'vocabulary | 調子': 'mild', 'vocabulary | 路地': 'mild', 'vocabulary | 最近': 'mild', 'vocabulary | 化かす': 'mild', 'vocabulary | 口調': 'mild', 'vocabulary | 転がる': 'mild', 'vocabulary | 進む': 'mild', 'vocabulary | 語る': 'mild', 'vocabulary | 開始': 'mild', 'vocabulary | 農場': 'mild', 'vocabulary | 電鉄': 'mild', 'vocabulary | 転送': 'mild', 'vocabulary | 思わず': 'mild', 'vocabulary | 最終': 'mild', 'vocabulary | 入院': 'mild', 'vocabulary | 強調': 'mild', 'vocabulary | 速度': 'mild', 'vocabulary | 病む': 'mild', 'vocabulary | 用意': 'yellow', 'vocabulary | 努力': 'yellow', 'vocabulary | 支度': 'yellow', 'vocabulary | 争う': 'yellow', 'vocabulary | 共同': 'yellow', 'vocabulary | 苦労': 'yellow', 'vocabulary | 気付く': 'yellow', 'vocabulary | 競う': 'yellow', 'kanji | 労': 'mild', 'vocabulary | 開放する': 'mild', 'vocabulary | 仲良し': 'mild', 'vocabulary | 育つ': 'mild', 'vocabulary | 指す': 'mild', 'vocabulary | 主位': 'mild', 'vocabulary | 友好': 'mild', 'vocabulary | 見事': 'mild', 'vocabulary | 利く': 'mild', 'vocabulary | 通う': 'mild', 'vocabulary | 心持': 'mild', 'vocabulary | 労働': 'mild', 'vocabulary | 仲良く': 'mild', 'vocabulary | 仲間': 'mild', 'vocabulary | 意見': 'mild', 'vocabulary | 待合': 'mild', 'vocabulary | 屋上': 'mild', 'vocabulary | 文字通り': 'mild', 'vocabulary | 意外': 'mild', 'vocabulary | 苦手': 'mild', 'vocabulary | 相図': 'mild', 'vocabulary | 注意': 'mild', 'kanji | 働': 'mild', 'vocabulary | 昔話': 'mild', 'vocabulary | 見送る': 'mild', 'kanji | 洋': 'mild', 'vocabulary | 初歩': 'mild', 'vocabulary | 合わせる': 'mild', 'vocabulary | 期待': 'red', 'vocabulary | 行動': 'yellow', 'vocabulary | 湯気': 'yellow', 'vocabulary | 利息': 'yellow', 'vocabulary | 転ぶ': 'yellow', 'vocabulary | 陽気': 'yellow', 'kanji | 陽': 'yellow', 'vocabulary | 植える': 'yellow', 'vocabulary | 商売': 'yellow', 'vocabulary | 起こる': 'mild', 'vocabulary | 登山': 'mild', 'vocabulary | 落ち': 'mild', 'vocabulary | 一流': 'mild', 'vocabulary | 勝手': 'mild', 'kanji | 温': 'mild', 'vocabulary | 親分': 'mild', 'kanji | 湯': 'mild', 'kanji | 息': 'mild', 'vocabulary | 根本': 'mild', 'vocabulary | 流行': 'mild', 'kanji | 植': 'mild', 'vocabulary | 活動': 'mild', 'kanji | 都': 'mild', 'vocabulary | 民族': 'mild', 'vocabulary | 旅': 'mild', 'vocabulary | 会員': 'mild', 'vocabulary | 文章': 'mild', 'vocabulary | 泉': 'mild', 'vocabulary | 根気': 'mild', 'vocabulary | 運動': 'mild', 'kanji | 倍': 'mild', 'vocabulary | 童話': 'mild', 'vocabulary | 都会': 'mild', 'vocabulary | 鳴る': 'mild', 'vocabulary | 家庭': 'mild', 'kanji | 登': 'mild', 'vocabulary | 根': 'mild', 'vocabulary | 息子': 'mild', 'vocabulary | 着く': 'mild', 'kanji | 悲': 'mild', 'vocabulary | 予想': 'red', 'vocabulary | 感想': 'red', 'vocabulary | 感心': 'red', 'vocabulary | 人情': 'red', 'vocabulary | 事情': 'red', 'vocabulary | 器用': 'yellow', 'kanji | 願': 'yellow', 'vocabulary | 想定': 'yellow', 'vocabulary | 整理': 'yellow', 'vocabulary | 整然': 'yellow', 'vocabulary | 思想': 'mild', 'vocabulary | 宿': 'mild', 'vocabulary | 表情': 'mild', 'vocabulary | 器': 'mild', 'vocabulary | 情熱': 'mild', 'vocabulary | 映る': 'mild', 'vocabulary | 養う': 'mild', 'kanji | 想': 'mild', 'vocabulary | 輪': 'mild', 'vocabulary | 疑問': 'mild', 'kanji | 練': 'mild', 'vocabulary | 映像': 'mild', 'vocabulary | 自然': 'mild', 'vocabulary | 暗い': 'mild', 'vocabulary | 謝る': 'mild', 'vocabulary | 詩歌': 'mild', 'vocabulary | 楽器': 'mild', 'kanji | 謝': 'mild', 'kanji | 熱': 'mild', 'vocabulary | 別れる': 'mild', 'vocabulary | 画像': 'mild', 'vocabulary | 目標': 'mild', 'vocabulary | 選手': 'mild', 'kanji | 賞': 'mild', 'vocabulary | 都合': 'red', 'vocabulary | 人性': 'red', 'vocabulary | 良好': 'red', 'vocabulary | 囲む': 'red', 'vocabulary | 求める': 'yellow', 'vocabulary | 格好': 'yellow', 'vocabulary | 折角': 'yellow', 'vocabulary | 念願': 'yellow', 'vocabulary | 技': 'yellow', 'vocabulary | 周年': 'yellow', 'vocabulary | 芸人': 'mild', 'vocabulary | 悪気': 'mild', 'vocabulary | 意地悪': 'mild', 'vocabulary | 材料': 'mild', 'vocabulary | 合格する': 'mild', 'kanji | 技': 'mild', 'vocabulary | 束': 'mild', 'vocabulary | 動かす': 'mild', 'vocabulary | 落ち着く': 'mild', 'vocabulary | 性格': 'mild', 'vocabulary | 意図的': 'mild', 'vocabulary | 特技': 'mild', 'kanji | 求': 'mild', 'vocabulary | 求人': 'mild', 'vocabulary | 残念': 'mild', 'vocabulary | 私立': 'mild', 'vocabulary | 要求': 'mild', 'kanji | 念': 'mild', 'vocabulary | 理性': 'mild', 'vocabulary | 周り': 'mild', 'kanji | 束': 'mild', 'kanji | 雰': 'mild', 'vocabulary | 参る': 'mild', 'vocabulary | 折る': 'mild', 'vocabulary | 計算': 'yellow', 'vocabulary | 信用': 'yellow', 'vocabulary | 信心': 'yellow', 'vocabulary | 計画': 'yellow', 'vocabulary | 伝': 'mild', 'vocabulary | 丈': 'mild', 'vocabulary | 昨今': 'mild', 'vocabulary | 返信': 'mild', 'vocabulary | 列': 'mild', 'kanji | 列': 'mild', 'kanji | 式': 'mild', 'kanji | 紀': 'mild', 'vocabulary | 整える': 'mild', 'vocabulary | 紀元後': 'mild', 'vocabulary | 合計': 'mild', 'kanji | 築': 'mild', 'vocabulary | 仏': 'mild', 'kanji | 浅': 'mild', 'vocabulary | 世紀': 'mild', 'vocabulary | 区分': 'mild', 'vocabulary | 変事': 'mild', 'vocabulary | 自信': 'mild', 'vocabulary | 治安': 'red', 'vocabulary | 保証': 'red', 'vocabulary | 地面': 'yellow', 'vocabulary | 顔面': 'yellow', 'vocabulary | 存じる': 'yellow', 'vocabulary | 係わる': 'yellow', 'vocabulary | 幸福': 'yellow', 'kanji | 険': 'yellow', 'vocabulary | 保つ': 'yellow', 'vocabulary | 事典': 'yellow', 'vocabulary | 保存': 'yellow', 'vocabulary | 証明': 'yellow', 'vocabulary | 世辞': 'yellow', 'vocabulary | 保持': 'yellow', 'vocabulary | 関心': 'yellow', 'vocabulary | 証': 'yellow', 'vocabulary | 芸術家': 'yellow', 'vocabulary | 残品': 'yellow', 'vocabulary | 下品': 'mild', 'vocabulary | 日光浴': 'mild', 'kanji | 係': 'mild', 'kanji | 喜': 'mild', 'vocabulary | 折れる': 'mild', 'kanji | 関': 'mild', 'kanji | 浴': 'mild', 'vocabulary | 急行': 'mild', 'vocabulary | 品': 'mild', 'kanji | 阪': 'mild', 'vocabulary | 冒険': 'mild', 'vocabulary | 場面': 'mild', 'vocabulary | 幸運': 'mild', 'vocabulary | 作品': 'mild', 'kanji | 冒': 'mild', 'vocabulary | 特急': 'mild', 'kanji | 真': 'mild', 'vocabulary | 技術': 'mild', 'vocabulary | 留学': 'mild', 'vocabulary | 心底': 'yellow', 'vocabulary | 敗れる': 'yellow', 'kanji | 結': 'yellow', 'vocabulary | 干渉': 'yellow', 'vocabulary | 川底': 'yellow', 'vocabulary | 交渉': 'mild', 'kanji | 識': 'mild', 'kanji | 署': 'mild', 'vocabulary | 相変わらず': 'mild', 'kanji | 是': 'mild', 'vocabulary | 原因': 'mild', 'vocabulary | 果てる': 'mild', 'vocabulary | 意識': 'mild', 'vocabulary | 栄える': 'mild', 'vocabulary | 虚しい': 'mild', 'vocabulary | 伝説': 'mild', 'vocabulary | 自覚': 'mild', 'vocabulary | 建つ': 'mild', 'kanji | 察': 'mild', 'vocabulary | 知識': 'mild', 'vocabulary | 幻覚': 'mild', 'vocabulary | 結局': 'mild', 'vocabulary | 勝敗': 'mild', 'vocabulary | 試す': 'yellow', 'vocabulary | 人種': 'yellow', 'vocabulary | 取決め': 'yellow', 'vocabulary | 訓練': 'yellow', 'vocabulary | 許す': 'yellow', 'vocabulary | 祈る': 'yellow', 'vocabulary | 取り分け': 'yellow', 'vocabulary | 一等': 'yellow', 'vocabulary | 人類': 'yellow', 'vocabulary | 取材': 'yellow', 'vocabulary | 伝達': 'mild', 'kanji | 訓': 'mild', 'vocabulary | 借用': 'mild', 'vocabulary | 借金': 'mild', 'vocabulary | 切り取る': 'mild', 'vocabulary | 報道': 'mild', 'kanji | 験': 'mild', 'vocabulary | 配達する': 'mild', 'vocabulary | 試みる': 'mild', 'vocabulary | 広告': 'mild', 'kanji | 試': 'mild', 'vocabulary | 取れる': 'mild', 'vocabulary | 煙': 'mild', 'kanji | 絡': 'yellow', 'vocabulary | 比例': 'yellow', 'vocabulary | 乱れる': 'yellow', 'vocabulary | 改まる': 'yellow', 'vocabulary | 果たして': 'yellow', 'vocabulary | 改正': 'yellow', 'vocabulary | 加える': 'yellow', 'vocabulary | 暴れる': 'yellow', 'vocabulary | 改善': 'yellow', 'vocabulary | 財閥': 'mild', 'vocabulary | 続々': 'mild', 'vocabulary | 借財': 'mild', 'vocabulary | 乱戦': 'mild', 'vocabulary | 混乱': 'mild', 'vocabulary | 連日': 'mild', 'kanji | 昆': 'mild', 'vocabulary | 連絡する': 'mild', 'vocabulary | 汽笛': 'mild', 'vocabulary | 自在': 'red', 'vocabulary | 議論': 'yellow', 'vocabulary | 正確': 'yellow', 'vocabulary | 余る': 'yellow', 'vocabulary | 残余': 'yellow', 'vocabulary | 裕福': 'yellow', 'vocabulary | 尾': 'yellow', 'vocabulary | 実在': 'yellow', 'vocabulary | 理論': 'mild', 'vocabulary | 余裕': 'mild', 'vocabulary | 被る': 'mild', 'vocabulary | 有罪': 'mild', 'vocabulary | 災難': 'mild', 'vocabulary | 余計': 'mild', 'vocabulary | 確率': 'mild', 'vocabulary | 機嫌': 'mild', 'vocabulary | 嫌疑': 'mild', 'vocabulary | 非難': 'mild', 'vocabulary | 反省': 'red', 'vocabulary | 総合': 'red', 'vocabulary | 資料': 'red', 'vocabulary | 評判': 'red', 'vocabulary | 審判': 'yellow', 'vocabulary | 省く': 'yellow', 'vocabulary | 審査': 'yellow', 'vocabulary | 義理': 'yellow', 'vocabulary | 総体的': 'yellow', 'vocabulary | 際': 'yellow', 'vocabulary | 評論': 'yellow', 'vocabulary | 解説': 'yellow', 'vocabulary | 条件': 'yellow', 'vocabulary | 乱す': 'yellow', 'vocabulary | 資格': 'yellow', 'vocabulary | 解ける': 'yellow', 'vocabulary | 企てる': 'yellow', 'kanji | 委': 'yellow', 'kanji | 省': 'yellow', 'vocabulary | 得体': 'mild', 'vocabulary | 責める': 'mild', 'kanji | 件': 'mild', 'vocabulary | 布地': 'mild', 'vocabulary | 定義': 'mild', 'kanji | 資': 'mild', 'vocabulary | 義務': 'mild', 'vocabulary | 素材': 'mild', 'kanji | 検': 'mild', 'vocabulary | 区域': 'yellow', 'vocabulary | 対応': 'yellow', 'vocabulary | 価': 'yellow', 'vocabulary | 提案': 'yellow', 'kanji | 域': 'yellow', 'vocabulary | 嫌味': 'mild', 'vocabulary | 姿': 'mild', 'vocabulary | 領域': 'mild', 'vocabulary | 営む': 'mild', 'vocabulary | 指示': 'mild', 'vocabulary | 圧倒する': 'mild', 'vocabulary | 観念': 'mild', 'vocabulary | 位置': 'mild', 'vocabulary | 済ます': 'red', 'vocabulary | 施設': 'yellow', 'vocabulary | 収入': 'yellow', 'vocabulary | 裁判': 'yellow', 'vocabulary | 反則': 'yellow', 'vocabulary | 記載': 'yellow', 'vocabulary | 記述': 'yellow', 'kanji | 販': 'yellow', 'vocabulary | 警視庁': 'yellow', 'vocabulary | 対象': 'yellow', 'vocabulary | 所載': 'yellow', 'vocabulary | 含意': 'red', 'vocabulary | 補う': 'red', 'vocabulary | 収める': 'yellow', 'vocabulary | 絞る': 'yellow', 'vocabulary | 障る': 'red', 'vocabulary | 構造': 'red', 'kanji | 貸': 'red', 'vocabulary | 抜ける': 'red', 'vocabulary | 退く': 'red', 'vocabulary | 処置': 'red', 'kanji | 綺': 'red', 'vocabulary | 清い': 'red'};
    function warn() {
        if ($('#main-info #character').length === 0) return;

        var characters = $('#main-info #character')[0].innerText;
        var type = $('#main-info')[0].className;

        var key = type+' | '+characters;
        //console.log("Current subject:", key, 'indicator:', leech_indicator[key], !leech_indicator[key]);

        if (characters.trim().length > 0 && (type != last_type || characters != last_characters)) {
            if (!leech_indicator[key]) {
                $('#leech-o-meter').hide();
            } else {
                if (leech_indicator[key] == 'mild') {
                    $('#leech-o-meter').show().css('background-color', 'yellow').attr('title', 'A leech for 10-20% of people.');
                } else if (leech_indicator[key] == 'yellow') {
                    $('#leech-o-meter').show().css('background-color', 'orange').attr('title', 'A leech for 20-30% of people.');
                } else {
                    $('#leech-o-meter').show().css('background-color', 'red').attr('title', 'A leech for 30%+ of people!');
                }
            }
            //console.log("New subject!", key, 'indicator:', leech_indicator[key]);
            last_type = type;
            last_characters = characters;
        }

        return;
    }

    setInterval(warn, 250);
})();