-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmorehandler.js
More file actions
90 lines (73 loc) · 1.85 KB
/
morehandler.js
File metadata and controls
90 lines (73 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
var sCover = document.getElementById("s-cover")
var fCover = document.getElementById("s-cover-files")
var up = document.getElementById("upload-diag")
function popupMoreMenu() {
sCover.style.display = "block"
sCover.focus()
editor.blur()
}
function popupFilesMenu() {
fCover.style.display = "block"
fCover.focus()
editor.blur()
}
function closeMoreMenu() {
sCover.style.display = "none"
sCover.blur()
editor.focus()
}
function closeFilesMenu() {
fCover.style.display = "none"
fCover.blur()
editor.focus()
}
function download(file, text) {
//creating an invisible element
var element = document.createElement('a');
element.setAttribute('href',
'data:text/plain;charset=utf-8, '
+ encodeURIComponent(text))
element.setAttribute('download', file)
// Above code is equivalent to
// <a href="path of file" download="file name">
document.body.appendChild(element)
//onClick property
element.click()
document.body.removeChild(element)
}
//download arbitrary data
function downloadURI(uri, name) {
uri = "data:text/plain," + uri
let link = document.createElement("a");
link.download = name;
link.href = uri;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function openHelp() {
window.open("help.html")
}
function openDocs() {
window.open("4zdocs.html")
}
function openClrhome() {
//opens clrhome instruction set table
window.open("https://clrhome.org/table/")
}
function savePrgm() {
let val = editor.getValue()
let name = "program.txt"
if (val.charAt(0) == ";") {
name = val.slice(1, val.indexOf("\n"))
}
downloadURI(editor.getValue(), name)
}
function saveASM() {
//save editor
savePrgm()
}
function loadPrgm() {
rfmode = "editor"
up.click()
}