add 'open in new tab' button to example pages

This commit is contained in:
rolux 2012-04-15 14:18:45 +02:00
parent d27a3ffe0f
commit c2a7902d0b

View file

@ -23,6 +23,20 @@ Ox.ExamplePage = function(options, self) {
.css({float: 'left', margin: '4px'}) .css({float: 'left', margin: '4px'})
.appendTo(self.$toolbar) .appendTo(self.$toolbar)
self.$openButton = Ox.Button({
disabled: self.options.selected == 'source',
title: 'open',
tooltip: 'Open in new tab',
type: 'image'
})
.css({float: 'right', margin: '4px 4px 4px 2px'})
.bindEvent({
click: function() {
window.open(self.options.html);
}
})
.appendTo(self.$toolbar);
self.$reloadButton = Ox.Button({ self.$reloadButton = Ox.Button({
disabled: self.options.selected == 'source', disabled: self.options.selected == 'source',
title: 'redo', title: 'redo',
@ -58,6 +72,7 @@ Ox.ExamplePage = function(options, self) {
change: function(data) { change: function(data) {
self.options.selected = data.value; self.options.selected = data.value;
self.$reloadButton.options({disabled: data.value == 'source'}); self.$reloadButton.options({disabled: data.value == 'source'});
self.$openButton.options({disabled: data.value == 'source'});
self.$content.animate({ self.$content.animate({
marginLeft: data.value == 'source' marginLeft: data.value == 'source'
? 0 : -self.options.width + 'px' ? 0 : -self.options.width + 'px'