fix lint errors
This commit is contained in:
@@ -222,16 +222,21 @@
|
||||
|
||||
//see http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
|
||||
supportsTransitions: function () {
|
||||
var b = document.body || document.documentElement;
|
||||
var s = b.style;
|
||||
var p = 'transition';
|
||||
if(typeof s[p] == 'string') {return true; }
|
||||
var b = document.body || document.documentElement,
|
||||
s = b.style,
|
||||
p = 'transition',
|
||||
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'];
|
||||
|
||||
if(typeof s[p] === 'string') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Tests for vendor specific prop
|
||||
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'],
|
||||
p = p.charAt(0).toUpperCase() + p.substr(1);
|
||||
for(var i=0; i<v.length; i++) {
|
||||
if(typeof s[v[i] + p] == 'string') { return true; }
|
||||
if(typeof s[v[i] + p] === 'string') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -224,30 +224,30 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
//sending data to server
|
||||
$.when(this.save(submitValue))
|
||||
.done($.proxy(function(response) {
|
||||
this.isSaving = false;
|
||||
|
||||
this.isSaving = false;
|
||||
|
||||
//run success callback
|
||||
var res = typeof this.options.success === 'function' ? this.options.success.call(this.options.scope, response, newValue) : null;
|
||||
|
||||
|
||||
//if success callback returns false --> keep form open and do not activate input
|
||||
if(res === false) {
|
||||
this.error(false);
|
||||
this.showForm(false);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if success callback returns string --> keep form open, show error and activate input
|
||||
if(typeof res === 'string') {
|
||||
this.error(res);
|
||||
this.showForm();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
|
||||
//it is usefull if you want to chnage value in url-function
|
||||
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
|
||||
newValue = res.newValue;
|
||||
}
|
||||
}
|
||||
|
||||
//clear error message
|
||||
this.error(false);
|
||||
@@ -264,20 +264,20 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
@example
|
||||
$('#form-div').on('save'), function(e, params){
|
||||
if(params.newValue === 'username') {...}
|
||||
});
|
||||
**/
|
||||
});
|
||||
**/
|
||||
this.$div.triggerHandler('save', {newValue: newValue, submitValue: submitValue, response: response});
|
||||
}, this))
|
||||
.fail($.proxy(function(xhr) {
|
||||
this.isSaving = false;
|
||||
|
||||
this.isSaving = false;
|
||||
|
||||
var msg;
|
||||
if(typeof this.options.error === 'function') {
|
||||
msg = this.options.error.call(this.options.scope, xhr, newValue);
|
||||
} else {
|
||||
msg = typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!';
|
||||
}
|
||||
|
||||
|
||||
this.error(msg);
|
||||
this.showForm();
|
||||
}, this));
|
||||
|
Reference in New Issue
Block a user