Added Word Form pullout for mobile.
This commit is contained in:
parent
1e82cd2745
commit
ce62aed494
|
@ -64,6 +64,23 @@ and (max-device-width : 910px) {
|
||||||
margin: 0px auto;
|
margin: 0px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mobileWordFormPullout {
|
||||||
|
position: fixed;
|
||||||
|
top: 7%;
|
||||||
|
left: 0;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
padding: 6px;
|
||||||
|
background: #86ac41;
|
||||||
|
-webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
|
||||||
|
-moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
|
||||||
|
box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
#dictionaryColumn {
|
#dictionaryColumn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -190,6 +190,8 @@ if ($display_mode != "build") {
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="mobileWordFormPullout" onclick="MobileToggleWordForm();" style="display:none;">+</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div id="dictionaryColumn"><div id="dictionaryContent">
|
<div id="dictionaryColumn"><div id="dictionaryContent">
|
||||||
|
|
40
js/ui.js
40
js/ui.js
|
@ -12,6 +12,7 @@ function Initialize() {
|
||||||
GetTextFile("/IMPORT.form", "importForm", false);
|
GetTextFile("/IMPORT.form", "importForm", false);
|
||||||
|
|
||||||
SetKeyboardShortcuts();
|
SetKeyboardShortcuts();
|
||||||
|
SetWindowListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetKeyboardShortcuts() {
|
function SetKeyboardShortcuts() {
|
||||||
|
@ -116,6 +117,25 @@ function SetKeyboardShortcuts() {
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SetWindowListeners() {
|
||||||
|
window.addEventListener("scroll", function() {
|
||||||
|
var doc = document.documentElement;
|
||||||
|
var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
||||||
|
var dictionaryColumn = document.getElementById("dictionaryColumn");
|
||||||
|
var wordPullout = document.getElementById("mobileWordFormPullout");
|
||||||
|
|
||||||
|
if (top > dictionaryColumn.offsetTop) {
|
||||||
|
wordPullout.style.display = "block";
|
||||||
|
} else {
|
||||||
|
wordPullout.style.display = "none";
|
||||||
|
if (wordPullout.innerHTML != "+") {
|
||||||
|
LockWordForm();
|
||||||
|
wordPullout.innerHTML = "+";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function SubmitWordOnCtrlEnter(keypress) {
|
function SubmitWordOnCtrlEnter(keypress) {
|
||||||
var keyCode = (event.which ? event.which : event.keyCode);
|
var keyCode = (event.which ? event.which : event.keyCode);
|
||||||
|
|
||||||
|
@ -335,26 +355,36 @@ function wordFormIsLocked() {
|
||||||
return document.getElementById("formLockButton").innerHTML == "\uD83D\uDD12";
|
return document.getElementById("formLockButton").innerHTML == "\uD83D\uDD12";
|
||||||
}
|
}
|
||||||
|
|
||||||
function ToggleWordFormLock() {
|
function MobileToggleWordForm() {
|
||||||
|
var pullout = document.getElementById("mobileWordFormPullout");
|
||||||
|
ToggleWordFormLock("7%");
|
||||||
|
if (pullout.innerHTML == "+") {
|
||||||
|
pullout.innerHTML = "✕";
|
||||||
|
} else {
|
||||||
|
pullout.innerHTML = "+";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ToggleWordFormLock(topValue) {
|
||||||
if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to.
|
if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to.
|
||||||
UnlockWordForm();
|
UnlockWordForm(topValue);
|
||||||
} else {
|
} else {
|
||||||
LockWordForm();
|
LockWordForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function UnlockWordForm() {
|
function UnlockWordForm(topValue) {
|
||||||
var lockButton = document.getElementById("formLockButton");
|
var lockButton = document.getElementById("formLockButton");
|
||||||
var leftColumn = document.getElementById("leftColumn");
|
var leftColumn = document.getElementById("leftColumn");
|
||||||
var wordForm = document.getElementById("wordEntryForm");
|
var wordForm = document.getElementById("wordEntryForm");
|
||||||
var wordFormWidth = wordForm.offsetWidth - 20;
|
var wordFormWidth = wordForm.offsetWidth;
|
||||||
var leftColumnWidth = leftColumn.offsetWidth;
|
var leftColumnWidth = leftColumn.offsetWidth;
|
||||||
var leftColumnHeight = leftColumn.offsetHeight;
|
var leftColumnHeight = leftColumn.offsetHeight;
|
||||||
|
|
||||||
lockButton.innerHTML = "🔓"; // Change to the "Unlocked lock" icon.
|
lockButton.innerHTML = "🔓"; // Change to the "Unlocked lock" icon.
|
||||||
|
|
||||||
wordForm.style.position = "fixed";
|
wordForm.style.position = "fixed";
|
||||||
wordForm.style.top = document.getElementsByTagName("header")[0].offsetHeight.toString() + "px";
|
wordForm.style.top = (typeof topValue !== 'undefined') ? topValue : document.getElementById("dictionaryColumn").offsetTop.toString() + "px";
|
||||||
wordForm.style.width = wordFormWidth.toString() + "px";
|
wordForm.style.width = wordFormWidth.toString() + "px";
|
||||||
|
|
||||||
leftColumn.style.width = leftColumnWidth.toString() + "px";
|
leftColumn.style.width = leftColumnWidth.toString() + "px";
|
||||||
|
|
Loading…
Reference in New Issue