By Sean Watson
Has 6 other scripts.
// ==UserScript==
// @name MySpace - Edit Profile Redesign
// @namespace Sean
// @description Adds some aesthetics to the Edit Profile Pages. Now includes "Drag N' Resize Textareas"
// @version 2/17/2008
// @include http://profileedit.myspace.tld/*=profile.*
// @include http://collect.myspace.com/index.cfm?fuseaction=profile.safedeleteComments*
// @include http://collect.myspace.com/index.cfm?fuseaction=groups.safeMode*
// @exclude http://*.myspace.tld/*=profile.editor*
// ==/UserScript==
var main = "ctl00_ctl00_cpMain_ProfileEditContent_";
//* Remove Annoyances *//
s = "#header, #footer, #sponsorlogoimage, div.vert, div.alignL, span#ctl00_ctl00_cpHeader_Header1_topNav_Span6, div.saveButtons , input#"+main+"editInterests_SaveInterests, input#"+main+"editInterests_PreviewBottom, #topnav, #details_tabs, hr.separator, #profileEdit_tabs {display:none;}\n";
//* Interests & Personality Page *//
s+= "textarea#"+main+"editInterests_AboutMeTextBox, #"+main+"editInterests_LikeToMeetText {font-family:Calibri, Arial; font-size:12px; width: 750px; height: 300px;}\n";
s+= "textarea#"+main+"editInterests_GeneralText, #"+main+"editInterests_MusicText, #"+main+"editInterests_MoviesText, #"+main+"editInterests_TelevisionText, #"+main+"editInterests_BooksText, #"+main+"editInterests_HeroesText {font-family:Calibri, Arial; font-size:12px; width: 750px; height: 225px;}\n";
//* Name Page *//
s+= "span#"+main+"editName_MySpaceNameLit, #"+main+"editName_MySpaceURlLit, #"+main+"editName_NameMsgLit {font-family:Calibri, Arial; font-size:13px; width: 500px;}\n";
//* Basic Information Page *//
s+= "input#"+main+"editBasicInfo_occupationTextBox, #"+main+"editBasicInfo_cityTextBox {font-family:Calibri, Arial; font-size:12px; width: 325px;}\n";
s+= "input#ctl00_ctl00_cpMain_ProfileEditContent_editBasicInfo_postalCodeTextBox, input#ctl00_ctl00_cpMain_ProfileEditContent_editBasicInfo_postalCodeTextBox:hover {width:100px}\n";
s+= "input#"+main+"editBasicInfo_postalCodeTextBox, select#ddMonth, #ddDay, #ddYear, #"+main+"editBasicInfo_GeoLocation1_ddlCountry, #"+main+"editBasicInfo_GeoLocation1_ddlRegion, #"+main+"editBasicInfo_ethnicityDropDownList, #"+main+"editBasicInfo_bodyTypeDropDownList, #"+main+"editBasicInfo_feetDropDownList, #"+main+"editBasicInfo_inchesDropDownList {font-family:Calibri, Arial; font-size:12px;}\n";
//* Background and Lifestyle *//
s+= "input#"+main+"editLifestyle_HometownText {font-family:Calibri, Arial; font-size:12px; width: 325px;}\n";
s+= "select#"+main+"editLifestyle_ReligionDropDown, #"+main+"editLifestyle_IncomeDropDown {font-family:Calibri, Arial; font-size:12px;}\n";
//* Schools Page *//
s+= "input#"+main+"schoolEditor_schoolFinder_schoolNameTextBox {font-family:Calibri, Arial; font-size:12px; width: 325px;}\n";
s+= "select#"+main+"schoolEditor_schoolFinder_countryDropDownList, #"+main+"schoolEditor_schoolFinder_regionDropDownList {font-family:Calibri, Arial; font-size:12px;}\n";
//* Companies Page *//
s+= "div.bgGrey {display:none;}\n";
s+= "input#"+main+"companyEditor_companyNameTextBox, #"+main+"companyEditor_cityTextBox, #"+main+"companyEditor_regionTextBox, #"+main+"companyEditor_titleTextBox, #"+main+"companyEditor_divisionTextBox, #"+main+"companyEditor_datesEmployedTextBox {font-family:Calibri, Arial; font-size:12px; width: 325px;}\n";
s+= "select#"+main+"companyEditor_countryDropDownList {font-family:Calibri, Arial; font-size:12px;}\n";
//* Networking Page *//
s+= "textarea#"+main+"networkEditor_descriptionTextBox {font-family:Calibri, Arial; font-size:12px; width: 400px; height:150px;}\n";
s+= "select#"+main+"networkEditor_categoryDropDownList, #"+main+"networkEditor_skillDropDownList, #"+main+"networkEditor_roleDropDownList {font-family:Calibri, Arial; font-size:12px;}\n";
//* Misc. Crarp *//
s+= "body {font-family:Calibri, Arial; font-size:12px;background:white none repeat scroll 0%!important;}\n";
s+= ".txtNavBlue, element.style, #profileSubHeaderTitle, h3 {float:none!important; margin-bottom:0px!important; margin-left:0px!important; margin-right:0pt!important; margin-top:0px!important;text-align:center!important;}";
s+= "#content {top:-50px;}";
s+= "textarea:hover, input[type='text']:hover, select:hover {background: #F5F5B3 none repeat scroll 0% !important;}";
s+= "input#ctl00_ctl00_cpMain_ProfileEditContent_editInterests_captcha_captchaResponseTextBox, input#ctl00_ctl00_cpMain_ProfileEditContent_editInterests_captcha_captchaResponseTextBox:hover {text-align:center!important;}";
s+= "input#ctl00_ctl00_cpMain_ProfileEditContent_editInterests_HeadlineText {font-family:Calibri, Arial; font-size:12px;width:550px;}\n";
s+= "input#ctl00_ctl00_cpMain_ProfileEditContent_editInterests_HeadlineText:hover {font-family:Calibri, Arial; font-size:11px; width: 750px;}\n";
s+= "#ctl00_ctl00_cpMain_ProfileEditContent_editName_DisplayNameTextBox:hover, #ctl00_ctl00_cpMain_ProfileEditContent_editName_FirstNameTextBox:hover, #ctl00_ctl00_cpMain_ProfileEditContent_editName_LastNameTextBox:hover, #ctl00_ctl00_cpMain_ProfileEditContent_editLifestyle_HometownText:hover {font-family:Calibri, Arial; font-size:11px; width: 500px;}\n";
s+= "div.borGrey {display:none!important;}\n";
GM_addStyle(s);
////////////////////
//Title Bar Fixer//
//////////////////
(function (){
var tb1 = window.location.href.split("fuseaction=");
var tb2 = tb1[1].split("&MyToken=");
if (tb2[0] == 'profile.interests'){
var tb3 = 'Interests & Personality'}
if (tb2[0] == 'profile.names'){
var tb3 = 'Name'}
if (tb2[0] == 'profile.basic'){
var tb3 = ' Basic Information'}
if (tb2[0] == 'profile.basic'){
var tb3 = 'Basic Information'}
if (tb2[0] == 'profile.lifestyle'){
var tb3 = 'Background & Lifestyle'}
if (tb2[0] == 'profile.schools'){
var tb3 = 'Schools'}
if (tb2[0] == 'profile.companies'){
var tb3 = 'Companies'}
if (tb2[0] == 'profile.networking'){
var tb3 = 'Networking'}
if (tb2[0] == 'profile.editprofilesongs'){
var tb3 = 'Profile Songs'}
if (tb2[0] == 'profile.safedeleteComments'){
var tb3 = 'Comments (Safe Mode)'}
if (tb2[0] == 'groups.safeMode'){
var tb3 = 'Groups (Safe Mode)'}
document.title = document.title+' - Edit: '+tb3;
}());
//////////////////////////
//Create Navigation Box//
////////////////////////
var navdiv = document.createElement("div");
navdiv.setAttribute('id','navdiv');
navdiv.innerHTML = '<a href="http://home.myspace.com/index.cfm?fuseaction=user">Home</a> | <a href="http://collect.myspace.com/index.cfm?fuseaction=signout">Sign Out</a><hr>'+
'<strong><u>EDIT:</u></strong><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.interests">Interests & Personality</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.names">Name</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.basic">Basic Info</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.lifestyle">Background & Lifestyle</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.schools">Schools</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.companies">Companies</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.networking">Networking</a><br>'+
'<a href="http://profileedit.myspace.com/index.cfm?fuseaction=profile.editprofilesongs">Profile Songs</a><hr>'+
'<a href="http://collect.myspace.com/index.cfm?fuseaction=profile.safedeleteComments">Delete Comments</a><br>'+
'<a href="http://collect.myspace.com/index.cfm?fuseaction=groups.safeMode">Edit Groups</a><hr>';
var aspform = document.getElementById('aspnetForm');
aspform.appendChild(navdiv);
var s='#navdiv{background-color:#6698CB;position:fixed;top:0px;right:0px;padding:1px 2px 4px 4px;-moz-border-radius-bottomleft:6px;width:160px;text-align:center;}'
+ '#navdiv a{color:white; font-family:Calibri, Arial; font-size:12px; font-weight:normal;}'
+'#profileHeaderSettings {text-align:center!important; font-weight:bolder;} .right {float:none!important;}';
GM_addStyle(s);
//Adds "View My Profile", "Account Settings", "profile editor" links to nav box
var settings = document.getElementById('profileHeaderSettings');
navdiv.appendChild(settings);
//Adds save and previw buttons to nav box
var savebutton = document.getElementById('ctl00_ctl00_cpMain_ProfileEditContent_editInterests_SaveTop');
navdiv.appendChild(savebutton);
var previewbutton = document.getElementById('ctl00_ctl00_cpMain_ProfileEditContent_editInterests_PreviewTop');
navdiv.appendChild(previewbutton);
///////////////////////////////
//*Drag N' Resize Textareas*//
/////////////////////////////
//*This puts a little "friend logo" resizer icon next to
//*every textarea; clicking and dragging that icon will resize its textarea.
var resizer = 'data:image/gif;base64,'+
'R0lGODlhDgAOAPQAAAAzmVR2u+/y+a+/3zBZrI+l0tDZ7BBAn4CZzFJztf///2+Mxb/M5Z+y2d/l'+
'8iBNpkBms3iTybPC4ZSl1u/393CNxpWq1f4BAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAQU'+
'AAAALAAAAAAOAA4AAAVMoCKOorAczyA6jlIAR4MANOAMtFQfUA3ItMiu4jMwDgfDKyZIwBqiBlQw'+
'YJQYVoUTEHjQCJYaweEr+7bmtHrNHvXWIxkC8faRRrNyCAA7';
var DEBUG = 0;
function trace (level,msg) { if(DEBUG >= level) GM_log(msg); return; }
if (
document.documentElement.tagName == "HTML"
&& document.contentType == "text/html"
&& document.body // Basic sanity
) {
trace(11, "Starting");
run();
}
function run () {
var them = document.getElementsByTagName("textarea");
if(!(them && them.length)) { trace(11, "No textareas."); return; }
inits();
for(var i = them.length - 1; i >= 0; i--) {
tweak_textarea(them[i]);
}
trace(5, them.length.toString() + " textareas");
return;
}
// - - - - - - - - -
function get_pref (prefname, defaulty) {
var gotten = GM_getValue(prefname, null);
if(gotten == null) {
GM_setValue(prefname, defaulty);
return defaulty;
} else {
return gotten;
}
}
var Drag_increments, Min_Height, Min_Width, Max_Height, Max_Width;
function inits () {
// Number of pixels that we grow by at a time:
Drag_increments = get_pref('drag_increment_size', 15);
// Constraints (in pixels) on draggable dimensions of textareas:
Min_Height = get_pref('min_height', 30);
Min_Width = get_pref('min_width' , 30);
Max_Height = get_pref('max_height', 1400);
Max_Width = get_pref('max_width' , 1400);
return;
}
function tweak_textarea (t) {
var d = t.ownerDocument;
var p = t.parentNode;
var n = t.nextSibling;
var s = getComputedStyle(t, "" );
var
oh = num(s.height),
ow = num(s.width ),
br = d.createElement('br');
button = d.createElement('img');
button.setAttribute('src',resizer);
button.setAttribute('height',12);
button.setAttribute('width' ,12);
button.setAttribute('alt','grabby');
// don't wrap button
p.style.whiteSpace="nowrap";
// insert linebreak
p.insertBefore(br, t);
// insert after textarea
if (n) p.insertBefore(button, n);
else p.appendChild(button);
button.title = "Click and drag me to change the textarea's size";
button.addEventListener('mousedown', function(event) {
// Yes, I think we really do need this as a closure here-- otherwise
// there's no (easy) way to work back from the event target to the textarea.
start_dragging( event, t, button );
event.preventDefault();
return;
},
true
);
if(ow && oh) {
t.style.height = oh.toString() + "px";
t.style.width = ow.toString() + "px";
}
return;
}
var Orig_width, Orig_height, Cursor_start_x, Cursor_start_y;
function start_dragging (event, textarea, button) {
Textarea = textarea;
Cursor_start_x = event.clientX;
Cursor_start_y = event.clientY;
var s = getComputedStyle(textarea, "" );
Orig_width = num( s.width );
Orig_height = num( s.height );
trace(4, "Starting dimensions of textarea: h=" + s.height.toString() +
" by w=" + s.width.toString());
textarea.ownerDocument.addEventListener("mousemove", ev_drag_move, true);
textarea.ownerDocument.addEventListener("mouseup", ev_drag_stop, true);
trace(5,"Starting dragging");
return;
}
function num (i) {
var m;
if(typeof(i) == "string") {
m = i.match( /(\d+)(\.\d+)*px/ );
// nota bene: yes, the computed style can be fractional, like "123.56px"!!
if(m) {
i = parseInt(m[1], 10);
} else {
trace(1, "Weird pseudonumerical value: \"" + i + "\"!");
}
} else if(typeof(i) == "number") {
// just fall thru
} else {
trace(1, "Weird nonnumerical value: \"" + i + "\"!");
}
//trace( typeof(i) + ": " + i.toString() );
return i;
}
function ev_drag_move (event) {
var
new_width = event.clientX - Cursor_start_x + Orig_width ,
new_height = event.clientY - Cursor_start_y + Orig_height;
new_width = px_between(Min_Width ,new_width , Max_Width, Drag_increments);;
new_height = px_between(Min_Height,new_height, Max_Height, Drag_increments);;
trace(10, "Setting dimensions to h=" + new_height.toString() +
" w=" + new_width.toString() );
Textarea.style.width = new_width;
Textarea.style.height = new_height;
event.preventDefault();
return;
}
function ev_drag_stop (event) {
// Stop capturing the mousemove and mouseup events.
document.removeEventListener("mousemove", ev_drag_move, true);
document.removeEventListener("mouseup", ev_drag_stop, true);
event.preventDefault();
return;
}
function px_between (min, i, max, incr) {
if(incr) i = Math.floor(i/incr) * incr;
return(
(
(i > max) ? max
:(i < min) ? min
: i
).toString() + "px"
);
}