From 3d4eef5eb0a1632b43e1e3372e38a70cd4b58914 Mon Sep 17 00:00:00 2001 From: Stephan Date: Sun, 31 Mar 2019 21:30:46 +0200 Subject: [PATCH] Code formatting according to standardjs --- gulpfile.js | 34 +++++++++---------- source/code/hippie/functions.js | 20 +++++------ source/code/hippie/global.js | 16 ++++----- source/screens/demo.njk | 2 +- source/screens/demo/elements.njk | 2 +- source/screens/demo/examples.njk | 2 +- source/screens/demo/intro.njk | 4 +-- source/templates/demo/_default.njk | 2 +- source/templates/demo/_extended.njk | 2 +- .../hippie/partials/_head_script.njk | 4 +-- 10 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 19e6118..97762aa 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -90,34 +90,34 @@ if (fs.existsSync('source/templates/data.json')) { // Create tasks // Clean build folder -function clean() { +function clean () { // You can use multiple globbing patterns as you would with `gulp.src`, // for example if you are using del 2.0 or above, return its promise return del(output.root +'/**'); } // Automagically reload browsers -function reload(done) { +function reload (done) { server.reload(); done(); } // Concatenate JSON files -function json() { +function json () { return src(input.data) .pipe(plumber()) - .pipe(jsonConcat(hippie.jsonFile +'.json', function(data) { + .pipe(jsonConcat(hippie.jsonFile +'.json', function (data) { return new Buffer.from(JSON.stringify(data)); })) .pipe(dest(output.data)); } // Transpile HTML -function nunjucks() { +function nunjucks () { return src(input.screens) .pipe(plumber()) - .pipe(data(function() { + .pipe(data(function () { let data = JSON.parse(fs.readFileSync(input.templates +'/'+ hippie.data)); object = {hippie, data}; return object; @@ -132,7 +132,7 @@ function nunjucks() { } // Serve files to the browser -function serve(done) { +function serve (done) { server.init({ index: hippie.index, open: false, @@ -143,7 +143,7 @@ function serve(done) { } // This is for the looks -function style() { +function style () { return src(input.style) .pipe(plumber()) // .pipe(plumbError('STYLE PROBLEM')) @@ -159,7 +159,7 @@ function style() { .pipe(dest(output.style)); } // Linting -function styleLint() { +function styleLint () { var dir = output.reports; if (!fs.existsSync(dir)) { fs.mkdirSync(dir); @@ -175,7 +175,7 @@ function styleLint() { })) .pipe(sassLint.format(file)); - stream.on('finish', function() { + stream.on('finish', function () { file.end(); }); @@ -183,7 +183,7 @@ function styleLint() { } // Javascript for the win -function code(cb) { +function code (cb) { pump([ src(input.code, { sourcemaps: true, @@ -203,7 +203,7 @@ function code(cb) { ], cb); } // Linting -function codeLint() { +function codeLint () { return src(input.code, { allowEmpty: true }) .pipe(plumber()) .pipe(jshint()) @@ -215,14 +215,14 @@ function codeLint() { } // Fonts -function fonts() { +function fonts () { return src(input.fonts) .pipe(plumber()) .pipe(dest(output.fonts)) } // Add art -function art() { +function art () { // Move favicons to the root folder let favicons = src(input.art.favicons) .pipe(plumber()) @@ -238,7 +238,7 @@ function art() { return merge(favicons, images) } -function sprites() { +function sprites () { // Assemble sprites let sprites = src(input.art.sprites) .pipe(plumber()) @@ -262,13 +262,13 @@ function sprites() { } // Gather dependencies for tools -function vendor() { +function vendor () { return src(input.vendor) .pipe(plumber()) .pipe(dest(output.vendor)) } -function overview() { +function overview () { watch([input.templates, input.screens, input.demo.data], series(nunjucks, reload)); watch(input.style, series(styleLint, style, reload)); watch(input.code, series(codeLint, code, reload)); diff --git a/source/code/hippie/functions.js b/source/code/hippie/functions.js index 3c371c9..936c590 100644 --- a/source/code/hippie/functions.js +++ b/source/code/hippie/functions.js @@ -1,5 +1,5 @@ // This is called everytime -function setup() { +function setup () { 'use strict'; console.info('\n', hippie.brand, '\n\n'); if (debugOn) { @@ -12,14 +12,14 @@ function setup() { } // MODULE Scroll navigation -function HippieScroll($el) { +function HippieScroll ($el) { 'use strict'; // this.$el = $el; // console.log('Elements:', $el, this.$el); - + // Toggle display on scroll position // console.log('Scroll object added'); - this.check = function() { + this.check = function () { // console.log('Scroll position checked'); hippie.screen.y = Math.min($(document).scrollTop(), document.documentElement.scrollTop); if (hippie.screen.y > initY) { @@ -37,14 +37,14 @@ function HippieScroll($el) { } }; // Add events to navigation elements - $('.js_scrolltop').click(function(event) { + $('.js_scrolltop').click(function (event) { event.preventDefault(); $('html, body').animate({ scrollTop: 0 }, basicEase); // console.log('Scrolled to top'); }); - $('.js_scrolldown').click(function(event) { + $('.js_scrolldown').click(function (event) { event.preventDefault(); var pos = Math.max(hippie.screen.dh, hippie.body.h) - hippie.screen.vh; $('html').scrollTop(pos); @@ -54,7 +54,7 @@ function HippieScroll($el) { } // get document coordinates of the element -// function getCoords(elem) { +// function getCoords (elem) { // let box = elem.getBoundingClientRect(); // // return { @@ -64,7 +64,7 @@ function HippieScroll($el) { // } // https://stackoverflow.com/a/488073/1444149 -// function Utils() {} +// function Utils () {} // // Utils.prototype = { // constructor: Utils, @@ -86,9 +86,9 @@ function HippieScroll($el) { // TEST -function scrollNav() { +function scrollNav () { 'use strict'; - $('.nav a').click(function() { + $('.nav a').click(function () { //Toggle Class $(".active").removeClass("active"); $(this).closest('li').addClass("active"); diff --git a/source/code/hippie/global.js b/source/code/hippie/global.js index 8d39b3b..9aa2e96 100644 --- a/source/code/hippie/global.js +++ b/source/code/hippie/global.js @@ -4,7 +4,7 @@ setup(); // DOM ready // ----------------------------------------------------------------------------- -$(document).ready(function() { +$(document).ready(function () { 'use strict'; // logPerf('DOM ready.'); @@ -17,16 +17,16 @@ $(document).ready(function() { // Displays explanation popup $('.js_pop').hover( - function() { + function () { // if ($(this).attr('emmet')) { // // } $(this).next('.exp_pop').show(); - }, function() { + }, function () { $(this).next('.exp_pop').hide(); } ).mousemove( - function(event) { + function (event) { $(this).next('.exp_pop').css({ 'top': event.pageY - $(this).next('.exp_pop').outerHeight() - 4, 'left': event.pageX + 8 @@ -39,13 +39,13 @@ $(document).ready(function() { // WIP Activates layer with explanation elements // Besser ::after oder ::before benutzen - $('.js_showmeta').click(function(e) { + $('.js_showmeta').click(function (e) { var $wrap, $pop; if (expMode !== true) { expMode = true; - $('.js_pop').each(function(i, e) { + $('.js_pop').each(function (i, e) { if ($(this).css('position') === 'static') { $(this).addClass('js_changed_pos'); $(this).css('position', 'relative'); @@ -57,7 +57,7 @@ $(document).ready(function() { }); } else { - $('.js_pop').each(function(i, e) { + $('.js_pop').each(function (i, e) { $wrap = $(this).parent('.exp_wrap'); $pop = $wrap.next('.exp_pop').detach(); $wrap.find('.exp_marker_pop').remove(); @@ -78,7 +78,7 @@ $(document).ready(function() { console.log('Explanation mode', expMode); }); - $('#gameIcon').click(function(event) { + $('#gameIcon').click(function (event) { event.preventDefault(); $(this).clone().appendTo('#gameDetail'); $(this).siblings().clone().appendTo('#gameDetail'); diff --git a/source/screens/demo.njk b/source/screens/demo.njk index 59edf93..aab32a8 100644 --- a/source/screens/demo.njk +++ b/source/screens/demo.njk @@ -48,7 +48,7 @@ // ------------------------------------------------------------------------------ assetsLoaded = true; logPerf('SCRIPT assets loaded.'); -$( document ).ready(function() { +$( document ).ready(function () { logPerf('JQ document \'ready\' event fired.'); }); logPerf('Application ready.'); diff --git a/source/screens/demo/elements.njk b/source/screens/demo/elements.njk index 7dd7575..eff0b6a 100644 --- a/source/screens/demo/elements.njk +++ b/source/screens/demo/elements.njk @@ -70,7 +70,7 @@