-
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.
- Loading branch information
0 parents
commit 8b4b7a2
Showing
713 changed files
with
138,950 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,17 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>apps - redirect service</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="apps - redirect service" /> | ||
<meta | ||
http-equiv="refresh" | ||
content="0;url=https://kherrick.github.io/apps/" | ||
/> | ||
<script> | ||
location.replace("https://kherrick.github.io/apps/"); | ||
</script> | ||
</head> | ||
<body></body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
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,61 @@ | ||
import { clear } from "./utils.js"; | ||
import { getAssemblyExports } from "./main.js"; | ||
import { | ||
handleCalculatorButtons, | ||
handleCalculatorValue, | ||
handleKeydownAndPaste, | ||
} from "./eventHandlers.js"; | ||
|
||
// result element | ||
const result = document.getElementById("result"); | ||
|
||
// setup model for calculator | ||
const model = { | ||
numbers: { | ||
first: "", | ||
second: "", | ||
}, | ||
operation: "", | ||
}; | ||
|
||
// define placeholder for instance of C# calculator | ||
let Calculator = null; | ||
|
||
// set C# calculator | ||
getAssemblyExports().then((assemblyExports) => { | ||
Calculator = assemblyExports.Calculator; | ||
}); | ||
|
||
// clear the calculator on first load | ||
clear(model, result); | ||
|
||
// setup event handlers for paste and keydown | ||
document.body.addEventListener("keydown", (e) => | ||
handleKeydownAndPaste(Calculator, model, result, e) | ||
); | ||
result.addEventListener("keydown", (e) => { | ||
// prevent modifying the results directly | ||
if (e.key !== "Tab") { | ||
e.preventDefault(); | ||
} | ||
}); | ||
result.addEventListener("beforeinput", (e) => { | ||
// check insertFromPaste using beforeinput | ||
if (e.inputType === "insertFromPaste") { | ||
handleKeydownAndPaste(Calculator, model, result, e); | ||
} | ||
}); | ||
|
||
// setup event handlers for clicking buttons | ||
document.querySelectorAll("input[type=button]").forEach((button) => { | ||
// need both click and keydown to differentiate between space and enter | ||
button.addEventListener("click", (e) => | ||
handleCalculatorButtons(Calculator, model, result, e, button) | ||
); | ||
button.addEventListener("keydown", (e) => | ||
handleCalculatorButtons(Calculator, model, result, e, button) | ||
); | ||
}); | ||
|
||
// focus clear button | ||
document.querySelector("[value='c']").focus(); |
Oops, something went wrong.