Created
May 1, 2009 10:19
-
-
Save liquidz/104973 to your computer and use it in GitHub Desktop.
This file contains 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
// ==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