This file contains hidden or 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
ko.bindingHandlers.modal = { | |
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { | |
var value = valueAccessor(); | |
var valueUnwrapped = ko.unwrap(value); | |
var options = valueUnwrapped.options; | |
options.show = valueUnwrapped.visible && ko.unwrap(valueUnwrapped.visible); | |
$(element).modal(options); | |
$(element).on('show.bs.modal', function() { | |
if(valueUnwrapped.visible) { | |
if(typeof(valueUnwrapped.visible) === 'function') valueUnwrapped.visible(true); |
This file contains hidden or 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
ko.bindingHandlers.tooltip = { | |
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { | |
var value = valueAccessor(); | |
var valueUnwrapped = ko.unwrap(value); | |
if (valueUnwrapped.text != null) | |
{ | |
$(element).attr('title', valueUnwrapped.text); | |
if (valueUnwrapped.alignment != null) { | |
$(element).attr('data-placement', valueUnwrapped.alignment); | |
} |
This file contains hidden or 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
// performs the specified action on each item in the array | |
Array.prototype.forEach = function (fnAction) { | |
var l = this.length; | |
for (var i = 0; i < l; ++i) { | |
fnAction(this[i]); | |
} | |
} | |
// returns an array containing the items matching the filter | |
Array.prototype.where = function (fnFilter) { |