12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706 |
- //[Master Javascript]
- //Project: Riday Admin - Responsive Admin Template
- //Primary use: Riday Admin - Responsive Admin Template
- //should be included in all pages. It controls some layout
- // Make sure jQuery has been loaded
- if (typeof jQuery === 'undefined') {
- throw new Error('template requires jQuery')
- }
- // Layout()
- // Implements layout.
- // Fixes the layout height in case min-height fails.
- // @usage activated automatically upon window load.
- // Configure any options by passing data-option="value"
- // to the body tag.
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.layout'
- var Default = {
- slimscroll : false,
- resetHeight: true
- }
- var Selector = {
- wrapper : '.wrapper',
- contentWrapper: '.content-wrapper',
- layoutBoxed : '.layout-boxed',
- mainFooter : '.main-footer',
- mainHeader : '.main-header',
- sidebar : '.sidebar',
- controlSidebar: '.control-sidebar',
- fixed : '.fixed',
- sidebarMenu : '.sidebar-menu',
- logo : '.main-header .logo'
- }
- var ClassName = {
- fixed : 'fixed',
- holdTransition: 'hold-transition'
- }
- var Layout = function (options) {
- this.options = options
- this.bindedResize = false
- this.activate()
- }
- Layout.prototype.activate = function () {
- this.fix()
- this.fixSidebar()
- $('body').removeClass(ClassName.holdTransition)
- if (this.options.resetHeight) {
- $('body, html, ' + Selector.wrapper).css({
- 'height' : 'auto',
- 'min-height': '100%'
- })
- }
- if (!this.bindedResize) {
- $(window).resize(function () {
- this.fix()
- this.fixSidebar()
- $(Selector.logo + ', ' + Selector.sidebar).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
- this.fix()
- this.fixSidebar()
- }.bind(this))
- }.bind(this))
- this.bindedResize = true
- }
- $(Selector.sidebarMenu).on('expanded.tree', function () {
- this.fix()
- this.fixSidebar()
- }.bind(this))
- $(Selector.sidebarMenu).on('collapsed.tree', function () {
- this.fix()
- this.fixSidebar()
- }.bind(this))
- }
- Layout.prototype.fix = function () {
- // Remove overflow from .wrapper if layout-boxed exists
- $(Selector.layoutBoxed + ' > ' + Selector.wrapper).css('overflow', 'hidden')
- // Get window height and the wrapper height
- var footerHeight = $(Selector.mainFooter).outerHeight() || 0
- var neg = $(Selector.mainHeader).outerHeight() + footerHeight
- var windowHeight = $(window).height()
- var sidebarHeight = $(Selector.sidebar).height() || 0
- // Set the min-height of the content and sidebar based on
- // the height of the document.
- if ($('body').hasClass(ClassName.fixed)) {
- $(Selector.contentWrapper).css('min-height', windowHeight - footerHeight)
- } else {
- var postSetHeight
- if (windowHeight >= sidebarHeight) {
- $(Selector.contentWrapper).css('min-height', windowHeight - neg)
- postSetHeight = windowHeight - neg
- } else {
- $(Selector.contentWrapper).css('min-height', sidebarHeight)
- postSetHeight = sidebarHeight
- }
- // Fix for the control sidebar height
- var $controlSidebar = $(Selector.controlSidebar)
- if (typeof $controlSidebar !== 'undefined') {
- if ($controlSidebar.height() > postSetHeight)
- $(Selector.contentWrapper).css('min-height', $controlSidebar.height())
- }
- }
- }
- Layout.prototype.fixSidebar = function () {
- // Make sure the body tag has the .fixed class
- if (!$('body').hasClass(ClassName.fixed)) {
- if (typeof $.fn.slimScroll !== 'undefined') {
- $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
- }
- return
- }
- // Enable slimscroll for fixed layout
- if (this.options.slimscroll) {
- if (typeof $.fn.slimScroll !== 'undefined') {
- // Destroy if it exists
- $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
- // Add slimscroll
- $(Selector.sidebar).slimScroll({
- height: ($(window).height() - $(Selector.mainHeader).height()) + 'px',
- color : 'rgba(0,0,0,0.2)',
- size : '3px'
- })
- }
- }
- }
- // Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- 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 Layout(options)))
- }
- if (typeof option == 'string') {
- if (typeof data[option] == 'undefined') {
- throw new Error('No method named ' + option)
- }
- data[option]()
- }
- })
- }
- var old = $.fn.layout
- $.fn.layout = Plugin
- $.fn.layout.Constuctor = Layout
- // No conflict mode
- $.fn.layout.noConflict = function () {
- $.fn.layout = old
- return this
- }
- // Layout DATA-API
- $(window).on('load', function () {
- Plugin.call($('body'))
- });
- }(jQuery) // End of use strict
- /* PushMenu()
- * Adds the push menu functionality to the sidebar.
- *
- * @usage: $('.btn').pushMenu(options)
- * or add [data-toggle="push-menu"] to any button
- * Pass any option as data-option="value"
- */
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.pushmenu'
- var Default = {
- collapseScreenSize : 767,
- expandOnHover : false,
- expandTransitionDelay: 200
- }
- var Selector = {
- collapsed : '.sidebar-collapse',
- open : '.sidebar-open',
- mainSidebar : '.main-sidebar',
- contentWrapper: '.content-wrapper',
- searchInput : '.sidebar-form .form-control',
- button : '[data-toggle="push-menu"]',
- mini : '.sidebar-mini',
- expanded : '',
- layoutFixed : '.fixed'
- }
- var ClassName = {
- collapsed : 'sidebar-collapse',
- open : 'sidebar-open',
- mini : 'sidebar-mini',
- expanded : '',
- expandFeature: '',
- layoutFixed : 'fixed'
- }
- var Event = {
- expanded : 'expanded.pushMenu',
- collapsed: 'collapsed.pushMenu'
- }
- // PushMenu Class Definition
- var PushMenu = function (options) {
- this.options = options
- this.init()
- }
- PushMenu.prototype.init = function () {
- //if (this.options.expandOnHover
- // || ($('body').is(Selector.mini + Selector.layoutFixed))) {
- // this.expandOnHover()
- // $('body').addClass(ClassName.expandFeature)
- // }
- $(Selector.contentWrapper).on(function () {
- // Enable hide menu when clicking on the content-wrapper on small screens
- if ($(window).width() <= this.options.collapseScreenSize && $('body').hasClass(ClassName.open)) {
- this.close()
- }
- }.bind(this))
- // __Fix for android devices
- $(Selector.searchInput).on(function (e) {
- e.stopPropagation()
- })
- }
- PushMenu.prototype.toggle = function () {
- var windowWidth = $(window).width()
- var isOpen = !$('body').hasClass(ClassName.collapsed)
- if (windowWidth <= this.options.collapseScreenSize) {
- isOpen = $('body').hasClass(ClassName.open)
- }
- if (!isOpen) {
- this.open()
- } else {
- this.close()
- }
- }
- PushMenu.prototype.open = function () {
- var windowWidth = $(window).width()
- if (windowWidth > this.options.collapseScreenSize) {
- $('body').removeClass(ClassName.collapsed)
- .trigger($.Event(Event.expanded))
- }
- else {
- $('body').addClass(ClassName.open)
- .trigger($.Event(Event.expanded))
- }
- }
- PushMenu.prototype.close = function () {
- var windowWidth = $(window).width()
- if (windowWidth > this.options.collapseScreenSize) {
- $('body').addClass(ClassName.collapsed)
- .trigger($.Event(Event.collapsed))
- } else {
- $('body').removeClass(ClassName.open + ' ' + ClassName.collapsed)
- .trigger($.Event(Event.collapsed))
- }
- }
- PushMenu.prototype.expandOnHover = function () {
- $(Selector.mainSidebar).hover(function () {
- if ($('body').is(Selector.mini + Selector.collapsed)
- && $(window).width() > this.options.collapseScreenSize) {
- this.expand()
- }
- }.bind(this), function () {
- if ($('body').is(Selector.expanded)) {
- this.collapse()
- }
- }.bind(this))
- }
- // PushMenu.prototype.expand = function () {
- // setTimeout(function () {
- // $('body').removeClass(ClassName.collapsed)
- // .addClass(ClassName.expanded)
- // }, this.options.expandTransitionDelay)
- // }
- PushMenu.prototype.collapse = function () {
- setTimeout(function () {
- $('body').removeClass(ClassName.expanded)
- .addClass(ClassName.collapsed)
- }, this.options.expandTransitionDelay)
- }
- // PushMenu Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- 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 PushMenu(options)))
- }
- if (option == 'toggle') data.toggle()
- })
- }
- var old = $.fn.pushMenu
- $.fn.pushMenu = Plugin
- $.fn.pushMenu.Constructor = PushMenu
- // No Conflict Mode
- $.fn.pushMenu.noConflict = function () {
- $.fn.pushMenu = old
- return this
- }
- // Data API
- $(document).on('click', Selector.button, function (e) {
- e.preventDefault()
- Plugin.call($(this), 'toggle')
- })
- $(window).on('load', function () {
- Plugin.call($(Selector.button))
- })
- }(jQuery) // End of use strict
- /* Tree()
- * Converts a nested list into a multilevel
- * tree view menu.
- *
- * @Usage: $('.my-menu').tree(options)
- * or add [data-widget="tree"] to the ul element
- * Pass any option as data-option="value"
- */
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.tree'
- var Default = {
- animationSpeed: 500,
- accordion : true,
- followLink : false,
- trigger : '.treeview a'
- }
- var Selector = {
- tree : '.tree',
- treeview : '.treeview',
- treeviewMenu: '.treeview-menu',
- open : '.menu-open, .active',
- li : 'li',
- data : '[data-widget="tree"]',
- active : '.active'
- }
- var ClassName = {
- open: 'menu-open',
- tree: 'tree'
- }
- var Event = {
- collapsed: 'collapsed.tree',
- expanded : 'expanded.tree'
- }
- // Tree Class Definition
- var Tree = function (element, options) {
- this.element = element
- this.options = options
- $(this.element).addClass(ClassName.tree)
- $(Selector.treeview + Selector.active, this.element).addClass(ClassName.open)
- this._setUpListeners()
- }
- Tree.prototype.toggle = function (link, event) {
- var treeviewMenu = link.next(Selector.treeviewMenu)
- var parentLi = link.parent()
- var isOpen = parentLi.hasClass(ClassName.open)
- if (!parentLi.is(Selector.treeview)) {
- return
- }
- if (!this.options.followLink || link.attr('href') == '#') {
- event.preventDefault()
- }
- if (isOpen) {
- this.collapse(treeviewMenu, parentLi)
- } else {
- this.expand(treeviewMenu, parentLi)
- }
- }
- Tree.prototype.expand = function (tree, parent) {
- var expandedEvent = $.Event(Event.expanded)
- if (this.options.accordion) {
- var openMenuLi = parent.siblings(Selector.open)
- var openTree = openMenuLi.children(Selector.treeviewMenu)
- this.collapse(openTree, openMenuLi)
- }
- parent.addClass(ClassName.open)
- tree.slideDown(this.options.animationSpeed, function () {
- $(this.element).trigger(expandedEvent)
- }.bind(this))
- }
- Tree.prototype.collapse = function (tree, parentLi) {
- var collapsedEvent = $.Event(Event.collapsed)
- tree.find(Selector.open).removeClass(ClassName.open)
- parentLi.removeClass(ClassName.open)
- tree.slideUp(this.options.animationSpeed, function () {
- tree.find(Selector.open + ' > ' + Selector.treeview).slideUp()
- $(this.element).trigger(collapsedEvent)
- }.bind(this))
- }
- // Private
- Tree.prototype._setUpListeners = function () {
- var that = this
- $(this.element).on('click', this.options.trigger, function (event) {
- that.toggle($(this), event)
- })
- }
- // Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this)
- var data = $this.data(DataKey)
- if (!data) {
- var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
- $this.data(DataKey, new Tree($this, options))
- }
- })
- }
- var old = $.fn.tree
- $.fn.tree = Plugin
- $.fn.tree.Constructor = Tree
- // No Conflict Mode
- $.fn.tree.noConflict = function () {
- $.fn.tree = old
- return this
- }
- // Tree Data API
- $(window).on('load', function () {
- $(Selector.data).each(function () {
- Plugin.call($(this))
- })
- })
- }(jQuery) // End of use strict
- /* ControlSidebar()
- * Toggles the state of the control sidebar
- *
- * @Usage: $('#control-sidebar-trigger').controlSidebar(options)
- * or add [data-toggle="control-sidebar"] to the trigger
- * Pass any option as data-option="value"
- */
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.controlsidebar'
- var Default = {
- slide: true
- }
- var Selector = {
- sidebar: '.control-sidebar',
- data : '[data-toggle="control-sidebar"]',
- open : '.control-sidebar-open',
- bg : '.control-sidebar-bg',
- wrapper: '.wrapper',
- content: '.content-wrapper',
- boxed : '.layout-boxed'
- }
- var ClassName = {
- open : 'control-sidebar-open',
- fixed: 'fixed'
- }
- var Event = {
- collapsed: 'collapsed.controlsidebar',
- expanded : 'expanded.controlsidebar'
- }
- // ControlSidebar Class Definition
- var ControlSidebar = function (element, options) {
- this.element = element
- this.options = options
- this.hasBindedResize = false
- this.init()
- }
- ControlSidebar.prototype.init = function () {
- // Add click listener if the element hasn't been
- // initialized using the data API
- if (!$(this.element).is(Selector.data)) {
- $(this).on('click', this.toggle)
- }
- this.fix()
- $(window).resize(function () {
- this.fix()
- }.bind(this))
- }
- ControlSidebar.prototype.toggle = function (event) {
- if (event) event.preventDefault()
- this.fix()
- if (!$(Selector.sidebar).is(Selector.open) && !$('body').is(Selector.open)) {
- this.expand()
- } else {
- this.collapse()
- }
- }
- ControlSidebar.prototype.expand = function () {
- if (!this.options.slide) {
- $('body').addClass(ClassName.open)
- } else {
- $(Selector.sidebar).addClass(ClassName.open)
- }
- $(this.element).trigger($.Event(Event.expanded))
- }
- ControlSidebar.prototype.collapse = function () {
- $('body, ' + Selector.sidebar).removeClass(ClassName.open)
- $(this.element).trigger($.Event(Event.collapsed))
- }
- ControlSidebar.prototype.fix = function () {
- if ($('body').is(Selector.boxed)) {
- this._fixForBoxed($(Selector.bg))
- }
- }
- // Private
- ControlSidebar.prototype._fixForBoxed = function (bg) {
- bg.css({
- position: 'absolute',
- height : $(Selector.wrapper).height()
- })
- }
- // Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- 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 ControlSidebar($this, options)))
- }
- if (typeof option == 'string') data.toggle()
- })
- }
- var old = $.fn.controlSidebar
- $.fn.controlSidebar = Plugin
- $.fn.controlSidebar.Constructor = ControlSidebar
- // No Conflict Mode
- $.fn.controlSidebar.noConflict = function () {
- $.fn.controlSidebar = old
- return this
- }
- // ControlSidebar Data API
- $(document).on('click', Selector.data, function (event) {
- if (event) event.preventDefault()
- Plugin.call($(this), 'toggle')
- })
- }(jQuery) // End of use strict
- /* BoxWidget()
- * Adds box widget functions to boxes.
- *
- * @Usage: $('.my-box').boxWidget(options)
- * This plugin auto activates on any element using the `.box` class
- * Pass any option as data-option="value"
- */
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.boxwidget'
- var Default = {
- animationSpeed : 500,
- collapseTrigger: '[data-widget="collapse"]',
- removeTrigger : '[data-widget="remove"]',
- collapseIcon : 'fa-minus',
- expandIcon : 'fa-plus',
- removeIcon : 'fa-times'
- }
- var Selector = {
- data : '.box',
- collapsed: '.collapsed-box',
- body : '.box-body',
- footer : '.box-footer',
- tools : '.box-tools'
- }
- var ClassName = {
- collapsed: 'collapsed-box'
- }
- var Event = {
- collapsed: 'collapsed.boxwidget',
- expanded : 'expanded.boxwidget',
- removed : 'removed.boxwidget'
- }
- // BoxWidget Class Definition
- var BoxWidget = function (element, options) {
- this.element = element
- this.options = options
- this._setUpListeners()
- }
- BoxWidget.prototype.toggle = function () {
- var isOpen = !$(this.element).is(Selector.collapsed)
- if (isOpen) {
- this.collapse()
- } else {
- this.expand()
- }
- }
- BoxWidget.prototype.expand = function () {
- var expandedEvent = $.Event(Event.expanded)
- var collapseIcon = this.options.collapseIcon
- var expandIcon = this.options.expandIcon
- $(this.element).removeClass(ClassName.collapsed)
- $(this.element)
- .find(Selector.tools)
- .find('.' + expandIcon)
- .removeClass(expandIcon)
- .addClass(collapseIcon)
- $(this.element).find(Selector.body + ', ' + Selector.footer)
- .slideDown(this.options.animationSpeed, function () {
- $(this.element).trigger(expandedEvent)
- }.bind(this))
- }
- BoxWidget.prototype.collapse = function () {
- var collapsedEvent = $.Event(Event.collapsed)
- var collapseIcon = this.options.collapseIcon
- var expandIcon = this.options.expandIcon
- $(this.element)
- .find(Selector.tools)
- .find('.' + collapseIcon)
- .removeClass(collapseIcon)
- .addClass(expandIcon)
- $(this.element).find(Selector.body + ', ' + Selector.footer)
- .slideUp(this.options.animationSpeed, function () {
- $(this.element).addClass(ClassName.collapsed)
- $(this.element).trigger(collapsedEvent)
- }.bind(this))
- }
- BoxWidget.prototype.remove = function () {
- var removedEvent = $.Event(Event.removed)
- $(this.element).slideUp(this.options.animationSpeed, function () {
- $(this.element).trigger(removedEvent)
- $(this.element).remove()
- }.bind(this))
- }
- // Private
- BoxWidget.prototype._setUpListeners = function () {
- var that = this
- $(this.element).on('click', this.options.collapseTrigger, function (event) {
- if (event) event.preventDefault()
- that.toggle()
- })
- $(this.element).on('click', this.options.removeTrigger, function (event) {
- if (event) event.preventDefault()
- that.remove()
- })
- }
- // Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- 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 BoxWidget($this, options)))
- }
- if (typeof option == 'string') {
- if (typeof data[option] == 'undefined') {
- throw new Error('No method named ' + option)
- }
- data[option]()
- }
- })
- }
- var old = $.fn.boxWidget
- $.fn.boxWidget = Plugin
- $.fn.boxWidget.Constructor = BoxWidget
- // No Conflict Mode
- $.fn.boxWidget.noConflict = function () {
- $.fn.boxWidget = old
- return this
- }
- // BoxWidget Data API
- $(window).on('load', function () {
- $(Selector.data).each(function () {
- Plugin.call($(this))
- })
- })
- }(jQuery) // End of use strict
- /* TodoList()
- * Converts a list into a todoList.
- *
- * @Usage: $('.my-list').todoList(options)
- * or add [data-widget="todo-list"] to the ul element
- * Pass any option as data-option="value"
- */
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.todolist'
- var Default = {
- iCheck : false,
- onCheck : function () {
- },
- onUnCheck: function () {
- }
- }
- var Selector = {
- data: '[data-widget="todo-list"]'
- }
- var ClassName = {
- done: 'done'
- }
- // TodoList Class Definition
- var TodoList = function (element, options) {
- this.element = element
- this.options = options
- this._setUpListeners()
- }
- TodoList.prototype.toggle = function (item) {
- item.parents(Selector.li).first().toggleClass(ClassName.done)
- if (!item.prop('checked')) {
- this.unCheck(item)
- return
- }
- this.check(item)
- }
- TodoList.prototype.check = function (item) {
- this.options.onCheck.call(item)
- }
- TodoList.prototype.unCheck = function (item) {
- this.options.onUnCheck.call(item)
- }
- // Private
- TodoList.prototype._setUpListeners = function () {
- var that = this
- $(this.element).on('change ifChanged', 'input:checkbox', function () {
- that.toggle($(this))
- })
- }
- // Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- 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 TodoList($this, options)))
- }
- if (typeof data == 'string') {
- if (typeof data[option] == 'undefined') {
- throw new Error('No method named ' + option)
- }
- data[option]()
- }
- })
- }
- var old = $.fn.todoList
- $.fn.todoList = Plugin
- $.fn.todoList.Constructor = TodoList
- // No Conflict Mode
- $.fn.todoList.noConflict = function () {
- $.fn.todoList = old
- return this
- }
- // TodoList Data API
- $(window).on('load', function () {
- $(Selector.data).each(function () {
- Plugin.call($(this))
- })
- })
- }(jQuery) // End of use strict
- /* DirectChat()
- * Toggles the state of the control sidebar
- *
- * @Usage: $('#my-chat-box').directChat()
- * or add [data-widget="direct-chat"] to the trigger
- */
- +function ($) {
- 'use strict'
- var DataKey = 'Masteradmin.directchat'
- var Selector = {
- data: '[data-widget="chat-pane-toggle"]',
- box : '.direct-chat'
- }
- var ClassName = {
- open: 'direct-chat-contacts-open'
- }
- // DirectChat Class Definition
- var DirectChat = function (element) {
- this.element = element
- }
- DirectChat.prototype.toggle = function ($trigger) {
- $trigger.parents(Selector.box).first().toggleClass(ClassName.open)
- }
- // Plugin Definition
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this)
- var data = $this.data(DataKey)
- if (!data) {
- $this.data(DataKey, (data = new DirectChat($this)))
- }
- if (typeof option == 'string') data.toggle($this)
- })
- }
- var old = $.fn.directChat
- $.fn.directChat = Plugin
- $.fn.directChat.Constructor = DirectChat
- // No Conflict Mode
- $.fn.directChat.noConflict = function () {
- $.fn.directChat = old
- return this
- }
- // DirectChat Data API
- $(document).on('click', Selector.data, function (event) {
- if (event) event.preventDefault()
- Plugin.call($(this), 'toggle')
- })
-
- // Slim scrolling
-
- $('.inner-content-div').slimScroll({
- height: '200'
- });
- $('.sm-scrol').slimScroll({
- height: '250'
- });
-
- $('.direct-chat-messages').slimScroll({
- height: '420'
- });
-
- $('.chat-box-one').slimScroll({
- height: '550'
- });
- $('.chat-box-one2').slimScroll({
- height: '580'
- });
- $('.chat-box-one-side').slimScroll({
- height: '650'
- });
- $('.chat-box-one-side2').slimScroll({
- height: '500'
- });
- $('.chat-box-one-side3').slimScroll({
- height: '685'
- });
-
- $('.notification-side').slimScroll({
- height: '325'
- });
-
- $('.suggestions-side').slimScroll({
- height: '300'
- });
-
- $('.events-side').slimScroll({
- height: '265'
- });
-
- $('.pat-div').slimScroll({
- height: '204'
- });
- $('.demo-panel-bx').slimScroll({
- height: 'auto'
- });
-
- $(".search-box a, .search-box .app-search .srh-btn").on('click', function() {
- $(".app-search").toggle(200);
- });
-
-
-
- // Close
- //
- $(document).on('click', '.box-btn-close', function() {
- $(this).parents('.box').fadeOut(600, function() {
- if ($(this).parent().children().length == 1) {
- $(this).parent().remove();
- }
- else {
- $(this).remove();
- }
- });
- });
- // Slide up/down
- //
- $(document).on('click', '.box-btn-slide', function(){
- $(this).toggleClass('rotate-180').parents('.box').find('.box-content, .box-body').slideToggle();
- });
- // Maximize
- //
- $(document).on('click', '.box-btn-maximize', function(){
- $(this).parents('.box').toggleClass('box-maximize').removeClass('box-fullscreen');
- });
- // Fullscreen
- //
- $(document).on('click', '.box-btn-fullscreen', function(){
- $(this).parents('.box').toggleClass('box-fullscreen').removeClass('box-maximize');
- });
-
-
- // Disable demonstrative links!
- //
- $(document).on('click', 'a[href="#"]', function(e){
- e.preventDefault();
- });
-
-
- // This is for the innerleft sidebar
- $(".open-left-block").on('click', function() {
- $('.left-block').toggleClass('open-panel');
- $('.open-left-block').toggleClass('mdi-menu');
- });
-
-
- // Upload
- //
- $(document).on('click', '.file-browser', function() {
- var $browser = $(this);
- if ( $browser.hasClass('form-control') ) {
- setTimeout(function(){
- $browser.closest('.file-group').find('[type="file"]').trigger('click');
- },300);
- }
- else {
- var file = $browser.closest('.file-group').find('[type="file"]');
- file.on( 'click', function(e) {
- e.stopPropagation();
- });
- file.trigger('click');
- }
- });
- // Event to change file name after file selection
- $(document).on('change', '.file-group [type="file"]', function(){
- var input = $(this)[0];
- var len = input.files.length;
- var filename = '';
- for (var i = 0; i < len; ++i) {
- filename += input.files.item(i).name + ', ';
- }
- filename = filename.substr(0, filename.length-2);
- $(this).closest('.file-group').find('.file-value').val(filename).text(filename).focus();
- });
- // Update file name for bootstrap custom file upload
- $(document).on('change', '.custom-file-input', function(){
- var filename = $(this).val().split('\\').pop();
- $(this).next('.custom-file-control').attr('data-input-value', filename);
- });
- $('.custom-file-control:not([data-input-value])').attr('data-input-value', 'Choose file...');
-
-
- /* The todo list plugin */
- $('.todo-list').todoList({
- onCheck : function () {
- window.console.log($(this), 'The element has been checked');
- },
- onUnCheck: function () {
- window.console.log($(this), 'The element has been unchecked');
- }
- });
-
- // bradcrumb section
-
- $('#thismonth').sparkline([8, 5, 4, 7, 9, 7, 10, 9], {
- type: 'bar',
- height: '35',
- barWidth: '4',
- resize: true,
- barSpacing: '4',
- barColor: '#843cf7'
- });
- $('#lastyear').sparkline([8, 5, 4, 7, 9, 7, 10, 9], {
- type: 'bar',
- height: '35',
- barWidth: '4',
- resize: true,
- barSpacing: '4',
- barColor: '#ec4b71'
- });
- var sparkResize;
-
- $("#chat-circle, #chat-box-toggle, #chat-popup").click(function(){
- $("#chat-box-body").toggleClass("show");
- });
-
- }(jQuery) // End of use strict
- // Fullscreen
- $(function () {
- 'use strict'
- $('[data-provide~="fullscreen"]').on('click', function () {
- screenfull.toggle($('#container')[0]);
- });
- }); // End of use strict
- +function ($) {
- 'use strict'
-
- // Dynamic active menu
- var path = window.location.pathname.split("/").pop();
- var target = $('.sidebar-menu li a[href="'+path+'"]');
- target.parent().addClass('active');
- $('.sidebar-menu li.active').parents('li').addClass('active');
- }(jQuery) // End of use strict
- +function ($) {
- 'use strict'
-
- // Dynamic active horizontal menu
- var path = window.location.pathname.split("/").pop();
- var target = $('.sm li a[href="'+path+'"]');
- target.parent().addClass('current');
- $('.sm li.current').parents('li').addClass('current');
- }(jQuery) // End of use strict
- // feather icon
- $(function () {
- 'use strict'
- feather.replace();
- }); // End of use strict
- /*!
- * Waves v0.6.4
- * http://fian.my.id/Waves
- *
- * Copyright 2014 Alfiana E. Sibuea and other contributors
- * Released under the MIT license
- * https://github.com/fians/Waves/blob/master/LICENSE
- */
- ;(function(window) {
- 'use strict';
- var Waves = Waves || {};
- var $$ = document.querySelectorAll.bind(document);
- // Find exact position of element
- function isWindow(obj) {
- return obj !== null && obj === obj.window;
- }
- function getWindow(elem) {
- return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
- }
- function offset(elem) {
- var docElem, win,
- box = {top: 0, left: 0},
- doc = elem && elem.ownerDocument;
- docElem = doc.documentElement;
- if (typeof elem.getBoundingClientRect !== typeof undefined) {
- box = elem.getBoundingClientRect();
- }
- win = getWindow(doc);
- return {
- top: box.top + win.pageYOffset - docElem.clientTop,
- left: box.left + win.pageXOffset - docElem.clientLeft
- };
- }
- function convertStyle(obj) {
- var style = '';
- for (var a in obj) {
- if (obj.hasOwnProperty(a)) {
- style += (a + ':' + obj[a] + ';');
- }
- }
- return style;
- }
- var Effect = {
- // Effect delay
- duration: 750,
- show: function(e, element) {
- // Disable right click
- if (e.button === 2) {
- return false;
- }
- var el = element || this;
- // Create ripple
- var ripple = document.createElement('div');
- ripple.className = 'waves-ripple';
- el.appendChild(ripple);
- // Get click coordinate and element witdh
- var pos = offset(el);
- var relativeY = (e.pageY - pos.top);
- var relativeX = (e.pageX - pos.left);
- var scale = 'scale('+((el.clientWidth / 100) * 10)+')';
- // Support for touch devices
- if ('touches' in e) {
- relativeY = (e.touches[0].pageY - pos.top);
- relativeX = (e.touches[0].pageX - pos.left);
- }
- // Attach data to element
- ripple.setAttribute('data-hold', Date.now());
- ripple.setAttribute('data-scale', scale);
- ripple.setAttribute('data-x', relativeX);
- ripple.setAttribute('data-y', relativeY);
- // Set ripple position
- var rippleStyle = {
- 'top': relativeY+'px',
- 'left': relativeX+'px'
- };
- ripple.className = ripple.className + ' waves-notransition';
- ripple.setAttribute('style', convertStyle(rippleStyle));
- ripple.className = ripple.className.replace('waves-notransition', '');
- // Scale the ripple
- rippleStyle['-webkit-transform'] = scale;
- rippleStyle['-moz-transform'] = scale;
- rippleStyle['-ms-transform'] = scale;
- rippleStyle['-o-transform'] = scale;
- rippleStyle.transform = scale;
- rippleStyle.opacity = '1';
- rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
- rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
- rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
- rippleStyle['transition-duration'] = Effect.duration + 'ms';
- rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
- rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
- rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
- rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
- ripple.setAttribute('style', convertStyle(rippleStyle));
- },
- hide: function(e) {
- TouchHandler.touchup(e);
- var el = this;
- var width = el.clientWidth * 1.4;
- // Get first ripple
- var ripple = null;
- var ripples = el.getElementsByClassName('waves-ripple');
- if (ripples.length > 0) {
- ripple = ripples[ripples.length - 1];
- } else {
- return false;
- }
- var relativeX = ripple.getAttribute('data-x');
- var relativeY = ripple.getAttribute('data-y');
- var scale = ripple.getAttribute('data-scale');
- // Get delay beetween mousedown and mouse leave
- var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
- var delay = 350 - diff;
- if (delay < 0) {
- delay = 0;
- }
- // Fade out ripple after delay
- setTimeout(function() {
- var style = {
- 'top': relativeY+'px',
- 'left': relativeX+'px',
- 'opacity': '0',
- // Duration
- '-webkit-transition-duration': Effect.duration + 'ms',
- '-moz-transition-duration': Effect.duration + 'ms',
- '-o-transition-duration': Effect.duration + 'ms',
- 'transition-duration': Effect.duration + 'ms',
- '-webkit-transform': scale,
- '-moz-transform': scale,
- '-ms-transform': scale,
- '-o-transform': scale,
- 'transform': scale,
- };
- ripple.setAttribute('style', convertStyle(style));
- setTimeout(function() {
- try {
- el.removeChild(ripple);
- } catch(e) {
- return false;
- }
- }, Effect.duration);
- }, delay);
- },
- // Little hack to make <input> can perform waves effect
- wrapInput: function(elements) {
- for (var a = 0; a < elements.length; a++) {
- var el = elements[a];
- if (el.tagName.toLowerCase() === 'input') {
- var parent = el.parentNode;
- // If input already have parent just pass through
- if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
- continue;
- }
- // Put element class and style to the specified parent
- var wrapper = document.createElement('i');
- wrapper.className = el.className + ' waves-input-wrapper';
- var elementStyle = el.getAttribute('style');
- if (!elementStyle) {
- elementStyle = '';
- }
- wrapper.setAttribute('style', elementStyle);
- el.className = 'waves-button-input';
- el.removeAttribute('style');
- // Put element as child
- parent.replaceChild(wrapper, el);
- wrapper.appendChild(el);
- }
- }
- }
- };
- /**
- * Disable mousedown event for 500ms during and after touch
- */
- var TouchHandler = {
- /* uses an integer rather than bool so there's no issues with
- * needing to clear timeouts if another touch event occurred
- * within the 500ms. Cannot mouseup between touchstart and
- * touchend, nor in the 500ms after touchend. */
- touches: 0,
- allowEvent: function(e) {
- var allow = true;
- if (e.type === 'touchstart') {
- TouchHandler.touches += 1; //push
- } else if (e.type === 'touchend' || e.type === 'touchcancel') {
- setTimeout(function() {
- if (TouchHandler.touches > 0) {
- TouchHandler.touches -= 1; //pop after 500ms
- }
- }, 500);
- } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
- allow = false;
- }
- return allow;
- },
- touchup: function(e) {
- TouchHandler.allowEvent(e);
- }
- };
- /**
- * Delegated click handler for .waves-effect element.
- * returns null when .waves-effect element not in "click tree"
- */
- function getWavesEffectElement(e) {
- if (TouchHandler.allowEvent(e) === false) {
- return null;
- }
- var element = null;
- var target = e.target || e.srcElement;
- while (target.parentNode !== null) {
- if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
- element = target;
- break;
- }
- target = target.parentNode;
- }
- return element;
- }
- /**
- * Bubble the click and show effect if .waves-effect elem was found
- */
- function showEffect(e) {
- var element = getWavesEffectElement(e);
- if (element !== null) {
- Effect.show(e, element);
- if ('ontouchstart' in window) {
- element.addEventListener('touchend', Effect.hide, false);
- element.addEventListener('touchcancel', Effect.hide, false);
- }
- element.addEventListener('mouseup', Effect.hide, false);
- element.addEventListener('mouseleave', Effect.hide, false);
- element.addEventListener('dragend', Effect.hide, false);
- }
- }
- Waves.displayEffect = function(options) {
- options = options || {};
- if ('duration' in options) {
- Effect.duration = options.duration;
- }
- //Wrap input inside <i> tag
- Effect.wrapInput($$('.waves-effect'));
- if ('ontouchstart' in window) {
- document.body.addEventListener('touchstart', showEffect, false);
- }
- document.body.addEventListener('mousedown', showEffect, false);
- };
- /**
- * Attach Waves to an input element (or any element which doesn't
- * bubble mouseup/mousedown events).
- * Intended to be used with dynamically loaded forms/inputs, or
- * where the user doesn't want a delegated click handler.
- */
- Waves.attach = function(element) {
- //FUTURE: automatically add waves classes and allow users
- // to specify them with an options param? Eg. light/classic/button
- if (element.tagName.toLowerCase() === 'input') {
- Effect.wrapInput([element]);
- element = element.parentNode;
- }
- if ('ontouchstart' in window) {
- element.addEventListener('touchstart', showEffect, false);
- }
- element.addEventListener('mousedown', showEffect, false);
- };
- window.Waves = Waves;
- document.addEventListener('DOMContentLoaded', function() {
- Waves.displayEffect();
- }, false);
- })(window);
- // Demo panel
- function w3_open() {
- document.getElementById("mySidebar").style.display = "block";
- document.getElementById("myOverlay").style.display = "block";
- }
- function w3_close() {
- document.getElementById("mySidebar").style.display = "none";
- document.getElementById("myOverlay").style.display = "none";
- }
- // loader
-
- var loader;
- function loadNow(opacity) {
- if (opacity <= 0) {
- displayContent();
- } else {
- loader.style.opacity = opacity;
- window.setTimeout(function() {
- loadNow(opacity - 0.05);
- }, 50);
- }
- }
- function displayContent() {
- loader.style.display = 'none';
- }
- document.addEventListener("DOMContentLoaded", function() {
- loader = document.getElementById('loader');
- loadNow(1);
- });
- new PerfectScrollbar(".multinav-scroll");
- var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
- var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
- return new bootstrap.Tooltip(tooltipTriggerEl)
- })
- $('#sidebarRight').slimScroll({
- height: '100%'
- });
- $(".right-bar-btn").click(function(){
- $("body").toggleClass("right-bar-toggle");
- });
- /* $(function () {
- 'use strict';
-
- var optionsSpark1 = {
- series: [{
- name: "Sales",
- data: [12, 14, 9, 27, 32, 15]
- }],
- chart: {
- type: 'area',
- height: 60,
- width:100,
- sparkline: {
- enabled: true
- },
- },
- colors: ["#01b075"],
- stroke: {
- curve: 'smooth'
- },
- fill: {
- opacity: 0.3
- },
- yaxis: {
- min: 0
- },
- };
- var chartSpark1 = new ApexCharts(document.querySelector("#chart-spark1"), optionsSpark1);
- chartSpark1.render();
-
-
-
-
- var optionsSpark2 = {
- series: [{
- name: "Sessions",
- data: [12, 14, 9, 27, 32, 15]
- }],
- chart: {
- type: 'area',
- height: 60,
- width:100,
- sparkline: {
- enabled: true
- },
- },
- colors: ["#4c95dd"],
- stroke: {
- curve: 'smooth'
- },
- fill: {
- opacity: 0.3
- },
- yaxis: {
- min: 0
- },
- };
- var chartSpark2 = new ApexCharts(document.querySelector("#chart-spark2"), optionsSpark2);
- chartSpark2.render();
-
-
-
- var options = {
- series: [{
- name: 'First Time',
- data: [31, 40, 28, 51, 42, 109, 100]
- }, {
- name: 'Returning',
- data: [11, 32, 45, 32, 34, 52, 41]
- }],
- chart: {
- width: 150,
- height: 120,
- type: 'area',
- zoom: {
- enabled: false
- },
- },
- dataLabels: {
- enabled: false
- },
- colors: ["#e66430", "#4c95dd"],
- stroke: {
- curve: 'smooth',
- width: 0.5,
- },
- grid: {
- show: false,
- },
- xaxis: {
- categories: ["Mon","Tue","Wed","Thu","Fri","Set","Sun"],
- labels: {
- show: false,
- },
- },
- yaxis: {
- labels: {
- show: false,
- },
- },
- legend: {
- show: false,
- },
- };
- var chart = new ApexCharts(document.querySelector("#chart3"), options);
- chart.render();
- });*/ // End of use strict
|