Skip to content

Instantly share code, notes, and snippets.

@umq
Created August 1, 2008 09:50
Show Gist options
  • Save umq/3608 to your computer and use it in GitHub Desktop.
Save umq/3608 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name nikkei-pc-em-refs
// @namespace http://slashdot.jp/~umq/
// @description Notify old articles
// @include http://pc.nikkeibp.co.jp/article/*
// ==/UserScript==
(function(){
var node = document.evaluate(
'//span[@class="co_capS"]',
document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if (node.singleNodeValue) {
var mediaSourceNote = document.createElement('div');
mediaSourceNote.setAttribute('id', 'nikkei-pc-em-refs');
var mediaSourceTitle = document.createElement('b');
mediaSourceTitle.appendChild(
document.createTextNode(
node.singleNodeValue.textContent));
mediaSourceNote.appendChild(mediaSourceTitle);
var node = document.evaluate(
'//div[@class="co_capS"]',
document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if (node.singleNodeValue) {
mediaSourceNote.appendChild(document.createElement('br'));
mediaSourceNote.appendChild(
node.singleNodeValue.firstChild.cloneNode(true));
var nStyle = mediaSourceNote.style;
nStyle.cursor = 'pointer';
nStyle.position = 'fixed';
nStyle.top = '1em';
nStyle.left = '1ex';
nStyle.zIndex = '10';
nStyle.backgroundColor = '#222';
nStyle.color = 'white';
nStyle.linkColor = 'white';
nStyle.vlinkColor = 'white';
nStyle.fontSize = 'large';
nStyle.border = '3px solid red';
nStyle.padding = '1ex';
document.body.appendChild(mediaSourceNote);
document.getElementById('nikkei-pc-em-refs').addEventListener(
'click',
function() {
document.body.removeChild(this);
},
false);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment