forked from 0x2620/oxjs
in example pages, allow for setting theme from outside the iframe
This commit is contained in:
parent
0148701372
commit
0f4d72c1da
14 changed files with 52 additions and 50 deletions
|
|
@ -26,7 +26,7 @@ Ox.ExamplePage = function(options, self) {
|
|||
self.$openButton = Ox.Button({
|
||||
disabled: self.options.selected == 'source',
|
||||
title: 'open',
|
||||
tooltip: 'Open in new tab',
|
||||
tooltip: 'Open in New Tab',
|
||||
type: 'image'
|
||||
})
|
||||
.css({float: 'right', margin: '4px 4px 4px 2px'})
|
||||
|
|
@ -51,6 +51,25 @@ Ox.ExamplePage = function(options, self) {
|
|||
})
|
||||
.appendTo(self.$toolbar);
|
||||
|
||||
self.$switchButton = Ox.Button({
|
||||
disabled: self.options.selected == 'source',
|
||||
title: 'switch',
|
||||
tooltip: 'Switch Theme',
|
||||
type: 'image'
|
||||
})
|
||||
.css({float: 'right', margin: '4px 2px 4px 2px'})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
self.$frame[0].contentWindow.postMessage(
|
||||
'Ox && Ox.Theme && Ox.Theme('
|
||||
+ 'Ox.Theme() == "classic" ? "modern" : "classic"'
|
||||
+ ')',
|
||||
'*'
|
||||
);
|
||||
}
|
||||
})
|
||||
.appendTo(self.$toolbar);
|
||||
|
||||
self.$tabs = Ox.ButtonGroup({
|
||||
buttons: [
|
||||
{
|
||||
|
|
@ -70,9 +89,11 @@ Ox.ExamplePage = function(options, self) {
|
|||
.css({float: 'right', margin: '4px 2px 4px 2px'})
|
||||
.bindEvent({
|
||||
change: function(data) {
|
||||
var disabled = data.value == 'source';
|
||||
self.options.selected = data.value;
|
||||
self.$reloadButton.options({disabled: data.value == 'source'});
|
||||
self.$openButton.options({disabled: data.value == 'source'});
|
||||
self.hasUI && self.$switchButton.options({disabled: disabled});
|
||||
self.$reloadButton.options({disabled: disabled});
|
||||
self.$openButton.options({disabled: disabled});
|
||||
self.$content.animate({
|
||||
marginLeft: data.value == 'source'
|
||||
? 0 : -self.options.width + 'px'
|
||||
|
|
@ -146,6 +167,11 @@ Ox.ExamplePage = function(options, self) {
|
|||
})
|
||||
);
|
||||
|
||||
Ox.get(self.options.js, function(js) {
|
||||
self.hasUI = /Ox\.load\(.+UI.+,/.test(js);
|
||||
!self.hasUI && self.$switchButton.options({disabled: true});
|
||||
});
|
||||
|
||||
Ox.$window.bind({
|
||||
resize: function() {
|
||||
setSize();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue