|
Post by Wormopolis on May 10, 2009 17:16:03 GMT -8
Browsers Tested: IE, chrome, and FF Placement: board or global footers Allows you to place anchors WITHIN a post that can be jumped to from links in the same post. to create an achor, simply type: [ank=name] where "name" is a unique identifier for that specific location jump. name cannot contain spaces. to create a link for jumping: [url=#name]Text to make clickable[/url] the "#" must be there in front of the name of the anchor. An added feature of this code, is the ability to create several anchors throughout the post, and have it create an automatic list at the top (or where you want the list to end up). To create a listed anchor, type: [ankL=name,Text to make clickable(,optional name for home)] in the post. again name cannot contain spaces, but the text you want clickable can. if you are using multiple home tags, the third parameter should be the home name. The code will find all of these listed anchors and create a spot at the top of the post to display them. the div it creates has classname "ankhome_standard" and can be customized with CSS. You can also designate where you want the div to show, by placing [ankHome] in your post somewhere, like say below a title or something. if using multiple home tags, use the format: [ankHome=homename] where homename is the name of the area the links appear. these areas will get the classname of "ankhome_homename" for CSS styling. code: <style type="text/css"> .ankhome_standard {border:1; border-color:FF0000; border-style:solid; font-size:10;} </style>
<script type="text/javascript"> <!-- // Internal Post Links v 1.51 // by Wormopolis - wormocodes.proboards.com // Please keep header intact - do not repost
// edit image sources if you want to var ankbtn="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/ank.gif"; var ankLbtn="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/ankl.gif"; var ankHomebtn="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/ankhome.gif";
var useButtons="true"; //set false if you dont want buttons
// no editing necessary below - use style tag to modify ankhome div if (!location.href.match(/noanchors/)) { var refholder = new Array(); var refcount=0; tds=document.getElementsByTagName('td'); for (f=0; f<tds.length; f++) { if (tds[f].colSpan==3 && tds[f].vAlign=="top" && tds[f].firstChild && tds[f].firstChild.nodeName && tds[f].firstChild.nodeName.match(/hr$/i)) { while (tds[f].innerHTML.match(/\[ankL=(.*?),(.*?)(,(.*?))?\]/i)) { var noteNum=RegExp.$1; var noteText=RegExp.$2; var homeOption=(RegExp.$4 !=undefined && RegExp.$4 !='' ? RegExp.$4 : 'standard'); var newRef='<a name="'+noteNum+'"></a>'; var newJmp="<a href='#"+noteNum+"'>"+noteText+"</a>"; if (homeOption && !refholder[homeOption]) { refholder[homeOption]=new Array(); refcount++; } refholder[homeOption].push(newJmp); tds[f].innerHTML=tds[f].innerHTML.replace(/\[ankL=(.*?),(.*?)(,(.*?))?\]/i,newRef); } while (tds[f].innerHTML.match(/\[ank=(.*?)\]/i)) { var noteNum=RegExp.$1; var newRef='<a name="'+noteNum+'" target="_self"></a>'; tds[f].innerHTML=tds[f].innerHTML.replace(/\[ank=(.*?)\]/i,newRef); } for (lnks=tds[f].getElementsByTagName('a'), i=0; i<lnks.length; i++) { if (!lnks[i].href.match(/\./) && lnks[i].href.match(/http:\/\/((\w|\W|\d)*?)\/$/)) { refplace='#'+RegExp.$1; lnks[i].href=refplace; lnks[i].target="_self"; } } if (refcount>0) { //legacy fix for old [ankhome] tag still in post if (tds[f].innerHTML.match(/\[ankHome\]/)) tds[f].innerHTML = tds[f].innerHTML.replace(/\[ankHome\]/,'[ankHome=standard]'); if (!tds[f].innerHTML.match(/\[ankHome=(.*?)\]/)) tds[f].insertBefore(document.createTextNode("[ankHome=standard]"),tds[f].firstChild.nextSibling); for (refi in refholder) { var hometag=refi; var hometaglist=refholder[refi]; var hometagmatch=new RegExp('\\[ankHome='+hometag+'\\]',''); nwDiv="<div class='ankhome_"+hometag+"'>"+hometaglist.join('<br>')+"</div></br>"; tds[f].innerHTML=tds[f].innerHTML.replace(hometagmatch,nwDiv); refcount=0; } } } } if (document.postForm && useButtons) { for (igs=document.getElementsByTagName('img'), g=0; g<igs.length; g++) { if (igs[g].alt=="Bold") { likeCell=igs[g].parentNode.parentNode; nwDiv=document.createElement('div'); with (nwDiv.style) { border=2; borderStyle="solid"; width='75px'; } nwDiv.align="center"; nwBtn1=igs[g].parentNode.cloneNode(true); nwBtn2=igs[g].parentNode.cloneNode(true); nwBtn3=igs[g].parentNode.cloneNode(true); nwBtn1.firstChild.src=ankbtn; nwBtn2.firstChild.src=ankLbtn; nwBtn3.firstChild.src=ankHomebtn; nwBtn1.firstChild.title="regular anchor tag, name cannot contain spaces"; nwBtn2.firstChild.title="listed anchor tag, name cannot contain spaces but text can"; nwBtn3.firstChild.title="anchor home for list, if using multiple homes change 'standard'"; nwBtn1.href="javascript: add('[ank=name]');"; nwBtn2.href="javascript: add('[ankL=name,text to click]');"; nwBtn3.href="javascript: add('[ankHome=standard]');"; with (nwDiv) { appendChild(nwBtn1); appendChild(nwBtn2); appendChild(nwBtn3); } with (likeCell) { appendChild(document.createElement('br')); appendChild(document.createElement('br')); appendChild(nwDiv); } break; } } } } // --> </script>
Preview: THIS THREAD IN REQUESTS[norunubbc]
|
|
|
Post by Wormopolis on May 10, 2009 20:05:23 GMT -8
fixed the error deadend found where I left in the thread restrict.. sorry about that. That what I get for copying codes from my own source!
|
|
|
Post by Wormopolis on May 11, 2009 1:44:04 GMT -8
should I make UBBC buttons for these?
|
|
|
Post by Wormopolis on May 11, 2009 3:02:59 GMT -8
added UBBC buttons, but they are optional.
|
|
Rei Kon
Junior Member
Posts: 52
Rei Kon said 0 great things
|
Post by Rei Kon on Feb 22, 2011 2:20:01 GMT -8
I have an idea for how this code could develop further (if this is the right place?)
Was just thinking maybe have the ability to set the ankhhome to have a certain 'name' and you could then create multiple ankhomes to relate to different areas of listing in the same thread?
|
|
|
Post by Wormopolis on Feb 22, 2011 10:59:21 GMT -8
not a bad idea at all.
how were you thinking of changing the link tags? [ankL=name,Text to make clickable]
|
|
Rei Kon
Junior Member
Posts: 52
Rei Kon said 0 great things
|
Post by Rei Kon on Feb 22, 2011 12:42:27 GMT -8
Okay basically
[ankHome=name for section]
[ankL=name for section to list under,name,Text to make clickable] if that makes sense?
|
|
|
Post by Wormopolis on Feb 22, 2011 17:46:05 GMT -8
That would work for me.. except then legacy would get messed up if they tried to upgrade. we would need to make that tag
[ankL=name,Text to make clickable,Home section name]
so that if the third parameter is missing the code doesnt choke.
|
|
|
Post by Wormopolis on Feb 22, 2011 20:10:31 GMT -8
version update 1.5: now able to do multiple home tags. see instructions. also will work with legacy posts using previous versions.
|
|
Rei Kon
Junior Member
Posts: 52
Rei Kon said 0 great things
|
Post by Rei Kon on Feb 22, 2011 23:06:18 GMT -8
Thanks for this
|
|
|
Post by Wormopolis on Dec 28, 2011 15:57:51 GMT -8
version update 1.51: URL fix for basic anchor tags
use [link=#name]test[/link]
to access them
|
|