There are 2 previous versions of this script.
// ==UserScript==
// @name MySpace Home - Advanced Customize It
// @namespace Seifer - http://userscripts.org/users/33118
// @description Add/Remove columns/rows and move things around on your homepage like never before :)
// @include http://home.myspace.com/*fuseaction=user*
// @exclude *fuseaction=user.*
// ==/UserScript==
if ($('col3')) { init(); // Check that we're using the new skin and initiate.
/* ==================================================================================
Change the variables below to setup your home page exactly how you want!
-------------------------------------------------------------------------------------
Use the letters to position the different "pieces" of the homepage in each column.
The first letter is the top, the last letter is the bottom.
A Profile
B Updates
C Applications Navigation
D Address Book (Find your friends..)
E Googles Ads
F Friend Status
G Friend Updates
H Bulletins
I Friend Space
J Square Ad
K Featured Profile and Ad
L Tabbed Ads
M MySpace Annoucement (message from Tom)
N Applications
O People You May Know
Y Comments On Homepage (needs http://userscripts.org/scripts/show/24394)
Z GreaseMonkey Script Link-Backs */
SetWidth('1640'); // Set the width of the entire page.
Column('','3');
Column('AB','195');
Column('','7');
Column('MH','714');
Column('','7');
Column('F','710');
Seperate();
Column('','3');
Column('G','815');
Column('','7');
Column('I','811');
Row('NZ');
SHOW_HAU_SETTINGS = 0; // Show InsaneNinja's Home-Auto Update controls. 1=yes, 0=no.
ENHANCED_BULLETINS = 1; // Show enhanced bulletin board? 1=yes, 0=no.
TOTAL_BULLETINS = 7; // How many bulletins to show on homepage if enhanced is on.
UPDATE = 1; // Update homepage? 1=yes, 0=no.
MENU_ALWAYS_OPEN = 1; // Show "View My" menu as always open. 1=yes, 0=no.
/**** To hide a piece completely just don't use its letter. ****
=======================================================================================
STOP EDITTING HERE UNLESS YOU KNOW WHAT YOU'RE DOING!
=====================================================================================*/
}
// ========= ADD FROM HERE ONWARDS TO YOUR SCRIPT =========
// This auto update-notification script was made by Seifer
// You can find it at http://userscripts.org/scripts/show/12193
// ========================================================
// === Edit the next four lines to suit your script. ===
scriptName='Myspace - Advanced Customize It';
scriptId='49521';
scriptVersion=1;
scriptUpdateText='Initial Release';
// === Stop editing here. ===
var lastCheck = GM_getValue('lastCheck', 0);
var lastVersion = GM_getValue('lastVersion', 0);
var d = new Date();
var currentTime = Math.round(d.getTime() / 1000); // Unix time in seconds
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth;
winH = window.innerHeight;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
if (currentTime > (lastCheck + 86400)) { //24 hours after last check
GM_xmlhttpRequest({
method: 'GET',
url: 'http://userscripts.org/scripts/review/'+scriptId+'?format=txt',
headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey','Accept': 'text/plain',},
onload: function(responseDetails) {
var text = responseDetails.responseText;
var onSiteVersion = text.substring(text.indexOf("scriptVersion=")+14,text.indexOf("\n",text.indexOf("scriptVersion="))-2);
var onSiteUpdateText = text.substring(text.indexOf("scriptUpdateText=")+18,text.indexOf("\n",text.indexOf("scriptUpdateText="))-3);
if(onSiteVersion > scriptVersion && onSiteVersion > lastVersion) {
GM_addStyle('#gm_update_alert {'
+' position: fixed;'
+' z-index:100000;'
+' top: '+((winH/2)-60)+'px;'
+' left: '+((winW/2)-275)+'px;'
+' width: 550px;'
+' height: 120px;'
+' background-color: yellow;'
+' text-align: center;'
+' font-size: 11px;'
+' font-family: Tahoma;'
+'}'
+'#gm_update_alert_buttons {'
+' position: relative;'
+' top: -5px;'
+' margin: 7px;'
+'}'
+'#gm_update_alert_button_close {'
+' position: absolute;'
+' right: 0px;'
+' top: 0px;'
+' padding: 3px 5px 3px 5px;'
+' border-style: outset;'
+' border-width: thin;'
+' z-index: inherit;'
+' background-color: #FF0000;'
+' color: #FFFFFF;'
+' cursor:pointer'
+'}'
+'#gm_update_alert_buttons span, #gm_update_alert_buttons span a {'
+' text-decoration:underline;'
+' color: #003399;'
+' font-weight: bold;'
+' cursor:pointer'
+'}'
+'#gm_update_alert_buttons span a:hover {'
+' text-decoration:underline;'
+' color: #990033;'
+' font-weight: bold;'
+' cursor:pointer'
+'}');
newversion = document.createElement("div");
newversion.setAttribute('id', 'gm_update_alert');
newversion.innerHTML = ''
+' <b>GreaseMonkey UserScript Update Notification</b><br>'
+' There is an update available for "'+scriptName+'" <br>'
+' You are currently running version '+scriptVersion+'. The newest version is '+onSiteVersion+'.<br>'
+' <br>'
+' <div id="gm_update_alert_button_close">'
+' Close</div>'
+' <b>What do you want to do?</b><br>'
+' <div id="gm_update_alert_buttons">'
+' <span id="gm_update_alert_button_showinfo"><a href="#">Show Update Info</a></span> '
+' <span id="gm_update_alert_button_scripthome"><a target="_blank" href="http://userscripts.org/scripts/show/'+scriptId+'">Go To Script Homepage</a></span> '
+' <span id="gm_update_alert_button_upgrade"><a href="http://userscripts.org/scripts/source/'+scriptId+'.user.js">Upgrade to version '+onSiteVersion+'</a></span> '
+' <span id="gm_update_alert_button_wait"><a href="#">Don't remind me again until tomorrow</a></span> '
+' <span id="gm_update_alert_button_waitnextversion"><a href="#">Don't remind me again'
+' until the next new version</a></span> </div>';
document.body.insertBefore(newversion, document.body.firstChild);
document.getElementById('gm_update_alert_button_showinfo').addEventListener('click', function(event) {
alert(onSiteUpdateText);
}, true);
document.getElementById('gm_update_alert_button_wait').addEventListener('click', function(event) {
GM_setValue('lastCheck', currentTime);
alert("You will not be reminded again until tomorrow.");
document.body.removeChild(document.getElementById('gm_update_alert'));
}, true);
document.getElementById('gm_update_alert_button_waitnextversion').addEventListener('click', function(event) {
GM_getValue('lastVersion', onSiteVersion);
alert("You will not be reminded again until the next new version is released.");
document.body.removeChild(document.getElementById('gm_update_alert'));
}, true);
document.getElementById('gm_update_alert_button_close').addEventListener('click', function(event) {
document.body.removeChild(document.getElementById('gm_update_alert'));
}, true);
}
}
});
}
function init() {
piece = [];
columns=0;
rows=0;
lastAdded='row';
////////////////////////////////
// Create script link-back (Concept by InsaneNinja)
//
if (!$('GM_Script_Links')) { var gsl = document.createElement('p'); gsl.setAttribute('id','GM_Script_Links');
if ($('col1')) $('col1').appendChild(gsl); GM_addStyle('#GM_Script_Links a {display:block;color:#CCC!important;}') }
GM_addStyle('#GM_Script_Links { text-align: center }');
$('GM_Script_Links').innerHTML += '<a href="http://userscripts.org/scripts/show/49521">GM - Advanced Customize it!</a>';
//
// if ($('GM_Script_Links') && $('GM_Script_Links').innerHTML.match('scripts/show/49521">GM')) (
////////////////////////////////
/* ==========================
Define all the pieces of the homepage so
they can be manipulated later.
------------------------*/
piece['A'] = $('userdisplay');
piece['B'] = $('updates');
piece['C'] = $('appnavigation');
piece['D'] = $('addressbook'); if(!piece['D']) { piece['D'] = $('addressbookintl'); }
piece['E'] = $('googleadtest'); if(!piece['E']) { piece['E'] = $('googleadtest_A'); } else if(piece['E'].innerHTML.indexOf('Sponsored Links') == -1) { piece['E'] = $('googleadtest_A'); }
piece['F'] = $('userstatus');
piece['G'] = $('friendUpdate');
piece['H'] = $('bulletins');
piece['I'] = $('friendspace');
piece['J'] = $('squareAd');
piece['K'] = $('featuredprofilerounded'); if(piece['K']) { piece['K'] = piece['K'].parentNode; }
piece['L'] = $('ctl00_ctl00_cpMain_cpMain_MarketingBox_userHomeTabs_userHomeTabs'); if(!piece['L']) { piece['L'] = $('marketingbox'); } else if(piece['L'].innerHTML.indexOf('Featured') == -1) { piece['L'] = $('marketingbox'); }
piece['M'] = $('tomannouncement');
piece['N'] = $('appslayer');
piece['O'] = $('pymkcol3');
piece['P'] = $('viewUL');
piece['Y'] = $('comments');
piece['Z'] = $('GM_Script_Links');
// ========================
// Re-Create missing updates block )(THANKS InsaneNinja!)
if (!$('updates') && $('userdisplay')) {
updates_div = document.createElement('div');
updates_div.setAttribute('id','updates')
updates_div.setAttribute('class','module')
updates_div.setAttribute('style','display: none;')
$('userdisplay').parentNode.insertBefore(updates_div, $('userdisplay').nextSibling);
}
// Remove top ad and google search bar
removeElement('leaderboard');
removeElement('googlebar');
// Hide the bulletin board tip if it's displayed.
removeElement('bulletinsModuleTip');
// Hide the old columns and all contents but leave for other scripts.
$('col1').setAttribute('style','display: none;');
$('col2').setAttribute('style','display: none;');
$('col3').setAttribute('style','display: none;');
GM_addStyle('#bulletins_scroll {\n'
+'position:relative;\n'
+'right:-8px;\n'
+'}\n'
+'#friendspace {\n'
+'margin-bottom:10px;\n'
+'}\n'
+'ul.activityDates {\n'
+'width:auto !important;'
+'}');
////////////////////////////////
// Credit to InsaneNinja (http://userscripts.org/scripts/show/12610)
// Adds the "view mine" between the "post bulletin | view all" bulletin links
//
var view_all = $('bulletins').getElementsByTagName('a')
view_all = view_all[(view_all.length-1)]
var view_mine = document.createElement('a')
view_mine.setAttribute('href','http://bulletins.myspace.com/index.cfm?fuseaction=bulletin.ShowMyBulletins')
view_mine.innerHTML = 'view mine'
view_all.parentNode.insertBefore(view_mine, view_all)
view_all.parentNode.insertBefore(document.createTextNode(' | '), view_all)
//
////////////////////////////////
if (document.getElementById('GM_Script_Links') && document.getElementById('GM_Script_Links').innerHTML.match('scripts/show/6365">GM')) {
// Fix Friends Space
GM_addStyle(".friend {"+
"height:150px;"+
"display:block;"+
"width:100px;"+
"overflow:hidden;"+
"margin:0px 0px 0px 0px !important;"+
"}"+
".friend a {"+
"line-height:10px !important;"+
"}"+
".friend img {"+
"max-height: 100px;"+
"}"+
"#HAU_Friends .friend {"+
"width: 100px !important;"+
"margin:0px 18px 0px 20px !important"+
"}");
} else {
GM_addStyle(".friend {"+
"height:150px;"+
"display:block;"+
"width:100px;"+
"overflow:hidden;"+
"margin:0px 18px 0px 20px !important"+
"}"+
".friend a {"+
"line-height:10px !important;"+
"}"+
".friend img {"+
"max-height: 100px;"+
"}");
}
GM_addStyle('#friends .clear, #HAU_Onlines .clear { clear:none !important; }');
// Create hide link for MySpace/Tom's Annoucement.
if($('tomannouncement')) {
GM_addStyle('#gm_hideannounce {text-align:right;margin-top:10px !important;,margin-bottom:-20px !important;;}');
hideannounce = document.createElement('div');
hideannounce.setAttribute('id','gm_hideannounce');
hideannounce.innerHTML = '<a href="#" id="gm_hideannouncelink">Got it! Hide this announcement.</a>';
$('tomannouncement').lastChild.previousSibling.appendChild(hideannounce);
document.getElementById('gm_hideannouncelink').addEventListener('click', function(event) { GM_setValue('tomannouncement',$('tomannouncement').innerHTML); $('tomannouncement').setAttribute('style','display:none'); }, true);
if(GM_getValue("tomannouncement",false) == $('tomannouncement').innerHTML) {
$('tomannouncement').setAttribute('style','display:none');
}
}
} // end of init.
// Check if we want to hide HAU controls
if ($('GM_Script_Links') && $('GM_Script_Links').innerHTML.match('scripts/show/6365">GM')) { if(!SHOW_HAU_SETTINGS) {
$('HAU_Choices').setAttribute('style','display:none;'); } }
// Check if we want the View My menu open
if (MENU_ALWAYS_OPEN) { GM_addStyle("div#viewMyList div {display:none;} div#viewMyList ul {position:relative;left:0px;}"); }
function SetWidth(width) {
GM_addStyle('div#main { width: '+width+'px; } ');
overallWidth = width;
}
function Column(pieces,width) {
if(lastAdded.indexOf('ow') > 0) {
seperate = document.createElement('span');
seperate.setAttribute('style','clear:both');
$('mainContent').insertBefore(seperate,$('col1'));
}
columns++;
column = document.createElement('div');
column.setAttribute('name','gm_col'+columns);
column.setAttribute('id','gm_col'+columns);
column.setAttribute('style','float:left; width:'+width+'px;');
column.innerHTML = " ";
$('mainContent').insertBefore(column,$('col1'));
lastAdded='gm_col'+columns;
contents = pieces.split('');
for(i=0; sel=contents[i]; i++) {
if(piece[sel]) {
ProcessPiece(sel);
$(lastAdded).appendChild(piece[sel]);
}
}
}
function Row(pieces,width) {
if(lastAdded.indexOf('olumn') > 0) {
seperate = document.createElement('span');
seperate.setAttribute('style','clear:both');
$('mainContent').insertBefore(seperate,$('col1'));
}
rows++;
row = document.createElement('div');
row.setAttribute('name','gm_row'+rows);
row.setAttribute('id','gm_row'+rows);
row.setAttribute('style','float:left; width:'+overallWidth+'px;');
row.innerHTML = " ";
lastAdded='gm_row'+rows;
$('mainContent').insertBefore(row,$('col1'));
contents = pieces.split('');
for(i=0; sel=contents[i]; i++) {
if(piece[sel]) {
ProcessPiece(sel);
$(lastAdded).appendChild(piece[sel]);
}
}
}
function Seperate() {
seperate = document.createElement('div');
seperate.setAttribute('style','height:0px;clear:both;');
$('mainContent').insertBefore(seperate,$('col1'));
}
function ProcessPiece(piece) {
if(piece == "P" || piece == "Q") {
removeElement('viewMyList');
removeElement('linksGroup');
removeChildNode('userdisplay','5');
}
}
loadBulletins_firstrun = 1;
loadStatus_firstrun = 1;
window.gm_refreshPage = function(){
if(ENHANCED_BULLETINS) {
if(loadBulletins_firstrun) {
GM_addStyle("#tblbulletins .profileimagelink { max-height: 40px; }");
loadBulletins_firstrun = 0;
}
GM_xmlhttpRequest({
method: 'GET',
url: 'http://bulletins.myspace.com/index.cfm?fuseaction=bulletin',
headers: {'User-Agent': 'MySpace Should Install Auto Updating'},
onload: function(responseDetails) {
var text = responseDetails.responseText;
// Get just from the board onwards.
startstr='<table id = "bulletin_inbox" align="center" >';
text = text.substr(text.indexOf(startstr));
// Fix whitespace in <tr > tag.
text = text.replace('<tr >','<tr>');
// Replace linebreaks with whitespace
text2 = '';
while(text != text2) {
text2 = text;
text = text.replace(/<br.*?>/i, " ");
}
i=0;
end=0;
startstr = '<tr>';
endstr = '</tr>';
bulletins = '<tr><td style="width: 100px;">From</td><td style="width: 130px;">Date</td><td>Subject</td></tr>';
while(i <= TOTAL_BULLETINS) {
start = text.indexOf(startstr,end);
end = text.indexOf(endstr,start);
bulletin = text.substr(start,(end+endstr.length)-start);
if(i > 0) { // If its not the first one, the header.
bulletins += bulletin;
}
i = i+1;
if(text.indexOf('<td class="userinfo">',end) == -1) { i = TOTAL_BULLETINS; }
}
$('tblbulletins').innerHTML = bulletins;
}
});
} // end enhance bulletins
if(UPDATE) {
// Get updated home screen for various updates.
GM_xmlhttpRequest({
method: 'GET',
url: 'http://home.myspace.com/index.cfm?fuseaction=user',
headers: {'User-Agent': 'MySpace Should Install Auto Updating'},
onload: function(responseDetails) {
var pagehtml = responseDetails.responseText;
// Update the friend status updates
// Get just the board.
startstr='<table width="100%" id="statusUpdates">';
start = pagehtml.indexOf(startstr);
start = start + startstr.length;
endstr = '</table>';
end = pagehtml.indexOf(endstr,start);
sutext = pagehtml.substr(start,end-start);
$('statusUpdates').innerHTML = sutext;
// Get updates
startstr = '<div id="updates" class="module">';
endstr = '<div class="bottom">';
endextra = '<div><div> </div></div></div>';
start = pagehtml.indexOf(startstr);
nextmodule = pagehtml.indexOf('<div id',start+10);
if(start > 0 && (nextmodule - 80) > start) {
start = start + startstr.length;
$('updates').setAttribute('style','display:block');
end = pagehtml.indexOf(endstr,start);
end = end + endstr.length + endextra.length;
utext = pagehtml.substr(start,end-start);
$('updates').innerHTML = utext;
} else {
$('updates').setAttribute('style','display:none');
}
}
}); // Finished getting updated home screen
}
}
function getAtt(elementId,att) { if(document.getElementById(elementId)) { return document.getElementById(elementId).getAttribute(att); } else { return false; } }
function removeElement(elementId) { if(document.getElementById(elementId)) { document.getElementById(elementId).setAttribute('style','display:none'); return true; } else { return false; } }
function removeChildNode(elementId,node) { if(document.getElementById(elementId)) { document.getElementById(elementId).childNodes[node].setAttribute('style','display:none'); return true; } else { return false; } }
function $(elementId) { return document.getElementById(elementId); } // shortcut from "Prototype Javascript Framework"
function $$(elementName) { return document.getElementsByName(elementName); }
////////////////////////////////
// Create and cycle the timer
// Check if we are updating anything
if (UPDATE) {
gm_refreshdump = document.createElement('div');
gm_refreshdump.setAttribute('style','display:none');
gm_refreshdump.setAttribute('id','gm_refreshdump');
document.body.appendChild(gm_refreshdump);
window.gm_SeifersUpdate = function() { window.gm_refreshPage(); setTimeout(gm_SeifersUpdate, 10000); }
window.gm_SeifersUpdate();
} else {
window.gm_refreshPage();
}
//
////////////////////////////////
