您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
ChordWikiのコードブックにないフレットボードをJGuitarから取得します。また、付加機能として、フレットボードの表示の動作を早めにしたり、矢印・括弧やUnicodeの音楽記号の含むコードを正しくフレットボードを表示したりします。
当前为
// ==UserScript== // @name ChordWikiGetExternalChord // @namespace https://twitter.com/graphemec1uster // @version 1.0 // @description ChordWikiのコードブックにないフレットボードをJGuitarから取得します。また、付加機能として、フレットボードの表示の動作を早めにしたり、矢印・括弧やUnicodeの音楽記号の含むコードを正しくフレットボードを表示したりします。 // @author ぐらふぃーむ // @match *://ja.chordwiki.org/wiki* // @grant GM_xmlhttpRequest // @grant GM.xmlhttpRequest // @connect jguitar.com // @noframes // ==/UserScript== if (typeof GM_xmlhttpRequest == "undefined") GM_xmlhttpRequest = GM.xmlHttpRequest; document.body.onload = function() { popupImage = function(filepath, e) { if (filepath == ">" || filepath == ">") return; filepath = filepath.replace(/♭/g, "b").replace(/♯/g, "s").replace(/𝄪/g, "ss").replace(/𝄫/g, "bb").replace(/[^!-~]/g, ""); var img = popupImage.imgNode; if (!img) { popupImage.imgNode = img = document.createElement("img"); if (document.all && _ie10) { img.attachEvent("onclick", closeImage); img.attachEvent("onmouseout", closeImage); } else if (document.implementation) { img.addEventListener("click", closeImage, true); img.addEventListener("mouseout", closeImage, true); } img.style.position = "absolute"; img.style.borderColor = "#0099FF"; img.style.backgroundColor = "#FFFFFF"; img.style.borderWidth = "2px"; img.style.borderStyle = "solid"; img.style.margin = "0"; } if (document.all && _ie10) e.target.attachEvent("mouseout", closeImage); else if (document.implementation) e.target.addEventListener("mouseout", closeImage, true); var match = filepath.match(/^\/cd\/\((.+)\)\.png$/); if (match) e.target.setAttribute("onclick", "javascript:popupImage('" + (filepath = "/cd/" + match[1] + ".png") + "', event);"); img.setAttribute("src", filepath); img.style.left = getLeftFromEvent(e) + "px"; img.style.top = getTopFromEvent(e) - 80 + "px"; if (filepath.charAt(0) == "h") img.style.width = img.style.height = "72px"; else { img.style.width = img.style.height = ""; if (filepath != "/cd/N.C..png") img.onload = function() { if (img.height == 76) { GM_xmlhttpRequest({ method: "GET", url: "https://jguitar.com/chordsearch/" + encodeURIComponent(e.target.innerText.replace(/♭/g, "b").replace(/♯/g, "#").replace(/𝄪/g, "##").replace(/𝄫/g, "bb").replace(/\(?単音\)?(.*)/, "$15omit5").replace(/[^!-~]/g, "").replace("on", "/").replace(/[(,]/g, "add").replace(/\)/g, "").replace("sus24", "sus2sus4").replace(/blk(sus4|M7)/, "9sus4-5").replace(/blk[37]/, "9-5").replace("blk", "9-5omit3")), onload: function(response) { if (response.responseText) var match = response.responseText.match(/src="(\/images\/chordshape\/.+?)"/); if (match) { e.target.setAttribute("onclick", "javascript:popupImage('" + (filepath = "https://jguitar.com" + match[1]) + "', event);"); img.onload = null; img.setAttribute("src", filepath); img.style.width = img.style.height = "72px"; } } }); } } } document.body.appendChild(img); popupImage.removed = false; function closeImage() { if (!popupImage.removed) { document.body.removeChild(img); popupImage.removed = true; } } }; };