Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linking capability #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HomeFiles/Lexicon.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<h1><span class="logo"><span>The OpenScriptures</span><br />Hebrew Bible</span> – Lexicon</h1>
</header>
<nav>
<form>
<form method="get">
<label for="lexID">Enter an OSHB lemma or Strong Number</label>
<input type="text" id="lexID" />
<input type="text" id="lexID" name="lexID" />
<input type="submit" id="submit" value="Enter" />
<a href="https://github.com/openscriptures/HebrewLexicon/blob/master/HomeFiles/readme.md" target="_blank">Instructions</a>
</form>
Expand Down
23 changes: 23 additions & 0 deletions HomeFiles/Script/Lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,37 @@
return parts[parts.length - 1].replace(" ", "");
}
// Click handler for the input form.
var noPush = false; // lets you go back and forward again
function setID() {
var id = parseLemma(lexID.value);
if (parseInt(id) || id.length == 1) {
id = aug[(augments.indexOf(id) >= 0) ? id + "a" : id];
}
wordGroup.set(id);

if (!noPush) {
window.history.pushState({}, "", "?lexID=" + lexID.value);
}
noPush = false;
return false;
}
document.getElementById("submit").onclick = setID;

function setIDFromQueryString() {
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
var lexIDFromQueryString = urlParams.get('lexID');

if (lexIDFromQueryString) {
lexID.value = lexIDFromQueryString;
setID();
}
}
setIDFromQueryString();
window.addEventListener("popstate", function() {
noPush = true;
setIDFromQueryString();
});

lexID.select();
})();
4 changes: 3 additions & 1 deletion HomeFiles/Script/WordGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ wordGroup = function() {
} else {
bdbControl("");
strongControl("");
lexID.value = currentID;
if(currentID !== undefined) {
lexID.value = currentID;
}
}
};
/******************************************************************************
Expand Down