argon.js 20 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  1. /*!
  2. =========================================================
  3. * Argon Dashboard - v1.2.0
  4. =========================================================
  5. * Product Page: https://www.creative-tim.com/product/argon-dashboard
  6. * Copyright 2020 Creative Tim (https://www.creative-tim.com)
  7. * Licensed under MIT (https://github.com/creativetimofficial/argon-dashboard/blob/master/LICENSE.md)
  8. * Coded by www.creative-tim.com
  9. =========================================================
  10. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  11. */
  12. //
  13. // Layout
  14. //
  15. 'use strict';
  16. var Layout = (function() {
  17. function pinSidenav() {
  18. $('.sidenav-toggler').addClass('active');
  19. $('.sidenav-toggler').data('action', 'sidenav-unpin');
  20. $('body').removeClass('g-sidenav-hidden').addClass('g-sidenav-show g-sidenav-pinned');
  21. $('body').append('<div class="backdrop d-xl-none" data-action="sidenav-unpin" data-target='+$('#sidenav-main').data('target')+' />');
  22. // Store the sidenav state in a cookie session
  23. Cookies.set('sidenav-state', 'pinned');
  24. }
  25. function unpinSidenav() {
  26. $('.sidenav-toggler').removeClass('active');
  27. $('.sidenav-toggler').data('action', 'sidenav-pin');
  28. $('body').removeClass('g-sidenav-pinned').addClass('g-sidenav-hidden');
  29. $('body').find('.backdrop').remove();
  30. // Store the sidenav state in a cookie session
  31. Cookies.set('sidenav-state', 'unpinned');
  32. }
  33. // Set sidenav state from cookie
  34. var $sidenavState = Cookies.get('sidenav-state') ? Cookies.get('sidenav-state') : 'pinned';
  35. if($(window).width() > 1200) {
  36. if($sidenavState == 'pinned') {
  37. pinSidenav()
  38. }
  39. if(Cookies.get('sidenav-state') == 'unpinned') {
  40. unpinSidenav()
  41. }
  42. $(window).resize(function() {
  43. if( $('body').hasClass('g-sidenav-show') && !$('body').hasClass('g-sidenav-pinned')) {
  44. $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hidden');
  45. }
  46. })
  47. }
  48. if($(window).width() < 1200){
  49. $('body').removeClass('g-sidenav-hide').addClass('g-sidenav-hidden');
  50. $('body').removeClass('g-sidenav-show');
  51. $(window).resize(function() {
  52. if( $('body').hasClass('g-sidenav-show') && !$('body').hasClass('g-sidenav-pinned')) {
  53. $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hidden');
  54. }
  55. })
  56. }
  57. $("body").on("click", "[data-action]", function(e) {
  58. e.preventDefault();
  59. var $this = $(this);
  60. var action = $this.data('action');
  61. var target = $this.data('target');
  62. // Manage actions
  63. switch (action) {
  64. case 'sidenav-pin':
  65. pinSidenav();
  66. break;
  67. case 'sidenav-unpin':
  68. unpinSidenav();
  69. break;
  70. case 'search-show':
  71. target = $this.data('target');
  72. $('body').removeClass('g-navbar-search-show').addClass('g-navbar-search-showing');
  73. setTimeout(function() {
  74. $('body').removeClass('g-navbar-search-showing').addClass('g-navbar-search-show');
  75. }, 150);
  76. setTimeout(function() {
  77. $('body').addClass('g-navbar-search-shown');
  78. }, 300)
  79. break;
  80. case 'search-close':
  81. target = $this.data('target');
  82. $('body').removeClass('g-navbar-search-shown');
  83. setTimeout(function() {
  84. $('body').removeClass('g-navbar-search-show').addClass('g-navbar-search-hiding');
  85. }, 150);
  86. setTimeout(function() {
  87. $('body').removeClass('g-navbar-search-hiding').addClass('g-navbar-search-hidden');
  88. }, 300);
  89. setTimeout(function() {
  90. $('body').removeClass('g-navbar-search-hidden');
  91. }, 500);
  92. break;
  93. }
  94. })
  95. // Add sidenav modifier classes on mouse events
  96. $('.sidenav').on('mouseenter', function() {
  97. if(! $('body').hasClass('g-sidenav-pinned')) {
  98. $('body').removeClass('g-sidenav-hide').removeClass('g-sidenav-hidden').addClass('g-sidenav-show');
  99. }
  100. })
  101. $('.sidenav').on('mouseleave', function() {
  102. if(! $('body').hasClass('g-sidenav-pinned')) {
  103. $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hide');
  104. setTimeout(function() {
  105. $('body').removeClass('g-sidenav-hide').addClass('g-sidenav-hidden');
  106. }, 300);
  107. }
  108. })
  109. // Make the body full screen size if it has not enough content inside
  110. $(window).on('load resize', function() {
  111. if($('body').height() < 800) {
  112. $('body').css('min-height', '100vh');
  113. $('#footer-main').addClass('footer-auto-bottom')
  114. }
  115. })
  116. })();
  117. //
  118. // Charts
  119. //
  120. 'use strict';
  121. var Charts = (function() {
  122. // Variable
  123. var $toggle = $('[data-toggle="chart"]');
  124. var mode = 'light';//(themeMode) ? themeMode : 'light';
  125. var fonts = {
  126. base: 'Open Sans'
  127. }
  128. // Colors
  129. var colors = {
  130. gray: {
  131. 100: '#f6f9fc',
  132. 200: '#e9ecef',
  133. 300: '#dee2e6',
  134. 400: '#ced4da',
  135. 500: '#adb5bd',
  136. 600: '#8898aa',
  137. 700: '#525f7f',
  138. 800: '#32325d',
  139. 900: '#212529'
  140. },
  141. theme: {
  142. 'default': '#172b4d',
  143. 'primary': '#5e72e4',
  144. 'secondary': '#f4f5f7',
  145. 'info': '#11cdef',
  146. 'success': '#2dce89',
  147. 'danger': '#f5365c',
  148. 'warning': '#fb6340'
  149. },
  150. black: '#12263F',
  151. white: '#FFFFFF',
  152. transparent: 'transparent',
  153. };
  154. // Methods
  155. // Chart.js global options
  156. function chartOptions() {
  157. // Options
  158. var options = {
  159. defaults: {
  160. global: {
  161. responsive: true,
  162. maintainAspectRatio: false,
  163. defaultColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600],
  164. defaultFontColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600],
  165. defaultFontFamily: fonts.base,
  166. defaultFontSize: 13,
  167. layout: {
  168. padding: 0
  169. },
  170. legend: {
  171. display: false,
  172. position: 'bottom',
  173. labels: {
  174. usePointStyle: true,
  175. padding: 16
  176. }
  177. },
  178. elements: {
  179. point: {
  180. radius: 0,
  181. backgroundColor: colors.theme['primary']
  182. },
  183. line: {
  184. tension: .4,
  185. borderWidth: 4,
  186. borderColor: colors.theme['primary'],
  187. backgroundColor: colors.transparent,
  188. borderCapStyle: 'rounded'
  189. },
  190. rectangle: {
  191. backgroundColor: colors.theme['warning']
  192. },
  193. arc: {
  194. backgroundColor: colors.theme['primary'],
  195. borderColor: (mode == 'dark') ? colors.gray[800] : colors.white,
  196. borderWidth: 4
  197. }
  198. },
  199. tooltips: {
  200. enabled: true,
  201. mode: 'index',
  202. intersect: false,
  203. }
  204. },
  205. doughnut: {
  206. cutoutPercentage: 83,
  207. legendCallback: function(chart) {
  208. var data = chart.data;
  209. var content = '';
  210. data.labels.forEach(function(label, index) {
  211. var bgColor = data.datasets[0].backgroundColor[index];
  212. content += '<span class="chart-legend-item">';
  213. content += '<i class="chart-legend-indicator" style="background-color: ' + bgColor + '"></i>';
  214. content += label;
  215. content += '</span>';
  216. });
  217. return content;
  218. }
  219. }
  220. }
  221. }
  222. // yAxes
  223. Chart.scaleService.updateScaleDefaults('linear', {
  224. gridLines: {
  225. borderDash: [2],
  226. borderDashOffset: [2],
  227. color: (mode == 'dark') ? colors.gray[900] : colors.gray[300],
  228. drawBorder: false,
  229. drawTicks: false,
  230. drawOnChartArea: true,
  231. zeroLineWidth: 0,
  232. zeroLineColor: 'rgba(0,0,0,0)',
  233. zeroLineBorderDash: [2],
  234. zeroLineBorderDashOffset: [2]
  235. },
  236. ticks: {
  237. beginAtZero: true,
  238. padding: 10,
  239. callback: function(value) {
  240. if (!(value % 10)) {
  241. return value
  242. }
  243. }
  244. }
  245. });
  246. // xAxes
  247. Chart.scaleService.updateScaleDefaults('category', {
  248. gridLines: {
  249. drawBorder: false,
  250. drawOnChartArea: false,
  251. drawTicks: false
  252. },
  253. ticks: {
  254. padding: 20
  255. },
  256. maxBarThickness: 10
  257. });
  258. return options;
  259. }
  260. // Parse global options
  261. function parseOptions(parent, options) {
  262. for (var item in options) {
  263. if (typeof options[item] !== 'object') {
  264. parent[item] = options[item];
  265. } else {
  266. parseOptions(parent[item], options[item]);
  267. }
  268. }
  269. }
  270. // Push options
  271. function pushOptions(parent, options) {
  272. for (var item in options) {
  273. if (Array.isArray(options[item])) {
  274. options[item].forEach(function(data) {
  275. parent[item].push(data);
  276. });
  277. } else {
  278. pushOptions(parent[item], options[item]);
  279. }
  280. }
  281. }
  282. // Pop options
  283. function popOptions(parent, options) {
  284. for (var item in options) {
  285. if (Array.isArray(options[item])) {
  286. options[item].forEach(function(data) {
  287. parent[item].pop();
  288. });
  289. } else {
  290. popOptions(parent[item], options[item]);
  291. }
  292. }
  293. }
  294. // Toggle options
  295. function toggleOptions(elem) {
  296. var options = elem.data('add');
  297. var $target = $(elem.data('target'));
  298. var $chart = $target.data('chart');
  299. if (elem.is(':checked')) {
  300. // Add options
  301. pushOptions($chart, options);
  302. // Update chart
  303. $chart.update();
  304. } else {
  305. // Remove options
  306. popOptions($chart, options);
  307. // Update chart
  308. $chart.update();
  309. }
  310. }
  311. // Update options
  312. function updateOptions(elem) {
  313. var options = elem.data('update');
  314. var $target = $(elem.data('target'));
  315. var $chart = $target.data('chart');
  316. // Parse options
  317. parseOptions($chart, options);
  318. // Toggle ticks
  319. toggleTicks(elem, $chart);
  320. // Update chart
  321. $chart.update();
  322. }
  323. // Toggle ticks
  324. function toggleTicks(elem, $chart) {
  325. if (elem.data('prefix') !== undefined || elem.data('prefix') !== undefined) {
  326. var prefix = elem.data('prefix') ? elem.data('prefix') : '';
  327. var suffix = elem.data('suffix') ? elem.data('suffix') : '';
  328. // Update ticks
  329. $chart.options.scales.yAxes[0].ticks.callback = function(value) {
  330. if (!(value % 10)) {
  331. return prefix + value + suffix;
  332. }
  333. }
  334. // Update tooltips
  335. $chart.options.tooltips.callbacks.label = function(item, data) {
  336. var label = data.datasets[item.datasetIndex].label || '';
  337. var yLabel = item.yLabel;
  338. var content = '';
  339. if (data.datasets.length > 1) {
  340. content += '<span class="popover-body-label mr-auto">' + label + '</span>';
  341. }
  342. content += '<span class="popover-body-value">' + prefix + yLabel + suffix + '</span>';
  343. return content;
  344. }
  345. }
  346. }
  347. // Events
  348. // Parse global options
  349. if (window.Chart) {
  350. parseOptions(Chart, chartOptions());
  351. }
  352. // Toggle options
  353. $toggle.on({
  354. 'change': function() {
  355. var $this = $(this);
  356. if ($this.is('[data-add]')) {
  357. toggleOptions($this);
  358. }
  359. },
  360. 'click': function() {
  361. var $this = $(this);
  362. if ($this.is('[data-update]')) {
  363. updateOptions($this);
  364. }
  365. }
  366. });
  367. // Return
  368. return {
  369. colors: colors,
  370. fonts: fonts,
  371. mode: mode
  372. };
  373. })();
  374. //
  375. // Icon code copy/paste
  376. //
  377. 'use strict';
  378. var CopyIcon = (function() {
  379. // Variables
  380. var $element = '.btn-icon-clipboard',
  381. $btn = $($element);
  382. // Methods
  383. function init($this) {
  384. $this.tooltip().on('mouseleave', function() {
  385. // Explicitly hide tooltip, since after clicking it remains
  386. // focused (as it's a button), so tooltip would otherwise
  387. // remain visible until focus is moved away
  388. $this.tooltip('hide');
  389. });
  390. var clipboard = new ClipboardJS($element);
  391. clipboard.on('success', function(e) {
  392. $(e.trigger)
  393. .attr('title', 'Copied!')
  394. .tooltip('_fixTitle')
  395. .tooltip('show')
  396. .attr('title', 'Copy to clipboard')
  397. .tooltip('_fixTitle')
  398. e.clearSelection()
  399. });
  400. }
  401. // Events
  402. if ($btn.length) {
  403. init($btn);
  404. }
  405. })();
  406. //
  407. // Navbar
  408. //
  409. 'use strict';
  410. var Navbar = (function() {
  411. // Variables
  412. var $nav = $('.navbar-nav, .navbar-nav .nav');
  413. var $collapse = $('.navbar .collapse');
  414. var $dropdown = $('.navbar .dropdown');
  415. // Methods
  416. function accordion($this) {
  417. $this.closest($nav).find($collapse).not($this).collapse('hide');
  418. }
  419. function closeDropdown($this) {
  420. var $dropdownMenu = $this.find('.dropdown-menu');
  421. $dropdownMenu.addClass('close');
  422. setTimeout(function() {
  423. $dropdownMenu.removeClass('close');
  424. }, 200);
  425. }
  426. // Events
  427. $collapse.on({
  428. 'show.bs.collapse': function() {
  429. accordion($(this));
  430. }
  431. })
  432. $dropdown.on({
  433. 'hide.bs.dropdown': function() {
  434. closeDropdown($(this));
  435. }
  436. })
  437. })();
  438. //
  439. // Navbar collapse
  440. //
  441. var NavbarCollapse = (function() {
  442. // Variables
  443. var $nav = $('.navbar-nav'),
  444. $collapse = $('.navbar .navbar-custom-collapse');
  445. // Methods
  446. function hideNavbarCollapse($this) {
  447. $this.addClass('collapsing-out');
  448. }
  449. function hiddenNavbarCollapse($this) {
  450. $this.removeClass('collapsing-out');
  451. }
  452. // Events
  453. if ($collapse.length) {
  454. $collapse.on({
  455. 'hide.bs.collapse': function() {
  456. hideNavbarCollapse($collapse);
  457. }
  458. })
  459. $collapse.on({
  460. 'hidden.bs.collapse': function() {
  461. hiddenNavbarCollapse($collapse);
  462. }
  463. })
  464. }
  465. var navbar_menu_visible = 0;
  466. $( ".sidenav-toggler" ).click(function() {
  467. if(navbar_menu_visible == 1){
  468. $('body').removeClass('nav-open');
  469. navbar_menu_visible = 0;
  470. $('.bodyClick').remove();
  471. } else {
  472. var div = '<div class="bodyClick"></div>';
  473. $(div).appendTo('body').click(function() {
  474. $('body').removeClass('nav-open');
  475. navbar_menu_visible = 0;
  476. $('.bodyClick').remove();
  477. });
  478. $('body').addClass('nav-open');
  479. navbar_menu_visible = 1;
  480. }
  481. });
  482. })();
  483. //
  484. // Popover
  485. //
  486. 'use strict';
  487. var Popover = (function() {
  488. // Variables
  489. var $popover = $('[data-toggle="popover"]'),
  490. $popoverClass = '';
  491. // Methods
  492. function init($this) {
  493. if ($this.data('color')) {
  494. $popoverClass = 'popover-' + $this.data('color');
  495. }
  496. var options = {
  497. trigger: 'focus',
  498. template: '<div class="popover ' + $popoverClass + '" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'
  499. };
  500. $this.popover(options);
  501. }
  502. // Events
  503. if ($popover.length) {
  504. $popover.each(function() {
  505. init($(this));
  506. });
  507. }
  508. })();
  509. //
  510. // Scroll to (anchor links)
  511. //
  512. 'use strict';
  513. var ScrollTo = (function() {
  514. //
  515. // Variables
  516. //
  517. var $scrollTo = $('.scroll-me, [data-scroll-to], .toc-entry a');
  518. //
  519. // Methods
  520. //
  521. function scrollTo($this) {
  522. var $el = $this.attr('href');
  523. var offset = $this.data('scroll-to-offset') ? $this.data('scroll-to-offset') : 0;
  524. var options = {
  525. scrollTop: $($el).offset().top - offset
  526. };
  527. // Animate scroll to the selected section
  528. $('html, body').stop(true, true).animate(options, 600);
  529. event.preventDefault();
  530. }
  531. //
  532. // Events
  533. //
  534. if ($scrollTo.length) {
  535. $scrollTo.on('click', function(event) {
  536. scrollTo($(this));
  537. });
  538. }
  539. })();
  540. //
  541. // Tooltip
  542. //
  543. 'use strict';
  544. var Tooltip = (function() {
  545. // Variables
  546. var $tooltip = $('[data-toggle="tooltip"]');
  547. // Methods
  548. function init() {
  549. $tooltip.tooltip();
  550. }
  551. // Events
  552. if ($tooltip.length) {
  553. init();
  554. }
  555. })();
  556. //
  557. // Form control
  558. //
  559. 'use strict';
  560. var FormControl = (function() {
  561. // Variables
  562. var $input = $('.form-control');
  563. // Methods
  564. function init($this) {
  565. $this.on('focus blur', function(e) {
  566. $(this).parents('.form-group').toggleClass('focused', (e.type === 'focus'));
  567. }).trigger('blur');
  568. }
  569. // Events
  570. if ($input.length) {
  571. init($input);
  572. }
  573. })();
  574. //
  575. // Bars chart
  576. //
  577. var BarsChart = (function() {
  578. //
  579. // Variables
  580. //
  581. var $chart = $('#chart-bars');
  582. //
  583. // Methods
  584. //
  585. // Init chart
  586. function initChart($chart) {
  587. // Create chart
  588. var ordersChart = new Chart($chart, {
  589. type: 'bar',
  590. data: {
  591. labels: ['Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  592. datasets: [{
  593. label: 'Sales',
  594. data: [25, 20, 30, 22, 17, 29]
  595. }]
  596. }
  597. });
  598. // Save to jQuery object
  599. $chart.data('chart', ordersChart);
  600. }
  601. // Init chart
  602. if ($chart.length) {
  603. initChart($chart);
  604. }
  605. })();
  606. 'use strict';
  607. //
  608. // Sales chart
  609. //
  610. var UsersChart = (function() {
  611. // Variables
  612. var $chart = $('#c1-dark');
  613. // Methods
  614. function init($chart) {
  615. var usersChart = new Chart($chart, {
  616. type: 'line',
  617. options: {
  618. scales: {
  619. yAxes: [{
  620. gridLines: {
  621. lineWidth: 1,
  622. color: Charts.colors.gray[900],
  623. zeroLineColor: Charts.colors.gray[900]
  624. },
  625. ticks: {
  626. callback: function(value) {
  627. if (!(value % 10)) {
  628. return value;
  629. }
  630. }
  631. }
  632. }]
  633. },
  634. tooltips: {
  635. callbacks: {
  636. label: function(item, data) {
  637. var label = data.datasets[item.datasetIndex].label || '';
  638. var yLabel = item.yLabel;
  639. var content = '';
  640. if (data.datasets.length > 1) {
  641. content += label;
  642. }
  643. content += yLabel + ' posts';
  644. return content;
  645. }
  646. }
  647. }
  648. },
  649. data: {
  650. labels: ['7', '6', '5', '4', '3', '2', '1'],
  651. datasets: [{
  652. label: '',
  653. data: $('.posts-this-week').data('update').data.datasets[0].data
  654. }]
  655. }
  656. });
  657. // Save to jQuery object
  658. $chart.data('chart', usersChart);
  659. };
  660. // Events
  661. if ($chart.length) {
  662. init($chart);
  663. }
  664. })();
  665. //
  666. // Bootstrap Datepicker
  667. //
  668. 'use strict';
  669. var Datepicker = (function() {
  670. // Variables
  671. var $datepicker = $('.datepicker');
  672. // Methods
  673. function init($this) {
  674. var options = {
  675. disableTouchKeyboard: true,
  676. autoclose: false
  677. };
  678. $this.datepicker(options);
  679. }
  680. // Events
  681. if ($datepicker.length) {
  682. $datepicker.each(function() {
  683. init($(this));
  684. });
  685. }
  686. })();
  687. //
  688. // Form control
  689. //
  690. 'use strict';
  691. var noUiSlider = (function() {
  692. // Variables
  693. // var $sliderContainer = $('.input-slider-container'),
  694. // $slider = $('.input-slider'),
  695. // $sliderId = $slider.attr('id'),
  696. // $sliderMinValue = $slider.data('range-value-min');
  697. // $sliderMaxValue = $slider.data('range-value-max');;
  698. // // Methods
  699. //
  700. // function init($this) {
  701. // $this.on('focus blur', function(e) {
  702. // $this.parents('.form-group').toggleClass('focused', (e.type === 'focus' || this.value.length > 0));
  703. // }).trigger('blur');
  704. // }
  705. //
  706. //
  707. // // Events
  708. //
  709. // if ($input.length) {
  710. // init($input);
  711. // }
  712. if ($(".input-slider-container")[0]) {
  713. $('.input-slider-container').each(function() {
  714. var slider = $(this).find('.input-slider');
  715. var sliderId = slider.attr('id');
  716. var minValue = slider.data('range-value-min');
  717. var maxValue = slider.data('range-value-max');
  718. var sliderValue = $(this).find('.range-slider-value');
  719. var sliderValueId = sliderValue.attr('id');
  720. var startValue = sliderValue.data('range-value-low');
  721. var c = document.getElementById(sliderId),
  722. d = document.getElementById(sliderValueId);
  723. noUiSlider.create(c, {
  724. start: [parseInt(startValue)],
  725. connect: [true, false],
  726. //step: 1000,
  727. range: {
  728. 'min': [parseInt(minValue)],
  729. 'max': [parseInt(maxValue)]
  730. }
  731. });
  732. c.noUiSlider.on('update', function(a, b) {
  733. d.textContent = a[b];
  734. });
  735. })
  736. }
  737. if ($("#input-slider-range")[0]) {
  738. var c = document.getElementById("input-slider-range"),
  739. d = document.getElementById("input-slider-range-value-low"),
  740. e = document.getElementById("input-slider-range-value-high"),
  741. f = [d, e];
  742. noUiSlider.create(c, {
  743. start: [parseInt(d.getAttribute('data-range-value-low')), parseInt(e.getAttribute('data-range-value-high'))],
  744. connect: !0,
  745. range: {
  746. min: parseInt(c.getAttribute('data-range-value-min')),
  747. max: parseInt(c.getAttribute('data-range-value-max'))
  748. }
  749. }), c.noUiSlider.on("update", function(a, b) {
  750. f[b].textContent = a[b]
  751. })
  752. }
  753. })();
  754. //
  755. // Scrollbar
  756. //
  757. 'use strict';
  758. var Scrollbar = (function() {
  759. // Variables
  760. var $scrollbar = $('.scrollbar-inner');
  761. // Methods
  762. function init() {
  763. $scrollbar.scrollbar().scrollLock()
  764. }
  765. // Events
  766. if ($scrollbar.length) {
  767. init();
  768. }
  769. })();