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

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
})();