-
-
Save cherenkov/2362580 to your computer and use it in GitHub Desktop.
FreeStyle Wiki Permlinker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name FreeStyleWiki PermLinker | |
// @namespace http://www.suchi.org/ | |
// @version 0.2 | |
// @description add permlink dagger | |
// ==/UserScript== | |
var a = document.querySelectorAll('h2>a[name], h3>a[name], h4>a[name]'); | |
for (var i = 0; i < a.length; i++) { | |
var dag = document.createElement('a'); | |
dag.className = 'anchor_super'; | |
dag.innerHTML = "†"; | |
dag.href = '#' + a[i].name; | |
a[i].parentNode.appendChild(dag); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
class属性はclassNameでアクセス。
一口メモ。classを追加したい場合。
element.className += ' newClass';
element.classList.add('newClass'); //上と同じ
参考:
HTML5で追加されるclassList APIについてのメモ :: 5509
http://5509.me/log/classlist-api