|
Post by Wormopolis on May 31, 2011 18:53:38 GMT -8
Browsers Tested: IE and FF placement: global footer
puts a drop down in the modifyprofile area where members can list their relationship status. extra variable to allow/disallow mods from changing a members status
<script type="text/javascript"> <!-- // relationship status v1.31 // by Wormopolis - www.wormocdes.com // request by Shannon // keep header intact
var RSchoiceArray=[ ['Single',false], //status, allow input field for name ['Married to',true], ['Engaged to',true], ['Widowed from',true], ['Divorced from',true] //no comma last entry ];
var allowModsToChangeOthersStatus=false; // admin is always allowed var onlyAllowCertainModsToChangeStatus=false; //if true, then variable above must be true as well var allowedMods="user1|user2|user3"; //seperate by | admin is always allowed
if (document.modifyForm) { var ptRw=document.modifyForm.personaltext.parentNode.parentNode.parentNode; var nwrw=ptRw.cloneNode(true); nwrw.firstChild.firstChild.innerHTML='Relationship Status:'; var choicetemp=''; for (aa=0; aa<RSchoiceArray.length; aa++) {choicetemp+='<option value=' +RSchoiceArray[aa][1]+ '>' +RSchoiceArray[aa][0]+ '</option>';} nwrw.firstChild.nextSibling.firstChild.innerHTML='<select name="relation" onchange="document.modifyForm.relationname.disabled=true; tmp=(this.value==\'false\'); document.modifyForm.relationname.disabled=tmp;"><option value=false></option>' + choicetemp + '</select> <input name="relationname" disabled="true">'; nwrw.firstChild.nextSibling.nextSibling.firstChild.innerHTML='Enter your relationship status.'; var nrgx=new RegExp('^('+allowedMods+')$',''); if (pb_username!='admin' && ((!document.modifyForm.password && !allowModsToChangeOthersStatus) || (onlyAllowCertainModsToChangeStatus && !pb_username.match(nrgx)))) nwrw.style.display='none';
ptRw.parentNode.insertBefore(nwrw, ptRw); if (modifyForm.personaltext.value.match(/\[RS:(\d+?)(=(.*?))?\]/i)) { var keepRS=RegExp.$1; var keepRSname=RegExp.$3; modifyForm.personaltext.value=modifyForm.personaltext.value.replace(/\[RS:(\d+?)(=(.*?))?\]/i,''); modifyForm.relation.selectedIndex=keepRS; if (keepRSname) { modifyForm.relationname.value=keepRSname; modifyForm.relationname.disabled=false;} } function saveRS() { if (modifyForm.relation.selectedIndex!=0) { modifyForm.personaltext.value+='[RS:'+ modifyForm.relation.selectedIndex + (!modifyForm.relationname.disabled ? '=' + modifyForm.relationname.value : '') + ']'; } } if (document.modifyForm.addEventListener) { document.modifyForm.addEventListener('submit',saveRS,true); } else { document.modifyForm.attachEvent('onsubmit',saveRS); } }
if (pb_action.match(/display|viewprofile|search2|calanderview/)) { for (tds=document.getElementsByTagName('td'), tt=0; tt<tds.length; tt++) { if (tds[tt].width=='20%' && tds[tt].className.match(/windowbg/) && tds[tt].vAlign=='top' && tds[tt].innerHTML.match(/\[RS:(\d+?)(=(.*?))?\]/i)) { var keepRS=RegExp.$1-1; var keepRSname=RegExp.$3; tds[tt].innerHTML=tds[tt].innerHTML.replace(/\[RS:(\d+?)(=(.*?))?\]/i,''); var newStuff='Relationship: '+ RSchoiceArray[keepRS][0] + (keepRSname!='' ? ' '+keepRSname : '') + '<br>'; tds[tt].innerHTML=tds[tt].innerHTML.replace(/Posts:/i, newStuff +'<br>Posts:'); } } } // --> </script>
|
|
|
Post by Wormopolis on Jan 20, 2012 16:40:22 GMT -8
version update 1.3: added in some more control for who can edit
|
|
ghostguest
Not New Member
Posts: 1
ghostguest said 0 great things
|
Post by ghostguest on Feb 19, 2012 8:22:08 GMT -8
Hello! I was wondering if there was a way to edit this code so that if you entered someone's username into the input field, it would link to their profile.
|
|
|
Post by Wormopolis on Feb 19, 2012 16:34:56 GMT -8
It could, but it wouldnt be able to pull their current display name or anything. if they changed their display name to something else, the code would have no way of knowing it.
|
|
kassy
Not New Member
Posts: 5
kassy said 0 great things
|
Post by kassy on Apr 25, 2012 14:25:37 GMT -8
Is there a way to choose where you want your relationship status to appear on the mini-profile?
Or even have it appear at the bottom of a post instead?
|
|
|
Post by Wormopolis on Apr 25, 2012 21:31:02 GMT -8
what if looking at a profile?
|
|
kassy
Not New Member
Posts: 5
kassy said 0 great things
|
Post by kassy on Apr 26, 2012 2:35:19 GMT -8
Perhpas just have it where it appears at the bottom of the mini-profile below everything in it. Or does it have some sort of an id so that when I do the build your own mini profile I can move it to where I want?
|
|
|
Post by Wormopolis on Apr 26, 2012 6:13:50 GMT -8
I doubt BYOMP will recognize it as a valid MP piece. it would have to run after.
change this line
tds.innerHTML=tds.innerHTML.replace(/Posts:/i, newStuff +'<br>Posts:');
to this
tds.innerHTML+='<br>'+newStuff;
|
|
kassy
Not New Member
Posts: 5
kassy said 0 great things
|
Post by kassy on Apr 26, 2012 13:33:35 GMT -8
Thank you!
|
|
emilygrace
Not New Member
Posts: 4
emilygrace said 0 great things
|
Post by emilygrace on Dec 1, 2012 8:41:56 GMT -8
[replyingto=admin]%3Cfont%20color%3D%22FF5500%22%3E%3Cfont%20color%3D%22FFFFFF%22%3EW%3C/font%3Eormopolis%3C/font%3E[/replyingto]I tried posting the code twice, so a character could have two relationship status.. but it didnt work? any tips?
|
|
|
Post by Wormopolis on Dec 14, 2012 21:48:07 GMT -8
wait.. didnt we solve this?
|
|