Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
GusInfiniteLinesOfCode authored Nov 19, 2023
1 parent 6246b23 commit 9541031
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<button onclick="saveText()">Save</button>
<button onclick="loadText()">Load</button>
<button onclick="loadTextbrowser()">LoadWithUI</button>

<label for="kindleFile">Load Kindle File:</label>
<input type="text" id="kindleFile" accept="text/plain">
Expand Down Expand Up @@ -56,6 +57,30 @@
}
}

function loadTextbrowser() {
var input = document.createElement('input');
input.type = 'file';
input.accept = 'text/plain';

input.onchange = function (event) {
var file = event.target.files[0];
if (!file) {
return;
}

var reader = new FileReader();
reader.onload = function (e) {
document.getElementById('textArea').value = e.target.result;
};
reader.readAsText(file);
};

input.click();
}
// Load the text from the cookie when the page loads
window.onload = function () {
loadTextfromCookies();
};
function saveText() {
saveTextToCookies();
var textToSave = document.getElementById('textArea').value;
Expand Down

0 comments on commit 9541031

Please sign in to comment.