diff --git a/gulpfile.js b/gulpfile.js
index 5978af15..ca12eff4 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -12,6 +12,9 @@ const browsersync = require('browser-sync').create();
const { exec } = require("child_process");
const spawn = require('child_process').spawn;
const cssnano = require('cssnano');
+const con = require('gulp-concat');
+const gulpif = require('gulp-if');
+const ignore = require('gulp-ignore');
sass.compiler = require('node-sass');
@@ -30,11 +33,11 @@ function styles(done) {
}
function scripts() {
- return gulp.src(['pipeline/source_assets/js/**/*.js',
- 'node_modules/jquery/dist/jquery.js',
+ const dest = 'pipeline/built_assets/js';
+ const base_scripts = ["src.js", "util.js", "alert.js", "collapse.js", "dropdown.js", "modal.js", "konami.js"];
+ return gulp.src(['node_modules/jquery/dist/jquery.js',
/* JQuery Plugins */
'node_modules/jquery-ui-dist/jquery-ui.js',
-
'node_modules/popper.js/dist/umd/popper.js',
/* Bootstrap Plugins */
'node_modules/bootstrap/js/dist/util.js',
@@ -51,10 +54,13 @@ function scripts() {
'node_modules/fullcalendar/main.js',
'node_modules/bootstrap-select/dist/js/bootstrap-select.js',
'node_modules/ajax-bootstrap-select/dist/js/ajax-bootstrap-select.js',
- 'node_modules/konami/konami.js'])
+ 'node_modules/konami/konami.js',
+ 'pipeline/source_assets/js/**/*.js',])
+ .pipe(gulpif(function(file) { return base_scripts.includes(file.relative);}, con('base.js')))
+ .pipe(ignore.exclude(function(file) { return base_scripts.includes(file.relative);}))
.pipe(flatten())
.pipe(terser())
- .pipe(gulp.dest('pipeline/built_assets/js'))
+ .pipe(gulp.dest(dest))
.pipe(browsersync.stream());
}
diff --git a/package-lock.json b/package-lock.json
index 08acd8c0..a1582626 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,7 +19,10 @@
"flatpickr": "^4.6.6",
"fullcalendar": "^5.3.2",
"gulp": "^4.0.2",
+ "gulp-concat": "^2.6.1",
"gulp-flatten": "^0.4.0",
+ "gulp-if": "^3.0.0",
+ "gulp-ignore": "^3.0.0",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.5",
@@ -1337,6 +1340,14 @@
"typedarray": "^0.0.6"
}
},
+ "node_modules/concat-with-sourcemaps": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz",
+ "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==",
+ "dependencies": {
+ "source-map": "^0.6.1"
+ }
+ },
"node_modules/connect": {
"version": "3.6.6",
"resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz",
@@ -1862,6 +1873,30 @@
"node": ">=8"
}
},
+ "node_modules/duplexify": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz",
+ "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==",
+ "dependencies": {
+ "end-of-stream": "^1.4.1",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1",
+ "stream-shift": "^1.0.0"
+ }
+ },
+ "node_modules/duplexify/node_modules/readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/each-props": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz",
@@ -2687,6 +2722,11 @@
"node": "*"
}
},
+ "node_modules/fork-stream": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz",
+ "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA="
+ },
"node_modules/form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
@@ -3449,6 +3489,19 @@
"object.assign": "^4.1.0"
}
},
+ "node_modules/gulp-concat": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz",
+ "integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=",
+ "dependencies": {
+ "concat-with-sourcemaps": "^1.0.0",
+ "through2": "^2.0.0",
+ "vinyl": "^2.0.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
"node_modules/gulp-flatten": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/gulp-flatten/-/gulp-flatten-0.4.0.tgz",
@@ -3523,6 +3576,51 @@
"node": ">=0.10.0"
}
},
+ "node_modules/gulp-if": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
+ "integrity": "sha512-fCUEngzNiEZEK2YuPm+sdMpO6ukb8+/qzbGfJBXyNOXz85bCG7yBI+pPSl+N90d7gnLvMsarthsAImx0qy7BAw==",
+ "dependencies": {
+ "gulp-match": "^1.1.0",
+ "ternary-stream": "^3.0.0",
+ "through2": "^3.0.1"
+ }
+ },
+ "node_modules/gulp-if/node_modules/through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "dependencies": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ },
+ "node_modules/gulp-ignore": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-ignore/-/gulp-ignore-3.0.0.tgz",
+ "integrity": "sha512-hRQDJipaU5A84J7QacNGG+bnFU3QLESdjuJCRTAZ5VuKsz4LmvOrECFJeeCtqxP3RV0Pn6mawU0Q3CFZGpirSg==",
+ "dependencies": {
+ "gulp-match": "^1.1.0",
+ "through2": "^3.0.1"
+ }
+ },
+ "node_modules/gulp-ignore/node_modules/through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "dependencies": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ },
+ "node_modules/gulp-match": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.1.0.tgz",
+ "integrity": "sha512-DlyVxa1Gj24DitY2OjEsS+X6tDpretuxD6wTfhXE/Rw2hweqc1f6D/XtsJmoiCwLWfXgR87W9ozEityPCVzGtQ==",
+ "dependencies": {
+ "minimatch": "^3.0.3"
+ }
+ },
"node_modules/gulp-postcss": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/gulp-postcss/-/gulp-postcss-8.0.0.tgz",
@@ -5265,6 +5363,11 @@
"node": ">=0.10.0"
}
},
+ "node_modules/merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="
+ },
"node_modules/micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
@@ -8318,6 +8421,26 @@
"node": ">=10"
}
},
+ "node_modules/ternary-stream": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-3.0.0.tgz",
+ "integrity": "sha512-oIzdi+UL/JdktkT+7KU5tSIQjj8pbShj3OASuvDEhm0NT5lppsm7aXWAmAq4/QMaBIyfuEcNLbAQA+HpaISobQ==",
+ "dependencies": {
+ "duplexify": "^4.1.1",
+ "fork-stream": "^0.0.4",
+ "merge-stream": "^2.0.0",
+ "through2": "^3.0.1"
+ }
+ },
+ "node_modules/ternary-stream/node_modules/through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "dependencies": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ },
"node_modules/tfunk": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tfunk/-/tfunk-4.0.0.tgz",
@@ -10307,6 +10430,14 @@
"typedarray": "^0.0.6"
}
},
+ "concat-with-sourcemaps": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz",
+ "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==",
+ "requires": {
+ "source-map": "^0.6.1"
+ }
+ },
"connect": {
"version": "3.6.6",
"resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz",
@@ -10724,6 +10855,29 @@
"is-obj": "^2.0.0"
}
},
+ "duplexify": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz",
+ "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==",
+ "requires": {
+ "end-of-stream": "^1.4.1",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1",
+ "stream-shift": "^1.0.0"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ }
+ }
+ },
"each-props": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz",
@@ -11404,6 +11558,11 @@
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
+ "fork-stream": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz",
+ "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA="
+ },
"form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
@@ -12026,6 +12185,16 @@
}
}
},
+ "gulp-concat": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz",
+ "integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=",
+ "requires": {
+ "concat-with-sourcemaps": "^1.0.0",
+ "through2": "^2.0.0",
+ "vinyl": "^2.0.0"
+ }
+ },
"gulp-flatten": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/gulp-flatten/-/gulp-flatten-0.4.0.tgz",
@@ -12081,6 +12250,55 @@
}
}
},
+ "gulp-if": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
+ "integrity": "sha512-fCUEngzNiEZEK2YuPm+sdMpO6ukb8+/qzbGfJBXyNOXz85bCG7yBI+pPSl+N90d7gnLvMsarthsAImx0qy7BAw==",
+ "requires": {
+ "gulp-match": "^1.1.0",
+ "ternary-stream": "^3.0.0",
+ "through2": "^3.0.1"
+ },
+ "dependencies": {
+ "through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ }
+ }
+ },
+ "gulp-ignore": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-ignore/-/gulp-ignore-3.0.0.tgz",
+ "integrity": "sha512-hRQDJipaU5A84J7QacNGG+bnFU3QLESdjuJCRTAZ5VuKsz4LmvOrECFJeeCtqxP3RV0Pn6mawU0Q3CFZGpirSg==",
+ "requires": {
+ "gulp-match": "^1.1.0",
+ "through2": "^3.0.1"
+ },
+ "dependencies": {
+ "through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ }
+ }
+ },
+ "gulp-match": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.1.0.tgz",
+ "integrity": "sha512-DlyVxa1Gj24DitY2OjEsS+X6tDpretuxD6wTfhXE/Rw2hweqc1f6D/XtsJmoiCwLWfXgR87W9ozEityPCVzGtQ==",
+ "requires": {
+ "minimatch": "^3.0.3"
+ }
+ },
"gulp-postcss": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/gulp-postcss/-/gulp-postcss-8.0.0.tgz",
@@ -13460,6 +13678,11 @@
"trim-newlines": "^1.0.0"
}
},
+ "merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="
+ },
"micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
@@ -15939,6 +16162,28 @@
}
}
},
+ "ternary-stream": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-3.0.0.tgz",
+ "integrity": "sha512-oIzdi+UL/JdktkT+7KU5tSIQjj8pbShj3OASuvDEhm0NT5lppsm7aXWAmAq4/QMaBIyfuEcNLbAQA+HpaISobQ==",
+ "requires": {
+ "duplexify": "^4.1.1",
+ "fork-stream": "^0.0.4",
+ "merge-stream": "^2.0.0",
+ "through2": "^3.0.1"
+ },
+ "dependencies": {
+ "through2": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
+ "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "2 || 3"
+ }
+ }
+ }
+ },
"tfunk": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tfunk/-/tfunk-4.0.0.tgz",
diff --git a/package.json b/package.json
index 30e24f9f..694a2b49 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,10 @@
"flatpickr": "^4.6.6",
"fullcalendar": "^5.3.2",
"gulp": "^4.0.2",
+ "gulp-concat": "^2.6.1",
"gulp-flatten": "^0.4.0",
+ "gulp-if": "^3.0.0",
+ "gulp-ignore": "^3.0.0",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.5",
diff --git a/pipeline/source_assets/js/base.js b/pipeline/source_assets/js/base.js
deleted file mode 100644
index 83c203f4..00000000
--- a/pipeline/source_assets/js/base.js
+++ /dev/null
@@ -1,41 +0,0 @@
-Date.prototype.getISOString = function () {
- var yyyy = this.getFullYear().toString();
- var mm = (this.getMonth() + 1).toString(); // getMonth() is zero-based
- var dd = this.getDate().toString();
- return yyyy + '-' + (mm[1] ? mm : "0" + mm[0]) + '-' + (dd[1] ? dd : "0" + dd[0]); // padding
-};
-jQuery(document).ready(function () {
- jQuery(document).on('click', '.modal-href', function (e) {
- $link = jQuery(this);
- // Anti modal inception
- if ($link.parents('#modal').length == 0) {
- e.preventDefault();
- modaltarget = $link.data('target');
- modalobject = "";
- jQuery('#modal').load($link.attr('href'), function (e) {
- jQuery('#modal').modal();
- });
- }
- });
-
-
- var easter_egg = new Konami();
- easter_egg.code = function () {
- var s = document.createElement('script');
- s.type = 'text/javascript';
- document.body.appendChild(s);
- s.src = '{% static "js/asteroids.min.js"%}';
- ga('send', 'event', 'easter_egg', 'activated');
- }
- easter_egg.load();
-});
-//CTRL-Enter form submission
-document.body.addEventListener('keydown', function(e) {
- if(e.keyCode == 13 && (e.metaKey || e.ctrlKey)) {
- var target = e.target;
- if(target.form) {
- target.form.submit();
- }
- }
-});
-$('.navbar-collapse').addClass('collapse')
diff --git a/pipeline/source_assets/js/src.js b/pipeline/source_assets/js/src.js
new file mode 100644
index 00000000..cc5a65df
--- /dev/null
+++ b/pipeline/source_assets/js/src.js
@@ -0,0 +1,39 @@
+Date.prototype.getISOString = function () {
+ var yyyy = this.getFullYear().toString();
+ var mm = (this.getMonth() + 1).toString(); // getMonth() is zero-based
+ var dd = this.getDate().toString();
+ return yyyy + '-' + (mm[1] ? mm : "0" + mm[0]) + '-' + (dd[1] ? dd : "0" + dd[0]); // padding
+};
+jQuery(document).ready(function () {
+ jQuery(document).on('click', '.modal-href', function (e) {
+ $link = jQuery(this);
+ // Anti modal inception
+ if ($link.parents('#modal').length == 0) {
+ e.preventDefault();
+ modaltarget = $link.data('target');
+ modalobject = "";
+ jQuery('#modal').load($link.attr('href'), function (e) {
+ jQuery('#modal').modal();
+ });
+ }
+ });
+ var easter_egg = new Konami();
+ easter_egg.code = function () {
+ var s = document.createElement('script');
+ s.type = 'text/javascript';
+ document.body.appendChild(s);
+ s.src = '{% static "js/asteroids.min.js"%}';
+ ga('send', 'event', 'easter_egg', 'activated');
+ }
+ easter_egg.load();
+});
+//CTRL-Enter form submission
+document.body.addEventListener('keydown', function(e) {
+ if(e.keyCode == 13 && (e.metaKey || e.ctrlKey)) {
+ var target = e.target;
+ if(target.form) {
+ target.form.submit();
+ }
+ }
+});
+$('.navbar-collapse').addClass('collapse');
diff --git a/templates/base.html b/templates/base.html
index 364e01fe..7ec15a58 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -87,12 +87,6 @@ if({{ request.user.dark_theme|lower }} || window.matchMedia('(prefers-color-sche
document.body.setAttribute('data-theme', 'dark');
}
-
-
-
-
-
-
{% block js %}
{% endblock %}