/// if ($.tabPages == undefined) { $.tabPages = new function () { //#region 私有字段 var _tabPageContainer = null; //TAB页容器 var _selectedTitle = null; //当前活动TAB页标题 var _currentTitle = null; //当前刷新TAB页标题 //#endregion //#region 构造方法 /// /// 构造方法 /// (function () { if (window != window.parent) { //如果当前窗口不为顶级窗口 //_tabPageContainer = parent.$('.tabs-container'); //获得父窗口中的TAB页容器 } }).apply(this); //#endregion //#region 私有方法 var getCurrentTabPageTitle = function () { /// /// 获得当前TAB页标题 /// var title = null; if (_tabPageContainer) { //如果TAB页容器不为空 _tabPageContainer.find('iframe').each(function (index) { if (this.contentWindow == window) { //如果当前需要刷新的页面是一个TAB页 title = _tabPageContainer.find('.tabs-title')[index].innerHTML; //获得当前页面的标题 return false; } }); } return title; } var getActiveTabPageTitle = function () { /// /// 获得活动TAB页标题 /// var title = null; if (_tabPageContainer) { //如果TAB页容器不为空 //title = parent.$('.tabs-selected').text(); //获得被选中的TAB页的标题 } return title; } //#endregion //#region 公共方法 /// /// TAB页开始绘制 /// this.beginDraw = function () { _selectedTitle = getActiveTabPageTitle(); _currentTitle = getCurrentTabPageTitle(); if (_selectedTitle != null && _currentTitle != null && _selectedTitle != _currentTitle) { _tabPageContainer.tabs('select', _currentTitle); } } /// /// TAB页结束绘制 /// this.endDraw = function () { if (_selectedTitle != null && _currentTitle != null && _selectedTitle != _currentTitle) { setTimeout(function () { _tabPageContainer.tabs('select', _selectedTitle); }, 1); } } //#endregion } }