adiary wiki content link key fix

adiaryのwikiコンテンツ化したリンクキーを自動で入力

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           adiary wiki content link key fix
// @namespace      http://efcl.info/
// @description    adiaryのwikiコンテンツ化したリンクキーを自動で入力
// @include        http://efcl.info/adiary/*?diary_edit
// @version 0.0.1.20140518104257
// ==/UserScript==
new function() {
    var title = document.getElementsByName("title")[0];
    var linkkey = document.getElementsByName("link_key")[0];
    var upnodeSelect = document.getElementById("upnode-select");
    var reg = /[\s.!#$%<>"'()=~|?:@,;\\]/g; // 除外する文字列
    title.addEventListener("keyup", function() {
        linkkey.value = title.value.replace(reg, "");
    }, false);
    upnodeSelect.addEventListener("change", function(evt) {
        var selectValue = evt.target.value || null;
        if (selectValue) {
            linkkey.value = selectValue.replace(reg, "") + "/" + linkkey.value;
        }
    }, false);
}