Fix r2.js webui with 'l'->'T'

This commit is contained in:
pancake 2014-08-28 03:48:43 +02:00
parent 60c7c33e3f
commit 14629fed36
4 changed files with 8 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@ enyo.kind ({
create: function() {
this.inherited (arguments);
var out = this.$.output;
this.logger = r2.get_logger ().on ("message", function (msg) {
this.logger = r2.getTextLogger ().on ("message", function (msg) {
out.setContent (out.getContent() + msg.text + "\n");
});
this.logger.autorefresh (3);

View File

@ -15,7 +15,7 @@ r2ui.consoleExec = function () {
r2ui.logger = null;
function init () {
logger = r2.get_logger ().on ("message", function (msg) {
logger = r2.getTextLogger ().on ("message", function (msg) {
var out = document.getElementById ('logsBody');
out.innerHTML += "<br />"+msg.text; // XXX XSS
});

View File

@ -234,26 +234,26 @@ r2.alive = function (cb) {
});
}
r2.get_logger = function (obj) {
r2.getTextLogger = function (obj) {
if (typeof (obj) != "object")
obj = {};
obj.last = 0;
obj.events = {};
obj.interval = null;
r2.cmd ("ll", function (x) {
r2.cmd ("Tl", function (x) {
obj.last = +x;
});
obj.load = function (cb) {
r2.cmd ("lj "+(obj.last+1), function (ret) {
r2.cmd ("Tj "+(obj.last+1), function (ret) {
if (cb) cb (JSON.parse (ret));
});
}
obj.clear = function (cb) {
// XXX: fix l-N
r2.cmd ("l-", cb); //+obj.last, cb);
r2.cmd ("T-", cb); //+obj.last, cb);
}
obj.send = function (msg, cb) {
r2.cmd ("l "+msg, cb);
r2.cmd ("T "+msg, cb);
}
obj.refresh = function (cb) {
obj.load (function (ret) {