Skip to content

Commit

Permalink
Add semicolons to support webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
almasaeed2010 committed Oct 26, 2017
1 parent d4ed1e4 commit 278785a
Show file tree
Hide file tree
Showing 11 changed files with 814 additions and 812 deletions.
40 changes: 20 additions & 20 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AdminLTE Gruntfile
module.exports = function (grunt) { // jshint ignore:line
'use strict'
'use strict';

grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
Expand Down Expand Up @@ -269,43 +269,43 @@ module.exports = function (grunt) { // jshint ignore:line
clean: {
build: ['build/img/*']
}
})
});

// Load all grunt tasks

// LESS Compiler
grunt.loadNpmTasks('grunt-contrib-less')
grunt.loadNpmTasks('grunt-contrib-less');
// Watch File Changes
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-watch');
// Compress JS Files
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-uglify');
// Include Files Within HTML
grunt.loadNpmTasks('grunt-includes')
grunt.loadNpmTasks('grunt-includes');
// Optimize images
grunt.loadNpmTasks('grunt-image')
grunt.loadNpmTasks('grunt-image');
// Validate JS code
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-jscs')
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
// Delete not needed files
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-clean');
// Lint CSS
grunt.loadNpmTasks('grunt-contrib-csslint')
grunt.loadNpmTasks('grunt-contrib-csslint');
// Lint Bootstrap
grunt.loadNpmTasks('grunt-bootlint')
grunt.loadNpmTasks('grunt-bootlint');
// Concatenate JS files
grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-concat');
// Notify
grunt.loadNpmTasks('grunt-notify')
grunt.loadNpmTasks('grunt-notify');
// Replace
grunt.loadNpmTasks('grunt-text-replace')
grunt.loadNpmTasks('grunt-text-replace');

// Linting task
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint'])
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint']);
// JS task
grunt.registerTask('js', ['concat', 'uglify'])
grunt.registerTask('js', ['concat', 'uglify']);
// CSS Task
grunt.registerTask('css', ['less:development', 'less:production', 'replace'])
grunt.registerTask('css', ['less:development', 'less:production', 'replace']);

// The default task (running 'grunt' in console) is 'watch'
grunt.registerTask('default', ['watch'])
}
grunt.registerTask('default', ['watch']);
};
88 changes: 44 additions & 44 deletions build/js/BoxRefresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Pass any option as data-option="value"
*/
+function ($) {
'use strict'
'use strict';

var DataKey = 'lte.boxrefresh'
var DataKey = 'lte.boxrefresh';

var Default = {
source : '',
Expand All @@ -22,98 +22,98 @@
onLoadStart : function () {
},
onLoadDone : function (response) {
return response
return response;
}
}
};

var Selector = {
data: '[data-widget="box-refresh"]'
}
};

// BoxRefresh Class Definition
// =========================
var BoxRefresh = function (element, options) {
this.element = element
this.options = options
this.$overlay = $(options.overlay)
this.element = element;
this.options = options;
this.$overlay = $(options.overlay);

if (options.source === '') {
throw new Error('Source url was not defined. Please specify a url in your BoxRefresh source option.')
throw new Error('Source url was not defined. Please specify a url in your BoxRefresh source option.');
}

this._setUpListeners()
this.load()
}
this._setUpListeners();
this.load();
};

BoxRefresh.prototype.load = function () {
this._addOverlay()
this.options.onLoadStart.call($(this))
this._addOverlay();
this.options.onLoadStart.call($(this));

$.get(this.options.source, this.options.params, function (response) {
if (this.options.loadInContent) {
$(this.options.content).html(response)
$(this.options.content).html(response);
}
this.options.onLoadDone.call($(this), response)
this._removeOverlay()
}.bind(this), this.options.responseType !== '' && this.options.responseType)
}
this.options.onLoadDone.call($(this), response);
this._removeOverlay();
}.bind(this), this.options.responseType !== '' && this.options.responseType);
};

// Private

BoxRefresh.prototype._setUpListeners = function () {
$(this.element).on('click', Selector.trigger, function (event) {
if (event) event.preventDefault()
this.load()
}.bind(this))
}
if (event) event.preventDefault();
this.load();
}.bind(this));
};

BoxRefresh.prototype._addOverlay = function () {
$(this.element).append(this.$overlay)
}
$(this.element).append(this.$overlay);
};

BoxRefresh.prototype._removeOverlay = function () {
$(this.element).remove(this.$overlay)
}
$(this.element).remove(this.$overlay);
};

// Plugin Definition
// =================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data(DataKey)
var $this = $(this);
var data = $this.data(DataKey);

if (!data) {
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
$this.data(DataKey, (data = new BoxRefresh($this, options)))
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
$this.data(DataKey, (data = new BoxRefresh($this, options)));
}

if (typeof data == 'string') {
if (typeof data[option] == 'undefined') {
throw new Error('No method named ' + option)
throw new Error('No method named ' + option);
}
data[option]()
data[option]();
}
})
});
}

var old = $.fn.boxRefresh
var old = $.fn.boxRefresh;

$.fn.boxRefresh = Plugin
$.fn.boxRefresh.Constructor = BoxRefresh
$.fn.boxRefresh = Plugin;
$.fn.boxRefresh.Constructor = BoxRefresh;

// No Conflict Mode
// ================
$.fn.boxRefresh.noConflict = function () {
$.fn.boxRefresh = old
return this
}
$.fn.boxRefresh = old;
return this;
};

// BoxRefresh Data API
// =================
$(window).on('load', function () {
$(Selector.data).each(function () {
Plugin.call($(this))
})
})
Plugin.call($(this));
});
});

}(jQuery)
}(jQuery);
Loading

0 comments on commit 278785a

Please sign in to comment.