The new code and the fragmention plugin were conflicting and I think this was the source of some of the glitches. So I've ditched the plugin and written some javascript to achieve the same thing.

[code lang="js"]
var loc = location.href;
var hash = loc.substring(loc.indexOf('##')+2).toLowerCase();

while (hash.indexOf('+') !== -1) {
hash = hash.replace("+", " ");

var pTags = document.getElementsByTagName("p");

var x, y, pContent;

for (var p = 0; p < pTags.length; p++) {
pContent = pTags[p].innerHTML.toLowerCase();

if (pContent.indexOf(hash) !== -1) {
x = pTags[p].innerHTML;
y = "<p fragmention>" + x + "</p>";
pTags[p].outerHTML = y;

That's it!

There's not much to it at all and I don't really know what the plugin does extra.

Leave a Reply

Your email address will not be published.