implemented charRed
This commit is contained in:
parent
fecd26f4bb
commit
9ee0b3e2c8
@ -117,7 +117,6 @@
|
|||||||
></a>
|
></a>
|
||||||
<a
|
<a
|
||||||
href="."
|
href="."
|
||||||
id="siteTitle"
|
|
||||||
class="w3-left-align w3-button w3-padding-large w3-flat-wet-asphalt"
|
class="w3-left-align w3-button w3-padding-large w3-flat-wet-asphalt"
|
||||||
><img class="logo" src="logo.png" alt="logo" height="30px"
|
><img class="logo" src="logo.png" alt="logo" height="30px"
|
||||||
/></a>
|
/></a>
|
||||||
@ -134,6 +133,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w3-main" style="margin-left: 300px">
|
<div class="w3-main" style="margin-left: 300px">
|
||||||
|
<h2 id="siteTitle" style="display: none">hello</h2>
|
||||||
<div
|
<div
|
||||||
id="mainForm"
|
id="mainForm"
|
||||||
class="w3-row-padding w3-padding-top-64 w3-container w3-flat-clouds"
|
class="w3-row-padding w3-padding-top-64 w3-container w3-flat-clouds"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { hideMenus, showMenu, showSidebar, showTextBlocks, clickSetForm, clickImportFiles, modalNotifier } from "./evts.js";
|
import { hideMenus, showMenu, showSidebar, showTextBlocks, clickSetForm, clickImportFiles, modalNotifier } from "./evts.js";
|
||||||
import { buildFile } from "./files.js";
|
import { buildFile } from "./files.js";
|
||||||
import setPassword, { passwordHash, sessionVerification } from "./scripts.js";
|
import setPassword, { passwordHash, sessionVerification, inputRead } from "./scripts.js";
|
||||||
import { getUsrId, logout } from "./scripts.js";
|
import { getUsrId, logout } from "./scripts.js";
|
||||||
import parseFormOnSubmit from "./parseForm.js";
|
import parseFormOnSubmit from "./parseForm.js";
|
||||||
import { createStorageObj } from "./storage.js";
|
import { createStorageObj } from "./storage.js";
|
||||||
@ -133,8 +133,9 @@ document
|
|||||||
.addEventListener("click", () => clickImportFiles());
|
.addEventListener("click", () => clickImportFiles());
|
||||||
|
|
||||||
//add key listener for ctrl s in form mode
|
//add key listener for ctrl s in form mode
|
||||||
|
inputRead.init();
|
||||||
window.addEventListener("keydown", (e) => {
|
window.addEventListener("keydown", (e) => {
|
||||||
|
inputRead.read(e);
|
||||||
if (e.ctrlKey && e.key == "s") {
|
if (e.ctrlKey && e.key == "s") {
|
||||||
if (activeState.activePage == "form");
|
if (activeState.activePage == "form");
|
||||||
createStorageObj();
|
createStorageObj();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { retrieveData } from "./storage.js";
|
import { createStorageObj, retrieveData } from "./storage.js";
|
||||||
import sha256 from "./sha256.min.js";
|
import sha256 from "./sha256.min.js";
|
||||||
import XORCipher from "./xorc.js";
|
import XORCipher from "./xorc.js";
|
||||||
import getBrowserFingerprint from "./identify.js"
|
import getBrowserFingerprint from "./identify.js"
|
||||||
@ -178,8 +178,49 @@ export function sanitize(string) {
|
|||||||
'=': '_'
|
'=': '_'
|
||||||
};
|
};
|
||||||
const reg = /[&<>"'/]/ig;
|
const reg = /[&<>"'/]/ig;
|
||||||
console.log(string.replace(reg, (match)=>(map[match])));
|
|
||||||
return string.replace(reg, (match)=>(map[match]));
|
return string.replace(reg, (match)=>(map[match]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isAlphaNumeric(str) {
|
||||||
|
var code, i, len;
|
||||||
|
|
||||||
|
for (i = 0, len = str.length; i < len; i++) {
|
||||||
|
code = str.charCodeAt(i);
|
||||||
|
if (!(code > 47 && code < 58) && // numeric (0-9)
|
||||||
|
!(code > 64 && code < 91) && // upper alpha (A-Z)
|
||||||
|
!(code > 96 && code < 123)) { // lower alpha (a-z)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inputRead = {
|
||||||
|
init: function () {
|
||||||
|
this.event = "";
|
||||||
|
this.inputString = "";
|
||||||
|
this.source = "";
|
||||||
|
this.inputContent = "";
|
||||||
|
},
|
||||||
|
read: function (event) {
|
||||||
|
this.event = event;
|
||||||
|
this.source = event.srcElement.id;
|
||||||
|
let key = (event.key !=undefined) ? event.key : "";
|
||||||
|
let contentElement = document.getElementById(this.source);
|
||||||
|
this.inputContent = (contentElement != undefined) ? contentElement.value + key : "";
|
||||||
|
|
||||||
|
if (this.inputContent == "" || key == "") return;
|
||||||
|
if (!isAlphaNumeric(key)) return;
|
||||||
|
if (key.length > 1) return;
|
||||||
|
if (activeState.activePage != "template") return;
|
||||||
|
|
||||||
|
document.getElementById("toggleFilesMenu").style.backgroundColor = "#c0392b";
|
||||||
|
const run = setTimeout(() => {
|
||||||
|
createStorageObj();
|
||||||
|
document.getElementById("toggleFilesMenu").style.backgroundColor = "#34495e"
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
|
//filter words
|
||||||
|
}
|
||||||
|
|
||||||
export default setPassword;
|
export default setPassword;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user