This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate UI bindings from actual function
- Loading branch information
Showing
15 changed files
with
235 additions
and
238 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// UI_* files contain JS code for GUI elements, isolated from any actual functions | ||
|
||
document.getElementById('clearDrawingPadBtn').onclick = function() { | ||
resetCanvas(); | ||
} | ||
|
||
/* presiction used by the "Predict" button (if autoprediction is disabled) */ | ||
document.getElementById('predictBtn').onclick = async function() { | ||
predict(); | ||
resetCanvas(); | ||
document.getElementById('predictBtn').disabled = true; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// UI_* files contain JS code for GUI elements, isolated from any actual functions | ||
|
||
/* wipe all data button */ | ||
document.getElementById('filemanWipe').onclick = () => { | ||
localStorage.removeItem('dataset'); | ||
init(); | ||
} | ||
|
||
/* show/hide debug */ | ||
document.getElementById('debugTogglerBtn').onclick = () => { | ||
document.getElementById('debug').style.display == "none" ? Configs.showDebug = 1 : Configs.showDebug = 0; | ||
saveConfigs(); | ||
updateUI(); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// UI_* files contain JS code for GUI elements, isolated from any actual functions | ||
|
||
/* show/hide UI blocks ("AppMode") */ | ||
document.getElementById('appModeSwitcher').onclick = () => { | ||
appModeSwitcher.checked ? Configs.currentAppMode = 1 : Configs.currentAppMode = 0; | ||
saveConfigs(); | ||
updateUI(); | ||
}; | ||
document.getElementById('appModeSwitcherHandler').oncontextmenu = () => { | ||
appModeSwitcher.indeterminate ? | ||
(appModeSwitcher.checked ? Configs.currentAppMode = 1 : Configs.currentAppMode = 0) | ||
: Configs.currentAppMode = 2; | ||
saveConfigs(); | ||
updateUI(); | ||
|
||
return false; // don't show context menu | ||
}; | ||
|
||
/* show/hide menu popup button */ | ||
document.getElementById('filemanTogglerBtn').onclick = function() { | ||
document.getElementById('fileman').style.transform != 'translateY(-115%)' | ||
? document.getElementById('fileman').style.transform = 'translateY(-115%)' | ||
: document.getElementById('fileman').style.transform = 'translateY(0%)'; | ||
} | ||
|
||
/* view mode buttons */ | ||
document.getElementById('viewAsGridBtn').onclick = () => { | ||
Configs.resultsViewMode = 1; | ||
saveConfigs(); | ||
updateUI(); | ||
}; | ||
document.getElementById('viewAsListBtn').onclick = () => { | ||
Configs.resultsViewMode = 0; | ||
saveConfigs(); | ||
updateUI(); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// UI_* files contain JS code for GUI elements, isolated from any actual functions | ||
|
||
/* autoprediction toggler */ | ||
document.getElementById('autopreditionToggler').onclick = () => { | ||
autopreditionToggler.checked ? Configs.useAutoprediction = 1 : Configs.useAutoprediction = 0; | ||
saveConfigs(); | ||
updateUI(); | ||
}; | ||
|
||
/* autotrain toggler */ | ||
document.getElementById('autotrainToggler').onclick = () => { | ||
autotrainToggler.checked ? Configs.useAutotrain = 1 : Configs.useAutotrain = 0; | ||
saveConfigs(); | ||
updateUI(); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// UI_* files contain JS code for GUI elements, isolated from any actual functions | ||
|
||
/* typeman input validation */ | ||
document.getElementById('addTypeInput').onchange = () => addTypeInputValidate(); | ||
document.getElementById('addTypeInput').onpaste = () => addTypeInputValidate(); | ||
document.getElementById('addTypeInput').oninput = () => addTypeInputValidate(); | ||
|
||
/* add class button using input name */ | ||
document.getElementById('addTypeBtn').onclick = () => createClassBtn( | ||
document.getElementById('addTypeInput').value.trim().replace(/ /g, '-') ); | ||
|
||
/* class removal mode button */ | ||
document.getElementById('removalModeTogglerBtn').onclick = () => toggleClassRemover(); |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.