mirror of https://github.com/snachodog/mybuddy.git
Refactor JS to use BabyBlotter as primary JS namespace.
This commit is contained in:
parent
78eb20ab91
commit
f81f763cfb
|
@ -0,0 +1,12 @@
|
|||
/* Baby Blotter
|
||||
*
|
||||
* Default namespace for the Baby Blotter app.
|
||||
*/
|
||||
if (typeof jQuery === 'undefined') {
|
||||
throw new Error('Baby Blotter requires jQuery.')
|
||||
}
|
||||
|
||||
var BabyBlotter = function () {
|
||||
var BabyBlotter = {};
|
||||
return BabyBlotter;
|
||||
}();
|
|
@ -1,25 +1,21 @@
|
|||
if (typeof jQuery === 'undefined') {
|
||||
throw new Error('BabyBlotter Timer requires jQuery.')
|
||||
}
|
||||
|
||||
var BBTimer = function ($) {
|
||||
/* Baby Blotter Timer
|
||||
*
|
||||
* Uses a supplied ID to run a timer. The element using the ID must have
|
||||
* three children with the following classes:
|
||||
* * timer-seconds
|
||||
* * timer-minutes
|
||||
* * timer-hours
|
||||
*/
|
||||
/* Baby Blotter Timer
|
||||
*
|
||||
* Uses a supplied ID to run a timer. The element using the ID must have
|
||||
* three children with the following classes:
|
||||
* * timer-seconds
|
||||
* * timer-minutes
|
||||
* * timer-hours
|
||||
*/
|
||||
BabyBlotter.Timer = function ($) {
|
||||
var runIntervalId = null;
|
||||
var timerElement = null;
|
||||
|
||||
var BBTimer = {
|
||||
var Timer = {
|
||||
run: function(id) {
|
||||
timerElement = $('#' + id);
|
||||
|
||||
if (timerElement.length == 0) {
|
||||
console.error('BBTimer: Timer element not found.')
|
||||
console.error('BBTimer: Timer element not found.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,5 +57,5 @@ var BBTimer = function ($) {
|
|||
}
|
||||
};
|
||||
|
||||
return BBTimer;
|
||||
return Timer;
|
||||
}(jQuery);
|
||||
|
|
|
@ -41,6 +41,6 @@
|
|||
|
||||
{% block javascript %}
|
||||
<script type="application/javascript">
|
||||
BBTimer.run('timer-status');
|
||||
BabyBlotter.Timer.run('timer-status');
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -5,7 +5,10 @@ var concat = require('gulp-concat');
|
|||
|
||||
gulp.task('app:scripts', function() {
|
||||
return gulp.src([
|
||||
'core/static/js/timer.js'
|
||||
'babyblotter/static_site/js/babyblotter.js',
|
||||
'api/static/js/*.js',
|
||||
'core/static/js/*.js',
|
||||
'dashboard/static/js/*.js'
|
||||
])
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulp.dest('babyblotter/static/babyblotter/js/'));
|
||||
|
|
Loading…
Reference in New Issue