!link
by
rikuba
2013-01-29 [2013/01/29 00:04:46]
(Forked from
!link by
noromanba)
toggle enable/disable links
@@ -7,8 +7,15 @@
* @require
*/
-Array.prototype.slice.call(document.querySelectorAll('a[href]')).forEach(function (link) {
- var style = link.style;
- // c.f. http://caniuse.com/pointer-events
- style.pointerEvents = style.pointerEvents === 'none' ? '' : 'none'; // awful...
-});
+(function (doc) {
+ var id = '-bookmarklet-disable-link-';
+ var style = doc.getElementById(id);
+ if (style) {
+ style.parentNode.removeChild(style);
+ return;
+ }
+ style = doc.createElement('style');
+ style.id = id;
+ style.textContent = 'a[href] { pointer-events: none; }';
+ doc.head.appendChild(style);
+})(document);
/*
* @title !link
* @description toggle enable/disable links
* @include http://*
* @include https://*
* @license MIT License http://nrm.mit-license.org/2013
* @require
*/
(function (doc) {
var id = '-bookmarklet-disable-link-';
var style = doc.getElementById(id);
if (style) {
style.parentNode.removeChild(style);
return;
}
style = doc.createElement('style');
style.id = id;
style.textContent = 'a[href] { pointer-events: none; }';
doc.head.appendChild(style);
})(document);
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。