Skip to content

Commit d707982

Browse files
author
Edwin Hui
committed
del useless function
1 parent 73f81df commit d707982

File tree

1 file changed

+7
-45
lines changed

1 file changed

+7
-45
lines changed

js/multitabs.js

+7-45
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if (typeof jQuery === "undefined") {
44
}((function($){
55
"use strict";
66
var NAMESPACE, tabIndex, _ignoreHashChange; //variable
7-
var MultiTabs, handler, getTabIndex, isExtUrl, sumWidth, trimText, insertRule, isEmptyObject, supportStorage; //function
7+
var MultiTabs, handler, getTabIndex, isExtUrl, sumWidth, trimText, insertRule, supportStorage; //function
88
var defaultLayoutTemplates; //default variable
99

1010
NAMESPACE = '.multitabs'; // namespace for on() function
@@ -94,43 +94,6 @@ if (typeof jQuery === "undefined") {
9494
return ( ! (urlRoot===webRoot) );
9595
};
9696

97-
/**
98-
* insert CSS style
99-
*
100-
* Example
101-
* .fixed .mt-nav-tools-right{
102-
* position: fixed;
103-
* right: 0;
104-
* background-color : #fff;
105-
* }
106-
*
107-
* can be inserted as below:
108-
* insertRule('.fixed .mt-nav-tools-right', 'position: fixed; right: 0; background-color : #fff;');
109-
*
110-
* @param selectorText selector in string
111-
* @param cssText css style in string
112-
* @param position position for insert, default is 0
113-
*/
114-
insertRule = function (selectorText, cssText, position) {
115-
var sheet = document.styleSheets[0];
116-
position = position || 0;
117-
if (sheet.insertRule) {
118-
sheet.insertRule(selectorText + "{" + cssText + "}", position);
119-
} else if (sheet.addRule) {
120-
sheet.addRule(selectorText, cssText, position);
121-
}
122-
};
123-
124-
/**
125-
* check the obj is empty object
126-
*/
127-
isEmptyObject = function (obj) {
128-
for (var key in obj) {
129-
return false;
130-
}
131-
return true;
132-
};
133-
13497
/**
13598
* Layout Templates
13699
*/
@@ -308,7 +271,6 @@ if (typeof jQuery === "undefined") {
308271
_createNavTab : function (param) {
309272
var self = this, $el = self.$element;
310273
var navTabHtml = self._getNavTabHtml(param);
311-
312274
var $navTabLi = $el.navPanelList.find('a[data-content="'+ param.content +'"][data-index="'+ param.index +'"]').parent('li');
313275
if($navTabLi.length){
314276
$navTabLi.html(navTabHtml);
@@ -608,7 +570,7 @@ if (typeof jQuery === "undefined") {
608570
self.create(v, false);
609571
})
610572
}
611-
if( isEmptyObject(storage)){
573+
if( $.isEmptyObject(storage)){
612574
init = (init instanceof Array) ? init : [];
613575
for(var i = 0; i < init.length; i++){
614576
param = self._getParam( init[i]);
@@ -631,7 +593,7 @@ if (typeof jQuery === "undefined") {
631593
*/
632594
_validate: function () {
633595
var self = this, $exception;
634-
if( isEmptyObject($(document).data('multitabs'))) {
596+
if( $.isEmptyObject($(document).data('multitabs'))) {
635597
return true;
636598
}
637599
$exception = '<div class="help-block alert alert-warning">' +
@@ -812,7 +774,7 @@ if (typeof jQuery === "undefined") {
812774
* @private
813775
*/
814776
_getParam : function(obj){
815-
if(isEmptyObject(obj)){
777+
if($.isEmptyObject(obj)){
816778
return false;
817779
}
818780
var self = this, options = self.options, param = {}, $obj = $(obj);
@@ -895,10 +857,10 @@ if (typeof jQuery === "undefined") {
895857
*/
896858
_exist : function(param){
897859
if(!param){
898-
return storage;
860+
return false;
899861
}
900-
var self = this, $el = self.$element, $navTab;
901-
$navTab = $el.navPanelList.find('a[data-url="'+ param.url +'"]');
862+
var self = this, $el = self.$element;
863+
var $navTab = $el.navPanelList.find('a[data-url="'+ param.url +'"]:first');
902864
if( $navTab.length ) {
903865
return $navTab;
904866
}else{

0 commit comments

Comments
 (0)