diff --git a/index.html b/index.html
index 1e0bd1e925..602ca7705d 100644
--- a/index.html
+++ b/index.html
@@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
@@ -17,8 +17,8 @@ this repository contains the full copyright notices and license terms. -->
media="screen"/>
diff --git a/src/screen.js b/src/screen.js
index e32e9b7f6c..eff34052e0 100644
--- a/src/screen.js
+++ b/src/screen.js
@@ -57,14 +57,20 @@
if (!jQuery.isEmptyObject(this.tab_domain)) {
this.tab = jQuery('
', {
'class': 'tab-domain'
- }).append(jQuery('').append(jQuery('')));
+ }).append(jQuery(''));
this.tab.tabs();
this.tab_domain.forEach(function(tab_domain, i) {
var name = tab_domain[0];
- this.tab.tabs('add', '#' + i, name);
+ jQuery('').append(jQuery('', {
+ href: '#' + i
+ }).append(name)).appendTo(this.tab.find('> .ui-tabs-nav'));
+ jQuery('', {
+ id: i
+ }).appendTo(this.tab);
}.bind(this));
this.tab.find('#0').append(this.content_box);
- this.tab.tabs('select', '#0');
+ this.tab.tabs('refresh');
+ this.tab.tabs('option', 'active', 0);
this.tab.tabs({
'activate': this.switch_page.bind(this)
});
diff --git a/src/tab.js b/src/tab.js
index 74cf9c43cc..7e7fdce24c 100644
--- a/src/tab.js
+++ b/src/tab.js
@@ -85,7 +85,7 @@
},
create_toolbar: function() {
var toolbar = jQuery('', {
- 'class': 'ui-widget-header ui-corner-all'
+ 'class': 'tab-toolbar ui-widget-header ui-corner-all'
});
var add_button = function(tool) {
var click_func = function() {
@@ -109,9 +109,15 @@
},
close: function() {
var tabs = jQuery('#tabs > div');
- tabs.tabs('select', this.id);
+ var tab = tabs.find(
+ '.ui-tabs-nav li[aria-controls="' + this.id + '"]');
+ tabs.tabs('option', 'active',
+ tabs.find('li').index(jQuery('#nav-' + this.id)));
+ tabs.tabs('refresh');
return this.modified_save().then(function() {
- tabs.tabs('remove', this.id);
+ tab.remove();
+ jQuery('#' + this.id).remove();
+ tabs.tabs('refresh');
if (!tabs.find('> ul').children().length) {
tabs.remove();
}
@@ -170,23 +176,34 @@
}
var tabs = jQuery('#tabs > div');
tabs.tabs();
- tab.id = '#tab-' + Sao.Tab.counter++;
- tabs.tabs('add', tab.id, tab.name);
- tabs.find('> ul li').last().append(jQuery('' +
- '' +
- '')
- .hover(
- function() {
- jQuery(this).css('cursor', 'pointer');
- },
- function() {
- jQuery(this).css('cursor', 'default');
- })
- .click(function() {
- tab.close();
- }));
- jQuery(tab.id).html(tab.el);
- tabs.tabs('select', tab.id);
+ tab.id = 'tab-' + Sao.Tab.counter++;
+ var tab_link = jQuery('', {
+ href: '#' + tab.id
+ }).append(tab.name);
+ var close_link = jQuery('', {
+ href: '#',
+ 'class': 'ui-tabs-anchor'
+ }).append(jQuery('', {
+ 'class': 'ui-icon ui-icon-circle-close'
+ })).hover(
+ function() {
+ jQuery(this).css('cursor', 'pointer');
+ },
+ function() {
+ jQuery(this).css('cursor', 'default');
+ })
+ .click(function() {
+ tab.close();
+ });
+ jQuery('', {
+ id: 'nav-' + tab.id
+ }).append(tab_link).append(close_link)
+ .appendTo(tabs.find('> .ui-tabs-nav'));
+ jQuery('', {
+ id: tab.id
+ }).html(tab.el).appendTo(tabs);
+ tabs.tabs('refresh');
+ tabs.tabs('option', 'active', -1);
jQuery(window).resize();
};
diff --git a/src/view.js b/src/view.js
index b9d90b8786..d163526e41 100644
--- a/src/view.js
+++ b/src/view.js
@@ -1699,14 +1699,20 @@
this.counter = 0;
},
add: function(tab, text) {
- var tab_id = '#tab-form-' + this.counter++;
- this.el.tabs('add', tab_id, text);
- this.el.children(tab_id).html(tab);
+ var tab_id = 'tab-form-' + this.counter++;
+ var page = jQuery('').append(
+ jQuery('', {
+ href: '#' + tab_id
+ }).append(text)).appendTo(this.el.find('> .ui-tabs-nav'));
+ jQuery('', {
+ id: tab_id
+ }).html(tab).appendTo(this.el);
+ this.el.tabs('refresh');
if (!this.selected) {
- this.el.tabs('select', tab_id);
+ this.el.tabs('option', 'active', -1);
this.selected = true;
}
- return jQuery('> ul li', this.el).last();
+ return page;
}
});