Greasy Fork

Greasy Fork is available in English.

扇贝单词笔记编辑框加高, 取词自动朗读

扇贝单词笔记编辑框加大. 取词放大语音按钮 & 自动朗读英音.

目前为 2020-02-09 提交的版本,查看 最新版本

// ==UserScript==
// @name         扇贝单词笔记编辑框加高, 取词自动朗读
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  扇贝单词笔记编辑框加大. 取词放大语音按钮 & 自动朗读英音.
// @author       wowo878787
// @match        https://www.shanbay.com/review/learning/*
// @match        https://www.shanbay.com/bdc/vocabulary/*
// @match        https://www.shanbay.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    $("<style></style>").text("textarea.note-textarea{height: 350px;}\
                               .icon-volume-off:before{font-size: xx-large;}\
                               .icon-volume-up:before{font-size: xx-large;}\
                               .popover-title .speaker{display: inline-block; width: 30px;}\
                              ").appendTo($("head"));

    var will_read = false;
    var input_new, input_old

    var interval = setInterval(function(){
        var is_pop = $('.popover').length
        if(is_pop === 1){
            input_new = $('.popover-title .word').text()
        }

        if (input_old != input_new){
            will_read = true;
            input_old = input_new
        }
        else {
            will_read = false
        }

        if(will_read){
            $(".speaker[data-target='uk']").click();
        }
    }, 900);
})();