Post by SubDevo on Feb 27, 2010 15:31:43 GMT -8
Hide Posted Links from Guests by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.
This code was done as a request. Some of you may find it useful.
This code allows you hide a link of your choosing from guests.
This is helpful for links such as personal download links.
The link will be replaced by text that you place in the code.
Example:
Download from here: [Only Members Can View This Link]
When you want a link hidden, your members need to put "[hide] " before the link to be hidden in the post. And yes, there must be a "space" after the "[hide]" and before the link. No closing tag is needed since it is not "real" UBBC. My code then looks for the "[hide]" tag in the posts removes it and changes the following link to not visible. Then the code goes through and finds the "hidden" links and makes them visible if you are a member. To keep the code short and sweet, there is NO button for a member to press to put in the "[hide]" tag, you have to type that in manually in your post.
Enjoy!!!
SubDevo
Only one variable to edit.
var mess="[Only Members Can View This Link]"; // Text for Link Replacement.
Location: Global Footer
<script type="text/Javascript">
<!--
/* Hide Posted Links from Guests by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var mess="[Only Members Can View This Link]"; // Text for Link Replacement.
var td=document.getElementsByTagName("font"); mess="<font>"+mess+"</font>";
if(!document.postForm&&(location.href.match(/=recent|thread=/i)||document.title.match(/search\sresults/i))){
for(var x=0;x<td.length;x++){with(td[x]){
if(innerHTML.match(/\[hide\]\s/i)){
td[x].innerHTML=a.replace(/\[hide\]\s<a\s/gi,mess+'<a id="lihide" name="lihide" style="display:none" ');
}}
}
if(pb_username!="Guest"){var ns=document.getElementsByName("lihide");
for(x=0;x<ns.length;x++){ns[x].style.display=""; ns[x].previousSibling.style.display="none";}
}
}
// -->
</script>
* fixed a typo in replace line - 10-15-11 - Wormo
Tested in IE, FF, Opera, Safari and Chrome.
This code was done as a request. Some of you may find it useful.
This code allows you hide a link of your choosing from guests.
This is helpful for links such as personal download links.
The link will be replaced by text that you place in the code.
Example:
Download from here: [Only Members Can View This Link]
When you want a link hidden, your members need to put "[hide] " before the link to be hidden in the post. And yes, there must be a "space" after the "[hide]" and before the link. No closing tag is needed since it is not "real" UBBC. My code then looks for the "[hide]" tag in the posts removes it and changes the following link to not visible. Then the code goes through and finds the "hidden" links and makes them visible if you are a member. To keep the code short and sweet, there is NO button for a member to press to put in the "[hide]" tag, you have to type that in manually in your post.
Enjoy!!!
SubDevo
Only one variable to edit.
var mess="[Only Members Can View This Link]"; // Text for Link Replacement.
Location: Global Footer
<script type="text/Javascript">
<!--
/* Hide Posted Links from Guests by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var mess="[Only Members Can View This Link]"; // Text for Link Replacement.
var td=document.getElementsByTagName("font"); mess="<font>"+mess+"</font>";
if(!document.postForm&&(location.href.match(/=recent|thread=/i)||document.title.match(/search\sresults/i))){
for(var x=0;x<td.length;x++){with(td[x]){
if(innerHTML.match(/\[hide\]\s/i)){
td[x].innerHTML=a.replace(/\[hide\]\s<a\s/gi,mess+'<a id="lihide" name="lihide" style="display:none" ');
}}
}
if(pb_username!="Guest"){var ns=document.getElementsByName("lihide");
for(x=0;x<ns.length;x++){ns[x].style.display=""; ns[x].previousSibling.style.display="none";}
}
}
// -->
</script>
* fixed a typo in replace line - 10-15-11 - Wormo