aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/switchbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/js/switchbox.js')
-rw-r--r--themes/default/js/switchbox.js34
1 files changed, 23 insertions, 11 deletions
diff --git a/themes/default/js/switchbox.js b/themes/default/js/switchbox.js
index 9e8167a33..4741e7980 100644
--- a/themes/default/js/switchbox.js
+++ b/themes/default/js/switchbox.js
@@ -1,11 +1,23 @@
-function switchBox(link, box) {
- jQuery(link).click(function() {
- var elt = jQuery(box);
- elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
- .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
- .toggle();
- });
- jQuery(box).on("mouseleave click", function() {
- jQuery(this).hide();
- });
-} \ No newline at end of file
+(function () {
+ var sbFunc = function(link, box) {
+ jQuery(link).click(function() {
+ var elt = jQuery(box);
+ elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
+ .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
+ .toggle();
+ return false;
+ });
+ jQuery(box).on("mouseleave click", function() {
+ jQuery(this).hide();
+ });
+ };
+
+ if (window.SwitchBox) {
+ for (var i=0; i<SwitchBox.length; i+=2)
+ sbFunc(SwitchBox[i], SwitchBox[i+1]);
+ }
+
+ SwitchBox = {
+ push: sbFunc
+ }
+})(); \ No newline at end of file