Added button and js for shortcode generation

This commit is contained in:
2023-06-26 13:33:42 -07:00
parent a97f27c77f
commit 1e2b4d1c6d
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ timestamp_runtime: datetime = datetime.now().strftime("%d%b%y-%H:%M")
logging.basicConfig( logging.basicConfig(
filename=f"logs/kjv-api_{datetime.now().strftime('%d%b%y')}.log", filename=f"logs/kjv-api_{datetime.now().strftime('%d%b%y')}.log",
encoding="utf-8", encoding="utf-8",
level=logging.DEBUG, level=logging.INFO,
) )
logging.info(f"Started: {timestamp_runtime}") logging.info(f"Started: {timestamp_runtime}")
+13
View File
@@ -13,10 +13,23 @@
<input type="submit" value="Search"> <input type="submit" value="Search">
<input type="hidden" name="view" value="rich"> <input type="hidden" name="view" value="rich">
</form> </form>
<button onclick="make_shortcode()">Get Shortcode: </button>
<a id="context_href" href=''></a>
<br>
&leftarrow; &leftarrow;
<a href="{prev_chapter_link}">{prev_chapter_name}</a> | <a href="{prev_chapter_link}">{prev_chapter_name}</a> |
{current_chapter_name} | {current_chapter_name} |
<a href="{next_chapter_link}">{next_chapter_name}</a> <a href="{next_chapter_link}">{next_chapter_name}</a>
&rightarrow; &rightarrow;
</div> </div>
<script>
function make_shortcode(){{
var xmlHttp = new XMLHttpRequest();
var theUrl = "/mksc/" + document.getElementById("searchBar").value;
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
document.getElementById("context_href").innerHTML = xmlHttp.responseText;
document.getElementById('context_href').setAttribute("href", "/" + xmlHttp.responseText);
}}
</script>
</header> </header>