summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/dependent.js12
-rw-r--r--js/tabs.js96
2 files changed, 54 insertions, 54 deletions
diff --git a/js/dependent.js b/js/dependent.js
index 25445fe..3755f63 100644
--- a/js/dependent.js
+++ b/js/dependent.js
@@ -28,11 +28,11 @@ Drupal.Views.dependent = { bindings: {}, activeBindings: {}, activeTriggers: []
Drupal.Views.dependent.inArray = function(array, search_term) {
var i = array.length;
if (i > 0) {
- do {
- if (array[i] == search_term) {
- return true;
- }
- } while (i--);
+ do {
+ if (array[i] == search_term) {
+ return true;
+ }
+ } while (i--);
}
return false;
}
@@ -105,7 +105,7 @@ Drupal.Views.dependent.autoAttach = function() {
for (i in Drupal.Views.dependent.bindings[bind_id]) {
var id = Drupal.Views.dependent.bindings[bind_id][i];
-
+
// Fix numerous errors
if (typeof id != 'string') {
continue;
diff --git a/js/tabs.js b/js/tabs.js
index 3da9cd6..a66a280 100644
--- a/js/tabs.js
+++ b/js/tabs.js
@@ -7,25 +7,25 @@
* This is nothing more than the pure jquery UI tabs implementation.
*/
(function($) {
-
+
// if the UI scope is not availalable, add it
$.ui = $.ui || {};
-
+
$.fn.tabs = function(initial, options) {
if (initial && initial.constructor == Object) { // shift arguments
options = initial;
initial = null;
}
options = options || {};
-
+
// first get initial tab from options
initial = initial && initial.constructor == Number && --initial || 0;
-
+
return this.each(function() {
new $.ui.tabs(this, $.extend(options, { initial: initial }));
});
};
-
+
// chainable tabs methods
$.each(['add', 'remove', 'enable', 'disable', 'click', 'load'], function(i, method) {
$.fn[method + 'Tab'] = function() {
@@ -39,19 +39,19 @@
$.fn.selectedTab = function(returnElement) {
var selected;
if (returnElement) {
-
+
} else {
-
+
}
return selected;
};
$.ui.tabs = function(el, options) {
-
+
this.source = el;
-
+
this.options = $.extend({
-
+
// basic setup
initial: 0,
event: 'click',
@@ -59,12 +59,12 @@
// TODO bookmarkable: $.ajaxHistory ? true : false,
unselected: false,
toggle: options.unselected ? true : false,
-
+
// Ajax
spinner: 'Loading…',
cache: false,
hashPrefix: 'tab-',
-
+
// animations
/*fxFade: null,
fxSlide: null,
@@ -73,7 +73,7 @@
fxSpeed: 'normal',
/*fxShowSpeed: null,
fxHideSpeed: null,*/
-
+
// callbacks
add: function() {},
remove: function() {},
@@ -83,7 +83,7 @@
hide: function() {},
show: function() {},
load: function() {},
-
+
// CSS classes
navClass: 'ui-tabs-nav',
selectedClass: 'ui-tabs-selected',
@@ -91,31 +91,31 @@
containerClass: 'ui-tabs-container',
hideClass: 'ui-tabs-hide',
loadingClass: 'ui-tabs-loading'
-
+
}, options);
-
+
this.tabify(true);
-
+
// save instance for later
var uuid = 'instance-' + $.ui.tabs.prototype.count++;
$.ui.tabs.instances[uuid] = this;
this.source['UI_TABS_UUID'] = uuid;
-
+
};
-
+
// static
$.ui.tabs.instances = {};
-
+
$.extend($.ui.tabs.prototype, {
animating: false,
count: 0,
tabify: function(init) {
-
+
this.$tabs = $('a:first-child', this.source);
this.$containers = $([]);
-
+
var self = this, o = this.options;
-
+
this.$tabs.each(function(i, a) {
// inline tab
if (a.hash && a.hash.replace('#', '')) { // safari 2 reports '#' for an empty hash
@@ -132,9 +132,9 @@
);
}
});
-
+
if (init) {
-
+
// Try to retrieve initial tab from fragment identifier in url if present,
// otherwise try to find selected class attribute on <li>.
this.$tabs.each(function(i, a) {
@@ -158,14 +158,14 @@
return false; // break
}
});
-
+
// attach necessary classes for styling if not present
$(this.source).is('.' + o.navClass) || $(this.source).addClass(o.navClass);
this.$containers.each(function() {
var $this = $(this);
$this.is('.' + o.containerClass) || $this.addClass(o.containerClass);
});
-
+
// highlight tab accordingly
var $lis = $('li', this.source);
this.$containers.addClass(o.hideClass);
@@ -174,7 +174,7 @@
this.$containers.slice(o.initial, o.initial + 1).show();
$lis.slice(o.initial, o.initial + 1).addClass(o.selectedClass);
}
-
+
// trigger load of initial tab is remote tab
if (this.$tabs[o.initial].url) {
this.load(o.initial + 1, this.$tabs[o.initial].url);
@@ -182,14 +182,14 @@
this.$tabs[o.initial].url = null; // if loaded once do not load them again
}
}
-
+
// disabled tabs
for (var i = 0, position; position = o.disabled[i]; i++) {
this.disable(position);
}
-
+
}
-
+
// setup animations
var showAnim = {}, hideAnim = {}, showSpeed = o.fxShowSpeed || o.fxSpeed,
hideSpeed = o.fxHideSpeed || o.fxSpeed;
@@ -216,10 +216,10 @@
hideSpeed = 1; // as little as 1 is sufficient
}
}
-
+
// callbacks
var click = o.click, hide = o.hide, show = o.show;
-
+
// reset some styles to maintain print style sheets etc.
var resetCSS = { display: '', overflow: '', height: '' };
if (!$.browser.msie) { // not in IE to prevent ClearType font issue
@@ -236,7 +236,7 @@
}
});
}
-
+
// show a tab, animation prevents browser scrolling to fragment
function showTab(clicked, $hide, $show) {
// show next tab
@@ -252,9 +252,9 @@
show(clicked, $show[0], $hide[0]);
self.animating = false;
});
-
+
}
-
+
// switch a tab
function switchTab(clicked, $hide, $show) {
/*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
@@ -264,13 +264,13 @@
.siblings().removeClass(o.selectedClass);
hideTab(clicked, $hide, $show);
}
-
+
// tab click handler
function tabClick(e) {
//var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
var $li = $(this).parents('li:eq(0)'), $hide = self.$containers.filter(':visible'), $show = $(this.hash);
-
+
// if tab may be closed
if (o.toggle && !$li.is('.' + o.disabledClass) && !self.animating) {
if ($li.is('.' + o.selectedClass)) {
@@ -285,7 +285,7 @@
return false;
}
}
-
+
// If tab is already selected or disabled, animation is still running or click callback
// returns false stop here.
// Check if click handler returns false last so that it is not executed for a disabled tab!
@@ -308,7 +308,7 @@
$show.attr('id', showId); // restore id
}, 0);
}*/
-
+
if (this.url) { // remote tab
var a = this;
self.load(self.$tabs.index(this) + 1, this.url, function() {
@@ -336,12 +336,12 @@
//return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE
return false;
-
+
}
-
+
// attach click event, avoid duplicates from former tabifying
this.$tabs.unbind(o.event, tabClick).bind(o.event, tabClick);
-
+
},
add: function(url, text, position) {
if (url && text) {
@@ -365,7 +365,7 @@
o.add(this.$tabs[position - 1], this.$containers[position - 1]); // callback
} else {
throw Drupal.t('jQuery UI Tabs: Not enough arguments to add tab.');
- }
+ }
},
remove: function(position) {
if (position && position.constructor == Number) {
@@ -404,17 +404,17 @@
$a = this.$tabs.slice(position - 1, position).addClass(o.loadingClass),
$span = $('span', $a),
text = $span.html();
-
+
// shift arguments
if (url && url.constructor == Function) {
callback = url;
}
-
+
// set new URL
if (url) {
$a[0].url = url;
}
-
+
// load
if (o.spinner) {
$span.html('<em>' + o.spinner + '</em>');
@@ -432,7 +432,7 @@
}
o.load(self.$tabs[position - 1], self.$containers[position - 1]); // callback
});
- }, 0);
+ }, 0);
}
});
})(jQuery);