aboutsummaryrefslogtreecommitdiffstats
path: root/bufferecho.js
diff options
context:
space:
mode:
authorteramako2008-09-21 02:03:56 +0000
committerteramako2008-09-21 02:03:56 +0000
commitaddadde7f4761239abe9452f252530f978ef514f (patch)
tree27d71f99de8de1f5ff8d3a303b294d08581472bd /bufferecho.js
parent0fa07caa7ed4fb10f05b7e9342c07405ff4f3dcc (diff)
downloadvimperator-plugins-addadde7f4761239abe9452f252530f978ef514f.tar.bz2
fix: indent
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@19659 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'bufferecho.js')
-rw-r--r--bufferecho.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/bufferecho.js b/bufferecho.js
index 18e2eee..c1826a9 100644
--- a/bufferecho.js
+++ b/bufferecho.js
@@ -10,38 +10,38 @@ liberator.plugins.buffer_echo = (function(){
var title = "bufferecho results";
var prefix = 'data:text/html,';
function execute(str){
- var result;
- try {
- result = (function(){ return window.eval("with(liberator) {" + str + "}") })();
- } catch (e) {
+ var result;
+ try {
+ result = (function(){ return window.eval("with(liberator) {" + str + "}") })();
+ } catch (e) {
result = e.name + ":\n" + e.message;
- }
- return result;
+ }
+ return result;
}
liberator.commands.addUserCommand(['bufferecho','becho'],'Display results of JavaScript to a buffer(browser)',
- function(args, special){
+ function(args, special){
liberator.plugins.buffer_echo.open(args, special);
- },{
- completer: function(filter) liberator.completion.javascript(filter)
- },true
+ },{
+ completer: function(filter) liberator.completion.javascript(filter)
+ },true
);
var manager = {
append: function(htmlString){
var body = liberator.buffer.evaluateXPath('/html/body').snapshotItem(0);
body.innerHTML += htmlString;
},
- open: function(str, forceNewTab) {
- var result = execute(str);
+ open: function(str, forceNewTab) {
+ var result = execute(str);
if (typeof(result) == "object") result = liberator.util.objectToString(result,true);
- var data = '<div><h1>' + str + '</h1><pre>' + result + '</pre></div>';
+ var data = '<div><h1>' + str + '</h1><pre>' + result + '</pre></div>';
if (liberator.buffer.title == title && !forceNewTab){
this.append(data);
return;
}
var where = liberator.buffer.URL == "about:blank" ? liberator.CURRENT_TAB : liberator.NEW_TAB;
liberator.open([prefix + '<title>'+title+'</title>' + data], where);
- }
+ }
};
return manager;
})();