bookmarklet
by
nonnonHTN
2017-06-05 [2017/06/05 12:33:01]
my bookmarklet
@@ -6,12 +6,18 @@
* @require
*/
-function __comm(idx)
+function __show(idx)
{
var popup = document.getElementById('__commPopup_' + idx);
if ( !span ) return;
popup.style.display='';
}
+function __show(idx)
+{
+ var popup = document.getElementById('__commPopup_' + idx);
+ if ( !span ) return;
+ popup.style.display='none';
+}
(function o()
{
@@ -26,9 +32,9 @@
var targetspan = document.getElementById('comment_otherdetails_' + comm_idx );
var link_id = i + "__" + comm_idx;
var targethtml = targetspan.parentNode.parentNode.parentNode.getElementsByClassName('contents_text')[0].innerHTML;
- html = html.substring(0,idx) + '<span onclick="__show('+ link_id +');" style="color:blue;">#'
+ html = html.substring(0,idx) + '<span onclick="__show(\"'+ link_id +'\");" style="color:blue;">#'
+ comm_idx + '</span>'
- + '<div class="_popop" id="__commPopup_' + link_id + '" style="position:absolute;background-color:white;border: 1 solid;display:none;" onclick="__hide(' + link_id + ')">'
+ + '<div class="_popop" id="__commPopup_' + link_id + '" style="position:absolute;background-color:white;border: 1 solid;display:none;" onclick="__hide(\"' + link_id + '\")">'
+ targethtml + '</div>' + html.substring(idx + 8);
elm.innerHTML = html;
}
/*
* @title bookmarklet
* @description my bookmarklet
* @include http://*
* @license MIT License
* @require
*/
function __show(idx)
{
var popup = document.getElementById('__commPopup_' + idx);
if ( !span ) return;
popup.style.display='';
}
function __show(idx)
{
var popup = document.getElementById('__commPopup_' + idx);
if ( !span ) return;
popup.style.display='none';
}
(function o()
{
var elms=document.getElementsByClassName('contents_text');
var length = elms.length;
for(i = 0; i < length; ++i){
elm = elms[i];
html = elm.innerHTML;
var idx = html.search("#[0-9]{7}");
if ( idx < 0 ) continue;
var comm_idx = html.substring(idx + 1, idx + 1 + 7);
var targetspan = document.getElementById('comment_otherdetails_' + comm_idx );
var link_id = i + "__" + comm_idx;
var targethtml = targetspan.parentNode.parentNode.parentNode.getElementsByClassName('contents_text')[0].innerHTML;
html = html.substring(0,idx) + '<span onclick="__show(\"'+ link_id +'\");" style="color:blue;">#'
+ comm_idx + '</span>'
+ '<div class="_popop" id="__commPopup_' + link_id + '" style="position:absolute;background-color:white;border: 1 solid;display:none;" onclick="__hide(\"' + link_id + '\")">'
+ targethtml + '</div>' + html.substring(idx + 8);
elm.innerHTML = html;
}
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。