I’ve added a setting that allows you to select the translation you want to use, and the component extends the content security policy to allow for the reftagger library to be included.
@RGJ, our community loves this feature. Thank you for developing in a secure and customizable manner. I appreciate your generosity in sharing this work back to the Discourse community.
I would love to see a similar component in which custom keywords and previews can be defined.
That would be super useful to create a glossary for example
Hello everyone, Reftagger was working swimmingly for a few months, and then it just stopped. It will still automatically generate an external link for the book/chapter/verse format, but it will not load the hover preview.
It’s working again now.
Reftagger apparently switched to a different CDN (reftagger.bibliacdn.com) which had to be whitelisted in the content security policy. I have added it and pushed a new version of the theme component. All you need to do is update the component.
Sto riesaminando un vecchio thread. Ho installato questo componente del tema e stanno succedendo due cose.
La prima è il messaggio che il componente necessita di un aggiornamento. [Avviso Admin] Il tema ‘Reftagger’ contiene codice che necessita di un aggiornamento. (id:discourse.script-tag-discourse-plugin) (Scopri di più)
La seconda potrebbe essere correlata al primo avviso in cui il componente necessita di un aggiornamento. I riferimenti non vengono contrassegnati e le pagine sembrano bloccarsi mostrando il cerchio di caricamento nella scheda del browser.
Ho fatto dei progressi con questo usando ChatGPT e ho dei reftagger funzionanti sia per Logos RefTagger che per Blue Letter Bible.
Se questi potessero essere raggruppati in un componente tematico per l’uso della community, sarebbe fantastico, altrimenti il componente tematico serve semplicemente a realizzarlo. Devi solo prendere il codice per quello che preferisci e inserirlo nella scheda JS di un nuovo componente tematico. Devi rimuovere il codice predefinito che si trova nella scheda JS di Discourse.
Se qualcuno ha feedback su come migliorare, è ben accetto. Le mie capacità si limitano a guidare l’LLM.
Usando Logos RefTagger:
import { apiInitializer } from "discourse/lib/api";
import loadScript from "discourse/lib/load-script";
export default apiInitializer("0.1", (api) => {
// 1. Define RefTagger settings on window BEFORE loading the script
window.refTagger = {
settings: {
bibleVersion: "ESV", // e.g. default Bible version
tagChapters: true, // tag chapter references as well
convertHyperlinks: false, // don’t retag existing links
roundCorners: true,
socialSharing: [ ],
}
};
// 2. Hook into Discourse post rendering:
api.decorateCooked((element) => {
// Load the external RefTagger script (if not already loaded)
loadScript("https://api.reftagger.com/v2/RefTagger.js").then(() => {
// Run the tagging on the new content element
window.refTagger.tag(element);
});
});
});
Usando BLB ScriptTagger:
import { apiInitializer } from "discourse/lib/api";
import loadScript from "discourse/lib/load-script";
export default apiInitializer("0.1", (api) => {
// Optionally set BLB ScriptTagger settings before loading (defaults shown)
window.BLB ||= {}; // ensure global BLB object exists
window.BLB.Tagger ||= {};
window.BLB.Tagger.Translation = "NKJV"; // default translation version
window.BLB.Tagger.HyperLinks = "all"; // tag even already-linked refs
window.BLB.Tagger.TargetNewWindow = true; // links open in new tab
// … (other settings like DarkTheme, etc., as needed)
api.decorateCooked((elem) => {
loadScript("https://www.blueletterbible.org/assets/scripts/blbToolTip/BLB_ScriptTagger-min.js")
.then(() => {
if (window.BLB && window.BLB.Tagger) {
window.BLB.Tagger.pageInit(); // re-scan new content for verses:contentReference
}
});
});
});