template.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706
  1. //[Master Javascript]
  2. //Project: Riday Admin - Responsive Admin Template
  3. //Primary use: Riday Admin - Responsive Admin Template
  4. //should be included in all pages. It controls some layout
  5. // Make sure jQuery has been loaded
  6. if (typeof jQuery === 'undefined') {
  7. throw new Error('template requires jQuery')
  8. }
  9. // Layout()
  10. // Implements layout.
  11. // Fixes the layout height in case min-height fails.
  12. // @usage activated automatically upon window load.
  13. // Configure any options by passing data-option="value"
  14. // to the body tag.
  15. +function ($) {
  16. 'use strict'
  17. var DataKey = 'Masteradmin.layout'
  18. var Default = {
  19. slimscroll : false,
  20. resetHeight: true
  21. }
  22. var Selector = {
  23. wrapper : '.wrapper',
  24. contentWrapper: '.content-wrapper',
  25. layoutBoxed : '.layout-boxed',
  26. mainFooter : '.main-footer',
  27. mainHeader : '.main-header',
  28. sidebar : '.sidebar',
  29. controlSidebar: '.control-sidebar',
  30. fixed : '.fixed',
  31. sidebarMenu : '.sidebar-menu',
  32. logo : '.main-header .logo'
  33. }
  34. var ClassName = {
  35. fixed : 'fixed',
  36. holdTransition: 'hold-transition'
  37. }
  38. var Layout = function (options) {
  39. this.options = options
  40. this.bindedResize = false
  41. this.activate()
  42. }
  43. Layout.prototype.activate = function () {
  44. this.fix()
  45. this.fixSidebar()
  46. $('body').removeClass(ClassName.holdTransition)
  47. if (this.options.resetHeight) {
  48. $('body, html, ' + Selector.wrapper).css({
  49. 'height' : 'auto',
  50. 'min-height': '100%'
  51. })
  52. }
  53. if (!this.bindedResize) {
  54. $(window).resize(function () {
  55. this.fix()
  56. this.fixSidebar()
  57. $(Selector.logo + ', ' + Selector.sidebar).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
  58. this.fix()
  59. this.fixSidebar()
  60. }.bind(this))
  61. }.bind(this))
  62. this.bindedResize = true
  63. }
  64. $(Selector.sidebarMenu).on('expanded.tree', function () {
  65. this.fix()
  66. this.fixSidebar()
  67. }.bind(this))
  68. $(Selector.sidebarMenu).on('collapsed.tree', function () {
  69. this.fix()
  70. this.fixSidebar()
  71. }.bind(this))
  72. }
  73. Layout.prototype.fix = function () {
  74. // Remove overflow from .wrapper if layout-boxed exists
  75. $(Selector.layoutBoxed + ' > ' + Selector.wrapper).css('overflow', 'hidden')
  76. // Get window height and the wrapper height
  77. var footerHeight = $(Selector.mainFooter).outerHeight() || 0
  78. var neg = $(Selector.mainHeader).outerHeight() + footerHeight
  79. var windowHeight = $(window).height()
  80. var sidebarHeight = $(Selector.sidebar).height() || 0
  81. // Set the min-height of the content and sidebar based on
  82. // the height of the document.
  83. if ($('body').hasClass(ClassName.fixed)) {
  84. $(Selector.contentWrapper).css('min-height', windowHeight - footerHeight)
  85. } else {
  86. var postSetHeight
  87. if (windowHeight >= sidebarHeight) {
  88. $(Selector.contentWrapper).css('min-height', windowHeight - neg)
  89. postSetHeight = windowHeight - neg
  90. } else {
  91. $(Selector.contentWrapper).css('min-height', sidebarHeight)
  92. postSetHeight = sidebarHeight
  93. }
  94. // Fix for the control sidebar height
  95. var $controlSidebar = $(Selector.controlSidebar)
  96. if (typeof $controlSidebar !== 'undefined') {
  97. if ($controlSidebar.height() > postSetHeight)
  98. $(Selector.contentWrapper).css('min-height', $controlSidebar.height())
  99. }
  100. }
  101. }
  102. Layout.prototype.fixSidebar = function () {
  103. // Make sure the body tag has the .fixed class
  104. if (!$('body').hasClass(ClassName.fixed)) {
  105. if (typeof $.fn.slimScroll !== 'undefined') {
  106. $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
  107. }
  108. return
  109. }
  110. // Enable slimscroll for fixed layout
  111. if (this.options.slimscroll) {
  112. if (typeof $.fn.slimScroll !== 'undefined') {
  113. // Destroy if it exists
  114. $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
  115. // Add slimscroll
  116. $(Selector.sidebar).slimScroll({
  117. height: ($(window).height() - $(Selector.mainHeader).height()) + 'px',
  118. color : 'rgba(0,0,0,0.2)',
  119. size : '3px'
  120. })
  121. }
  122. }
  123. }
  124. // Plugin Definition
  125. function Plugin(option) {
  126. return this.each(function () {
  127. var $this = $(this)
  128. var data = $this.data(DataKey)
  129. if (!data) {
  130. var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
  131. $this.data(DataKey, (data = new Layout(options)))
  132. }
  133. if (typeof option == 'string') {
  134. if (typeof data[option] == 'undefined') {
  135. throw new Error('No method named ' + option)
  136. }
  137. data[option]()
  138. }
  139. })
  140. }
  141. var old = $.fn.layout
  142. $.fn.layout = Plugin
  143. $.fn.layout.Constuctor = Layout
  144. // No conflict mode
  145. $.fn.layout.noConflict = function () {
  146. $.fn.layout = old
  147. return this
  148. }
  149. // Layout DATA-API
  150. $(window).on('load', function () {
  151. Plugin.call($('body'))
  152. });
  153. }(jQuery) // End of use strict
  154. /* PushMenu()
  155. * Adds the push menu functionality to the sidebar.
  156. *
  157. * @usage: $('.btn').pushMenu(options)
  158. * or add [data-toggle="push-menu"] to any button
  159. * Pass any option as data-option="value"
  160. */
  161. +function ($) {
  162. 'use strict'
  163. var DataKey = 'Masteradmin.pushmenu'
  164. var Default = {
  165. collapseScreenSize : 767,
  166. expandOnHover : false,
  167. expandTransitionDelay: 200
  168. }
  169. var Selector = {
  170. collapsed : '.sidebar-collapse',
  171. open : '.sidebar-open',
  172. mainSidebar : '.main-sidebar',
  173. contentWrapper: '.content-wrapper',
  174. searchInput : '.sidebar-form .form-control',
  175. button : '[data-toggle="push-menu"]',
  176. mini : '.sidebar-mini',
  177. expanded : '',
  178. layoutFixed : '.fixed'
  179. }
  180. var ClassName = {
  181. collapsed : 'sidebar-collapse',
  182. open : 'sidebar-open',
  183. mini : 'sidebar-mini',
  184. expanded : '',
  185. expandFeature: '',
  186. layoutFixed : 'fixed'
  187. }
  188. var Event = {
  189. expanded : 'expanded.pushMenu',
  190. collapsed: 'collapsed.pushMenu'
  191. }
  192. // PushMenu Class Definition
  193. var PushMenu = function (options) {
  194. this.options = options
  195. this.init()
  196. }
  197. PushMenu.prototype.init = function () {
  198. //if (this.options.expandOnHover
  199. // || ($('body').is(Selector.mini + Selector.layoutFixed))) {
  200. // this.expandOnHover()
  201. // $('body').addClass(ClassName.expandFeature)
  202. // }
  203. $(Selector.contentWrapper).on(function () {
  204. // Enable hide menu when clicking on the content-wrapper on small screens
  205. if ($(window).width() <= this.options.collapseScreenSize && $('body').hasClass(ClassName.open)) {
  206. this.close()
  207. }
  208. }.bind(this))
  209. // __Fix for android devices
  210. $(Selector.searchInput).on(function (e) {
  211. e.stopPropagation()
  212. })
  213. }
  214. PushMenu.prototype.toggle = function () {
  215. var windowWidth = $(window).width()
  216. var isOpen = !$('body').hasClass(ClassName.collapsed)
  217. if (windowWidth <= this.options.collapseScreenSize) {
  218. isOpen = $('body').hasClass(ClassName.open)
  219. }
  220. if (!isOpen) {
  221. this.open()
  222. } else {
  223. this.close()
  224. }
  225. }
  226. PushMenu.prototype.open = function () {
  227. var windowWidth = $(window).width()
  228. if (windowWidth > this.options.collapseScreenSize) {
  229. $('body').removeClass(ClassName.collapsed)
  230. .trigger($.Event(Event.expanded))
  231. }
  232. else {
  233. $('body').addClass(ClassName.open)
  234. .trigger($.Event(Event.expanded))
  235. }
  236. }
  237. PushMenu.prototype.close = function () {
  238. var windowWidth = $(window).width()
  239. if (windowWidth > this.options.collapseScreenSize) {
  240. $('body').addClass(ClassName.collapsed)
  241. .trigger($.Event(Event.collapsed))
  242. } else {
  243. $('body').removeClass(ClassName.open + ' ' + ClassName.collapsed)
  244. .trigger($.Event(Event.collapsed))
  245. }
  246. }
  247. PushMenu.prototype.expandOnHover = function () {
  248. $(Selector.mainSidebar).hover(function () {
  249. if ($('body').is(Selector.mini + Selector.collapsed)
  250. && $(window).width() > this.options.collapseScreenSize) {
  251. this.expand()
  252. }
  253. }.bind(this), function () {
  254. if ($('body').is(Selector.expanded)) {
  255. this.collapse()
  256. }
  257. }.bind(this))
  258. }
  259. // PushMenu.prototype.expand = function () {
  260. // setTimeout(function () {
  261. // $('body').removeClass(ClassName.collapsed)
  262. // .addClass(ClassName.expanded)
  263. // }, this.options.expandTransitionDelay)
  264. // }
  265. PushMenu.prototype.collapse = function () {
  266. setTimeout(function () {
  267. $('body').removeClass(ClassName.expanded)
  268. .addClass(ClassName.collapsed)
  269. }, this.options.expandTransitionDelay)
  270. }
  271. // PushMenu Plugin Definition
  272. function Plugin(option) {
  273. return this.each(function () {
  274. var $this = $(this)
  275. var data = $this.data(DataKey)
  276. if (!data) {
  277. var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
  278. $this.data(DataKey, (data = new PushMenu(options)))
  279. }
  280. if (option == 'toggle') data.toggle()
  281. })
  282. }
  283. var old = $.fn.pushMenu
  284. $.fn.pushMenu = Plugin
  285. $.fn.pushMenu.Constructor = PushMenu
  286. // No Conflict Mode
  287. $.fn.pushMenu.noConflict = function () {
  288. $.fn.pushMenu = old
  289. return this
  290. }
  291. // Data API
  292. $(document).on('click', Selector.button, function (e) {
  293. e.preventDefault()
  294. Plugin.call($(this), 'toggle')
  295. })
  296. $(window).on('load', function () {
  297. Plugin.call($(Selector.button))
  298. })
  299. }(jQuery) // End of use strict
  300. /* Tree()
  301. * Converts a nested list into a multilevel
  302. * tree view menu.
  303. *
  304. * @Usage: $('.my-menu').tree(options)
  305. * or add [data-widget="tree"] to the ul element
  306. * Pass any option as data-option="value"
  307. */
  308. +function ($) {
  309. 'use strict'
  310. var DataKey = 'Masteradmin.tree'
  311. var Default = {
  312. animationSpeed: 500,
  313. accordion : true,
  314. followLink : false,
  315. trigger : '.treeview a'
  316. }
  317. var Selector = {
  318. tree : '.tree',
  319. treeview : '.treeview',
  320. treeviewMenu: '.treeview-menu',
  321. open : '.menu-open, .active',
  322. li : 'li',
  323. data : '[data-widget="tree"]',
  324. active : '.active'
  325. }
  326. var ClassName = {
  327. open: 'menu-open',
  328. tree: 'tree'
  329. }
  330. var Event = {
  331. collapsed: 'collapsed.tree',
  332. expanded : 'expanded.tree'
  333. }
  334. // Tree Class Definition
  335. var Tree = function (element, options) {
  336. this.element = element
  337. this.options = options
  338. $(this.element).addClass(ClassName.tree)
  339. $(Selector.treeview + Selector.active, this.element).addClass(ClassName.open)
  340. this._setUpListeners()
  341. }
  342. Tree.prototype.toggle = function (link, event) {
  343. var treeviewMenu = link.next(Selector.treeviewMenu)
  344. var parentLi = link.parent()
  345. var isOpen = parentLi.hasClass(ClassName.open)
  346. if (!parentLi.is(Selector.treeview)) {
  347. return
  348. }
  349. if (!this.options.followLink || link.attr('href') == '#') {
  350. event.preventDefault()
  351. }
  352. if (isOpen) {
  353. this.collapse(treeviewMenu, parentLi)
  354. } else {
  355. this.expand(treeviewMenu, parentLi)
  356. }
  357. }
  358. Tree.prototype.expand = function (tree, parent) {
  359. var expandedEvent = $.Event(Event.expanded)
  360. if (this.options.accordion) {
  361. var openMenuLi = parent.siblings(Selector.open)
  362. var openTree = openMenuLi.children(Selector.treeviewMenu)
  363. this.collapse(openTree, openMenuLi)
  364. }
  365. parent.addClass(ClassName.open)
  366. tree.slideDown(this.options.animationSpeed, function () {
  367. $(this.element).trigger(expandedEvent)
  368. }.bind(this))
  369. }
  370. Tree.prototype.collapse = function (tree, parentLi) {
  371. var collapsedEvent = $.Event(Event.collapsed)
  372. tree.find(Selector.open).removeClass(ClassName.open)
  373. parentLi.removeClass(ClassName.open)
  374. tree.slideUp(this.options.animationSpeed, function () {
  375. tree.find(Selector.open + ' > ' + Selector.treeview).slideUp()
  376. $(this.element).trigger(collapsedEvent)
  377. }.bind(this))
  378. }
  379. // Private
  380. Tree.prototype._setUpListeners = function () {
  381. var that = this
  382. $(this.element).on('click', this.options.trigger, function (event) {
  383. that.toggle($(this), event)
  384. })
  385. }
  386. // Plugin Definition
  387. function Plugin(option) {
  388. return this.each(function () {
  389. var $this = $(this)
  390. var data = $this.data(DataKey)
  391. if (!data) {
  392. var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
  393. $this.data(DataKey, new Tree($this, options))
  394. }
  395. })
  396. }
  397. var old = $.fn.tree
  398. $.fn.tree = Plugin
  399. $.fn.tree.Constructor = Tree
  400. // No Conflict Mode
  401. $.fn.tree.noConflict = function () {
  402. $.fn.tree = old
  403. return this
  404. }
  405. // Tree Data API
  406. $(window).on('load', function () {
  407. $(Selector.data).each(function () {
  408. Plugin.call($(this))
  409. })
  410. })
  411. }(jQuery) // End of use strict
  412. /* ControlSidebar()
  413. * Toggles the state of the control sidebar
  414. *
  415. * @Usage: $('#control-sidebar-trigger').controlSidebar(options)
  416. * or add [data-toggle="control-sidebar"] to the trigger
  417. * Pass any option as data-option="value"
  418. */
  419. +function ($) {
  420. 'use strict'
  421. var DataKey = 'Masteradmin.controlsidebar'
  422. var Default = {
  423. slide: true
  424. }
  425. var Selector = {
  426. sidebar: '.control-sidebar',
  427. data : '[data-toggle="control-sidebar"]',
  428. open : '.control-sidebar-open',
  429. bg : '.control-sidebar-bg',
  430. wrapper: '.wrapper',
  431. content: '.content-wrapper',
  432. boxed : '.layout-boxed'
  433. }
  434. var ClassName = {
  435. open : 'control-sidebar-open',
  436. fixed: 'fixed'
  437. }
  438. var Event = {
  439. collapsed: 'collapsed.controlsidebar',
  440. expanded : 'expanded.controlsidebar'
  441. }
  442. // ControlSidebar Class Definition
  443. var ControlSidebar = function (element, options) {
  444. this.element = element
  445. this.options = options
  446. this.hasBindedResize = false
  447. this.init()
  448. }
  449. ControlSidebar.prototype.init = function () {
  450. // Add click listener if the element hasn't been
  451. // initialized using the data API
  452. if (!$(this.element).is(Selector.data)) {
  453. $(this).on('click', this.toggle)
  454. }
  455. this.fix()
  456. $(window).resize(function () {
  457. this.fix()
  458. }.bind(this))
  459. }
  460. ControlSidebar.prototype.toggle = function (event) {
  461. if (event) event.preventDefault()
  462. this.fix()
  463. if (!$(Selector.sidebar).is(Selector.open) && !$('body').is(Selector.open)) {
  464. this.expand()
  465. } else {
  466. this.collapse()
  467. }
  468. }
  469. ControlSidebar.prototype.expand = function () {
  470. if (!this.options.slide) {
  471. $('body').addClass(ClassName.open)
  472. } else {
  473. $(Selector.sidebar).addClass(ClassName.open)
  474. }
  475. $(this.element).trigger($.Event(Event.expanded))
  476. }
  477. ControlSidebar.prototype.collapse = function () {
  478. $('body, ' + Selector.sidebar).removeClass(ClassName.open)
  479. $(this.element).trigger($.Event(Event.collapsed))
  480. }
  481. ControlSidebar.prototype.fix = function () {
  482. if ($('body').is(Selector.boxed)) {
  483. this._fixForBoxed($(Selector.bg))
  484. }
  485. }
  486. // Private
  487. ControlSidebar.prototype._fixForBoxed = function (bg) {
  488. bg.css({
  489. position: 'absolute',
  490. height : $(Selector.wrapper).height()
  491. })
  492. }
  493. // Plugin Definition
  494. function Plugin(option) {
  495. return this.each(function () {
  496. var $this = $(this)
  497. var data = $this.data(DataKey)
  498. if (!data) {
  499. var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
  500. $this.data(DataKey, (data = new ControlSidebar($this, options)))
  501. }
  502. if (typeof option == 'string') data.toggle()
  503. })
  504. }
  505. var old = $.fn.controlSidebar
  506. $.fn.controlSidebar = Plugin
  507. $.fn.controlSidebar.Constructor = ControlSidebar
  508. // No Conflict Mode
  509. $.fn.controlSidebar.noConflict = function () {
  510. $.fn.controlSidebar = old
  511. return this
  512. }
  513. // ControlSidebar Data API
  514. $(document).on('click', Selector.data, function (event) {
  515. if (event) event.preventDefault()
  516. Plugin.call($(this), 'toggle')
  517. })
  518. }(jQuery) // End of use strict
  519. /* BoxWidget()
  520. * Adds box widget functions to boxes.
  521. *
  522. * @Usage: $('.my-box').boxWidget(options)
  523. * This plugin auto activates on any element using the `.box` class
  524. * Pass any option as data-option="value"
  525. */
  526. +function ($) {
  527. 'use strict'
  528. var DataKey = 'Masteradmin.boxwidget'
  529. var Default = {
  530. animationSpeed : 500,
  531. collapseTrigger: '[data-widget="collapse"]',
  532. removeTrigger : '[data-widget="remove"]',
  533. collapseIcon : 'fa-minus',
  534. expandIcon : 'fa-plus',
  535. removeIcon : 'fa-times'
  536. }
  537. var Selector = {
  538. data : '.box',
  539. collapsed: '.collapsed-box',
  540. body : '.box-body',
  541. footer : '.box-footer',
  542. tools : '.box-tools'
  543. }
  544. var ClassName = {
  545. collapsed: 'collapsed-box'
  546. }
  547. var Event = {
  548. collapsed: 'collapsed.boxwidget',
  549. expanded : 'expanded.boxwidget',
  550. removed : 'removed.boxwidget'
  551. }
  552. // BoxWidget Class Definition
  553. var BoxWidget = function (element, options) {
  554. this.element = element
  555. this.options = options
  556. this._setUpListeners()
  557. }
  558. BoxWidget.prototype.toggle = function () {
  559. var isOpen = !$(this.element).is(Selector.collapsed)
  560. if (isOpen) {
  561. this.collapse()
  562. } else {
  563. this.expand()
  564. }
  565. }
  566. BoxWidget.prototype.expand = function () {
  567. var expandedEvent = $.Event(Event.expanded)
  568. var collapseIcon = this.options.collapseIcon
  569. var expandIcon = this.options.expandIcon
  570. $(this.element).removeClass(ClassName.collapsed)
  571. $(this.element)
  572. .find(Selector.tools)
  573. .find('.' + expandIcon)
  574. .removeClass(expandIcon)
  575. .addClass(collapseIcon)
  576. $(this.element).find(Selector.body + ', ' + Selector.footer)
  577. .slideDown(this.options.animationSpeed, function () {
  578. $(this.element).trigger(expandedEvent)
  579. }.bind(this))
  580. }
  581. BoxWidget.prototype.collapse = function () {
  582. var collapsedEvent = $.Event(Event.collapsed)
  583. var collapseIcon = this.options.collapseIcon
  584. var expandIcon = this.options.expandIcon
  585. $(this.element)
  586. .find(Selector.tools)
  587. .find('.' + collapseIcon)
  588. .removeClass(collapseIcon)
  589. .addClass(expandIcon)
  590. $(this.element).find(Selector.body + ', ' + Selector.footer)
  591. .slideUp(this.options.animationSpeed, function () {
  592. $(this.element).addClass(ClassName.collapsed)
  593. $(this.element).trigger(collapsedEvent)
  594. }.bind(this))
  595. }
  596. BoxWidget.prototype.remove = function () {
  597. var removedEvent = $.Event(Event.removed)
  598. $(this.element).slideUp(this.options.animationSpeed, function () {
  599. $(this.element).trigger(removedEvent)
  600. $(this.element).remove()
  601. }.bind(this))
  602. }
  603. // Private
  604. BoxWidget.prototype._setUpListeners = function () {
  605. var that = this
  606. $(this.element).on('click', this.options.collapseTrigger, function (event) {
  607. if (event) event.preventDefault()
  608. that.toggle()
  609. })
  610. $(this.element).on('click', this.options.removeTrigger, function (event) {
  611. if (event) event.preventDefault()
  612. that.remove()
  613. })
  614. }
  615. // Plugin Definition
  616. function Plugin(option) {
  617. return this.each(function () {
  618. var $this = $(this)
  619. var data = $this.data(DataKey)
  620. if (!data) {
  621. var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
  622. $this.data(DataKey, (data = new BoxWidget($this, options)))
  623. }
  624. if (typeof option == 'string') {
  625. if (typeof data[option] == 'undefined') {
  626. throw new Error('No method named ' + option)
  627. }
  628. data[option]()
  629. }
  630. })
  631. }
  632. var old = $.fn.boxWidget
  633. $.fn.boxWidget = Plugin
  634. $.fn.boxWidget.Constructor = BoxWidget
  635. // No Conflict Mode
  636. $.fn.boxWidget.noConflict = function () {
  637. $.fn.boxWidget = old
  638. return this
  639. }
  640. // BoxWidget Data API
  641. $(window).on('load', function () {
  642. $(Selector.data).each(function () {
  643. Plugin.call($(this))
  644. })
  645. })
  646. }(jQuery) // End of use strict
  647. /* TodoList()
  648. * Converts a list into a todoList.
  649. *
  650. * @Usage: $('.my-list').todoList(options)
  651. * or add [data-widget="todo-list"] to the ul element
  652. * Pass any option as data-option="value"
  653. */
  654. +function ($) {
  655. 'use strict'
  656. var DataKey = 'Masteradmin.todolist'
  657. var Default = {
  658. iCheck : false,
  659. onCheck : function () {
  660. },
  661. onUnCheck: function () {
  662. }
  663. }
  664. var Selector = {
  665. data: '[data-widget="todo-list"]'
  666. }
  667. var ClassName = {
  668. done: 'done'
  669. }
  670. // TodoList Class Definition
  671. var TodoList = function (element, options) {
  672. this.element = element
  673. this.options = options
  674. this._setUpListeners()
  675. }
  676. TodoList.prototype.toggle = function (item) {
  677. item.parents(Selector.li).first().toggleClass(ClassName.done)
  678. if (!item.prop('checked')) {
  679. this.unCheck(item)
  680. return
  681. }
  682. this.check(item)
  683. }
  684. TodoList.prototype.check = function (item) {
  685. this.options.onCheck.call(item)
  686. }
  687. TodoList.prototype.unCheck = function (item) {
  688. this.options.onUnCheck.call(item)
  689. }
  690. // Private
  691. TodoList.prototype._setUpListeners = function () {
  692. var that = this
  693. $(this.element).on('change ifChanged', 'input:checkbox', function () {
  694. that.toggle($(this))
  695. })
  696. }
  697. // Plugin Definition
  698. function Plugin(option) {
  699. return this.each(function () {
  700. var $this = $(this)
  701. var data = $this.data(DataKey)
  702. if (!data) {
  703. var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option)
  704. $this.data(DataKey, (data = new TodoList($this, options)))
  705. }
  706. if (typeof data == 'string') {
  707. if (typeof data[option] == 'undefined') {
  708. throw new Error('No method named ' + option)
  709. }
  710. data[option]()
  711. }
  712. })
  713. }
  714. var old = $.fn.todoList
  715. $.fn.todoList = Plugin
  716. $.fn.todoList.Constructor = TodoList
  717. // No Conflict Mode
  718. $.fn.todoList.noConflict = function () {
  719. $.fn.todoList = old
  720. return this
  721. }
  722. // TodoList Data API
  723. $(window).on('load', function () {
  724. $(Selector.data).each(function () {
  725. Plugin.call($(this))
  726. })
  727. })
  728. }(jQuery) // End of use strict
  729. /* DirectChat()
  730. * Toggles the state of the control sidebar
  731. *
  732. * @Usage: $('#my-chat-box').directChat()
  733. * or add [data-widget="direct-chat"] to the trigger
  734. */
  735. +function ($) {
  736. 'use strict'
  737. var DataKey = 'Masteradmin.directchat'
  738. var Selector = {
  739. data: '[data-widget="chat-pane-toggle"]',
  740. box : '.direct-chat'
  741. }
  742. var ClassName = {
  743. open: 'direct-chat-contacts-open'
  744. }
  745. // DirectChat Class Definition
  746. var DirectChat = function (element) {
  747. this.element = element
  748. }
  749. DirectChat.prototype.toggle = function ($trigger) {
  750. $trigger.parents(Selector.box).first().toggleClass(ClassName.open)
  751. }
  752. // Plugin Definition
  753. function Plugin(option) {
  754. return this.each(function () {
  755. var $this = $(this)
  756. var data = $this.data(DataKey)
  757. if (!data) {
  758. $this.data(DataKey, (data = new DirectChat($this)))
  759. }
  760. if (typeof option == 'string') data.toggle($this)
  761. })
  762. }
  763. var old = $.fn.directChat
  764. $.fn.directChat = Plugin
  765. $.fn.directChat.Constructor = DirectChat
  766. // No Conflict Mode
  767. $.fn.directChat.noConflict = function () {
  768. $.fn.directChat = old
  769. return this
  770. }
  771. // DirectChat Data API
  772. $(document).on('click', Selector.data, function (event) {
  773. if (event) event.preventDefault()
  774. Plugin.call($(this), 'toggle')
  775. })
  776. // Slim scrolling
  777. $('.inner-content-div').slimScroll({
  778. height: '200'
  779. });
  780. $('.sm-scrol').slimScroll({
  781. height: '250'
  782. });
  783. $('.direct-chat-messages').slimScroll({
  784. height: '420'
  785. });
  786. $('.chat-box-one').slimScroll({
  787. height: '550'
  788. });
  789. $('.chat-box-one2').slimScroll({
  790. height: '580'
  791. });
  792. $('.chat-box-one-side').slimScroll({
  793. height: '650'
  794. });
  795. $('.chat-box-one-side2').slimScroll({
  796. height: '500'
  797. });
  798. $('.chat-box-one-side3').slimScroll({
  799. height: '685'
  800. });
  801. $('.notification-side').slimScroll({
  802. height: '325'
  803. });
  804. $('.suggestions-side').slimScroll({
  805. height: '300'
  806. });
  807. $('.events-side').slimScroll({
  808. height: '265'
  809. });
  810. $('.pat-div').slimScroll({
  811. height: '204'
  812. });
  813. $('.demo-panel-bx').slimScroll({
  814. height: 'auto'
  815. });
  816. $(".search-box a, .search-box .app-search .srh-btn").on('click', function() {
  817. $(".app-search").toggle(200);
  818. });
  819. // Close
  820. //
  821. $(document).on('click', '.box-btn-close', function() {
  822. $(this).parents('.box').fadeOut(600, function() {
  823. if ($(this).parent().children().length == 1) {
  824. $(this).parent().remove();
  825. }
  826. else {
  827. $(this).remove();
  828. }
  829. });
  830. });
  831. // Slide up/down
  832. //
  833. $(document).on('click', '.box-btn-slide', function(){
  834. $(this).toggleClass('rotate-180').parents('.box').find('.box-content, .box-body').slideToggle();
  835. });
  836. // Maximize
  837. //
  838. $(document).on('click', '.box-btn-maximize', function(){
  839. $(this).parents('.box').toggleClass('box-maximize').removeClass('box-fullscreen');
  840. });
  841. // Fullscreen
  842. //
  843. $(document).on('click', '.box-btn-fullscreen', function(){
  844. $(this).parents('.box').toggleClass('box-fullscreen').removeClass('box-maximize');
  845. });
  846. // Disable demonstrative links!
  847. //
  848. $(document).on('click', 'a[href="#"]', function(e){
  849. e.preventDefault();
  850. });
  851. // This is for the innerleft sidebar
  852. $(".open-left-block").on('click', function() {
  853. $('.left-block').toggleClass('open-panel');
  854. $('.open-left-block').toggleClass('mdi-menu');
  855. });
  856. // Upload
  857. //
  858. $(document).on('click', '.file-browser', function() {
  859. var $browser = $(this);
  860. if ( $browser.hasClass('form-control') ) {
  861. setTimeout(function(){
  862. $browser.closest('.file-group').find('[type="file"]').trigger('click');
  863. },300);
  864. }
  865. else {
  866. var file = $browser.closest('.file-group').find('[type="file"]');
  867. file.on( 'click', function(e) {
  868. e.stopPropagation();
  869. });
  870. file.trigger('click');
  871. }
  872. });
  873. // Event to change file name after file selection
  874. $(document).on('change', '.file-group [type="file"]', function(){
  875. var input = $(this)[0];
  876. var len = input.files.length;
  877. var filename = '';
  878. for (var i = 0; i < len; ++i) {
  879. filename += input.files.item(i).name + ', ';
  880. }
  881. filename = filename.substr(0, filename.length-2);
  882. $(this).closest('.file-group').find('.file-value').val(filename).text(filename).focus();
  883. });
  884. // Update file name for bootstrap custom file upload
  885. $(document).on('change', '.custom-file-input', function(){
  886. var filename = $(this).val().split('\\').pop();
  887. $(this).next('.custom-file-control').attr('data-input-value', filename);
  888. });
  889. $('.custom-file-control:not([data-input-value])').attr('data-input-value', 'Choose file...');
  890. /* The todo list plugin */
  891. $('.todo-list').todoList({
  892. onCheck : function () {
  893. window.console.log($(this), 'The element has been checked');
  894. },
  895. onUnCheck: function () {
  896. window.console.log($(this), 'The element has been unchecked');
  897. }
  898. });
  899. // bradcrumb section
  900. $('#thismonth').sparkline([8, 5, 4, 7, 9, 7, 10, 9], {
  901. type: 'bar',
  902. height: '35',
  903. barWidth: '4',
  904. resize: true,
  905. barSpacing: '4',
  906. barColor: '#843cf7'
  907. });
  908. $('#lastyear').sparkline([8, 5, 4, 7, 9, 7, 10, 9], {
  909. type: 'bar',
  910. height: '35',
  911. barWidth: '4',
  912. resize: true,
  913. barSpacing: '4',
  914. barColor: '#ec4b71'
  915. });
  916. var sparkResize;
  917. $("#chat-circle, #chat-box-toggle, #chat-popup").click(function(){
  918. $("#chat-box-body").toggleClass("show");
  919. });
  920. }(jQuery) // End of use strict
  921. // Fullscreen
  922. $(function () {
  923. 'use strict'
  924. $('[data-provide~="fullscreen"]').on('click', function () {
  925. screenfull.toggle($('#container')[0]);
  926. });
  927. }); // End of use strict
  928. +function ($) {
  929. 'use strict'
  930. // Dynamic active menu
  931. var path = window.location.pathname.split("/").pop();
  932. var target = $('.sidebar-menu li a[href="'+path+'"]');
  933. target.parent().addClass('active');
  934. $('.sidebar-menu li.active').parents('li').addClass('active');
  935. }(jQuery) // End of use strict
  936. +function ($) {
  937. 'use strict'
  938. // Dynamic active horizontal menu
  939. var path = window.location.pathname.split("/").pop();
  940. var target = $('.sm li a[href="'+path+'"]');
  941. target.parent().addClass('current');
  942. $('.sm li.current').parents('li').addClass('current');
  943. }(jQuery) // End of use strict
  944. // feather icon
  945. $(function () {
  946. 'use strict'
  947. feather.replace();
  948. }); // End of use strict
  949. /*!
  950. * Waves v0.6.4
  951. * http://fian.my.id/Waves
  952. *
  953. * Copyright 2014 Alfiana E. Sibuea and other contributors
  954. * Released under the MIT license
  955. * https://github.com/fians/Waves/blob/master/LICENSE
  956. */
  957. ;(function(window) {
  958. 'use strict';
  959. var Waves = Waves || {};
  960. var $$ = document.querySelectorAll.bind(document);
  961. // Find exact position of element
  962. function isWindow(obj) {
  963. return obj !== null && obj === obj.window;
  964. }
  965. function getWindow(elem) {
  966. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  967. }
  968. function offset(elem) {
  969. var docElem, win,
  970. box = {top: 0, left: 0},
  971. doc = elem && elem.ownerDocument;
  972. docElem = doc.documentElement;
  973. if (typeof elem.getBoundingClientRect !== typeof undefined) {
  974. box = elem.getBoundingClientRect();
  975. }
  976. win = getWindow(doc);
  977. return {
  978. top: box.top + win.pageYOffset - docElem.clientTop,
  979. left: box.left + win.pageXOffset - docElem.clientLeft
  980. };
  981. }
  982. function convertStyle(obj) {
  983. var style = '';
  984. for (var a in obj) {
  985. if (obj.hasOwnProperty(a)) {
  986. style += (a + ':' + obj[a] + ';');
  987. }
  988. }
  989. return style;
  990. }
  991. var Effect = {
  992. // Effect delay
  993. duration: 750,
  994. show: function(e, element) {
  995. // Disable right click
  996. if (e.button === 2) {
  997. return false;
  998. }
  999. var el = element || this;
  1000. // Create ripple
  1001. var ripple = document.createElement('div');
  1002. ripple.className = 'waves-ripple';
  1003. el.appendChild(ripple);
  1004. // Get click coordinate and element witdh
  1005. var pos = offset(el);
  1006. var relativeY = (e.pageY - pos.top);
  1007. var relativeX = (e.pageX - pos.left);
  1008. var scale = 'scale('+((el.clientWidth / 100) * 10)+')';
  1009. // Support for touch devices
  1010. if ('touches' in e) {
  1011. relativeY = (e.touches[0].pageY - pos.top);
  1012. relativeX = (e.touches[0].pageX - pos.left);
  1013. }
  1014. // Attach data to element
  1015. ripple.setAttribute('data-hold', Date.now());
  1016. ripple.setAttribute('data-scale', scale);
  1017. ripple.setAttribute('data-x', relativeX);
  1018. ripple.setAttribute('data-y', relativeY);
  1019. // Set ripple position
  1020. var rippleStyle = {
  1021. 'top': relativeY+'px',
  1022. 'left': relativeX+'px'
  1023. };
  1024. ripple.className = ripple.className + ' waves-notransition';
  1025. ripple.setAttribute('style', convertStyle(rippleStyle));
  1026. ripple.className = ripple.className.replace('waves-notransition', '');
  1027. // Scale the ripple
  1028. rippleStyle['-webkit-transform'] = scale;
  1029. rippleStyle['-moz-transform'] = scale;
  1030. rippleStyle['-ms-transform'] = scale;
  1031. rippleStyle['-o-transform'] = scale;
  1032. rippleStyle.transform = scale;
  1033. rippleStyle.opacity = '1';
  1034. rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
  1035. rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
  1036. rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
  1037. rippleStyle['transition-duration'] = Effect.duration + 'ms';
  1038. rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  1039. rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  1040. rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  1041. rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  1042. ripple.setAttribute('style', convertStyle(rippleStyle));
  1043. },
  1044. hide: function(e) {
  1045. TouchHandler.touchup(e);
  1046. var el = this;
  1047. var width = el.clientWidth * 1.4;
  1048. // Get first ripple
  1049. var ripple = null;
  1050. var ripples = el.getElementsByClassName('waves-ripple');
  1051. if (ripples.length > 0) {
  1052. ripple = ripples[ripples.length - 1];
  1053. } else {
  1054. return false;
  1055. }
  1056. var relativeX = ripple.getAttribute('data-x');
  1057. var relativeY = ripple.getAttribute('data-y');
  1058. var scale = ripple.getAttribute('data-scale');
  1059. // Get delay beetween mousedown and mouse leave
  1060. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  1061. var delay = 350 - diff;
  1062. if (delay < 0) {
  1063. delay = 0;
  1064. }
  1065. // Fade out ripple after delay
  1066. setTimeout(function() {
  1067. var style = {
  1068. 'top': relativeY+'px',
  1069. 'left': relativeX+'px',
  1070. 'opacity': '0',
  1071. // Duration
  1072. '-webkit-transition-duration': Effect.duration + 'ms',
  1073. '-moz-transition-duration': Effect.duration + 'ms',
  1074. '-o-transition-duration': Effect.duration + 'ms',
  1075. 'transition-duration': Effect.duration + 'ms',
  1076. '-webkit-transform': scale,
  1077. '-moz-transform': scale,
  1078. '-ms-transform': scale,
  1079. '-o-transform': scale,
  1080. 'transform': scale,
  1081. };
  1082. ripple.setAttribute('style', convertStyle(style));
  1083. setTimeout(function() {
  1084. try {
  1085. el.removeChild(ripple);
  1086. } catch(e) {
  1087. return false;
  1088. }
  1089. }, Effect.duration);
  1090. }, delay);
  1091. },
  1092. // Little hack to make <input> can perform waves effect
  1093. wrapInput: function(elements) {
  1094. for (var a = 0; a < elements.length; a++) {
  1095. var el = elements[a];
  1096. if (el.tagName.toLowerCase() === 'input') {
  1097. var parent = el.parentNode;
  1098. // If input already have parent just pass through
  1099. if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
  1100. continue;
  1101. }
  1102. // Put element class and style to the specified parent
  1103. var wrapper = document.createElement('i');
  1104. wrapper.className = el.className + ' waves-input-wrapper';
  1105. var elementStyle = el.getAttribute('style');
  1106. if (!elementStyle) {
  1107. elementStyle = '';
  1108. }
  1109. wrapper.setAttribute('style', elementStyle);
  1110. el.className = 'waves-button-input';
  1111. el.removeAttribute('style');
  1112. // Put element as child
  1113. parent.replaceChild(wrapper, el);
  1114. wrapper.appendChild(el);
  1115. }
  1116. }
  1117. }
  1118. };
  1119. /**
  1120. * Disable mousedown event for 500ms during and after touch
  1121. */
  1122. var TouchHandler = {
  1123. /* uses an integer rather than bool so there's no issues with
  1124. * needing to clear timeouts if another touch event occurred
  1125. * within the 500ms. Cannot mouseup between touchstart and
  1126. * touchend, nor in the 500ms after touchend. */
  1127. touches: 0,
  1128. allowEvent: function(e) {
  1129. var allow = true;
  1130. if (e.type === 'touchstart') {
  1131. TouchHandler.touches += 1; //push
  1132. } else if (e.type === 'touchend' || e.type === 'touchcancel') {
  1133. setTimeout(function() {
  1134. if (TouchHandler.touches > 0) {
  1135. TouchHandler.touches -= 1; //pop after 500ms
  1136. }
  1137. }, 500);
  1138. } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
  1139. allow = false;
  1140. }
  1141. return allow;
  1142. },
  1143. touchup: function(e) {
  1144. TouchHandler.allowEvent(e);
  1145. }
  1146. };
  1147. /**
  1148. * Delegated click handler for .waves-effect element.
  1149. * returns null when .waves-effect element not in "click tree"
  1150. */
  1151. function getWavesEffectElement(e) {
  1152. if (TouchHandler.allowEvent(e) === false) {
  1153. return null;
  1154. }
  1155. var element = null;
  1156. var target = e.target || e.srcElement;
  1157. while (target.parentNode !== null) {
  1158. if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
  1159. element = target;
  1160. break;
  1161. }
  1162. target = target.parentNode;
  1163. }
  1164. return element;
  1165. }
  1166. /**
  1167. * Bubble the click and show effect if .waves-effect elem was found
  1168. */
  1169. function showEffect(e) {
  1170. var element = getWavesEffectElement(e);
  1171. if (element !== null) {
  1172. Effect.show(e, element);
  1173. if ('ontouchstart' in window) {
  1174. element.addEventListener('touchend', Effect.hide, false);
  1175. element.addEventListener('touchcancel', Effect.hide, false);
  1176. }
  1177. element.addEventListener('mouseup', Effect.hide, false);
  1178. element.addEventListener('mouseleave', Effect.hide, false);
  1179. element.addEventListener('dragend', Effect.hide, false);
  1180. }
  1181. }
  1182. Waves.displayEffect = function(options) {
  1183. options = options || {};
  1184. if ('duration' in options) {
  1185. Effect.duration = options.duration;
  1186. }
  1187. //Wrap input inside <i> tag
  1188. Effect.wrapInput($$('.waves-effect'));
  1189. if ('ontouchstart' in window) {
  1190. document.body.addEventListener('touchstart', showEffect, false);
  1191. }
  1192. document.body.addEventListener('mousedown', showEffect, false);
  1193. };
  1194. /**
  1195. * Attach Waves to an input element (or any element which doesn't
  1196. * bubble mouseup/mousedown events).
  1197. * Intended to be used with dynamically loaded forms/inputs, or
  1198. * where the user doesn't want a delegated click handler.
  1199. */
  1200. Waves.attach = function(element) {
  1201. //FUTURE: automatically add waves classes and allow users
  1202. // to specify them with an options param? Eg. light/classic/button
  1203. if (element.tagName.toLowerCase() === 'input') {
  1204. Effect.wrapInput([element]);
  1205. element = element.parentNode;
  1206. }
  1207. if ('ontouchstart' in window) {
  1208. element.addEventListener('touchstart', showEffect, false);
  1209. }
  1210. element.addEventListener('mousedown', showEffect, false);
  1211. };
  1212. window.Waves = Waves;
  1213. document.addEventListener('DOMContentLoaded', function() {
  1214. Waves.displayEffect();
  1215. }, false);
  1216. })(window);
  1217. // Demo panel
  1218. function w3_open() {
  1219. document.getElementById("mySidebar").style.display = "block";
  1220. document.getElementById("myOverlay").style.display = "block";
  1221. }
  1222. function w3_close() {
  1223. document.getElementById("mySidebar").style.display = "none";
  1224. document.getElementById("myOverlay").style.display = "none";
  1225. }
  1226. // loader
  1227. var loader;
  1228. function loadNow(opacity) {
  1229. if (opacity <= 0) {
  1230. displayContent();
  1231. } else {
  1232. loader.style.opacity = opacity;
  1233. window.setTimeout(function() {
  1234. loadNow(opacity - 0.05);
  1235. }, 50);
  1236. }
  1237. }
  1238. function displayContent() {
  1239. loader.style.display = 'none';
  1240. }
  1241. document.addEventListener("DOMContentLoaded", function() {
  1242. loader = document.getElementById('loader');
  1243. loadNow(1);
  1244. });
  1245. new PerfectScrollbar(".multinav-scroll");
  1246. var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
  1247. var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  1248. return new bootstrap.Tooltip(tooltipTriggerEl)
  1249. })
  1250. $('#sidebarRight').slimScroll({
  1251. height: '100%'
  1252. });
  1253. $(".right-bar-btn").click(function(){
  1254. $("body").toggleClass("right-bar-toggle");
  1255. });
  1256. /* $(function () {
  1257. 'use strict';
  1258. var optionsSpark1 = {
  1259. series: [{
  1260. name: "Sales",
  1261. data: [12, 14, 9, 27, 32, 15]
  1262. }],
  1263. chart: {
  1264. type: 'area',
  1265. height: 60,
  1266. width:100,
  1267. sparkline: {
  1268. enabled: true
  1269. },
  1270. },
  1271. colors: ["#01b075"],
  1272. stroke: {
  1273. curve: 'smooth'
  1274. },
  1275. fill: {
  1276. opacity: 0.3
  1277. },
  1278. yaxis: {
  1279. min: 0
  1280. },
  1281. };
  1282. var chartSpark1 = new ApexCharts(document.querySelector("#chart-spark1"), optionsSpark1);
  1283. chartSpark1.render();
  1284. var optionsSpark2 = {
  1285. series: [{
  1286. name: "Sessions",
  1287. data: [12, 14, 9, 27, 32, 15]
  1288. }],
  1289. chart: {
  1290. type: 'area',
  1291. height: 60,
  1292. width:100,
  1293. sparkline: {
  1294. enabled: true
  1295. },
  1296. },
  1297. colors: ["#4c95dd"],
  1298. stroke: {
  1299. curve: 'smooth'
  1300. },
  1301. fill: {
  1302. opacity: 0.3
  1303. },
  1304. yaxis: {
  1305. min: 0
  1306. },
  1307. };
  1308. var chartSpark2 = new ApexCharts(document.querySelector("#chart-spark2"), optionsSpark2);
  1309. chartSpark2.render();
  1310. var options = {
  1311. series: [{
  1312. name: 'First Time',
  1313. data: [31, 40, 28, 51, 42, 109, 100]
  1314. }, {
  1315. name: 'Returning',
  1316. data: [11, 32, 45, 32, 34, 52, 41]
  1317. }],
  1318. chart: {
  1319. width: 150,
  1320. height: 120,
  1321. type: 'area',
  1322. zoom: {
  1323. enabled: false
  1324. },
  1325. },
  1326. dataLabels: {
  1327. enabled: false
  1328. },
  1329. colors: ["#e66430", "#4c95dd"],
  1330. stroke: {
  1331. curve: 'smooth',
  1332. width: 0.5,
  1333. },
  1334. grid: {
  1335. show: false,
  1336. },
  1337. xaxis: {
  1338. categories: ["Mon","Tue","Wed","Thu","Fri","Set","Sun"],
  1339. labels: {
  1340. show: false,
  1341. },
  1342. },
  1343. yaxis: {
  1344. labels: {
  1345. show: false,
  1346. },
  1347. },
  1348. legend: {
  1349. show: false,
  1350. },
  1351. };
  1352. var chart = new ApexCharts(document.querySelector("#chart3"), options);
  1353. chart.render();
  1354. });*/ // End of use strict