Fix Warnings

This commit is contained in:
Naoki Takezoe
2014-09-13 19:01:49 +09:00
parent a602ece8e9
commit 97c6b0495e
2 changed files with 19 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ $(function(){
});
$('.markdown-head').mouseleave(function(e){
var anchorLink = $(e.target).children('a.markdown-anchor-link');
if(anchorLink.data('active') != true){
if(anchorLink.data('active') !== true){
anchorLink.hide();
}
});
@@ -39,7 +39,7 @@ function displayErrors(data){
var i = 0;
$.each(data, function(key, value){
$('#error-' + key.split(".").join("_")).text(value);
if(i == 0){
if(i === 0){
$('#' + key).focus();
}
i++;
@@ -71,17 +71,15 @@ function displayErrors(data){
function diffUsingJS(oldTextId, newTextId, outputId) {
// get the baseText and newText values from the two textboxes, and split them into lines
var oldText = document.getElementById(oldTextId).value;
if(oldText == ''){
var oldLines = [];
} else {
var oldLines = difflib.stringAsLines(oldText);
if(oldText !== ''){
oldLines = difflib.stringAsLines(oldText);
}
var newText = document.getElementById(newTextId).value
if(newText == ''){
var newText = document.getElementById(newTextId).value;
var newLines = [];
} else {
var newLines = difflib.stringAsLines(newText);
if(newText !== ''){
newLines = difflib.stringAsLines(newText);
}
// create a SequenceMatcher instance that diffs the two sets of lines

View File

@@ -4,22 +4,22 @@ $(function(){
});
$.each($('input[formaction]'), function(i, input){
$(input).click(function(){
var form = $(input).parents('form')
$(form).attr('action', $(input).attr('formaction'))
var form = $(input).parents('form');
$(form).attr('action', $(input).attr('formaction'));
});
});
});
function validate(e){
var form = $(e.target);
$(form).find('[type=submit]').attr('disabled', 'disabled')
$(form).find('[type=submit]').attr('disabled', 'disabled');
if(form.data('validated') == true){
if(form.data('validated') !== true){
return true;
}
$.post(form.attr('action') + '/validate', $(e.target).serialize(), function(data){
$(form).find('[type=submit]').removeAttr('disabled')
$(form).find('[type=submit]').removeAttr('disabled');
// clear all error messages
$('.error').text('');