您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
ChordWikiのコードブックにないフレットボードをJGuitarから取得します。また、矢印や括弧、全角の♯や♭が使われている場合のフレットボード表示にも対応しています。付加機能として、フレットボードの表示速度の改善も行っています。
当前为
// ==UserScript== // @name ChordWikiGetExternalChord // @namespace https://twitter.com/graphemec1uster // @version 1.1 // @description ChordWikiのコードブックにないフレットボードをJGuitarから取得します。また、矢印や括弧、全角の♯や♭が使われている場合のフレットボード表示にも対応しています。付加機能として、フレットボードの表示速度の改善も行っています。 // @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() { var imageList = {}; 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 chord = 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")); 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); if (imageList[chord]) e.target.setAttribute("onclick", "javascript:popupImage('" + (filepath = "https://jguitar.com" + imageList[chord]) + "', event);"); else { 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.borderColor = "#585E72"; img.style.width = img.style.height = "72px"; } else { img.style.borderColor = "#0099FF"; img.style.width = img.style.height = ""; if (filepath != "/cd/N.C..png") img.onload = function() { img.onload = null; if (img.height == 76) { GM_xmlhttpRequest({ method: "GET", url: "https://jguitar.com/chordsearch/" + chord, 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" + (imageList[chord] = match[1])) + "', event);"); img.setAttribute("src", filepath); img.style.borderColor = "#585E72"; 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; } } }; };