mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Cleanup indentation and quotes
Aligns all requirements vertically for easier reading + adds single quote standard consistently throughout Ghost, except in long strings.
This commit is contained in:
parent
8eefbf9cc7
commit
c3a9a903c6
12 changed files with 70 additions and 70 deletions
|
@ -1,9 +1,9 @@
|
|||
/*globals Handlebars, moment
|
||||
*/
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
Handlebars.registerHelper('date', function (context, block) {
|
||||
var f = block.hash.format || "MMM Do, YYYY",
|
||||
var f = block.hash.format || 'MMM Do, YYYY',
|
||||
timeago = block.hash.timeago,
|
||||
date;
|
||||
if (timeago) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*globals window, $, _, Backbone, Validator */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var Ghost = {
|
||||
Layout : {},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/*global $, window, CodeMirror, Showdown, moment */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
var Markdown = {
|
||||
init : function (options, elem) {
|
||||
var self = this;
|
||||
|
@ -17,59 +17,59 @@
|
|||
replace: function () {
|
||||
var text = this.elem.getSelection(), pass = true, md, cursor, line, word, letterCount, converter;
|
||||
switch (this.style) {
|
||||
case "h1":
|
||||
case 'h1':
|
||||
cursor = this.elem.getCursor();
|
||||
line = this.elem.getLine(cursor.line);
|
||||
this.elem.setLine(cursor.line, "# " + line);
|
||||
this.elem.setLine(cursor.line, '# ' + line);
|
||||
this.elem.setCursor(cursor.line, cursor.ch + 2);
|
||||
pass = false;
|
||||
break;
|
||||
case "h2":
|
||||
case 'h2':
|
||||
cursor = this.elem.getCursor();
|
||||
line = this.elem.getLine(cursor.line);
|
||||
this.elem.setLine(cursor.line, "## " + line);
|
||||
this.elem.setLine(cursor.line, '## ' + line);
|
||||
this.elem.setCursor(cursor.line, cursor.ch + 3);
|
||||
pass = false;
|
||||
break;
|
||||
case "h3":
|
||||
case 'h3':
|
||||
cursor = this.elem.getCursor();
|
||||
line = this.elem.getLine(cursor.line);
|
||||
this.elem.setLine(cursor.line, "### " + line);
|
||||
this.elem.setLine(cursor.line, '### ' + line);
|
||||
this.elem.setCursor(cursor.line, cursor.ch + 4);
|
||||
pass = false;
|
||||
break;
|
||||
case "h4":
|
||||
case 'h4':
|
||||
cursor = this.elem.getCursor();
|
||||
line = this.elem.getLine(cursor.line);
|
||||
this.elem.setLine(cursor.line, "#### " + line);
|
||||
this.elem.setLine(cursor.line, '#### ' + line);
|
||||
this.elem.setCursor(cursor.line, cursor.ch + 5);
|
||||
pass = false;
|
||||
break;
|
||||
case "h5":
|
||||
case 'h5':
|
||||
cursor = this.elem.getCursor();
|
||||
line = this.elem.getLine(cursor.line);
|
||||
this.elem.setLine(cursor.line, "##### " + line);
|
||||
this.elem.setLine(cursor.line, '##### ' + line);
|
||||
this.elem.setCursor(cursor.line, cursor.ch + 6);
|
||||
pass = false;
|
||||
break;
|
||||
case "h6":
|
||||
case 'h6':
|
||||
cursor = this.elem.getCursor();
|
||||
line = this.elem.getLine(cursor.line);
|
||||
this.elem.setLine(cursor.line, "###### " + line);
|
||||
this.elem.setLine(cursor.line, '###### ' + line);
|
||||
this.elem.setCursor(cursor.line, cursor.ch + 7);
|
||||
pass = false;
|
||||
break;
|
||||
case "link":
|
||||
case 'link':
|
||||
md = this.options.syntax.link.replace('$1', text);
|
||||
this.elem.replaceSelection(md, "end");
|
||||
this.elem.replaceSelection(md, 'end');
|
||||
cursor = this.elem.getCursor();
|
||||
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
|
||||
pass = false;
|
||||
break;
|
||||
case "image":
|
||||
case 'image':
|
||||
cursor = this.elem.getCursor();
|
||||
md = this.options.syntax.image.replace('$1', text);
|
||||
if (this.elem.getLine(cursor.line) !== "") {
|
||||
if (this.elem.getLine(cursor.line) !== '') {
|
||||
md = "\n\n" + md;
|
||||
}
|
||||
this.elem.replaceSelection(md, "end");
|
||||
|
@ -77,16 +77,16 @@
|
|||
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
|
||||
pass = false;
|
||||
break;
|
||||
case "uppercase":
|
||||
case 'uppercase':
|
||||
md = text.toLocaleUpperCase();
|
||||
break;
|
||||
case "lowercase":
|
||||
case 'lowercase':
|
||||
md = text.toLocaleLowerCase();
|
||||
break;
|
||||
case "titlecase":
|
||||
case 'titlecase':
|
||||
md = text.toTitleCase();
|
||||
break;
|
||||
case "selectword":
|
||||
case 'selectword':
|
||||
cursor = this.elem.getCursor();
|
||||
word = this.elem.getTokenAt(cursor);
|
||||
if (!/\w$/g.test(word.string)) {
|
||||
|
@ -95,7 +95,7 @@
|
|||
this.elem.setSelection({line: cursor.line, ch: word.start}, {line: cursor.line, ch: word.end});
|
||||
}
|
||||
break;
|
||||
case "copyHTML":
|
||||
case 'copyHTML':
|
||||
converter = new Showdown.converter();
|
||||
if (text) {
|
||||
md = converter.makeHtml(text);
|
||||
|
@ -106,14 +106,14 @@
|
|||
$(".modal-copyToHTML-content").text(md).selectText();
|
||||
pass = false;
|
||||
break;
|
||||
case "list":
|
||||
md = text.replace(/^(\s*)(\w\W*)/gm, "$1* $2");
|
||||
this.elem.replaceSelection(md, "end");
|
||||
case 'list':
|
||||
md = text.replace(/^(\s*)(\w\W*)/gm, '$1* $2');
|
||||
this.elem.replaceSelection(md, 'end');
|
||||
pass = false;
|
||||
break;
|
||||
case "currentDate":
|
||||
md = moment(new Date()).format("D MMMM YYYY");
|
||||
this.elem.replaceSelection(md, "end");
|
||||
case 'currentDate':
|
||||
md = moment(new Date()).format('D MMMM YYYY');
|
||||
this.elem.replaceSelection(md, 'end');
|
||||
pass = false;
|
||||
break;
|
||||
default:
|
||||
|
@ -122,7 +122,7 @@
|
|||
}
|
||||
}
|
||||
if (pass && md) {
|
||||
this.elem.replaceSelection(md, "end");
|
||||
this.elem.replaceSelection(md, 'end');
|
||||
if (!text) {
|
||||
letterCount = md.length;
|
||||
cursor = this.elem.getCursor();
|
||||
|
|
|
@ -3,49 +3,49 @@
|
|||
/*global window, document, $, FastClick */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
FastClick.attach(document.body);
|
||||
|
||||
// ### Show content preview when swiping left on content list
|
||||
$(".manage").on("click", ".content-list ol li", function (event) {
|
||||
$('.manage').on('click', '.content-list ol li', function (event) {
|
||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$(".content-list").animate({right: "100%", left: "-100%", 'margin-right': "15px"}, 300);
|
||||
$(".content-preview").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
|
||||
$('.content-list').animate({right: '100%', left: '-100%', 'margin-right': '15px'}, 300);
|
||||
$('.content-preview').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
|
||||
}
|
||||
});
|
||||
|
||||
// ### Hide content preview
|
||||
$(".manage").on("click", ".content-preview .button-back", function (event) {
|
||||
$('.manage').on('click', '.content-preview .button-back', function (event) {
|
||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$(".content-list").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
|
||||
$(".content-preview").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
|
||||
$('.content-list').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
|
||||
$('.content-preview').animate({right: '-100%', left: '100%', 'margin-left': '15px'}, 300);
|
||||
}
|
||||
});
|
||||
|
||||
// ### Show settings options page when swiping left on settings menu link
|
||||
$(".settings").on("click", ".settings-menu li", function (event) {
|
||||
$('.settings').on('click', '.settings-menu li', function (event) {
|
||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$(".settings-sidebar").animate({right: "100%", left: "-102%", 'margin-right': "15px"}, 300);
|
||||
$(".settings-content").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
|
||||
$(".settings-content .button-back, .settings-content .button-save").css("display", "inline-block");
|
||||
$('.settings-sidebar').animate({right: '100%', left: '-102%', 'margin-right': '15px'}, 300);
|
||||
$('.settings-content').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
|
||||
$('.settings-content .button-back, .settings-content .button-save').css('display', 'inline-block');
|
||||
}
|
||||
});
|
||||
|
||||
// ### Hide settings options page
|
||||
$(".settings").on("click", ".settings-content .button-back", function (event) {
|
||||
$('.settings').on('click', '.settings-content .button-back', function (event) {
|
||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$(".settings-sidebar").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
|
||||
$(".settings-content").animate({right: "-100%", left: "100%", 'margin-left': "15"}, 300);
|
||||
$(".settings-content .button-back, .settings-content .button-save").css("display", "none");
|
||||
$('.settings-sidebar').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
|
||||
$('.settings-content').animate({right: '-100%', left: '100%', 'margin-left': '15'}, 300);
|
||||
$('.settings-content .button-back, .settings-content .button-save').css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*global window, document, Ghost, $, _, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.Post = Backbone.Model.extend({
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
|||
|
||||
parse: function (resp) {
|
||||
if (resp.status) {
|
||||
resp.published = !!(resp.status === "published");
|
||||
resp.draft = !!(resp.status === "draft");
|
||||
resp.published = !!(resp.status === 'published');
|
||||
resp.draft = !!(resp.status === 'draft');
|
||||
}
|
||||
if (resp.tags) {
|
||||
// TODO: parse tags into it's own collection on the model (this.tags)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*global window, document, Ghost, $, _, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
//id:0 is used to issue PUT requests
|
||||
Ghost.Models.Settings = Backbone.Model.extend({
|
||||
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
|
||||
id: "0"
|
||||
id: '0'
|
||||
});
|
||||
|
||||
}());
|
|
@ -1,6 +1,6 @@
|
|||
/*global window, document, Ghost, $, _, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Ghost.Collections.Tags = Backbone.Collection.extend({
|
||||
url: Ghost.settings.apiRoot + '/tags/'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*global window, document, Ghost, $, _, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.Themes = Backbone.Model.extend({
|
||||
url: Ghost.settings.apiRoot + '/themes'
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*global Ghost, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
Ghost.Models.uploadModal = Backbone.Model.extend({
|
||||
|
||||
options: {
|
||||
close: true,
|
||||
type: "action",
|
||||
type: 'action',
|
||||
style: ["wide"],
|
||||
animation: 'fade',
|
||||
afterRender: function () {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*global window, document, Ghost, $, _, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.User = Backbone.Model.extend({
|
||||
url: Ghost.settings.apiRoot + '/users/me/'
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/*global window, document, Ghost, $, _, Backbone */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.Widget = Backbone.Model.extend({
|
||||
|
||||
defaults: {
|
||||
title: "",
|
||||
name: "",
|
||||
author: "",
|
||||
applicationID: "",
|
||||
size: "",
|
||||
title: '',
|
||||
name: '',
|
||||
author: '',
|
||||
applicationID: '',
|
||||
size: '',
|
||||
content: {
|
||||
template: '',
|
||||
data: {
|
||||
|
@ -17,9 +17,9 @@
|
|||
count: 0,
|
||||
sub: {
|
||||
value: 0,
|
||||
dir: "", // "up" or "down"
|
||||
item: "",
|
||||
period: ""
|
||||
dir: '', // "up" or "down"
|
||||
item: '',
|
||||
period: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,8 @@
|
|||
settingsPane: false,
|
||||
enabled: false,
|
||||
options: [{
|
||||
title: "ERROR",
|
||||
value: "Widget options not set"
|
||||
title: 'ERROR',
|
||||
value: 'Widget options not set'
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/*global document, $, Ghost */
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
Ghost.temporary.hideToggles = function () {
|
||||
$('[data-toggle]').each(function () {
|
||||
|
@ -11,7 +11,7 @@
|
|||
});
|
||||
|
||||
// Toggle active classes on menu headers
|
||||
$("[data-toggle].active").removeClass("active");
|
||||
$('[data-toggle].active').removeClass('active');
|
||||
};
|
||||
|
||||
Ghost.temporary.initToggles = function ($el) {
|
||||
|
|
Loading…
Add table
Reference in a new issue