mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
client side code webstorm code cleanup.
This commit is contained in:
parent
375f887539
commit
445ea4f344
94 changed files with 4355 additions and 4243 deletions
|
@ -2,13 +2,13 @@
|
|||
|
||||
$.fn.autoComplete = function (resource) {
|
||||
$(this).typeahead({
|
||||
source: function (filter, callback) {
|
||||
source : function (filter, callback) {
|
||||
$.ajax({
|
||||
url: NzbDrone.Constants.ApiRoot + resource,
|
||||
url : NzbDrone.Constants.ApiRoot + resource,
|
||||
dataType: "json",
|
||||
type: "GET",
|
||||
data: { query: filter },
|
||||
success: function (data) {
|
||||
type : "GET",
|
||||
data : { query: filter },
|
||||
success : function (data) {
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,28 +1,25 @@
|
|||
//try to add ajax data as query string to DELETE calls.
|
||||
(function (){
|
||||
(function () {
|
||||
|
||||
var original = Backbone.ajax;
|
||||
|
||||
Backbone.ajax = function (){
|
||||
Backbone.ajax = function () {
|
||||
|
||||
var xhr = arguments[0];
|
||||
|
||||
//check if ajax call was made with data option
|
||||
if(xhr && xhr.data && xhr.type=='DELETE')
|
||||
{
|
||||
if(xhr.url.indexOf('?') === -1)
|
||||
{
|
||||
if (xhr && xhr.data && xhr.type == 'DELETE') {
|
||||
if (xhr.url.indexOf('?') === -1) {
|
||||
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
xhr.url = xhr.url + '&' + $.param(xhr.data);
|
||||
}
|
||||
}
|
||||
|
||||
if (original){
|
||||
original.apply (this, arguments);
|
||||
if (original) {
|
||||
original.apply(this, arguments);
|
||||
}
|
||||
|
||||
};
|
||||
} ());
|
||||
}());
|
|
@ -12,7 +12,7 @@ Marionette.TemplateCache.get = function (templateId) {
|
|||
return function (data) {
|
||||
|
||||
try {
|
||||
console.log('rendering template ' + templateName);
|
||||
//console.log('rendering template ' + templateName);
|
||||
return templateFunction(data);
|
||||
}
|
||||
catch (error) {
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
function bestDateString(sourceDate){
|
||||
if (!sourceDate) return '';
|
||||
function bestDateString(sourceDate) {
|
||||
if (!sourceDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(sourceDate);
|
||||
|
||||
if (date.isYesterday()) return 'Yesterday';
|
||||
if (date.isToday()) return 'Today';
|
||||
if (date.isTomorrow()) return 'Tomorrow';
|
||||
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) return date.format('{Weekday}');
|
||||
if (date.isYesterday()) {
|
||||
return 'Yesterday';
|
||||
}
|
||||
if (date.isToday()) {
|
||||
return 'Today';
|
||||
}
|
||||
if (date.isTomorrow()) {
|
||||
return 'Tomorrow';
|
||||
}
|
||||
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
|
||||
return date.format('{Weekday}');
|
||||
}
|
||||
|
||||
return date.format('{MM}/{dd}/{yyyy}');
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
$.tablesorter.addParser({
|
||||
// set a unique id
|
||||
id: 'title',
|
||||
is: function (s) {
|
||||
id : 'title',
|
||||
is : function (s) {
|
||||
// return false so this parser is not auto detected
|
||||
return false;
|
||||
},
|
||||
|
@ -10,33 +10,34 @@ $.tablesorter.addParser({
|
|||
return s.match(/title="(.*?)"/)[1].toLowerCase();
|
||||
},
|
||||
// set type, either numeric or text
|
||||
type: 'text'
|
||||
type : 'text'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
// set a unique id
|
||||
id: 'date',
|
||||
is: function (s) {
|
||||
id : 'date',
|
||||
is : function (s) {
|
||||
// return false so this parser is not auto detected
|
||||
return false;
|
||||
},
|
||||
format: function (s) {
|
||||
// format your data for normalization
|
||||
var match = s.match(/data-date="(.*?)"/)[1];
|
||||
|
||||
if (match === '')
|
||||
|
||||
if (match === '') {
|
||||
return Date.create().addYears(100).format(Date.ISO8601_DATETIME);
|
||||
}
|
||||
|
||||
return match;
|
||||
},
|
||||
// set type, either numeric or text
|
||||
type: 'text'
|
||||
type : 'text'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
// set a unique id
|
||||
id: 'innerHtml',
|
||||
is: function (s) {
|
||||
id : 'innerHtml',
|
||||
is : function (s) {
|
||||
// return false so this parser is not auto detected
|
||||
return false;
|
||||
},
|
||||
|
@ -45,5 +46,5 @@ $.tablesorter.addParser({
|
|||
return $(s).get(0).innerHTML;
|
||||
},
|
||||
// set type, either numeric or text
|
||||
type: 'text'
|
||||
type : 'text'
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue