App-Alice
view release on metacpan or search on metacpan
share/static/alice.js view on Meta::CPAN
help.visible() ? help.hide() : help.show();
},
toggleConfig: function(e) {
this.connection.getConfig(function (transport) {
alice.activeWindow().input.disabled = true;
$('container').insert(transport.responseText);
}.bind(this));
e.stop();
},
togglePrefs: function(e) {
this.connection.getPrefs(function (transport) {
alice.activeWindow().input.disabled = true;
$('container').insert(transport.responseText);
}.bind(this));
e.stop();
},
toggleLogs: function(e) {
if (this.logWindow && !this.logWindow.closed && this.logWindow.focus) {
this.logWindow.focus();
} else {
this.logWindow = window.open(null, "logs", "resizable=no,scrollbars=no,statusbar=no, toolbar=no,location=no,width=500,height=480");
this.connection.getLog(function (transport) {
this.logWindow.document.write(transport.responseText);
}.bind(this));
}
e.stop();
},
windows: function () {
return this.window_map.values();
},
nth_window: function(n) {
var tab = $('tabs').down('li', n);
if (tab) {
var m = tab.id.match(/([^_]+)_tab/);
if (m) {
return this.window_map.get(m[1]);
}
}
},
openWindow: function(element, title, active, hashtag) {
var win = new Alice.Window(this, element, title, active, hashtag);
this.addWindow(win);
if (active) {
win.focus();
}
return win;
},
addWindow: function(win) {
this.window_map.set(win.id, win);
if (window.fluid)
window.fluid.addDockMenuItem(win.title, win.focus.bind(win));
},
removeWindow: function(win) {
if (win.active) this.focusLast();
if (window.fluid)
window.fluid.removeDockMenuItem(win.title);
if (win.id == this.previousFocus.id) {
this.previousFocus = 0;
}
this.window_map.unset(win.id);
this.connection.closeWindow(win);
win = null;
},
getWindow: function(windowId) {
return this.window_map.get(windowId);
},
activeWindow: function() {
var windows = this.windows();
for (var i=0; i < windows.length; i++) {
if (windows[i].active) return windows[i];
}
if (windows[0]) return windows[0];
},
addFilters: function(list) {
this.filters = this.filters.concat(list);
},
applyFilters: function(content) {
return this.filters.inject(content, function(value, filter) {
return filter(value);
});
},
nextWindow: function() {
var active = this.activeWindow();
var nextTab = active.tab.next();
if (!nextTab)
nextTab = $$('ul#tabs li').first();
if (!nextTab) return;
var id = nextTab.id.replace('_tab','');
if (id != active.id) {
this.getWindow(id).focus();
}
},
focusLast: function() {
if (this.previousFocus && this.previousFocus.id != this.activeWindow().id)
this.previousFocus.focus();
else
this.previousWindow();
},
previousWindow: function() {
var active = this.activeWindow();
var previousTab = this.activeWindow().tab.previous();
if (!previousTab)
previousTab = $$('ul#tabs li').last();
if (!previousTab) return;
var id = previousTab.id.replace('_tab','');
( run in 1.001 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )