Greasy Fork

Greasy Fork is available in English.

扇贝单词默认显示我的笔记

背单词时自动滚到页面底部并展示我的笔记

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         扇贝单词默认显示我的笔记
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  背单词时自动滚到页面底部并展示我的笔记
// @author       wowo878787
// @match        https://web.shanbay.com/wordsweb/*
// @require      https://code.jquery.com/jquery-2.2.4.min.js
// @grant        none
// ==/UserScript==

(function() {
    $("<style></style>").text(".Layout_page__2Wedt{padding-bottom:0}.index_left__3SFmQ{white-space:pre-line};").appendTo($("head"));

    will_scroll = false
    is_detail_old = 0

    var interval = setInterval(function(){
        is_detail = $('.VocabPronounce_word__17Tma').length

        // 判断是否在单词详情页, 并决定 scroll 到页面底部
        if(is_detail_old === 0 && is_detail === 1){
            will_scroll = true
            is_detail_old = is_detail
        }
        else if(is_detail_old === 1 && is_detail === 0){
            will_scroll = false
            is_detail_old = is_detail
        }
        else{
            will_scroll = false
        }

        if(will_scroll){
            $('.index_noteWrap__DZxrn .index_tabs__1CVfU .index_tab__37Cha:nth-child(2)').click();
            window.scrollTo(0,document.body.scrollHeight);
        }
    },500);
})();