Skip to content

Instantly share code, notes, and snippets.

@cherenkov
Forked from suchi/fsplinker.js
Created April 11, 2012 21:06
Show Gist options
  • Save cherenkov/2362580 to your computer and use it in GitHub Desktop.
Save cherenkov/2362580 to your computer and use it in GitHub Desktop.
FreeStyle Wiki Permlinker
// ==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 = "&dagger;";
dag.href = '#' + a[i].name;
a[i].parentNode.appendChild(dag);
}
@cherenkov
Copy link
Author

class属性はclassNameでアクセス。

一口メモ。classを追加したい場合。
element.className += ' newClass';
element.classList.add('newClass'); //上と同じ

参考:
HTML5で追加されるclassList APIについてのメモ :: 5509
http://5509.me/log/classlist-api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment