summaryrefslogtreecommitdiff
path: root/chimere/static/bsmSelect/js/jquery.bsmselect.compatibility.js
blob: a743a07ee204460a95fd470e29d431d86c664e1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Better Select Multiple Compatibility Plugin - jQuery Plugin
 *
 * Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
 *
 * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
 *
 * version: v1.0.0 - 2010-09-05
 */
(function($) {
  $.bsmSelect.plugins.compatibility = function()
  {
    if (!(this instanceof arguments.callee)) {
      return new arguments.callee();
    }
  }

  $.extend($.bsmSelect.plugins.compatibility.prototype, {
    init: function(bsm) {

      var o = bsm.options;

      if (typeof o.animate != 'undefined')
      {
        if (o.animate === true) {
          o.showEffect = $.bsmSelect.effects.verticalListAdd;
          o.hideEffect = $.bsmSelect.effects.verticalListRemove;
        } else if ($.isFunction(o.animate.add)) {
          o.showEffect = o.animate.add;
        } else if (typeof(o.animate.add) == 'string' && $.isFunction($.bsmSelect.effects[o.animate.add])) {
          o.showEffect = $.bsmSelect.effects[o.animate.add];
        } else {
          o.showEffect = $.bsmSelect.effects.show;
        }        

        if ($.isFunction(o.animate.drop)) {
          o.hideEffect = o.animate.drop;
        } else if (typeof(o.animate.drop) == 'string' && $.isFunction($.bsmSelect.effects[o.animate.drop])) {
          o.hideEffect = $.bsmSelect.effects[o.animate.drop];
        } else {
          o.hideEffect = $.bsmSelect.effects.remove;
        }
      }

      if (typeof o.highlight != 'undefined')
      {
        if (o.highlight === true) {
          o.highlightEffect = $.bsmSelect.effects.highlight;
        } else if ($.isFunction(o.highlight)) {
          o.highlightEffect = o.highlight;
        } else if (typeof(o.highlight) == 'string' && $.isFunction($.bsmSelect.effects[o.highlight])) {
          o.highlightEffect = $.bsmSelect.effects[o.highlight];
        }
      }

    }

  });
})(jQuery);