Skip to content

Instantly share code, notes, and snippets.

@kurumigi
Created January 1, 2011 11:48
Show Gist options
  • Save kurumigi/761704 to your computer and use it in GitHub Desktop.
Save kurumigi/761704 to your computer and use it in GitHub Desktop.
[GM script]Hatena Haiku notify auto opener / はてなハイク1.1の新着通知を自動で開きます。
// ==UserScript==
// @name Hatena Haiku notify auto opener
// @namespace http://d.hatena.ne.jp/kurumigi/
// @description はてなハイク1.1の新着通知を自動で開きます。
// @include http://h.hatena.ne.jp/*
// @include http://h.hatena.com/*
// @include http://h1beta.hatena.ne.jp/*
// @include http://h1beta.hatena.com/*
// @version 1.2
// ==/UserScript==
location.href = 'javascript:(' + function(){
(function(unsafeWindow){
document.getElementById('main').addEventListener('DOMNodeInserted',function(evt) {
if ((evt.relatedNode.id == 'notifier') && (evt.target.textContent != unsafeWindow.Hatena.Locale.text('haiku.2010.using_beta'))) {
location.href = 'javascript:(' + function(){
var ev1 = document.createEvent('MouseEvents');
ev1.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
document.getElementById('notifier').dispatchEvent(ev1);
}.toString() + ')()';
}
}, false);
})(this.unsafeWindow||window);
}.toString() + ')()';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment