summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2014-04-30 14:45:52 +0800
committerIru Cai <mytbk920423@gmail.com>2014-04-30 14:45:52 +0800
commit2a87abfc15d8f9569ca64562c8e5bc8308c78b80 (patch)
tree21ba4e0e5e947ccc03402aef7f840df9ad8417b2 /res
parenta1031553ef3136bbc074255a59495977490b50ee (diff)
downloadfqterm-2a87abfc15d8f9569ca64562c8e5bc8308c78b80.tar.xz
Add artDialog in FQTerm script engine
- Modify filedialog so that it'll work without config. - Use artDialog to show the result of the downloadart.js
Diffstat (limited to 'res')
-rw-r--r--res/script/README3
-rw-r--r--res/script/downloadart.js10
2 files changed, 9 insertions, 4 deletions
diff --git a/res/script/README b/res/script/README
index 8e273fc..5e11eb9 100644
--- a/res/script/README
+++ b/res/script/README
@@ -116,4 +116,5 @@ toUTF8(str, codec)
decode from string in specified codec to utf8
return string
-
+artDialog(content)
+open a dialog with content denoted in the argument
diff --git a/res/script/downloadart.js b/res/script/downloadart.js
index f0fd212..8438a52 100644
--- a/res/script/downloadart.js
+++ b/res/script/downloadart.js
@@ -1,6 +1,6 @@
fqterm.importFile("utils.js");
-var saveFile = "/tmp/save.txt";
+// var saveFile = "/tmp/save.txt";
var LastLine = 23;
var timeout = 300;
var retries = 5;
@@ -8,6 +8,7 @@ var retries = 5;
// there'll be a 'XX%' at the last line
var r = new RegExp("%");
var esc = new RegExp('\x1b\x1b','g');
+var content = "";
getAnsiLine = function(i){
var line = fqterm.getAttrText(i).replace(esc, "\x1b[");
@@ -16,7 +17,8 @@ getAnsiLine = function(i){
// first copy the previous lines
for (var i=0; i<LastLine; ++i){
- fqterm.appendFile(saveFile, getAnsiLine(i));
+// fqterm.appendFile(saveFile, getAnsiLine(i));
+ content += getAnsiLine(i);
}
// then copy until article ends
@@ -34,7 +36,9 @@ while (1){
sleep(timeout);
}
}
- fqterm.appendFile(saveFile, cur);
+// fqterm.appendFile(saveFile, cur);
+ content += cur;
}
+fqterm.artDialog(content);