Greasy Fork

语雀小屏幕适配,笔记详情页添加返回笔记目录按钮

try to take over the world!

// ==UserScript==
// @name         语雀小屏幕适配,笔记详情页添加返回笔记目录按钮
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.yuque.com/rockykwok/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // get url
    var url = window.location.href;
    url = url.split('/', 5).join('/');
    // insert before lark-editor-header-action
    var a = document.createElement('a')
    a.setAttribute('href', url)
    a.setAttribute('class', 'backtotoc')
    a.appendChild(document.createTextNode('回到笔记目录 > '))
    var el = document.getElementsByClassName('header-crumb')[0]
    el.insertBefore(a, document.getElementsByClassName('lark-breadcrumb')[0])
    console.log(url, a, el)
})();