mirror of https://github.com/ColorlibHQ/AdminLTE
Add semicolons to support webpack
parent
d4ed1e435a
commit
278785ad49
40
Gruntfile.js
40
Gruntfile.js
|
@ -1,6 +1,6 @@
|
||||||
// AdminLTE Gruntfile
|
// AdminLTE Gruntfile
|
||||||
module.exports = function (grunt) { // jshint ignore:line
|
module.exports = function (grunt) { // jshint ignore:line
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
pkg : grunt.file.readJSON('package.json'),
|
pkg : grunt.file.readJSON('package.json'),
|
||||||
|
@ -269,43 +269,43 @@ module.exports = function (grunt) { // jshint ignore:line
|
||||||
clean: {
|
clean: {
|
||||||
build: ['build/img/*']
|
build: ['build/img/*']
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// Load all grunt tasks
|
// Load all grunt tasks
|
||||||
|
|
||||||
// LESS Compiler
|
// LESS Compiler
|
||||||
grunt.loadNpmTasks('grunt-contrib-less')
|
grunt.loadNpmTasks('grunt-contrib-less');
|
||||||
// Watch File Changes
|
// Watch File Changes
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch')
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
// Compress JS Files
|
// Compress JS Files
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify')
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
// Include Files Within HTML
|
// Include Files Within HTML
|
||||||
grunt.loadNpmTasks('grunt-includes')
|
grunt.loadNpmTasks('grunt-includes');
|
||||||
// Optimize images
|
// Optimize images
|
||||||
grunt.loadNpmTasks('grunt-image')
|
grunt.loadNpmTasks('grunt-image');
|
||||||
// Validate JS code
|
// Validate JS code
|
||||||
grunt.loadNpmTasks('grunt-contrib-jshint')
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
grunt.loadNpmTasks('grunt-jscs')
|
grunt.loadNpmTasks('grunt-jscs');
|
||||||
// Delete not needed files
|
// Delete not needed files
|
||||||
grunt.loadNpmTasks('grunt-contrib-clean')
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||||
// Lint CSS
|
// Lint CSS
|
||||||
grunt.loadNpmTasks('grunt-contrib-csslint')
|
grunt.loadNpmTasks('grunt-contrib-csslint');
|
||||||
// Lint Bootstrap
|
// Lint Bootstrap
|
||||||
grunt.loadNpmTasks('grunt-bootlint')
|
grunt.loadNpmTasks('grunt-bootlint');
|
||||||
// Concatenate JS files
|
// Concatenate JS files
|
||||||
grunt.loadNpmTasks('grunt-contrib-concat')
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
// Notify
|
// Notify
|
||||||
grunt.loadNpmTasks('grunt-notify')
|
grunt.loadNpmTasks('grunt-notify');
|
||||||
// Replace
|
// Replace
|
||||||
grunt.loadNpmTasks('grunt-text-replace')
|
grunt.loadNpmTasks('grunt-text-replace');
|
||||||
|
|
||||||
// Linting task
|
// Linting task
|
||||||
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint'])
|
grunt.registerTask('lint', ['jshint', 'csslint', 'bootlint']);
|
||||||
// JS task
|
// JS task
|
||||||
grunt.registerTask('js', ['concat', 'uglify'])
|
grunt.registerTask('js', ['concat', 'uglify']);
|
||||||
// CSS Task
|
// 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'
|
// The default task (running 'grunt' in console) is 'watch'
|
||||||
grunt.registerTask('default', ['watch'])
|
grunt.registerTask('default', ['watch']);
|
||||||
}
|
};
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
* Pass any option as data-option="value"
|
* Pass any option as data-option="value"
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.boxrefresh'
|
var DataKey = 'lte.boxrefresh';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
source : '',
|
source : '',
|
||||||
|
@ -22,98 +22,98 @@
|
||||||
onLoadStart : function () {
|
onLoadStart : function () {
|
||||||
},
|
},
|
||||||
onLoadDone : function (response) {
|
onLoadDone : function (response) {
|
||||||
return response
|
return response;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
data: '[data-widget="box-refresh"]'
|
data: '[data-widget="box-refresh"]'
|
||||||
}
|
};
|
||||||
|
|
||||||
// BoxRefresh Class Definition
|
// BoxRefresh Class Definition
|
||||||
// =========================
|
// =========================
|
||||||
var BoxRefresh = function (element, options) {
|
var BoxRefresh = function (element, options) {
|
||||||
this.element = element
|
this.element = element;
|
||||||
this.options = options
|
this.options = options;
|
||||||
this.$overlay = $(options.overlay)
|
this.$overlay = $(options.overlay);
|
||||||
|
|
||||||
if (options.source === '') {
|
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._setUpListeners();
|
||||||
this.load()
|
this.load();
|
||||||
}
|
};
|
||||||
|
|
||||||
BoxRefresh.prototype.load = function () {
|
BoxRefresh.prototype.load = function () {
|
||||||
this._addOverlay()
|
this._addOverlay();
|
||||||
this.options.onLoadStart.call($(this))
|
this.options.onLoadStart.call($(this));
|
||||||
|
|
||||||
$.get(this.options.source, this.options.params, function (response) {
|
$.get(this.options.source, this.options.params, function (response) {
|
||||||
if (this.options.loadInContent) {
|
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
|
// Private
|
||||||
|
|
||||||
BoxRefresh.prototype._setUpListeners = function () {
|
BoxRefresh.prototype._setUpListeners = function () {
|
||||||
$(this.element).on('click', Selector.trigger, function (event) {
|
$(this.element).on('click', Selector.trigger, function (event) {
|
||||||
if (event) event.preventDefault()
|
if (event) event.preventDefault();
|
||||||
this.load()
|
this.load();
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
BoxRefresh.prototype._addOverlay = function () {
|
BoxRefresh.prototype._addOverlay = function () {
|
||||||
$(this.element).append(this.$overlay)
|
$(this.element).append(this.$overlay);
|
||||||
}
|
};
|
||||||
|
|
||||||
BoxRefresh.prototype._removeOverlay = function () {
|
BoxRefresh.prototype._removeOverlay = function () {
|
||||||
$(this.element).remove(this.$overlay)
|
$(this.element).remove(this.$overlay);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
||||||
$this.data(DataKey, (data = new BoxRefresh($this, options)))
|
$this.data(DataKey, (data = new BoxRefresh($this, options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data == 'string') {
|
if (typeof data == 'string') {
|
||||||
if (typeof data[option] == 'undefined') {
|
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 = Plugin;
|
||||||
$.fn.boxRefresh.Constructor = BoxRefresh
|
$.fn.boxRefresh.Constructor = BoxRefresh;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.boxRefresh.noConflict = function () {
|
$.fn.boxRefresh.noConflict = function () {
|
||||||
$.fn.boxRefresh = old
|
$.fn.boxRefresh = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// BoxRefresh Data API
|
// BoxRefresh Data API
|
||||||
// =================
|
// =================
|
||||||
$(window).on('load', function () {
|
$(window).on('load', function () {
|
||||||
$(Selector.data).each(function () {
|
$(Selector.data).each(function () {
|
||||||
Plugin.call($(this))
|
Plugin.call($(this));
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
* Pass any option as data-option="value"
|
* Pass any option as data-option="value"
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.boxwidget'
|
var DataKey = 'lte.boxwidget';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
animationSpeed : 500,
|
animationSpeed : 500,
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
collapseIcon : 'fa-minus',
|
collapseIcon : 'fa-minus',
|
||||||
expandIcon : 'fa-plus',
|
expandIcon : 'fa-plus',
|
||||||
removeIcon : 'fa-times'
|
removeIcon : 'fa-times'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
data : '.box',
|
data : '.box',
|
||||||
|
@ -27,141 +27,141 @@
|
||||||
body : '.box-body',
|
body : '.box-body',
|
||||||
footer : '.box-footer',
|
footer : '.box-footer',
|
||||||
tools : '.box-tools'
|
tools : '.box-tools'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
collapsed: 'collapsed-box'
|
collapsed: 'collapsed-box'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
collapsed: 'collapsed.boxwidget',
|
collapsed: 'collapsed.boxwidget',
|
||||||
expanded : 'expanded.boxwidget',
|
expanded : 'expanded.boxwidget',
|
||||||
removed : 'removed.boxwidget'
|
removed : 'removed.boxwidget'
|
||||||
}
|
};
|
||||||
|
|
||||||
// BoxWidget Class Definition
|
// BoxWidget Class Definition
|
||||||
// =====================
|
// =====================
|
||||||
var BoxWidget = function (element, options) {
|
var BoxWidget = function (element, options) {
|
||||||
this.element = element
|
this.element = element;
|
||||||
this.options = options
|
this.options = options;
|
||||||
|
|
||||||
this._setUpListeners()
|
this._setUpListeners();
|
||||||
}
|
};
|
||||||
|
|
||||||
BoxWidget.prototype.toggle = function () {
|
BoxWidget.prototype.toggle = function () {
|
||||||
var isOpen = !$(this.element).is(Selector.collapsed)
|
var isOpen = !$(this.element).is(Selector.collapsed);
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
this.collapse()
|
this.collapse();
|
||||||
} else {
|
} else {
|
||||||
this.expand()
|
this.expand();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
BoxWidget.prototype.expand = function () {
|
BoxWidget.prototype.expand = function () {
|
||||||
var expandedEvent = $.Event(Event.expanded)
|
var expandedEvent = $.Event(Event.expanded);
|
||||||
var collapseIcon = this.options.collapseIcon
|
var collapseIcon = this.options.collapseIcon;
|
||||||
var expandIcon = this.options.expandIcon
|
var expandIcon = this.options.expandIcon;
|
||||||
|
|
||||||
$(this.element).removeClass(ClassName.collapsed)
|
$(this.element).removeClass(ClassName.collapsed);
|
||||||
|
|
||||||
$(this.element)
|
$(this.element)
|
||||||
.children(Selector.header + ', ' + Selector.body + ', ' + Selector.footer)
|
.children(Selector.header + ', ' + Selector.body + ', ' + Selector.footer)
|
||||||
.children(Selector.tools)
|
.children(Selector.tools)
|
||||||
.find('.' + expandIcon)
|
.find('.' + expandIcon)
|
||||||
.removeClass(expandIcon)
|
.removeClass(expandIcon)
|
||||||
.addClass(collapseIcon)
|
.addClass(collapseIcon);
|
||||||
|
|
||||||
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
||||||
.slideDown(this.options.animationSpeed, function () {
|
.slideDown(this.options.animationSpeed, function () {
|
||||||
$(this.element).trigger(expandedEvent)
|
$(this.element).trigger(expandedEvent);
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
BoxWidget.prototype.collapse = function () {
|
BoxWidget.prototype.collapse = function () {
|
||||||
var collapsedEvent = $.Event(Event.collapsed)
|
var collapsedEvent = $.Event(Event.collapsed);
|
||||||
var collapseIcon = this.options.collapseIcon
|
var collapseIcon = this.options.collapseIcon;
|
||||||
var expandIcon = this.options.expandIcon
|
var expandIcon = this.options.expandIcon;
|
||||||
|
|
||||||
$(this.element)
|
$(this.element)
|
||||||
.children(Selector.header + ', ' + Selector.body + ', ' + Selector.footer)
|
.children(Selector.header + ', ' + Selector.body + ', ' + Selector.footer)
|
||||||
.children(Selector.tools)
|
.children(Selector.tools)
|
||||||
.find('.' + collapseIcon)
|
.find('.' + collapseIcon)
|
||||||
.removeClass(collapseIcon)
|
.removeClass(collapseIcon)
|
||||||
.addClass(expandIcon)
|
.addClass(expandIcon);
|
||||||
|
|
||||||
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
||||||
.slideUp(this.options.animationSpeed, function () {
|
.slideUp(this.options.animationSpeed, function () {
|
||||||
$(this.element).addClass(ClassName.collapsed)
|
$(this.element).addClass(ClassName.collapsed);
|
||||||
$(this.element).trigger(collapsedEvent)
|
$(this.element).trigger(collapsedEvent);
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
BoxWidget.prototype.remove = function () {
|
BoxWidget.prototype.remove = function () {
|
||||||
var removedEvent = $.Event(Event.removed)
|
var removedEvent = $.Event(Event.removed);
|
||||||
|
|
||||||
$(this.element).slideUp(this.options.animationSpeed, function () {
|
$(this.element).slideUp(this.options.animationSpeed, function () {
|
||||||
$(this.element).trigger(removedEvent)
|
$(this.element).trigger(removedEvent);
|
||||||
$(this.element).remove()
|
$(this.element).remove();
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
BoxWidget.prototype._setUpListeners = function () {
|
BoxWidget.prototype._setUpListeners = function () {
|
||||||
var that = this
|
var that = this;
|
||||||
|
|
||||||
$(this.element).on('click', this.options.collapseTrigger, function (event) {
|
$(this.element).on('click', this.options.collapseTrigger, function (event) {
|
||||||
if (event) event.preventDefault()
|
if (event) event.preventDefault();
|
||||||
that.toggle($(this))
|
that.toggle($(this));
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(this.element).on('click', this.options.removeTrigger, function (event) {
|
$(this.element).on('click', this.options.removeTrigger, function (event) {
|
||||||
if (event) event.preventDefault()
|
if (event) event.preventDefault();
|
||||||
that.remove($(this))
|
that.remove($(this));
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
||||||
$this.data(DataKey, (data = new BoxWidget($this, options)))
|
$this.data(DataKey, (data = new BoxWidget($this, options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof option == 'string') {
|
if (typeof option == 'string') {
|
||||||
if (typeof data[option] == 'undefined') {
|
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.boxWidget
|
var old = $.fn.boxWidget;
|
||||||
|
|
||||||
$.fn.boxWidget = Plugin
|
$.fn.boxWidget = Plugin;
|
||||||
$.fn.boxWidget.Constructor = BoxWidget
|
$.fn.boxWidget.Constructor = BoxWidget;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.boxWidget.noConflict = function () {
|
$.fn.boxWidget.noConflict = function () {
|
||||||
$.fn.boxWidget = old
|
$.fn.boxWidget = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// BoxWidget Data API
|
// BoxWidget Data API
|
||||||
// ==================
|
// ==================
|
||||||
$(window).on('load', function () {
|
$(window).on('load', function () {
|
||||||
$(Selector.data).each(function () {
|
$(Selector.data).each(function () {
|
||||||
Plugin.call($(this))
|
Plugin.call($(this));
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
* Pass any option as data-option="value"
|
* Pass any option as data-option="value"
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.controlsidebar'
|
var DataKey = 'lte.controlsidebar';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
slide: true
|
slide: true
|
||||||
}
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
sidebar: '.control-sidebar',
|
sidebar: '.control-sidebar',
|
||||||
|
@ -23,73 +23,73 @@
|
||||||
wrapper: '.wrapper',
|
wrapper: '.wrapper',
|
||||||
content: '.content-wrapper',
|
content: '.content-wrapper',
|
||||||
boxed : '.layout-boxed'
|
boxed : '.layout-boxed'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
open : 'control-sidebar-open',
|
open : 'control-sidebar-open',
|
||||||
fixed: 'fixed'
|
fixed: 'fixed'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
collapsed: 'collapsed.controlsidebar',
|
collapsed: 'collapsed.controlsidebar',
|
||||||
expanded : 'expanded.controlsidebar'
|
expanded : 'expanded.controlsidebar'
|
||||||
}
|
};
|
||||||
|
|
||||||
// ControlSidebar Class Definition
|
// ControlSidebar Class Definition
|
||||||
// ===============================
|
// ===============================
|
||||||
var ControlSidebar = function (element, options) {
|
var ControlSidebar = function (element, options) {
|
||||||
this.element = element
|
this.element = element;
|
||||||
this.options = options
|
this.options = options;
|
||||||
this.hasBindedResize = false
|
this.hasBindedResize = false;
|
||||||
|
|
||||||
this.init()
|
this.init();
|
||||||
}
|
};
|
||||||
|
|
||||||
ControlSidebar.prototype.init = function () {
|
ControlSidebar.prototype.init = function () {
|
||||||
// Add click listener if the element hasn't been
|
// Add click listener if the element hasn't been
|
||||||
// initialized using the data API
|
// initialized using the data API
|
||||||
if (!$(this.element).is(Selector.data)) {
|
if (!$(this.element).is(Selector.data)) {
|
||||||
$(this).on('click', this.toggle)
|
$(this).on('click', this.toggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fix()
|
this.fix();
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
this.fix()
|
this.fix();
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
ControlSidebar.prototype.toggle = function (event) {
|
ControlSidebar.prototype.toggle = function (event) {
|
||||||
if (event) event.preventDefault()
|
if (event) event.preventDefault();
|
||||||
|
|
||||||
this.fix()
|
this.fix();
|
||||||
|
|
||||||
if (!$(Selector.sidebar).is(Selector.open) && !$('body').is(Selector.open)) {
|
if (!$(Selector.sidebar).is(Selector.open) && !$('body').is(Selector.open)) {
|
||||||
this.expand()
|
this.expand();
|
||||||
} else {
|
} else {
|
||||||
this.collapse()
|
this.collapse();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ControlSidebar.prototype.expand = function () {
|
ControlSidebar.prototype.expand = function () {
|
||||||
if (!this.options.slide) {
|
if (!this.options.slide) {
|
||||||
$('body').addClass(ClassName.open)
|
$('body').addClass(ClassName.open);
|
||||||
} else {
|
} else {
|
||||||
$(Selector.sidebar).addClass(ClassName.open)
|
$(Selector.sidebar).addClass(ClassName.open);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this.element).trigger($.Event(Event.expanded))
|
$(this.element).trigger($.Event(Event.expanded));
|
||||||
}
|
};
|
||||||
|
|
||||||
ControlSidebar.prototype.collapse = function () {
|
ControlSidebar.prototype.collapse = function () {
|
||||||
$('body, ' + Selector.sidebar).removeClass(ClassName.open)
|
$('body, ' + Selector.sidebar).removeClass(ClassName.open);
|
||||||
$(this.element).trigger($.Event(Event.collapsed))
|
$(this.element).trigger($.Event(Event.collapsed));
|
||||||
}
|
};
|
||||||
|
|
||||||
ControlSidebar.prototype.fix = function () {
|
ControlSidebar.prototype.fix = function () {
|
||||||
if ($('body').is(Selector.boxed)) {
|
if ($('body').is(Selector.boxed)) {
|
||||||
this._fixForBoxed($(Selector.bg))
|
this._fixForBoxed($(Selector.bg));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
|
@ -97,42 +97,42 @@
|
||||||
bg.css({
|
bg.css({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
height : $(Selector.wrapper).height()
|
height : $(Selector.wrapper).height()
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
||||||
$this.data(DataKey, (data = new ControlSidebar($this, options)))
|
$this.data(DataKey, (data = new ControlSidebar($this, options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof option == 'string') data.toggle()
|
if (typeof option == 'string') data.toggle();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var old = $.fn.controlSidebar
|
var old = $.fn.controlSidebar;
|
||||||
|
|
||||||
$.fn.controlSidebar = Plugin
|
$.fn.controlSidebar = Plugin;
|
||||||
$.fn.controlSidebar.Constructor = ControlSidebar
|
$.fn.controlSidebar.Constructor = ControlSidebar;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.controlSidebar.noConflict = function () {
|
$.fn.controlSidebar.noConflict = function () {
|
||||||
$.fn.controlSidebar = old
|
$.fn.controlSidebar = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// ControlSidebar Data API
|
// ControlSidebar Data API
|
||||||
// =======================
|
// =======================
|
||||||
$(document).on('click', Selector.data, function (event) {
|
$(document).on('click', Selector.data, function (event) {
|
||||||
if (event) event.preventDefault()
|
if (event) event.preventDefault();
|
||||||
Plugin.call($(this), 'toggle')
|
Plugin.call($(this), 'toggle');
|
||||||
})
|
});
|
||||||
|
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
|
@ -6,61 +6,61 @@
|
||||||
* or add [data-widget="direct-chat"] to the trigger
|
* or add [data-widget="direct-chat"] to the trigger
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.directchat'
|
var DataKey = 'lte.directchat';
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
data: '[data-widget="chat-pane-toggle"]',
|
data: '[data-widget="chat-pane-toggle"]',
|
||||||
box : '.direct-chat'
|
box : '.direct-chat'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
open: 'direct-chat-contacts-open'
|
open: 'direct-chat-contacts-open'
|
||||||
}
|
};
|
||||||
|
|
||||||
// DirectChat Class Definition
|
// DirectChat Class Definition
|
||||||
// ===========================
|
// ===========================
|
||||||
var DirectChat = function (element) {
|
var DirectChat = function (element) {
|
||||||
this.element = element
|
this.element = element;
|
||||||
}
|
};
|
||||||
|
|
||||||
DirectChat.prototype.toggle = function ($trigger) {
|
DirectChat.prototype.toggle = function ($trigger) {
|
||||||
$trigger.parents(Selector.box).first().toggleClass(ClassName.open)
|
$trigger.parents(Selector.box).first().toggleClass(ClassName.open);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
$this.data(DataKey, (data = new DirectChat($this)))
|
$this.data(DataKey, (data = new DirectChat($this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof option == 'string') data.toggle($this)
|
if (typeof option == 'string') data.toggle($this);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var old = $.fn.directChat
|
var old = $.fn.directChat;
|
||||||
|
|
||||||
$.fn.directChat = Plugin
|
$.fn.directChat = Plugin;
|
||||||
$.fn.directChat.Constructor = DirectChat
|
$.fn.directChat.Constructor = DirectChat;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.directChat.noConflict = function () {
|
$.fn.directChat.noConflict = function () {
|
||||||
$.fn.directChat = old
|
$.fn.directChat = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// DirectChat Data API
|
// DirectChat Data API
|
||||||
// ===================
|
// ===================
|
||||||
$(document).on('click', Selector.data, function (event) {
|
$(document).on('click', Selector.data, function (event) {
|
||||||
if (event) event.preventDefault()
|
if (event) event.preventDefault();
|
||||||
Plugin.call($(this), 'toggle')
|
Plugin.call($(this), 'toggle');
|
||||||
})
|
});
|
||||||
|
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
* to the body tag.
|
* to the body tag.
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.layout'
|
var DataKey = 'lte.layout';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
slimscroll : true,
|
slimscroll : true,
|
||||||
resetHeight: true
|
resetHeight: true
|
||||||
}
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
wrapper : '.wrapper',
|
wrapper : '.wrapper',
|
||||||
|
@ -28,98 +28,98 @@
|
||||||
fixed : '.fixed',
|
fixed : '.fixed',
|
||||||
sidebarMenu : '.sidebar-menu',
|
sidebarMenu : '.sidebar-menu',
|
||||||
logo : '.main-header .logo'
|
logo : '.main-header .logo'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
fixed : 'fixed',
|
fixed : 'fixed',
|
||||||
holdTransition: 'hold-transition'
|
holdTransition: 'hold-transition'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Layout = function (options) {
|
var Layout = function (options) {
|
||||||
this.options = options
|
this.options = options;
|
||||||
this.bindedResize = false
|
this.bindedResize = false;
|
||||||
this.activate()
|
this.activate();
|
||||||
}
|
};
|
||||||
|
|
||||||
Layout.prototype.activate = function () {
|
Layout.prototype.activate = function () {
|
||||||
this.fix()
|
this.fix();
|
||||||
this.fixSidebar()
|
this.fixSidebar();
|
||||||
|
|
||||||
$('body').removeClass(ClassName.holdTransition)
|
$('body').removeClass(ClassName.holdTransition);
|
||||||
|
|
||||||
if (this.options.resetHeight) {
|
if (this.options.resetHeight) {
|
||||||
$('body, html, ' + Selector.wrapper).css({
|
$('body, html, ' + Selector.wrapper).css({
|
||||||
'height' : 'auto',
|
'height' : 'auto',
|
||||||
'min-height': '100%'
|
'min-height': '100%'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.bindedResize) {
|
if (!this.bindedResize) {
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
this.fix()
|
this.fix();
|
||||||
this.fixSidebar()
|
this.fixSidebar();
|
||||||
|
|
||||||
$(Selector.logo + ', ' + Selector.sidebar).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
|
$(Selector.logo + ', ' + Selector.sidebar).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
|
||||||
this.fix()
|
this.fix();
|
||||||
this.fixSidebar()
|
this.fixSidebar();
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
|
|
||||||
this.bindedResize = true
|
this.bindedResize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(Selector.sidebarMenu).on('expanded.tree', function () {
|
$(Selector.sidebarMenu).on('expanded.tree', function () {
|
||||||
this.fix()
|
this.fix();
|
||||||
this.fixSidebar()
|
this.fixSidebar();
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
|
|
||||||
$(Selector.sidebarMenu).on('collapsed.tree', function () {
|
$(Selector.sidebarMenu).on('collapsed.tree', function () {
|
||||||
this.fix()
|
this.fix();
|
||||||
this.fixSidebar()
|
this.fixSidebar();
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
Layout.prototype.fix = function () {
|
Layout.prototype.fix = function () {
|
||||||
// Remove overflow from .wrapper if layout-boxed exists
|
// Remove overflow from .wrapper if layout-boxed exists
|
||||||
$(Selector.layoutBoxed + ' > ' + Selector.wrapper).css('overflow', 'hidden')
|
$(Selector.layoutBoxed + ' > ' + Selector.wrapper).css('overflow', 'hidden');
|
||||||
|
|
||||||
// Get window height and the wrapper height
|
// Get window height and the wrapper height
|
||||||
var footerHeight = $(Selector.mainFooter).outerHeight() || 0
|
var footerHeight = $(Selector.mainFooter).outerHeight() || 0;
|
||||||
var neg = $(Selector.mainHeader).outerHeight() + footerHeight
|
var neg = $(Selector.mainHeader).outerHeight() + footerHeight;
|
||||||
var windowHeight = $(window).height()
|
var windowHeight = $(window).height();
|
||||||
var sidebarHeight = $(Selector.sidebar).height() || 0
|
var sidebarHeight = $(Selector.sidebar).height() || 0;
|
||||||
|
|
||||||
// Set the min-height of the content and sidebar based on
|
// Set the min-height of the content and sidebar based on
|
||||||
// the height of the document.
|
// the height of the document.
|
||||||
if ($('body').hasClass(ClassName.fixed)) {
|
if ($('body').hasClass(ClassName.fixed)) {
|
||||||
$(Selector.contentWrapper).css('min-height', windowHeight - footerHeight)
|
$(Selector.contentWrapper).css('min-height', windowHeight - footerHeight);
|
||||||
} else {
|
} else {
|
||||||
var postSetHeight
|
var postSetHeight;
|
||||||
|
|
||||||
if (windowHeight >= sidebarHeight) {
|
if (windowHeight >= sidebarHeight) {
|
||||||
$(Selector.contentWrapper).css('min-height', windowHeight - neg)
|
$(Selector.contentWrapper).css('min-height', windowHeight - neg);
|
||||||
postSetHeight = windowHeight - neg
|
postSetHeight = windowHeight - neg;
|
||||||
} else {
|
} else {
|
||||||
$(Selector.contentWrapper).css('min-height', sidebarHeight)
|
$(Selector.contentWrapper).css('min-height', sidebarHeight);
|
||||||
postSetHeight = sidebarHeight
|
postSetHeight = sidebarHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for the control sidebar height
|
// Fix for the control sidebar height
|
||||||
var $controlSidebar = $(Selector.controlSidebar)
|
var $controlSidebar = $(Selector.controlSidebar);
|
||||||
if (typeof $controlSidebar !== 'undefined') {
|
if (typeof $controlSidebar !== 'undefined') {
|
||||||
if ($controlSidebar.height() > postSetHeight)
|
if ($controlSidebar.height() > postSetHeight)
|
||||||
$(Selector.contentWrapper).css('min-height', $controlSidebar.height())
|
$(Selector.contentWrapper).css('min-height', $controlSidebar.height());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Layout.prototype.fixSidebar = function () {
|
Layout.prototype.fixSidebar = function () {
|
||||||
// Make sure the body tag has the .fixed class
|
// Make sure the body tag has the .fixed class
|
||||||
if (!$('body').hasClass(ClassName.fixed)) {
|
if (!$('body').hasClass(ClassName.fixed)) {
|
||||||
if (typeof $.fn.slimScroll !== 'undefined') {
|
if (typeof $.fn.slimScroll !== 'undefined') {
|
||||||
$(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
|
$(Selector.sidebar).slimScroll({ destroy: true }).height('auto');
|
||||||
}
|
}
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable slimscroll for fixed layout
|
// Enable slimscroll for fixed layout
|
||||||
|
@ -131,47 +131,47 @@
|
||||||
// Add slimscroll
|
// Add slimscroll
|
||||||
$(Selector.sidebar).slimScroll({
|
$(Selector.sidebar).slimScroll({
|
||||||
height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
|
height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option);
|
||||||
$this.data(DataKey, (data = new Layout(options)))
|
$this.data(DataKey, (data = new Layout(options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof option === 'string') {
|
if (typeof option === 'string') {
|
||||||
if (typeof data[option] === 'undefined') {
|
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.layout
|
var old = $.fn.layout;
|
||||||
|
|
||||||
$.fn.layout = Plugin
|
$.fn.layout = Plugin;
|
||||||
$.fn.layout.Constuctor = Layout
|
$.fn.layout.Constuctor = Layout;
|
||||||
|
|
||||||
// No conflict mode
|
// No conflict mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.layout.noConflict = function () {
|
$.fn.layout.noConflict = function () {
|
||||||
$.fn.layout = old
|
$.fn.layout = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// Layout DATA-API
|
// Layout DATA-API
|
||||||
// ===============
|
// ===============
|
||||||
$(window).on('load', function () {
|
$(window).on('load', function () {
|
||||||
Plugin.call($('body'))
|
Plugin.call($('body'));
|
||||||
})
|
});
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
* Pass any option as data-option="value"
|
* Pass any option as data-option="value"
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.pushmenu'
|
var DataKey = 'lte.pushmenu';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
collapseScreenSize : 767,
|
collapseScreenSize : 767,
|
||||||
expandOnHover : false,
|
expandOnHover : false,
|
||||||
expandTransitionDelay: 200
|
expandTransitionDelay: 200
|
||||||
}
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
collapsed : '.sidebar-collapse',
|
collapsed : '.sidebar-collapse',
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
mini : '.sidebar-mini',
|
mini : '.sidebar-mini',
|
||||||
expanded : '.sidebar-expanded-on-hover',
|
expanded : '.sidebar-expanded-on-hover',
|
||||||
layoutFixed : '.fixed'
|
layoutFixed : '.fixed'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
collapsed : 'sidebar-collapse',
|
collapsed : 'sidebar-collapse',
|
||||||
|
@ -36,141 +36,141 @@
|
||||||
expanded : 'sidebar-expanded-on-hover',
|
expanded : 'sidebar-expanded-on-hover',
|
||||||
expandFeature: 'sidebar-mini-expand-feature',
|
expandFeature: 'sidebar-mini-expand-feature',
|
||||||
layoutFixed : 'fixed'
|
layoutFixed : 'fixed'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
expanded : 'expanded.pushMenu',
|
expanded : 'expanded.pushMenu',
|
||||||
collapsed: 'collapsed.pushMenu'
|
collapsed: 'collapsed.pushMenu'
|
||||||
}
|
};
|
||||||
|
|
||||||
// PushMenu Class Definition
|
// PushMenu Class Definition
|
||||||
// =========================
|
// =========================
|
||||||
var PushMenu = function (options) {
|
var PushMenu = function (options) {
|
||||||
this.options = options
|
this.options = options;
|
||||||
this.init()
|
this.init();
|
||||||
}
|
};
|
||||||
|
|
||||||
PushMenu.prototype.init = function () {
|
PushMenu.prototype.init = function () {
|
||||||
if (this.options.expandOnHover
|
if (this.options.expandOnHover
|
||||||
|| ($('body').is(Selector.mini + Selector.layoutFixed))) {
|
|| ($('body').is(Selector.mini + Selector.layoutFixed))) {
|
||||||
this.expandOnHover()
|
this.expandOnHover();
|
||||||
$('body').addClass(ClassName.expandFeature)
|
$('body').addClass(ClassName.expandFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(Selector.contentWrapper).click(function () {
|
$(Selector.contentWrapper).click(function () {
|
||||||
// Enable hide menu when clicking on the content-wrapper on small screens
|
// Enable hide menu when clicking on the content-wrapper on small screens
|
||||||
if ($(window).width() <= this.options.collapseScreenSize && $('body').hasClass(ClassName.open)) {
|
if ($(window).width() <= this.options.collapseScreenSize && $('body').hasClass(ClassName.open)) {
|
||||||
this.close()
|
this.close();
|
||||||
}
|
}
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
|
|
||||||
// __Fix for android devices
|
// __Fix for android devices
|
||||||
$(Selector.searchInput).click(function (e) {
|
$(Selector.searchInput).click(function (e) {
|
||||||
e.stopPropagation()
|
e.stopPropagation();
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
PushMenu.prototype.toggle = function () {
|
PushMenu.prototype.toggle = function () {
|
||||||
var windowWidth = $(window).width()
|
var windowWidth = $(window).width();
|
||||||
var isOpen = !$('body').hasClass(ClassName.collapsed)
|
var isOpen = !$('body').hasClass(ClassName.collapsed);
|
||||||
|
|
||||||
if (windowWidth <= this.options.collapseScreenSize) {
|
if (windowWidth <= this.options.collapseScreenSize) {
|
||||||
isOpen = $('body').hasClass(ClassName.open)
|
isOpen = $('body').hasClass(ClassName.open);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
this.open()
|
this.open();
|
||||||
} else {
|
} else {
|
||||||
this.close()
|
this.close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
PushMenu.prototype.open = function () {
|
PushMenu.prototype.open = function () {
|
||||||
var windowWidth = $(window).width()
|
var windowWidth = $(window).width();
|
||||||
|
|
||||||
if (windowWidth > this.options.collapseScreenSize) {
|
if (windowWidth > this.options.collapseScreenSize) {
|
||||||
$('body').removeClass(ClassName.collapsed)
|
$('body').removeClass(ClassName.collapsed)
|
||||||
.trigger($.Event(Event.expanded))
|
.trigger($.Event(Event.expanded));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('body').addClass(ClassName.open)
|
$('body').addClass(ClassName.open)
|
||||||
.trigger($.Event(Event.expanded))
|
.trigger($.Event(Event.expanded));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
PushMenu.prototype.close = function () {
|
PushMenu.prototype.close = function () {
|
||||||
var windowWidth = $(window).width()
|
var windowWidth = $(window).width();
|
||||||
if (windowWidth > this.options.collapseScreenSize) {
|
if (windowWidth > this.options.collapseScreenSize) {
|
||||||
$('body').addClass(ClassName.collapsed)
|
$('body').addClass(ClassName.collapsed)
|
||||||
.trigger($.Event(Event.collapsed))
|
.trigger($.Event(Event.collapsed));
|
||||||
} else {
|
} else {
|
||||||
$('body').removeClass(ClassName.open + ' ' + ClassName.collapsed)
|
$('body').removeClass(ClassName.open + ' ' + ClassName.collapsed)
|
||||||
.trigger($.Event(Event.collapsed))
|
.trigger($.Event(Event.collapsed));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
PushMenu.prototype.expandOnHover = function () {
|
PushMenu.prototype.expandOnHover = function () {
|
||||||
$(Selector.mainSidebar).hover(function () {
|
$(Selector.mainSidebar).hover(function () {
|
||||||
if ($('body').is(Selector.mini + Selector.collapsed)
|
if ($('body').is(Selector.mini + Selector.collapsed)
|
||||||
&& $(window).width() > this.options.collapseScreenSize) {
|
&& $(window).width() > this.options.collapseScreenSize) {
|
||||||
this.expand()
|
this.expand();
|
||||||
}
|
}
|
||||||
}.bind(this), function () {
|
}.bind(this), function () {
|
||||||
if ($('body').is(Selector.expanded)) {
|
if ($('body').is(Selector.expanded)) {
|
||||||
this.collapse()
|
this.collapse();
|
||||||
}
|
|
||||||
}.bind(this))
|
|
||||||
}
|
}
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
PushMenu.prototype.expand = function () {
|
PushMenu.prototype.expand = function () {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$('body').removeClass(ClassName.collapsed)
|
$('body').removeClass(ClassName.collapsed)
|
||||||
.addClass(ClassName.expanded)
|
.addClass(ClassName.expanded);
|
||||||
}, this.options.expandTransitionDelay)
|
}, this.options.expandTransitionDelay);
|
||||||
}
|
};
|
||||||
|
|
||||||
PushMenu.prototype.collapse = function () {
|
PushMenu.prototype.collapse = function () {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$('body').removeClass(ClassName.expanded)
|
$('body').removeClass(ClassName.expanded)
|
||||||
.addClass(ClassName.collapsed)
|
.addClass(ClassName.collapsed);
|
||||||
}, this.options.expandTransitionDelay)
|
}, this.options.expandTransitionDelay);
|
||||||
}
|
};
|
||||||
|
|
||||||
// PushMenu Plugin Definition
|
// PushMenu Plugin Definition
|
||||||
// ==========================
|
// ==========================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
||||||
$this.data(DataKey, (data = new PushMenu(options)))
|
$this.data(DataKey, (data = new PushMenu(options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option === 'toggle') data.toggle()
|
if (option === 'toggle') data.toggle();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var old = $.fn.pushMenu
|
var old = $.fn.pushMenu;
|
||||||
|
|
||||||
$.fn.pushMenu = Plugin
|
$.fn.pushMenu = Plugin;
|
||||||
$.fn.pushMenu.Constructor = PushMenu
|
$.fn.pushMenu.Constructor = PushMenu;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.pushMenu.noConflict = function () {
|
$.fn.pushMenu.noConflict = function () {
|
||||||
$.fn.pushMenu = old
|
$.fn.pushMenu = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// Data API
|
// Data API
|
||||||
// ========
|
// ========
|
||||||
$(document).on('click', Selector.button, function (e) {
|
$(document).on('click', Selector.button, function (e) {
|
||||||
e.preventDefault()
|
e.preventDefault();
|
||||||
Plugin.call($(this), 'toggle')
|
Plugin.call($(this), 'toggle');
|
||||||
})
|
});
|
||||||
$(window).on('load', function () {
|
$(window).on('load', function () {
|
||||||
Plugin.call($(Selector.button))
|
Plugin.call($(Selector.button));
|
||||||
})
|
});
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
|
@ -7,102 +7,102 @@
|
||||||
* Pass any option as data-option="value"
|
* Pass any option as data-option="value"
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.todolist'
|
var DataKey = 'lte.todolist';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
onCheck : function (item) {
|
onCheck : function (item) {
|
||||||
return item
|
return item;
|
||||||
},
|
},
|
||||||
onUnCheck: function (item) {
|
onUnCheck: function (item) {
|
||||||
return item
|
return item;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
data: '[data-widget="todo-list"]'
|
data: '[data-widget="todo-list"]'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
done: 'done'
|
done: 'done'
|
||||||
}
|
};
|
||||||
|
|
||||||
// TodoList Class Definition
|
// TodoList Class Definition
|
||||||
// =========================
|
// =========================
|
||||||
var TodoList = function (element, options) {
|
var TodoList = function (element, options) {
|
||||||
this.element = element
|
this.element = element;
|
||||||
this.options = options
|
this.options = options;
|
||||||
|
|
||||||
this._setUpListeners()
|
this._setUpListeners();
|
||||||
}
|
};
|
||||||
|
|
||||||
TodoList.prototype.toggle = function (item) {
|
TodoList.prototype.toggle = function (item) {
|
||||||
item.parents(Selector.li).first().toggleClass(ClassName.done)
|
item.parents(Selector.li).first().toggleClass(ClassName.done);
|
||||||
if (!item.prop('checked')) {
|
if (!item.prop('checked')) {
|
||||||
this.unCheck(item)
|
this.unCheck(item);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.check(item)
|
this.check(item);
|
||||||
}
|
};
|
||||||
|
|
||||||
TodoList.prototype.check = function (item) {
|
TodoList.prototype.check = function (item) {
|
||||||
this.options.onCheck.call(item)
|
this.options.onCheck.call(item);
|
||||||
}
|
};
|
||||||
|
|
||||||
TodoList.prototype.unCheck = function (item) {
|
TodoList.prototype.unCheck = function (item) {
|
||||||
this.options.onUnCheck.call(item)
|
this.options.onUnCheck.call(item);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
TodoList.prototype._setUpListeners = function () {
|
TodoList.prototype._setUpListeners = function () {
|
||||||
var that = this
|
var that = this;
|
||||||
$(this.element).on('change ifChanged', 'input:checkbox', function () {
|
$(this.element).on('change ifChanged', 'input:checkbox', function () {
|
||||||
that.toggle($(this))
|
that.toggle($(this));
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
||||||
$this.data(DataKey, (data = new TodoList($this, options)))
|
$this.data(DataKey, (data = new TodoList($this, options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data == 'string') {
|
if (typeof data == 'string') {
|
||||||
if (typeof data[option] == 'undefined') {
|
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.todoList
|
var old = $.fn.todoList;
|
||||||
|
|
||||||
$.fn.todoList = Plugin
|
$.fn.todoList = Plugin;
|
||||||
$.fn.todoList.Constructor = TodoList
|
$.fn.todoList.Constructor = TodoList;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.todoList.noConflict = function () {
|
$.fn.todoList.noConflict = function () {
|
||||||
$.fn.todoList = old
|
$.fn.todoList = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// TodoList Data API
|
// TodoList Data API
|
||||||
// =================
|
// =================
|
||||||
$(window).on('load', function () {
|
$(window).on('load', function () {
|
||||||
$(Selector.data).each(function () {
|
$(Selector.data).each(function () {
|
||||||
Plugin.call($(this))
|
Plugin.call($(this));
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
108
build/js/Tree.js
108
build/js/Tree.js
|
@ -8,16 +8,16 @@
|
||||||
* Pass any option as data-option="value"
|
* Pass any option as data-option="value"
|
||||||
*/
|
*/
|
||||||
+function ($) {
|
+function ($) {
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
var DataKey = 'lte.tree'
|
var DataKey = 'lte.tree';
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
animationSpeed: 500,
|
animationSpeed: 500,
|
||||||
accordion : true,
|
accordion : true,
|
||||||
followLink : false,
|
followLink : false,
|
||||||
trigger : '.treeview a'
|
trigger : '.treeview a'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
tree : '.tree',
|
tree : '.tree',
|
||||||
|
@ -27,119 +27,119 @@
|
||||||
li : 'li',
|
li : 'li',
|
||||||
data : '[data-widget="tree"]',
|
data : '[data-widget="tree"]',
|
||||||
active : '.active'
|
active : '.active'
|
||||||
}
|
};
|
||||||
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
open: 'menu-open',
|
open: 'menu-open',
|
||||||
tree: 'tree'
|
tree: 'tree'
|
||||||
}
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
collapsed: 'collapsed.tree',
|
collapsed: 'collapsed.tree',
|
||||||
expanded : 'expanded.tree'
|
expanded : 'expanded.tree'
|
||||||
}
|
};
|
||||||
|
|
||||||
// Tree Class Definition
|
// Tree Class Definition
|
||||||
// =====================
|
// =====================
|
||||||
var Tree = function (element, options) {
|
var Tree = function (element, options) {
|
||||||
this.element = element
|
this.element = element;
|
||||||
this.options = options
|
this.options = options;
|
||||||
|
|
||||||
$(this.element).addClass(ClassName.tree)
|
$(this.element).addClass(ClassName.tree);
|
||||||
|
|
||||||
$(Selector.treeview + Selector.active, this.element).addClass(ClassName.open)
|
$(Selector.treeview + Selector.active, this.element).addClass(ClassName.open);
|
||||||
|
|
||||||
this._setUpListeners()
|
this._setUpListeners();
|
||||||
}
|
};
|
||||||
|
|
||||||
Tree.prototype.toggle = function (link, event) {
|
Tree.prototype.toggle = function (link, event) {
|
||||||
var treeviewMenu = link.next(Selector.treeviewMenu)
|
var treeviewMenu = link.next(Selector.treeviewMenu);
|
||||||
var parentLi = link.parent()
|
var parentLi = link.parent();
|
||||||
var isOpen = parentLi.hasClass(ClassName.open)
|
var isOpen = parentLi.hasClass(ClassName.open);
|
||||||
|
|
||||||
if (!parentLi.is(Selector.treeview)) {
|
if (!parentLi.is(Selector.treeview)) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.followLink || link.attr('href') === '#') {
|
if (!this.options.followLink || link.attr('href') === '#') {
|
||||||
event.preventDefault()
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
this.collapse(treeviewMenu, parentLi)
|
this.collapse(treeviewMenu, parentLi);
|
||||||
} else {
|
} else {
|
||||||
this.expand(treeviewMenu, parentLi)
|
this.expand(treeviewMenu, parentLi);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Tree.prototype.expand = function (tree, parent) {
|
Tree.prototype.expand = function (tree, parent) {
|
||||||
var expandedEvent = $.Event(Event.expanded)
|
var expandedEvent = $.Event(Event.expanded);
|
||||||
|
|
||||||
if (this.options.accordion) {
|
if (this.options.accordion) {
|
||||||
var openMenuLi = parent.siblings(Selector.open)
|
var openMenuLi = parent.siblings(Selector.open);
|
||||||
var openTree = openMenuLi.children(Selector.treeviewMenu)
|
var openTree = openMenuLi.children(Selector.treeviewMenu);
|
||||||
this.collapse(openTree, openMenuLi)
|
this.collapse(openTree, openMenuLi);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.addClass(ClassName.open)
|
parent.addClass(ClassName.open);
|
||||||
tree.slideDown(this.options.animationSpeed, function () {
|
tree.slideDown(this.options.animationSpeed, function () {
|
||||||
$(this.element).trigger(expandedEvent)
|
$(this.element).trigger(expandedEvent);
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
Tree.prototype.collapse = function (tree, parentLi) {
|
Tree.prototype.collapse = function (tree, parentLi) {
|
||||||
var collapsedEvent = $.Event(Event.collapsed)
|
var collapsedEvent = $.Event(Event.collapsed);
|
||||||
|
|
||||||
tree.find(Selector.open).removeClass(ClassName.open)
|
tree.find(Selector.open).removeClass(ClassName.open);
|
||||||
parentLi.removeClass(ClassName.open)
|
parentLi.removeClass(ClassName.open);
|
||||||
tree.slideUp(this.options.animationSpeed, function () {
|
tree.slideUp(this.options.animationSpeed, function () {
|
||||||
tree.find(Selector.open + ' > ' + Selector.treeview).slideUp()
|
tree.find(Selector.open + ' > ' + Selector.treeview).slideUp();
|
||||||
$(this.element).trigger(collapsedEvent)
|
$(this.element).trigger(collapsedEvent);
|
||||||
}.bind(this))
|
}.bind(this));
|
||||||
}
|
};
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
Tree.prototype._setUpListeners = function () {
|
Tree.prototype._setUpListeners = function () {
|
||||||
var that = this
|
var that = this;
|
||||||
|
|
||||||
$(this.element).on('click', this.options.trigger, function (event) {
|
$(this.element).on('click', this.options.trigger, function (event) {
|
||||||
that.toggle($(this), event)
|
that.toggle($(this), event);
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// Plugin Definition
|
// Plugin Definition
|
||||||
// =================
|
// =================
|
||||||
function Plugin(option) {
|
function Plugin(option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this);
|
||||||
var data = $this.data(DataKey)
|
var data = $this.data(DataKey);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option)
|
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
||||||
$this.data(DataKey, new Tree($this, options))
|
$this.data(DataKey, new Tree($this, options));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var old = $.fn.tree
|
var old = $.fn.tree;
|
||||||
|
|
||||||
$.fn.tree = Plugin
|
$.fn.tree = Plugin;
|
||||||
$.fn.tree.Constructor = Tree
|
$.fn.tree.Constructor = Tree;
|
||||||
|
|
||||||
// No Conflict Mode
|
// No Conflict Mode
|
||||||
// ================
|
// ================
|
||||||
$.fn.tree.noConflict = function () {
|
$.fn.tree.noConflict = function () {
|
||||||
$.fn.tree = old
|
$.fn.tree = old;
|
||||||
return this
|
return this;
|
||||||
}
|
};
|
||||||
|
|
||||||
// Tree Data API
|
// Tree Data API
|
||||||
// =============
|
// =============
|
||||||
$(window).on('load', function () {
|
$(window).on('load', function () {
|
||||||
$(Selector.data).each(function () {
|
$(Selector.data).each(function () {
|
||||||
Plugin.call($(this))
|
Plugin.call($(this));
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
}(jQuery)
|
}(jQuery);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue