コメントをさらすユーザースクリプト
ちょっと必要な場面があったので作った。
// ==UserScript== // @name Comment Exposer // @description Make all comments visible // ==/UserScript== (function() { var textnodes = document.evaluate( "//comment()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < textnodes.snapshotLength; i++) { var node = textnodes.snapshotItem(i); var s = node.data; var sp = document.createElement("span"); sp.setAttribute("style", "color: #a00"); var sp_content = document.createTextNode(node.data); sp.appendChild(sp_content); node.parentNode.replaceChild(sp, node); } })();