Labs/Ubiquity/0.2 Proposed Uplift Commands: Difference between revisions
Jump to navigation
Jump to search
(New page: This page contains a list of commands that are being proposed for uplift into Ubiquity 0.2.) |
(Added a few simple implementations of some commands suggested by Breydon Fuller via groups) |
||
| Line 1: | Line 1: | ||
This page contains a list of commands that are being proposed for uplift into Ubiquity 0.2. | This page contains a list of commands that are being proposed for uplift into Ubiquity 0.2. | ||
== Browser-related commands == | |||
; fullscreen : | |||
CmdUtils.CreateCommand({ | |||
name: "fullscreen", | |||
description: "Toggles fullscreen mode", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.fullScreen = win.fullScreen ? false : true; | |||
} | |||
}); | |||
; back : | |||
CmdUtils.CreateCommand({ | |||
name: "back", | |||
description: "Go one step back in history", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.history.go(-1); | |||
} | |||
}); | |||
; forward : | |||
CmdUtils.CreateCommand({ | |||
name: "forward", | |||
description: "Go one step forward in history", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.history.go(1); | |||
} | |||
}); | |||
; home : | |||
CmdUtils.CreateCommand({ | |||
name: "home", | |||
description: "Go to home page", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.home(); | |||
} | |||
}); | |||
; close : | |||
CmdUtils.CreateCommand({ | |||
name: "close", | |||
description: "Close firefox", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.close(); | |||
} | |||
}); | |||
; refresh : | |||
CmdUtils.CreateCommand({ | |||
name: "refresh", | |||
description: "Refresh current document", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.location.reload( true ); | |||
} | |||
}); | |||
; bookmark : | |||
CmdUtils.CreateCommand({ | |||
name: "bookmark", | |||
description: "Add current document to bookmarks", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindowInsecure(); | |||
var doc = CmdUtils.getDocument(); | |||
try { | |||
win.sidebar.addPanel(doc.title, win.location.href,""); | |||
} catch ( e ) { displayMessage("Page could not be bookmarked!" + ((e)?" - "+e:"")); } | |||
} | |||
}); | |||
; print : | |||
CmdUtils.CreateCommand({ | |||
name: "print", | |||
description: "Print current page", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
var win = CmdUtils.getWindow(); | |||
win.print(); | |||
} | |||
}); | |||
=== Requests === | |||
; restart : | |||
Currently doesn't work because Application is wrapped by XPCOM | |||
CmdUtils.CreateCommand({ | |||
name: "restart", | |||
description: "Restarts firefox", | |||
preview: function( pblock ) {pblock.innerHTML=this.description}, | |||
execute: function() { | |||
Application.restart(); | |||
} | |||
}); | |||
; exit : Equivalent of File->Exit | |||
Revision as of 08:10, 9 January 2009
This page contains a list of commands that are being proposed for uplift into Ubiquity 0.2.
- fullscreen
CmdUtils.CreateCommand({
name: "fullscreen",
description: "Toggles fullscreen mode",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.fullScreen = win.fullScreen ? false : true;
}
});
- back
CmdUtils.CreateCommand({
name: "back",
description: "Go one step back in history",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.history.go(-1);
}
});
- forward
CmdUtils.CreateCommand({
name: "forward",
description: "Go one step forward in history",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.history.go(1);
}
});
- home
CmdUtils.CreateCommand({
name: "home",
description: "Go to home page",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.home();
}
});
- close
CmdUtils.CreateCommand({
name: "close",
description: "Close firefox",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.close();
}
});
- refresh
CmdUtils.CreateCommand({
name: "refresh",
description: "Refresh current document",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.location.reload( true );
}
});
- bookmark
CmdUtils.CreateCommand({
name: "bookmark",
description: "Add current document to bookmarks",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindowInsecure();
var doc = CmdUtils.getDocument();
try {
win.sidebar.addPanel(doc.title, win.location.href,"");
} catch ( e ) { displayMessage("Page could not be bookmarked!" + ((e)?" - "+e:"")); }
}
});
CmdUtils.CreateCommand({
name: "print",
description: "Print current page",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
var win = CmdUtils.getWindow();
win.print();
}
});
Requests
- restart
Currently doesn't work because Application is wrapped by XPCOM
CmdUtils.CreateCommand({
name: "restart",
description: "Restarts firefox",
preview: function( pblock ) {pblock.innerHTML=this.description},
execute: function() {
Application.restart();
}
});
- exit
- Equivalent of File->Exit