jQuery Biblify

Update 30-01-2016 After getting a number of false positives I've dropped this library from the current blog theme whilst I work out the bugs. The pattern match was a bit optimistic, I need to key on the book names more closely...

I've recently started including a new JavaScript library on BibleSnippets designed to find Bible references in a webpage and turn them into hyperlinks. It's called jQuery Biblify.

Using this library allows you to simply type out references to Bible verses (or ranges of verses) in your website. When a user views the site, their browser will automatically turn the references into hyperlinks.

<script type="text/javascript" src="jquery.min.js"></script>  
<script type="text/javascript" src="jquery.biblify.js"></script>  
...
$(document).ready(
  function () {
    $("article").biblify();
  });

If you have a large site with lots of unlinked references then including this library in a page will fix them all up. It's also great for bloggers who have to manually create links by copy/pasting URLs from Bible sites.

By default the library links up references to BibleGateway.com, and will generate suitable tooltips and consistent referencing format. It won't yet auto-detect Bible versions, but the adventurous could always try selector-based workarounds:

// Not shown: define two different links in options object

$('#main .nkjv').biblify(nkjvOptions);
$('#main .esv').biblify(esvOptions);

Full usage instructions can be found in the repository readme.md file.

If you want to use the library, please be aware of the following:

  1. It won't attempt to modify Bible references that are already in hyperlinks.

  2. It will only look for references in text nodes, so tooltips or other content will be ignored.

  3. It's not been heavily tested (i.e "works on my machine"). If it doesn't work for you then either fork me and fix it yourself, or find an alternative.

  4. You're welcome to submit issues which I'll take a look at as frequently as I can.

  5. If you fork me and make improvements please send a pull request!

Contact

If you have questions or suggestions you can find me on Twitter @biblesnippets or write on the Facebook page wall. Bear in mind I have a 10 week old and a 2 year old, so support is on a "best endeavours" basis!

Example

The library can deal with inline references, such as Ezra 3v1, for example. It can also deal with references in their own element (Psa 4v2) or those just after an element: Matt 4v16. References just before - Rev20v5 should also work.

Nathan

Bible enthusiast, husband, Dad, and tech-head with too many projects and not enough time.