Rust Doc to Chinese ver

Jump to chinese version of this doc page

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Rust Doc to Chinese ver
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Jump to chinese version of this doc page
// @author       安逐悲
// @match        *://doc.rust-lang.org/*
// @icon         https://www.rust-lang.org/static/images/rust-logo-blk.svg
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const AllUrl="https://rustwiki.org";
    const TargetUrl="https://rustwiki.org/zh-CN";
    let head=document.querySelector('.search-form');
    let btn = document.createElement('button');
    btn.type='button';
    let currentUrl= document.URL;
    const hostname = window.location.hostname;
    const path = currentUrl.split(hostname)[1];

    btn.textContent = '转到中文站';

    btn.addEventListener('click',() => {
        window.location.href = TargetUrl+path;
    });
    head.appendChild(btn);
})();