How to use refTagger.tag

Please provide more details on how to call refTagger.tag, A brief example would be good. I am using MVC and need to rescan part of the document when a partialview is loaded with new data that includes Bible references. I don't want to reload the whole page for performance reasons.
I modified my page to set tagAutomatically to false, but I get an error about noSearchTagNames being undefined when I execute the tag method. Also, I am not sure about the syntax for the parameter passed to the tag method. It looks like the Init of the settings fails if you have this setting.
my settings look like this:
var refTagger = {
settings: {
bibleVersion: "ESV",
noSearchTagNames: [],
roundCorners: true,
tagAutomatically: false,
customStyle: {
heading: {backgroundColor: "#d7b7ff",
color: "#7851A9",
fontFamily: "Arial, 'Helvetica Neue', Helvetica, sans-serif",
fontSize: "16px"
},
body: {
color: "#7851A9",
fontFamily: "Tahoma, Verdana, Segoe, sans-serif",
moreLink: {
color: "#a465b5"
}
}
}
}
};
Regards,
Dave
Comments
-
var o_c = document.getElementById('comment');
o_c.innerHTML = "See Romans 1:10 for details";
refTagger.tag(o_c);
0 -
Thanks it works great. I have a partial view in VS2013 MVC5 that loads data into a div with verse references pulled from a database and the partial view is now rescanned and references are tagged using the ajax .done method so I don't have to reload the whole page.
However, I did not find it necessary to set the tagAutomatically to false in the refTagger settings as indicated in other posts.
0 -
How did you know about refTagger.tag? Is there documentation somewhere that shows methods that are available? If so, where is aforementioned documentation?
0 -
Information about refTagger.tag is not included in the official documentation, but it is a supported feature. Its only parameter is a DOM node that should be scanned.
David Mitchell
Development Lead
Faithlife0 -
David Mitchell, how do I need to setup reftagger to enable this? When I try to run this, I get the error: "refTagger.tag is not a function". Here is my setup code:
var refTagger = {
settings: {
bibleVersion: "NKJV",
socialSharing: [],
useTooltip: true,
tagChapters: true,
tagAutomatically: false,
noSearchTagNames: []
}
};
(function (d, t) {
var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
g.src = "//api.reftagger.com/v2/RefTagger.js";
s.parentNode.insertBefore(g, s);
}(document, "script"));0 -
I am also in need of learning how to use the .tag function.
I unminified the code for refTagger and see that they use this function when it tags Automatically.
However, it doesn't seem to be exposed to use except within the library.
David Mitchell, I have tried to use the .tag and I get the same error Tyler gets.
Please help.
Thanks!
0 -
Andrew Alanis said:
I am also in need of learning how to use the .tag function.
I unminified the code for refTagger and see that they use this function when it tags Automatically.
However, it doesn't seem to be exposed to use except within the library.
David Mitchell, I have tried to use the .tag and I get the same error Tyler gets.
Please help.
Thanks!
It is likely that RefTagger is not yet initialized at the time you call `tag`. To work around this, you could add an `onload` handler to the script that imports the RefTagger library and ensure that you don't call `tag` until it has completed. Alternatively, you could create a simple wrapper around `tag` that makes a call to `setTimeout` and retries the operation if `refTagger.tag` is not yet available.
David Mitchell
Development Lead
Faithlife0