TRPL Bookmarks

Add bookmarks to the rust programming language website.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         TRPL Bookmarks
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  Add bookmarks to the rust programming language website.
// @author       Cai
// @match        https://kaisery.github.io/trpl-zh-cn/*
// @grant        GM_addStyle
// ==/UserScript==

GM_addStyle(`
#menu-bar-sticky-container {
  backdrop-filter: blur(3px)!important;
  background: rgba(255,255,255,0.6)!important;
  border-bottom-width: 0!important;
}
.content main {
  margin-right: 0!important;
}
.cczz-out {
  position: fixed;
  top: 60px;
  z-index: 100;
  padding: 10px;
  border-radius: 5px;
  background: #ccc5;
  backdrop-filter: blur(2px);
}
.cczz-node {
  display: block;
}
.cczz-H2 {
  font-size: 16px;
  font-weight: bold;
}
.cczz-H3 {
  font-size: 14px;
  color: black!important;
}
.cczz-H4 {
  font-size: 12px;
  color: grey!important;
  text-indent: 24px;
}
`)

const $content = document.getElementById("content")
const $headers = $content.getElementsByClassName("header")
const $bookmark = document.createElement("DIV")
$bookmark.classList.add("cczz-out")
Array.from($headers).forEach($el => {
    const $node = document.createElement("A")
    $node.innerText = $el.innerText
    $node.href = $el.href
    $node.classList.add("cczz-node", "cczz-" + $el.children[0].tagName)
    $bookmark.appendChild($node)
})
$content.appendChild($bookmark)