From a7efc76c36aa652899d116a64b4eb486032b7ad9 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 6 Nov 2012 22:53:34 +0100 Subject: [PATCH] Removed usage of deprecated jQuery UI 1.9 features See http://jqueryui.com/upgrade-guide/1.9 for details. Fixes fade effect on changing toplevel tabs (semantics for "show" option in $.tabs() changed). --- admin/javascript/LeftAndMain.js | 26 +++++++++++++------------- javascript/TabSet.js | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 31b7e872e..06e78b617 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -368,7 +368,7 @@ jQuery.noConflict(); * Can be hooked into an ajax 'success' callback. */ handleAjaxResponse: function(data, status, xhr) { - var self = this, url, selectedTabs, guessFragment; + var self = this, url, activeTabs, guessFragment; // Pseudo-redirects via X-ControllerURL might return empty data, in which // case we'll ignore the response @@ -489,15 +489,15 @@ jQuery.noConflict(); saveTabState: function() { if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage == null) return; - var selectedTabs = [], url = this._tabStateUrl(); + var activeTabs = [], url = this._tabStateUrl(); this.find('.cms-tabset,.ss-tabset').each(function(i, el) { var id = $(el).attr('id'); if(!id) return; // we need a unique reference if(!$(el).data('tabs')) return; // don't act on uninit'ed controls if($(el).data('ignoreTabState')) return; // allow opt-out - selectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')}); + activeTabs.push({id:id, active:$(el).tabs('option', 'active')}); }); - if(selectedTabs) window.sessionStorage.setItem('tabs-' + url, JSON.stringify(selectedTabs)); + if(activeTabs) window.sessionStorage.setItem('tabs-' + url, JSON.stringify(activeTabs)); }, /** @@ -509,12 +509,12 @@ jQuery.noConflict(); var self = this, url = this._tabStateUrl(), data = window.sessionStorage.getItem('tabs-' + url), - selectedTabs = data ? JSON.parse(data) : false; - if(selectedTabs) { - $.each(selectedTabs, function(i, selectedTab) { - var el = self.find('#' + selectedTab.id); + activeTabs = data ? JSON.parse(data) : false; + if(activeTabs) { + $.each(activeTabs, function(i, activeTab) { + var el = self.find('#' + activeTab.id); if(!el.data('tabs')) return; // don't act on uninit'ed controls - el.tabs('select', selectedTab.selected); + el.tabs('option', 'active', activeTab.active); }); } }, @@ -918,10 +918,10 @@ jQuery.noConflict(); redrawTabs: function() { this.rewriteHashlinks(); - var id = this.attr('id'), selectedTab = this.find('ul:first .ui-tabs-active'); + var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active'); - if(!this.data('tabs')) this.tabs({ - selected: (selectedTab.index() != -1) ? selectedTab.index() : 0, + if(!this.data('uiTabs')) this.tabs({ + active: (activeTab.index() != -1) ? activeTab.index() : 0, beforeLoad: function(e, settings) { // Overwrite ajax loading to use CMS logic instead var makeAbs = $.path.makeUrlAbsolute, @@ -933,7 +933,7 @@ jQuery.noConflict(); return false; }, - show: function(e, ui) { + activate: function(e, ui) { // Usability: Hide actions for "readonly" tabs (which don't contain any editable fields) var actions = $(this).closest('form').find('.Actions'); if($(ui.tab).closest('li').hasClass('readonly')) { diff --git a/javascript/TabSet.js b/javascript/TabSet.js index c11d3c17c..c09d4a4f4 100644 --- a/javascript/TabSet.js +++ b/javascript/TabSet.js @@ -10,7 +10,7 @@ this._super(); }, onremove: function() { - if(this.data('tabs')) this.tabs('destroy'); + if(this.data('uiTabs')) this.tabs('destroy'); this._super(); }, redrawTabs: function() {