Skip to content

Instantly share code, notes, and snippets.

@liquidz
Created May 1, 2009 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liquidz/104973 to your computer and use it in GitHub Desktop.
Save liquidz/104973 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name nicomessage
// @namespace http://www.nifty.com
// @include http://www.nicotto.jp/user/mypage
// ==/UserScript==
(function(){
// =$
// ----------------------------------------------------
var $ = function(id){
return (id && id != "") ? document.getElementById(id) : null;
};
// =foreach
// ----------------------------------------------------
var foreach = function(obj, fn){
for(var i = 0; i < obj.length; ++i){
if(fn(obj[i], i) == -1) break;
}
};
// =main
// ----------------------------------------------------
GM_xmlhttpRequest({
method: 'GET',
url: 'http://www.nicotto.jp/user/mypage/myboardlist?user_id=181404',
onload: function(res){
var html = res.responseText.replace(/[\r\n\t]/g, "");
var all = html.match(/<dl>(.+?)<\/dl>/g);
var mbl = $("myBoardList");
if(mbl){
mbl.innerHTML = "";
foreach(all, function(m){
var div = document.createElement("div");
div.setAttribute("class", "newMessageList");
div.innerHTML = m.replace("<dl>", "<dl style='margin-left:0;height:auto;'>").replace(/<dd class="btn">.+?<\/dd>/, "");
mbl.appendChild(div);
});
}
},
onerror: function(res){
GM_log("error: " + res);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment