mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-31 04:00:18 -07:00
removed backbone from VS solution,
renamed NzbDrone.Backbone to UI
This commit is contained in:
parent
c7776f74e1
commit
663160c06a
230 changed files with 57 additions and 386 deletions
35
UI/JsLibraries/backbone.shortcuts.js
Normal file
35
UI/JsLibraries/backbone.shortcuts.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
(function() {
|
||||
var Shortcuts;
|
||||
|
||||
Shortcuts = function(options) {
|
||||
this.cid = _.uniqueId("backbone.shortcuts");
|
||||
this.initialize.apply(this, arguments);
|
||||
return this.delegateShortcuts();
|
||||
};
|
||||
|
||||
_.extend(Shortcuts.prototype, Backbone.Events, {
|
||||
initialize: function() {},
|
||||
delegateShortcuts: function() {
|
||||
var callback, match, method, scope, shortcut, shortcutKey, _ref, _results;
|
||||
if (!this.shortcuts) return;
|
||||
_ref = this.shortcuts;
|
||||
_results = [];
|
||||
for (shortcut in _ref) {
|
||||
callback = _ref[shortcut];
|
||||
if (!_.isFunction(callback)) method = this[callback];
|
||||
if (!method) throw new Error("Method " + callback + " does not exist");
|
||||
match = shortcut.match(/^(\S+)\s*(.*)$/);
|
||||
shortcutKey = match[1];
|
||||
scope = match[2] === "" ? "all" : match[2];
|
||||
method = _.bind(method, this);
|
||||
_results.push(key(shortcutKey, scope, method));
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
});
|
||||
|
||||
Backbone.Shortcuts = Shortcuts;
|
||||
|
||||
Backbone.Shortcuts.extend = Backbone.View.extend;
|
||||
|
||||
}).call(this);
|
Loading…
Add table
Add a link
Reference in a new issue