-
-
Save snaka/173654 to your computer and use it in GitHub Desktop.
http://
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSS 用 pubsubhubbub publish ブックマークレット *オレ仕様* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _____pshb_BookmarkletRun = function () { | |
var post_id = 'pshb-bookmarklet-iframe'; | |
var post = null; | |
var close = null; | |
if (document.getElementById(post_id) == null) { | |
post = document.createElement('iframe'); | |
post.id = post_id; | |
post.width = '250'; | |
post.height = '120'; | |
var s = post.style; | |
s.position = 'absolute'; | |
s.top = '10px'; | |
s.right = '10px'; | |
s.padding = '0'; | |
s.margin = '0'; | |
s.border = '5px solid #9c0'; | |
s.zIndex = '1000000'; | |
close = document.createElement('a'); | |
close.href = 'javascript:window._____pshb_closeMe();'; | |
close.innerHTML = '×'; | |
s = close.style; | |
s.cursor = 'default'; | |
s.fontWeight = 'bold'; | |
s.fontSize = '12px'; | |
s.position = 'absolute'; | |
s.top = '15px'; | |
s.right = '15px'; | |
s.margin = '0'; | |
s.borderStyle = 'dotted'; | |
s.borderColor = '#aaa;'; | |
s.borderWidth = '0 0 1px 1px'; | |
s.padding = '0 3px 0 3px'; | |
s.display = 'block'; | |
s.textDecoration = 'none'; | |
s.color = '#000'; | |
s.zIndex = '1000001'; | |
}; | |
var canonicalize = function (s) { | |
if (s == '' || s == null) { | |
return ''; | |
}; | |
var temp = document.createElement('div'); | |
temp.innerHTML = s.toLowerCase(); | |
var result = temp.childNodes[0].nodeValue; | |
temp.removeChild(temp.firstChild); | |
return result; | |
}; | |
window._____pshb_closeMe = function () { | |
document.body.removeChild(close); | |
document.body.removeChild(post); | |
}; | |
var findRssFeed = function () { | |
var links = document.getElementsByTagName('link'); | |
for (var i = 0; i < links.length; ++i) { | |
var item = links[i]; | |
if (item.type != undefined && item.href != undefined && item.rel != undefined && canonicalize(item.type).indexOf('application/rss') == 0 && canonicalize(item.rel).indexOf('alternate') == 0 && item.href.length > 0) { | |
return item.href; | |
}; | |
}; | |
return null; | |
}; | |
window._____pshb_sawLoad = false; | |
window._____pshb_autoClose = true; | |
window._____pshb_handleLoad = function () { | |
if (!window._____pshb_sawLoad) { | |
window._____pshb_sawLoad = true; | |
} else { | |
window._____pshb_autoClose = false; | |
}; | |
}; | |
var autoClose = function () { | |
if (window._____pshb_autoClose) { | |
window._____pshb_closeMe(); | |
}; | |
}; | |
if (post != null) { | |
//var feed = findRssFeed(); | |
var feed = "http://feeds.feedburner.com/snaka-hatena" | |
var hub = _____pshb_getHub(); | |
post.onload = _____pshb_handleLoad; | |
post.src = 'http://pubsubhubbub.appspot.com/bookmarklet.html' + '?feed=' + feed + '&hub=' + hub; | |
document.body.appendChild(post); | |
document.body.appendChild(close); | |
setTimeout(autoClose, 10000); | |
}; | |
}; | |
_____pshb_BookmarkletRun(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){if(document.body&&!document.xmlVersion){var jsonp=document.createElement('script');jsonp.type='text/javascript';jsonp.src='http://gist.github.com/raw/173654/a8ad4da86e54eb773caf2d4a3baa4b3cfa7a64a6/bookmarklet_jsonp.min.js?rand='+Math.floor(Math.random()*1000);var head=document.getElementsByTagName('head')[0].appendChild(jsonp);};})();(function(){window._____pshb_getHub = function() {return 'http://pubsubhubbub.appspot.com/';};})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment