ko.bindingHandlers.truncatedText = { update: function (element, valueAccessor, allBindingsAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()), length = ko.utils.unwrapObservable(allBindingsAccessor().length) || ko.bindingHandlers.truncatedText.defaultLength, truncatedValue = value.length > length ? value.substring(0, Math.min(value.length, length)) + " ..." : value; ko.bindingHandlers.text.update(element, function () { return truncatedValue; }); }, defaultLength: 15 }; ko.bindingHandlers.filedrop = { init: function (element, valueAccessor) { var options = $.extend({}, { overlaySelector: null }, valueAccessor()); if (!options.onFileDrop) return; else if (!window.File || !window.FileReader || !window.FileList || !window.FormData) { console.log("File drop disabled because this browser is too old"); return; } $(element).bind("dragenter", function (e) { e.stopPropagation(); e.preventDefault(); if (options.overlaySelector) $(options.overlaySelector).show(); }); $(element).bind("dragleave", function (e) { e.stopPropagation(); e.preventDefault(); // EDITED FOR FIREFOX! // Without the check for is(), the screen will blink in firefox! if (options.overlaySelector && $(e.target).is('.main-filedrop')) $(options.overlaySelector).hide(); }); $(element).bind("drop", function (e) { e.stopPropagation(); e.preventDefault(); if (options.overlaySelector) $(options.overlaySelector).hide(); if (typeof options.onFileDrop === "function") $.each(e.originalEvent.dataTransfer.files, function () { if (!/^.*\.(nzb)$/ig.test(this.name)) return; options.onFileDrop(this); }); }); } }; $(document).bind('dragover', function (e) { e.preventDefault(); }); // knockout-sortable 0.8.4 | (c) 2013 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license ;(function(factory) { if (typeof define === "function" && define.amd) { // AMD anonymous module define(["knockout", "jquery", "jquery.ui.sortable"], factory); } else { // No module loader (plain