天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.6 KiB

/// <reference path="/Scripts/jquery.1.11.0.min.js" />
if ($.tabPages == undefined) {
$.tabPages = new function () {
//#region 私有字段
var _tabPageContainer = null; //TAB页容器
var _selectedTitle = null; //当前活动TAB页标题
var _currentTitle = null; //当前刷新TAB页标题
//#endregion
//#region 构造方法
///<summary>
/// 构造方法
///</summary>
(function () {
if (window != window.parent) { //如果当前窗口不为顶级窗口
//_tabPageContainer = parent.$('.tabs-container'); //获得父窗口中的TAB页容器
}
}).apply(this);
//#endregion
//#region 私有方法
var getCurrentTabPageTitle = function () {
///<summary>
/// 获得当前TAB页标题
///</summary>
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 () {
///<summary>
/// 获得活动TAB页标题
///</summary>
var title = null;
if (_tabPageContainer) { //如果TAB页容器不为空
//title = parent.$('.tabs-selected').text(); //获得被选中的TAB页的标题
}
return title;
}
//#endregion
//#region 公共方法
///<summary>
/// TAB页开始绘制
///</summary>
this.beginDraw = function () {
_selectedTitle = getActiveTabPageTitle();
_currentTitle = getCurrentTabPageTitle();
if (_selectedTitle != null && _currentTitle != null && _selectedTitle != _currentTitle) {
_tabPageContainer.tabs('select', _currentTitle);
}
}
///<summary>
/// TAB页结束绘制
///</summary>
this.endDraw = function () {
if (_selectedTitle != null && _currentTitle != null && _selectedTitle != _currentTitle) {
setTimeout(function () { _tabPageContainer.tabs('select', _selectedTitle); }, 1);
}
}
//#endregion
}
}