0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

issue #58 - frontend jslint

Improvements to consistency
This commit is contained in:
Hannah Wolfe 2013-06-25 13:23:09 +01:00
parent ba810fb0bb
commit 588152898c
15 changed files with 44 additions and 50 deletions

View file

@ -1,8 +1,7 @@
// # Temporary Admin UI
/*global window, document, jQuery */
(function ($) {
/*global window, document, $ */
(function () {
"use strict";
// UTILS
@ -66,4 +65,5 @@
});
});
}(jQuery));
}());

View file

@ -1,6 +1,5 @@
/*globals window, _, $, Backbone */
(function ($) {
/*globals window, $, _, Backbone */
(function () {
"use strict";
var Ghost = {

View file

@ -1,7 +1,7 @@
/*global console, jQuery, CodeMirror*/
// # Surrounds given text with Markdown syntax
(function ($) {
/*global $, CodeMirror */
(function () {
"use strict";
var Markdown = {
init : function (options, elem) {
@ -19,10 +19,7 @@
if (this.options.syntax[this.style]) {
md = this.options.syntax[this.style].replace('$1', text);
this.elem.replaceSelection(md);
} else {
console.log("Invalid style.");
}
}
};
@ -50,4 +47,5 @@
currentDate: new Date().toLocaleString()
}
};
}(jQuery));
}());

View file

@ -1,4 +1,4 @@
/*global window, document, Ghost, $, Backbone, _ */
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";

View file

@ -1,4 +1,4 @@
/*global window, document, Ghost, $, Backbone, _ */
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";

View file

@ -1,4 +1,4 @@
/*global window, document, Ghost, $, Backbone, _ */
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";

View file

@ -1,6 +1,5 @@
/*global window, document, Ghost, Backbone, $, _ */
(function () {
"use strict";
Ghost.Router = Backbone.Router.extend({

View file

@ -1,15 +1,12 @@
// ## Tag Selector UI
/*jslint regexp: true */ // - would like to remove this
/*global jQuery, document, window */
(function ($) {
/*global window, document, $ */
(function () {
"use strict";
var suggestions,
categoryOffset,
existingTags = [ // This will be replaced by an API return.
],
existingTags = [], // This will be replaced by an API return.
keys = {
UP: 38,
DOWN: 40,
@ -60,6 +57,7 @@
pattern = new RegExp("(" + term + ")", "i");
src_str = src_str.replace(pattern, "<mark>$1</mark>");
/*jslint regexp: true */ // - would like to remove this
src_str = src_str.replace(/(<mark>[^<>]*)((<[^>]+>)+)([^<>]*<\/mark>)/, "$1</mark>$2<mark>$4");
$(this).html(src_str);
@ -186,4 +184,5 @@
$('.categories').on('click', ".category", handleCategoryClick);
$('[data-off-canvas]').on('click', handleClickOff);
});
}(jQuery));
}());

View file

@ -1,7 +1,7 @@
// # Toggle Support
/*global document, jQuery, Ghost */
(function ($) {
/*global document, $, Ghost */
(function () {
"use strict";
Ghost.temporary.initToggles = function ($el) {
@ -35,4 +35,4 @@
Ghost.temporary.initToggles($(document));
});
}(jQuery));
}());

View file

@ -1,5 +1,5 @@
/*global window, document, Ghost, Backbone, $, JST, _ */
(function (_) {
/*global window, document, Ghost, $, _, Backbone, JST */
(function () {
"use strict";
Ghost.View = Backbone.View.extend({
@ -72,4 +72,4 @@
}
});
}(_));
}());

View file

@ -1,4 +1,4 @@
/*global window, document, Ghost, Backbone, confirm, JST, $, _ */
/*global window, document, Ghost, $, _, Backbone, JST */
(function () {
"use strict";
@ -147,7 +147,7 @@
deletePost: function (e) {
e.preventDefault();
if (confirm('Are you sure you want to delete this post?')) {
if (window.confirm('Are you sure you want to delete this post?')) {
this.model.destroy({
wait: true
});

View file

@ -1,4 +1,4 @@
/*global window, document, localStorage, Ghost, Backbone, confirm, JST, $, _ */
/*global window, document, Ghost, $, _, Backbone, JST */
(function () {
"use strict";

View file

@ -1,5 +1,5 @@
/*global jQuery, window, document, Ghost, Backbone, $, _, alert */
(function ($, _, Backbone, Ghost) {
/*global window, document, Ghost, $, _, Backbone, JST */
(function () {
"use strict";
Ghost.Views.Debug = Ghost.View.extend({
@ -22,4 +22,4 @@
}
});
}(jQuery, _, Backbone, window.Ghost));
}());

View file

@ -1,6 +1,6 @@
// # Article Editor
/*global window, alert, document, history, Backbone, Ghost, $, _, Showdown, CodeMirror, shortcut, Countable */
/*global window, document, $, _, Backbone, Ghost, Showdown, CodeMirror, shortcut, Countable */
(function () {
"use strict";
@ -93,7 +93,7 @@
this.savePost({
status: keys[newIndex]
}).then(function () {
alert('Your post: ' + model.get('title') + ' has been ' + keys[newIndex]);
window.alert('Your post: ' + model.get('title') + ' has been ' + keys[newIndex]);
});
},
@ -103,16 +103,16 @@
model = this.model;
if (status === 'publish-on') {
return alert('Scheduled publishing not supported yet.');
return window.alert('Scheduled publishing not supported yet.');
}
if (status === 'queue') {
return alert('Scheduled publishing not supported yet.');
return window.alert('Scheduled publishing not supported yet.');
}
this.savePost({
status: status
}).then(function () {
alert('Your post: ' + model.get('title') + ' has been ' + status);
window.alert('Your post: ' + model.get('title') + ' has been ' + status);
});
},
@ -122,9 +122,9 @@
}
var model = this.model;
this.savePost().then(function () {
alert('Your post was saved as ' + model.get('status'));
window.alert('Your post was saved as ' + model.get('status'));
}, function () {
alert(model.validationError);
window.alert(model.validationError);
});
},
@ -248,7 +248,6 @@
view.renderPreview();
});
}
});
}());

View file

@ -1,4 +1,4 @@
/*global window, document, Ghost, Backbone, $, _, alert */
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
@ -85,7 +85,7 @@
email: this.$('#email-address').val()
}, {
success: function () {
alert('Saved');
window.alert('Saved');
}
});
},
@ -109,7 +109,7 @@
description: this.$('#blog-description').val()
}, {
success: function () {
alert('Saved');
window.alert('Saved');
}
});
},