Post by Wormopolis on May 11, 2009 3:04:44 GMT -8
Browsers Tested: IE 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 achors 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]
in the post. again name cannot contain spaces, but the text you want clickable can.
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" 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.
code:
Preview: THIS THREAD IN WC REQUESTS
UPDATES TO THIS CODE FOUND ON wormocodes.proboards.com
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 achors 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]
in the post. again name cannot contain spaces, but the text you want clickable can.
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" 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.
code:
<style type="text/css">
.ankhome {border:1; border-color:FF0000; border-style:solid; font-size:10;}
</style>
<script type="text/javascript">
<!--
// Internal Post Links v 1.1
// by Wormopolis - wormocodes.proboards.com
// Please keep header intact - do not repost
// edit image sources if you want to
var ankbtn="http://i197./aa250/WORMOPOLIS/ank.gif";
var ankLbtn="http://i197./aa250/WORMOPOLIS/ankl.gif";
var ankHomebtn="http://i197./aa250/WORMOPOLIS/ankhome.gif";
var useButtons="true"; //set false if you dont want buttons
// no editing necessary below, unless you know what you are doing
// - use style tag to modify ankhome div
var refholder = new Array();
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)) {
noteNum=RegExp.$1;
noteText=RegExp.$2;
newRef='<a name="'+noteNum+'"></a>';
newJmp="<a href='#"+noteNum+"'>"+noteText+"</a>";
refholder.push(newJmp);
tds[f].innerHTML=tds[f].innerHTML.replace(/\[ankL=(.*?),(.*?)\]/i,newRef);
}
while (tds[f].innerHTML.match(/\[ank=(.*?)\]/i)) {
noteNum=RegExp.$1;
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(/\/\/\/(#.*?)$/)) {
refplace=RegExp.$1;
lnks[i].href=refplace;
lnks[i].target="_self";
}
}
if (refholder.length>0) {
if (!tds[f].innerHTML.match(/\[ankHome\]/)) tds[f].insertBefore(document.createTextNode("[ankHome]"),tds[f].firstChild.nextSibling);
nwDiv="<div class='ankhome'>"+refholder.join('<br>')+"</div></br>";
tds[f].innerHTML=tds[f].innerHTML.replace(/\[ankHome\]/,nwDiv);
refholder=new Array();
}
}
}
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=igs[g].width*3+4;
}
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.alt="name cannot contain spaces";
nwBtn2.firstChild.alt="name cannot contain spaces, but text can";
nwBtn3.firstChild.alt="destination of ankL list";
nwBtn1.href="javascript: add('[ank=name]');";
nwBtn2.href="javascript: add('[ankL=name,text to click]');";
nwBtn3.href="javascript: add('[ankHome]');";
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 WC REQUESTS
UPDATES TO THIS CODE FOUND ON wormocodes.proboards.com