|
|
1行目: |
1行目: |
| // ==UserScript==
| | / == UserHeat == |
| // -*- mode:JScript; Encoding:utf8n -*-
| |
| // @name Wikipedia.citePopup
| |
| // @namespace http://d.hatena.ne.jp/p-arai/
| |
| // @description Add pop-up on reference to footnote
| |
| // @include http://ja.wikipedia.org/wiki/*
| |
| // @grant none
| |
| //
| |
| // @author p-arai, yuuAn
| |
| // @version 2012.11.10
| |
| // ==/UserScript==
| |
| | |
| (function () {
| |
| | |
| // retrive array of cites
| |
| var cites = new Array();
| |
| var lis = document.getElementsByTagName("li");
| |
| for (var i=0; i < lis.length; i++){
| |
| var li = lis[i];
| |
| if (li.id.match(/^cite_note(?:-[\w\.]+){0,}-(\d+)$/)){
| |
| var index = RegExp.$1;
| |
| cites[index] = li;
| |
| }
| |
| }
| |
| | |
| // retrive and modify reference element
| |
| var hrefs = document.getElementsByTagName("a");
| |
| for (var i=0; i < hrefs.length; i++){
| |
| var a = hrefs[i];
| |
| if (a.href.match(/#cite_note(?:-[\w\.]+){0,}-(\d+)$/)){
| |
| var index = RegExp.$1;
| |
| if (typeof a.textContent != "undefined") {
| |
| a.title = cites[index].textContent.replace(/^[^]\s*/, "");
| |
| } else {
| |
| a.title = cites[index].innerText.replace(/^[^]\s*/, "");
| |
| }
| |
| }
| |
| }
| |
| | |
| })();
| |
| | |
| | |
| // == UserHeat ==
| |
| (function(add, cla){window['UserHeatTag']=cla;window[cla]=window[cla]||function(){(window[cla].q=window[cla].q||[]).push(arguments)},window[cla].l=1*new Date();var ul=document.createElement('script');var tag = document.getElementsByTagName('script')[0];ul.async=1;ul.src=add;tag.parentNode.insertBefore(ul,tag);})('//uh.nakanohito.jp/uhj2/uh.js', '_uhtracker');_uhtracker({id:'uhxScATTSI'}); | | (function(add, cla){window['UserHeatTag']=cla;window[cla]=window[cla]||function(){(window[cla].q=window[cla].q||[]).push(arguments)},window[cla].l=1*new Date();var ul=document.createElement('script');var tag = document.getElementsByTagName('script')[0];ul.async=1;ul.src=add;tag.parentNode.insertBefore(ul,tag);})('//uh.nakanohito.jp/uhj2/uh.js', '_uhtracker');_uhtracker({id:'uhxScATTSI'}); |