-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christian Glatthard
committed
Aug 11, 2015
1 parent
c45e7a8
commit 48a93f8
Showing
7 changed files
with
1,625 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
ipynbsrv/web/static/js/bootstrap-multiselect-collapsible-groups.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
! function(e) { | ||
"use strict"; | ||
jQuery.fn.multiselect.Constructor.prototype.selectAll = (function() { | ||
var cached_function = jQuery.fn.multiselect.Constructor.prototype.selectAll; | ||
|
||
return function() { | ||
var args = Array.prototype.slice.call( arguments ); | ||
args[0] = (this.options.enableCollapsibleOptGroups && this.options.multiple) ? false : args[0]; | ||
cached_function.apply(this, args); | ||
}; | ||
}()); | ||
|
||
jQuery.fn.multiselect.Constructor.prototype.deselectAll = (function() { | ||
var cached_function = jQuery.fn.multiselect.Constructor.prototype.deselectAll; | ||
|
||
return function() { | ||
var args = Array.prototype.slice.call( arguments ); | ||
args[0] = (this.options.enableCollapsibleOptGroups && this.options.multiple) ? false : args[0]; | ||
cached_function.apply(this, args); | ||
}; | ||
}()); | ||
|
||
jQuery.fn.multiselect.Constructor.prototype.createOptgroup = (function() { | ||
var cached_function = jQuery.fn.multiselect.Constructor.prototype.createOptgroup; | ||
|
||
return function() { | ||
var args = Array.prototype.slice.call( arguments ); | ||
var t = args[0]; | ||
if (this.options.enableCollapsibleOptGroups && this.options.multiple) { | ||
var n = e(t).attr("label"); | ||
var v = e(t).attr("value"); | ||
var r = e('<li class="multiselect-item multiselect-group"><a href="javascript:void(0);"><input type="checkbox" value="' + v + '"/><b> ' + n + '<b class="caret"></b></b></a></li>'); | ||
|
||
if (this.options.enableClickableOptGroups) { | ||
r.addClass("multiselect-group-clickable") | ||
} | ||
this.$ul.append(r); | ||
if (e(t).is(":disabled")) { | ||
r.addClass("disabled") | ||
} | ||
e("option", t).each(e.proxy(function(e, t) { | ||
this.createOptionValue(t) | ||
}, this)) | ||
} else { | ||
cached_function.apply(this, arguments); | ||
} | ||
}; | ||
}()); | ||
|
||
jQuery.fn.multiselect.Constructor.prototype.buildDropdownOptions = (function() { | ||
var cached_function = jQuery.fn.multiselect.Constructor.prototype.buildDropdownOptions; | ||
|
||
return function() { | ||
cached_function.apply(this, arguments); | ||
|
||
if (this.options.enableCollapsibleOptGroups && this.options.multiple) { | ||
|
||
e("li.multiselect-group input", this.$ul).off(); | ||
e("li.multiselect-group", this.$ul).siblings().not("li.multiselect-group, li.multiselect-all", this.$ul).each( function () { | ||
$(this).toggleClass('hidden', true); | ||
}); | ||
e("li.multiselect-group", this.$ul).on("click", e.proxy(function(t) { | ||
t.stopPropagation(); | ||
}, this)); | ||
e("li.multiselect-group > a > b", this.$ul).on("click", e.proxy(function(t) { | ||
t.stopPropagation(); | ||
var n = e(t.target).closest('li'); | ||
var r = n.nextUntil("li.multiselect-group"); | ||
var i = true; | ||
r.each(function() { | ||
i = i && e(this).hasClass('hidden'); | ||
}); | ||
r.toggleClass('hidden', !i); | ||
}, this)); | ||
e("li.multiselect-group > a > input", this.$ul).on("change", e.proxy(function(t) { | ||
t.stopPropagation(); | ||
var n = e(t.target).closest('li'); | ||
var r = n.nextUntil("li.multiselect-group"); | ||
var i = true; | ||
var s = r.find("input"); | ||
s.each(function() { | ||
i = i && e(this).prop("checked") | ||
}); | ||
s.prop("checked", !i).trigger("change") | ||
}, this)); | ||
e("li.multiselect-all", this.$ul).css('background', '#f3f3f3').css('border-bottom', '1px solid #eaeaea'); | ||
e("li.multiselect-group > a, li.multiselect-all > a > label.checkbox", this.$ul).css('padding', '3px 20px 3px 35px'); | ||
e("li.multiselect-group > a > input", this.$ul).css('margin', '4px 0px 5px -20px'); | ||
} | ||
}; | ||
}()); | ||
}(window.jQuery) |
Oops, something went wrong.