Created
March 16, 2022 09:18
-
-
Save danielbair/6aae35814a92d72c183e00ab06420873 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Monarch Fix Bible Ref | |
// @namespace http://danielbair.com/ | |
// @version 0.1 | |
// @description Fix bible references on Monarch App | |
// @author Daniel Bair | |
// @match https://monarch-app.aop.com/curriculum/* | |
// @icon https://www.google.com/s2/favicons?domain=aop.com | |
// @grant none | |
// @copyright 2020+, Daniel Bair | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.addEventListener("load", function(){ | |
window.fixRef = function() { | |
console.log('Fixing Monarch Bible References'); | |
Object.values(document.getElementsByClassName('bibleref')).forEach(function(item){ | |
var book = item.getAttribute("book").replace(/ /g, "_");; | |
var chapter = item.getAttribute("chapter"); | |
var versebeg = item.getAttribute("versebeg"); | |
var verseend = item.getAttribute("verseend"); | |
load_verse_inline("nasb",book,chapter,versebeg,verseend,item); | |
console.log(item); | |
}); | |
var child = document.createElement('style'); | |
child.setAttribute('type','text/css'); | |
child.innerHTML = ".monarch-verse-copyright {display: none;}"; | |
document.head.appendChild(child); | |
console.log('Adding Custom styles'); | |
} | |
function load_verse_inline($_translation,$_book,$_chapter,$_verse_begin,$_verse_end,$_elem){ | |
var $_url = '/curriculum/bible/' + | |
$_translation + '/' + | |
$_book + '/' + | |
$_chapter + '/' + | |
$_verse_begin + '/' + | |
$_verse_end; | |
const xhttp = new XMLHttpRequest(); | |
xhttp.onload = function() { | |
$_elem.innerHTML = this.responseText; | |
} | |
xhttp.open("GET", $_url, true); | |
xhttp.send() | |
} | |
//setTimeout(function(){ | |
window.fixRef(); | |
//}, 1000); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment