|
@@ -13284,13 +13284,6 @@ define("drop", function(){});
|
|
|
/**
|
|
/**
|
|
|
* http://git.oschina.net/hbbcs/bootStrap-addTabs
|
|
* http://git.oschina.net/hbbcs/bootStrap-addTabs
|
|
|
* Created by joe on 2015-12-19.
|
|
* Created by joe on 2015-12-19.
|
|
|
- * @param {type} options {
|
|
|
|
|
- * content string||html 直接指定内容
|
|
|
|
|
- * close bool 是否可以关闭
|
|
|
|
|
- * monitor 监视的区域
|
|
|
|
|
- * }
|
|
|
|
|
- *
|
|
|
|
|
- * @returns
|
|
|
|
|
*/
|
|
*/
|
|
|
$.fn.addtabs = function (options) {
|
|
$.fn.addtabs = function (options) {
|
|
|
var obj = $(this);
|
|
var obj = $(this);
|
|
@@ -13302,6 +13295,7 @@ $.fn.addtabs = function (options) {
|
|
|
tab: '.tab-addtabs',
|
|
tab: '.tab-addtabs',
|
|
|
iframeUse: true, //使用iframe还是ajax
|
|
iframeUse: true, //使用iframe还是ajax
|
|
|
iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
|
|
iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
|
|
|
|
|
+ iframeForceRefresh: false, //点击后强制刷新对应的iframe
|
|
|
callback: function () {
|
|
callback: function () {
|
|
|
//关闭后回调函数
|
|
//关闭后回调函数
|
|
|
}
|
|
}
|
|
@@ -13318,7 +13312,7 @@ $.fn.addtabs = function (options) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
$(options.monitor).on('click', '[addtabs]', function (e) {
|
|
$(options.monitor).on('click', '[addtabs]', function (e) {
|
|
|
- if ($(this).attr('url').indexOf("javascript") !== 0) {
|
|
|
|
|
|
|
+ if ($(this).attr('url').indexOf("javascript:") !== 0) {
|
|
|
if ($(this).is("a")) {
|
|
if ($(this).is("a")) {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
}
|
|
}
|
|
@@ -13337,7 +13331,7 @@ $.fn.addtabs = function (options) {
|
|
|
window.history.pushState(state, title, pushurl);
|
|
window.history.pushState(state, title, pushurl);
|
|
|
}
|
|
}
|
|
|
$(this).data("pushstate", null);
|
|
$(this).data("pushstate", null);
|
|
|
- _add({
|
|
|
|
|
|
|
+ _add.call(this, {
|
|
|
id: id,
|
|
id: id,
|
|
|
title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
|
|
title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
|
|
|
content: content,
|
|
content: content,
|
|
@@ -13401,8 +13395,15 @@ $.fn.addtabs = function (options) {
|
|
|
navobj.append(title);
|
|
navobj.append(title);
|
|
|
}
|
|
}
|
|
|
tabobj.append(content);
|
|
tabobj.append(content);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //强制刷新iframe
|
|
|
|
|
+ if (options.iframeForceRefresh) {
|
|
|
|
|
+ $("#" + conid + " iframe").attr('src', function (i, val) {
|
|
|
|
|
+ return val;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ localStorage.setItem("addtabs", $(this).prop('outerHTML'));
|
|
|
//激活TAB
|
|
//激活TAB
|
|
|
$("#" + tabid).addClass('active');
|
|
$("#" + tabid).addClass('active');
|
|
|
$("#" + conid).addClass("active");
|
|
$("#" + conid).addClass("active");
|
|
@@ -13410,8 +13411,8 @@ $.fn.addtabs = function (options) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
_close = function (id) {
|
|
_close = function (id) {
|
|
|
- var tabid = 'tab_'+id;
|
|
|
|
|
- var conid = 'con_'+id;
|
|
|
|
|
|
|
+ var tabid = 'tab_' + id;
|
|
|
|
|
+ var conid = 'con_' + id;
|
|
|
//如果关闭的是当前激活的TAB,激活他的前一个TAB
|
|
//如果关闭的是当前激活的TAB,激活他的前一个TAB
|
|
|
if (obj.find("li.active").attr('id') == tabid) {
|
|
if (obj.find("li.active").attr('id') == tabid) {
|
|
|
if ($("#" + tabid).prev().not(".tabdrop").size() > 0) {
|
|
if ($("#" + tabid).prev().not(".tabdrop").size() > 0) {
|