I was wondering if I could get some help in something. I am working on my church's website, and I previously implemented something called "Reftagger" onto the new website: http://www.logos.com/reftagger
It "converts" any bible verse into a hyperlink as well as a tooltip. I thought that this was a neat idea, and wanted to do the same with the Westminster Larger (and Shorter) Catechism as well. Anytime it says "WLC Q58" (for example) I want it to automatically display that specific question and answer. So far, I simply have a basic tooltip and a hyperlink inserted for every WLC Q: http://covenantrpc.f...venant/sermons/ (just look at the page source and you'll see what I did). Then I have the tooltip.js file: http://covenantrpc.freehostia.com/covenant...mons/tooltip.js
What I want to do is create some sort of definition library or glossary. One where it tells the webpage that every time the webpage says "WLC 58" it will be automatically converted into a hyperlink and tooltip, just like Reftagger.
| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Autolink And Tooltip Combo
Started by threehappypenguins, Apr 19 2010 09:31 PM
4 replies to this topic
#2
Posted 20 April 2010 - 06:42 AM
I too plan on using Reftagger on my site. But to do what you want, the only way i know how is to replace the content of the document through innerHTML.
<script type="text/javascript">
function wlc()
{
var reg = /\b(WLC Q?\d{1,})\b/g;
var iHtml = document.body.innerHTML;
iHtml = iHtml.replace(reg, "<a href=\"#\">$1</a>");
document.body.innerHTML = iHtml;
}
window.onload = wlc();
</script>
Just make sure this is at the end of page (right before the ending of the body element). Just replace <a href=\"#\">$1</a> with whatever you want. Note, though, that this assumes that WLC Q# won't be within title or alt attributes.
#3
Posted 28 April 2010 - 07:40 AM
This seems like a hell of a good idea and looks like it can be applied to alot more things not just for you church website. This could be used on Blogs, Forums, News websites. I will pass this idea along to some of my friends they will love to here this idea.
#4
Posted 12 August 2010 - 02:50 PM
truefusion, on 20 April 2010 - 06:42 AM, said:
I too plan on using Reftagger on my site. But to do what you want, the only way i know how is to replace the content of the document through innerHTML.
<script type="text/javascript">
function wlc()
{
var reg = /\b(WLC Q?\d{1,})\b/g;
var iHtml = document.body.innerHTML;
iHtml = iHtml.replace(reg, "<a href=\"#\">$1</a>");
document.body.innerHTML = iHtml;
}
window.onload = wlc();
</script>
Just make sure this is at the end of page (right before the ending of the body element). Just replace <a href=\"#\">$1</a> with whatever you want. Note, though, that this assumes that WLC Q# won't be within title or alt attributes.Truefusion, I'm not sure that I follow? I guess what I'm trying to ask is if there is some library or glossary generating program, or someone who has already written some kind of library or glossary and posted it (where I could just make appropriate changes). I don't know how to write javascript. I just copy and paste it, and then make changes. I would create a .js file or something and "call" that glossary or library from the footer of the webpage. Unfortunately, Reftagger doesn't give too many details on how they do it, so I can't "use" their files and make changes. I was hoping that someone would come across this and know what to do!!!
#5
Posted 14 August 2010 - 01:54 AM
threehappypenguins, on 12 August 2010 - 02:50 PM, said:
Truefusion, I'm not sure that I follow? I guess what I'm trying to ask is if there is some library or glossary generating program, or someone who has already written some kind of library or glossary and posted it (where I could just make appropriate changes). I don't know how to write javascript. I just copy and paste it, and then make changes. I would create a .js file or something and "call" that glossary or library from the footer of the webpage. Unfortunately, Reftagger doesn't give too many details on how they do it, so I can't "use" their files and make changes. I was hoping that someone would come across this and know what to do!!!
The Reftagger script does something similar to the script i have provided, it just does it better and it only looks up Biblical verses. The reason why both scripts have to be placed at the bottom of the page is because this ensures that the body element will be available to the script on page load. You could try to edit the RefTagger script to fit your needs, but if you do not understand JavaScript except to what can be understood intuitively (assuming it is possible to understand some parts of the script without previous knowledge of JavaScript or similar langauges), then trying to modify a complex JavaScript script i would not recommend to you.
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users













