Update to jQuery 2.1.1 and jQuery ui 1.11.1

review8641002
This commit is contained in:
C?dric Krier 2014-10-22 11:56:20 +02:00
parent d98098656d
commit 1be9b835cc
4 changed files with 60 additions and 31 deletions

View file

@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
<SCRIPT type="text/javascript" src="external/jquery.js"></SCRIPT>
<SCRIPT type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write(unescape('%3CSCRIPT type="text/javascript" src="//code.jquery.com/jquery-1.8.3.js"%3E%3C/SCRIPT%3E'));
document.write(unescape('%3CSCRIPT type="text/javascript" src="//code.jquery.com/jquery-2.1.1.js"%3E%3C/SCRIPT%3E'));
}
</SCRIPT>
<SCRIPT type="text/javascript" src="external/jquery-ui.js"></SCRIPT>
@ -17,8 +17,8 @@ this repository contains the full copyright notices and license terms. -->
media="screen"/>
<SCRIPT type="text/javascript">
if (typeof jQuery.ui == 'undefined') {
document.write(unescape('%3CSCRIPT type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"%3E%3C/SCRIPT%3E'));
document.write(unescape('%3CLINK rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" media="screen"/%3E'));
document.write(unescape('%3CSCRIPT type="text/javascript" src="//code.jquery.com/ui/1.11.1/jquery-ui.js"%3E%3C/SCRIPT%3E'));
document.write(unescape('%3CLINK rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" media="screen"/%3E'));
}
</SCRIPT>
<SCRIPT type="text/javascript" src="dist/sao.min.js"></SCRIPT>

View file

@ -57,14 +57,20 @@
if (!jQuery.isEmptyObject(this.tab_domain)) {
this.tab = jQuery('<div/>', {
'class': 'tab-domain'
}).append(jQuery('<div/>').append(jQuery('<ul/>')));
}).append(jQuery('<ul/>'));
this.tab.tabs();
this.tab_domain.forEach(function(tab_domain, i) {
var name = tab_domain[0];
this.tab.tabs('add', '#' + i, name);
jQuery('<li/>').append(jQuery('<a/>', {
href: '#' + i
}).append(name)).appendTo(this.tab.find('> .ui-tabs-nav'));
jQuery('<div/>', {
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)
});

View file

@ -85,7 +85,7 @@
},
create_toolbar: function() {
var toolbar = jQuery('<div/>', {
'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('<a href="#">' +
'<span class="ui-icon ui-icon-circle-close"></span>' +
'</a>')
.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('<a/>', {
href: '#' + tab.id
}).append(tab.name);
var close_link = jQuery('<a/>', {
href: '#',
'class': 'ui-tabs-anchor'
}).append(jQuery('<span/>', {
'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('<li/>', {
id: 'nav-' + tab.id
}).append(tab_link).append(close_link)
.appendTo(tabs.find('> .ui-tabs-nav'));
jQuery('<div/>', {
id: tab.id
}).html(tab.el).appendTo(tabs);
tabs.tabs('refresh');
tabs.tabs('option', 'active', -1);
jQuery(window).resize();
};

View file

@ -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('<li/>').append(
jQuery('<a/>', {
href: '#' + tab_id
}).append(text)).appendTo(this.el.find('> .ui-tabs-nav'));
jQuery('<div/>', {
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;
}
});