|
Post by Wormopolis on Apr 25, 2012 22:43:30 GMT -8
Browser tested: IE and FF placement: global footer
This code will let member attach a special thread in a board you setup to their mini profile. they click the button on the thread they created in that board, and it takes them to their profile to add in a link to their personal text.
var topicBoard="general"; //this is the board(s) where their topics will be
If you want more then one board to be available to set up a personal topic, seperate board name by |
var topicBoard="general|otherboard|otherboard2"; //this is the board(s) where their topics will be
<script type="text/javascript"> <!-- // Personal Topic Link in MP // v 1.5 // by Wormopolis - [url]www.wormocodes.com[/url] // keep header intact - do not repost
var topicBoard="general"; //this is the board(s) where their topics will be var ptbuttonimage="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/about_me.jpg"; //image for button in MP var PTmessage="Set this thread as Personal Topic"; var PTconfirm="Your Personal Topic has been set!";
// create button for making new link in profileedit if (!document.postForm && location.href.match(new RegExp('board=('+topicBoard+')($|&)','')) && location.href.match(/action=display/) && !location.href.match(/page=/)) { for(td=document.getElementsByTagName('td'),b=0; b<td.length; b++) { if (td[b].width=='80%' && td[b].className.match(/catbg/) && td[b].innerHTML.match(/Topic:/)) { authCell=td[b].parentNode.nextSibling.firstChild; if (authCell.getElementsByTagName('b')[0]) { auth=authCell.getElementsByTagName('b')[0].firstChild; authName=auth.href.split('user=')[1]; if (authName==pb_username) { nwTbl=document.createElement('table'); nwTbl.insertRow(0); nwTbl.rows[0].insertCell(0); nwTbl.rows[0].insertCell(0); nwTbl.width="100%"; nwTbl.rows[0].cells[0].align="left"; nwTbl.rows[0].cells[1].align="right"; nwTbl.rows[0].cells[0].className=nwTbl.rows[0].cells[1].className="catbg"; nwTbl.rows[0].cells[1].style.fontSize="10px"; nwTbl.rows[0].cells[0].appendChild(td[b].firstChild); nwLnk=nwTbl.rows[0].cells[1].appendChild(document.createElement('a')); nwLnk.appendChild(document.createTextNode("[ "+PTmessage+" ]")); thnum=location.href.split('thread=')[1]; bid=location.href.split('board=')[1].split('&')[0]; nwLnk.href="/index.cgi?action=modifyprofile&user="+pb_username+"&keepnum="+thnum +(topicBoard.split('|').length>1 ? "&keepbord="+bid : "" ); td[b].appendChild(nwTbl); } } } } } if (document.modifyForm && location.href.match(/keepnum=(\d+)(&keepbord=(.*?))?$/)) { nwNum=RegExp.$1; nwBrd=RegExp.$3; document.modifyForm.personaltext.value=document.modifyForm.personaltext.value.replace(/\[brw(\d+)(\|(.*?))?\]/,''); document.modifyForm.personaltext.value="[brw"+nwNum+ (nwBrd ? "|"+nwBrd : "") + "]"+document.modifyForm.personaltext.value; alert(PTconfirm); document.modifyForm.submit(); } // show button in MP if PT contains flag if (!document.postForm && location.href.match(/(board=|action=(viewprofile|recent|search2))/)) { for (td=document.getElementsByTagName('td'), b=0; b<td.length; b++) { if (td[b].width=='20%' && td[b].className.match(/windowbg/) && td[b].innerHTML.match(/\[brw(\d+)(\|(.*?))?\]/)) { vict=td[b].innerHTML.match(/\[brw(\d+)(\|(.*?))?\]/); thNum=vict[1]; thBrd=vict[3]; td[b].innerHTML=td[b].innerHTML.replace(/\[brw(\d+)(\|(.*?))?\]/,''); ctr=td[b].getElementsByTagName('center'); if (ctr[0]) { nwBtn=document.createElement('a'); nwBtn.href="/index.cgi?action=display&thread="+thNum + "&board=" +(thBrd ? thBrd : topicBoard); nwBtn.appendChild(document.createElement('img')); nwBtn.firstChild.border=0; nwBtn.firstChild.src=ptbuttonimage; ctr[0].appendChild(document.createElement('br')); ctr[0].appendChild(nwBtn); } } } }
// --> </script>
|
|
kassy
Not New Member
Posts: 5
kassy said 0 great things
|
Post by kassy on May 2, 2012 14:29:39 GMT -8
Is there a way to make it for more than one board? Like I have the profiles for the characters on my site separated into four subboards. One for each Hogwarts House and one for Adults.
|
|
|
Post by Wormopolis on May 2, 2012 22:53:11 GMT -8
the reason I went with a single board is it makes it where it doesnt have to STORE which board in the personal text. it just has to store the thread id. if you want to have it where different boards are allowed, it goes from using 4 or 5 characters of space to something like 10 or 11 depending on how long your board ids are.
if you are fine with sacrificing personal text space, I can make the adjustment. It probably wont be until the weekend though since Im pretty slammed at work.
|
|
kassy
Not New Member
Posts: 5
kassy said 0 great things
|
Post by kassy on May 3, 2012 14:51:24 GMT -8
That's completely fine with me!
|
|
|
Post by Wormopolis on May 6, 2012 2:20:56 GMT -8
version update 1.5: ability to have more then 1 board as topic board. keep in mind this will now use more space to save topic if you do it.
|
|