-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
99 lines (84 loc) · 1.92 KB
/
app.js
File metadata and controls
99 lines (84 loc) · 1.92 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
91
92
93
94
95
96
97
98
99
$(document).ready(function(){
// Enabled console log Garuda Javascript
run_console = true;
// This Code Just An Example For Make Sure That Garuda Javascript Is Work !...
// Repository https://github.com/eligrey/FileSaver.js
// Many Thanks to Eli Grey
_focus("txt_file");
var txt = _getById("f_txt");
var js = _getById("f_js");
var php = _getById("f_php");
var html = _getById("f_html");
function save()
{
/**
* gQuery
* @type {[type]}
*/
const filename = _getValById("txt_file");
const content = _getValById("txt_content");
var format_file;
if (filename==='')
{
_writeAlert("msg_warning","Masukkan Nama File Terlebih Dahulu ( Tanpa Format File ) ! ","warning");
_focus("txt_file");
return;
}
if (txt.checked==true)
{
format_file = ".txt";
}
else if (js.checked==true)
{
format_file = ".js";
}
else if (php.checked==true)
{
format_file = ".php";
}
else if (html.checked==true)
{
format_file = ".html";
}
else
{
_writeAlert("msg_warning","Silahkan Pilih Format File Terlebih Dahulu ","warning");
return;
}
if (content==='')
{
_writeAlert("msg_warning","Masukkan Content yang ingin anda Simpan !","warning");
_focus("txt_content");
return;
}
/**
* End gQuery
* @type {[type]}
*/
/**
* Save To File
* @type {Blob}
*/
var blob = new Blob([content], {type: "text/plain;charset=utf-8"});
saveAs(blob, filename+format_file);
// End Save To File
}
_onClick("btn_clear",function(){
_clear("txt_content");
_clear("txt_file");
_focus("txt_file");
});
_onClick("btn_save",function(){
save();
});
_keyCustom(function(){
save();
},_keyCode.insert);
// Set to input value txt_file
//_setValue("txt_file","example");
// Set to input value txt_content
_setValue("txt_content"
,'<?php \n $string= "Hello World !"; \n var_dump($string);');
// checked radio button
php.checked = true;
});