Greasy Fork

来自缓存

Greasy Fork is available in English.

MEMRISE / add a link in the navigation bar

Click on the memrise's logo in the navigation bar to add a new link

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         MEMRISE / add a link in the navigation bar
// @name:fr      MEMRISE / ajoutez un lien dans la barre de navigation
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Click on the memrise's logo in the navigation bar to add a new link
// @description:fr  Cliquez sur le logo de memrise pour ajouter a nouveau lien
// @author       nadroy
// @include      /https:\/\/www\.memrise\.com/
// @grant        none
// ==/UserScript==
(function(){
    var ls = window.localStorage
    var btnColored = document.getElementsByClassName("header-nav-item colored premium")[0]
    if(ls.getItem("TheNewLinks") != null && ls.getItem("TheNewLinks") != "" && ls.getItem("TheNewLinks").includes(":")){
        btnColored.insertAdjacentHTML("beforebegin" , ls.getItem("TheNewLinks"))
    }
    var memriseLogo = document.getElementsByClassName("header-logo-desktop")[0]
    document.getElementsByClassName("header-logo")[0].removeAttribute("href")
    function addElementNav(){
        var newLinkValue = prompt("The new link : ")
        var newTextLinkValue = prompt("Text to display : ")
        var theLink = `<li class="header-nav-item plain"><a href="` + newLinkValue + `" class="nav-item-btn">
                        <span class="nav-item-btn-text plain">` + newTextLinkValue + `</span>
                    </a></li>`
        if(newTextLinkValue != ""){
            if(newLinkValue.includes("http://") != false || newLinkValue.includes("https://") != false){
                if(ls.getItem("TheNewLinks") != null && ls.getItem("TheNewLinks") != ""){
                    ls.setItem("TheNewLinks" , ls.getItem("TheNewLinks") + theLink)
                    btnColored.insertAdjacentHTML('beforebegin' , theLink)
                }else{
                    ls.setItem("TheNewLinks" , theLink)
                    btnColored.insertAdjacentHTML('beforebegin' , theLink)
                }

            }else{
                return false
            }
        }else{
            return false
        }
        return false
    }
    memriseLogo.onclick = function(){
        addElementNav()
    }
})()