// ==UserScript== // @name RvB Message Alert Popup // @namespace http://rvb.roosterteeth.com/joequincy // @include http://*.roosterteeth.com/* // ==/UserScript== // This is a modification of a script by #Jo\n // all credit goes to him for the original concept. // http://www.myspace.com/slipinsin /* There are still some bugs to work out in this one. It has issues handling more than one type of alert at once. I'm going to put it out as a beta version though, and ask for the assistance of better Javascript coders than I. */ // Configuration Options: messages = true; messageIcon = 'http://r4wr.com/images/GMmessage.png'; friendrequests = true; friendrequestIcon = 'http://r4wr.com/images/GMfriendrequest.png'; comments = true; commentIcon = 'http://r4wr.com/images/GMcomment.png'; imgcomments = true; imgcommentIcon = 'http://r4wr.com/images/GMcamera.png'; blogComments = true; blogCommentIcon = 'http://r4wr.com/images/GMbcom.png'; blogSubscriptions = true; blogSubscriptionIcon = 'http://r4wr.com/images/GMsubblog.png'; events = true; eventIcon = 'http://r4wr.com/images/GMevent.png'; birthdays = true; birthdayIcon = 'http://r4wr.com/images/GMbirthday.png'; /* Don't edit anything below unless you know what you're doing */ function makeRequest() { GM_xmlhttpRequest({ method:"GET", url:"http://www.roosterteeth.com/members/index.php", headers:{ "User-Agent":"monkeyagent", "Accept":"text/monkey,text/xml", }, onload: function(details) { // Store html of the RvB homepage. var response=details.responseText; // Retrieve the user's current site. var site=window.location.host; // Fill in applicable notifications var html= ''; var msgTest=/You have (.*)(\d+)(.*) new message(s?)\./i; var msgLength=msgTest.test(response); if(msgLength == true) { msgText=msgTest.exec(response)[0]; msghtml= ' '+msgText+'
'; show = 1; } else{ msghtml= ''; } var reqTest=/You have (.*)(\d+)(.*) new friend request(s?)\./i; var reqLength=reqTest.test(response); if(reqLength == true) { reqText=reqTest.exec(response)[0]; reqhtml= ' '+reqText+'
'; show = 1; }else{ reqhtml= ''; } var comTest=/You have (.*)(\d+)(.*) new personal comment(s?)\./i; var comLength=comTest.test(response); if(comLength == true) { comText=comTest.exec(response)[0]; comhtml= ' '+comText+'
'; show = true; }else{ comhtml= ''; } /* var imgAlert=response.split("You have * new image comment*"); var imgText=response.split("/members/images/image.php?id=*'"); var reqLength=reqAlert.length - 1; if(reqLength == 0) { html+= ' You have new Image Comments!
'; show = true; } var jcomAlert=response.split("You have * new journal comment*"); var imgText=response.split("/members/journal/entry.php?id=*'"); var reqLength=reqAlert.length - 1; if(reqLength == 0) { html+= ' You have new Journal Comments!
'; show = true; } */ if(show) { // Create notifier element. var notifier = document.createElement('div'); notifier.setAttribute('id', 'GM_RvBNotify'); document.body.appendChild(notifier); notifier.innerHTML = msghtml + reqhtml + comhtml; // Apply some custom CSS to the notifier element. GM_addStyle('#GM_RvBNotify {' + 'display:block!important;' + 'position:fixed!important;' + 'top:0!important;' + 'left:0!important;' + 'z-index:9999!important;' + 'width:160px!important;' + 'background-color:#660000!important;' + 'opacity:0.9!important;' + 'text-align:left!important;' + '-moz-border-radius:0 10px 10px 0!important;' + 'padding:3px!important;}' + '#GM_RvBNotify a {' + 'display:inline!important;' + 'color:#000000!important;' + 'text-decoration:none!important;' + 'line-height:8px;' + 'font:normal 10px Arial, serif!important;}' + '#GM_RvBNotify br {display:inline!important}' + '#GM_RvBNotify img {width:12px!important;opacity:1!important;border:none!important}' ); } } }); } // Make sure we're not in a frame's body, then execute script. if(top.location == location) { makeRequest(); }