diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..a86e0128 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true diff --git a/gulpfile.js b/gulpfile.js index 550bd257..a81f3f4e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -22,12 +22,15 @@ gulp.task('prettify:verify', ['prettify:sources:verify', 'prettify:jsx:verify']) var prettify_options = { html: { + eol: '\n', indentSize: 2 }, css: { + eol: '\n', indentSize: 2 }, js: { + eol: '\n', indentSize: 2, braceStyle: "end-expand" } diff --git a/src/browser/js/badge.js b/src/browser/js/badge.js index b77e1f22..0b0b168e 100644 --- a/src/browser/js/badge.js +++ b/src/browser/js/badge.js @@ -1,29 +1,29 @@ -'use strict'; - -var createDataURL = function(text) { - const scale = 2; // should rely display dpi - const size = 16 * scale; - const canvas = document.createElement('canvas'); - canvas.setAttribute('width', size); - canvas.setAttribute('height', size); - const ctx = canvas.getContext('2d'); - - // circle - ctx.fillStyle = "#FF1744"; // Material Red A400 - ctx.beginPath(); - ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2); - ctx.fill(); - - // text - ctx.fillStyle = "#ffffff" - ctx.textAlign = 'center'; - ctx.textBaseline = 'middle'; - ctx.font = (11 * scale) + "px sans-serif"; - ctx.fillText(text, size / 2, size / 2, size); - - return canvas.toDataURL(); -}; - -module.exports = { - createDataURL: createDataURL +'use strict'; + +var createDataURL = function(text) { + const scale = 2; // should rely display dpi + const size = 16 * scale; + const canvas = document.createElement('canvas'); + canvas.setAttribute('width', size); + canvas.setAttribute('height', size); + const ctx = canvas.getContext('2d'); + + // circle + ctx.fillStyle = "#FF1744"; // Material Red A400 + ctx.beginPath(); + ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2); + ctx.fill(); + + // text + ctx.fillStyle = "#ffffff" + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.font = (11 * scale) + "px sans-serif"; + ctx.fillText(text, size / 2, size / 2, size); + + return canvas.toDataURL(); +}; + +module.exports = { + createDataURL: createDataURL };