app.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 5);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./resources/assets/js/core/app.js":
  89. /*!*****************************************!*\
  90. !*** ./resources/assets/js/core/app.js ***!
  91. \*****************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports) {
  94. /*=========================================================================================
  95. File Name: app.js
  96. Description: Template related app JS.
  97. ----------------------------------------------------------------------------------------
  98. Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
  99. Author: Pixinvent
  100. Author URL: hhttp://www.themeforest.net/user/pixinvent
  101. ==========================================================================================*/
  102. (function (window, document, $) {
  103. "use strict";
  104. var $html = $("html");
  105. var $body = $("body");
  106. var $danger = "#ea5455";
  107. var $primary = "#7367f0";
  108. var $textcolor = "#4e5154";
  109. $(window).on("load", function () {
  110. var rtl;
  111. var compactMenu = false; // Set it to true, if you want default menu to be compact
  112. if ($body.hasClass("menu-collapsed")) {
  113. compactMenu = true;
  114. }
  115. if ($("html").data("textdirection") == "rtl") {
  116. rtl = true;
  117. }
  118. setTimeout(function () {
  119. $html.removeClass("loading").addClass("loaded");
  120. }, 1200);
  121. $.app && $.app.menu.init(compactMenu); // Navigation configurations
  122. var config = {
  123. speed: 300 // set speed to expand / collpase menu
  124. };
  125. if ($.app && $.app.nav.initialized === false) {
  126. $.app.nav.init(config);
  127. }
  128. Unison.on("change", function (bp) {
  129. $.app && $.app.menu.change();
  130. }); // Tooltip Initialization
  131. $('[data-toggle="tooltip"]').tooltip({
  132. container: "body"
  133. }); // Top Navbars - Hide on Scroll
  134. if ($(".navbar-hide-on-scroll").length > 0) {
  135. $(".navbar-hide-on-scroll.fixed-top").headroom({
  136. offset: 205,
  137. tolerance: 5,
  138. classes: {
  139. // when element is initialised
  140. initial: "headroom",
  141. // when scrolling up
  142. pinned: "headroom--pinned-top",
  143. // when scrolling down
  144. unpinned: "headroom--unpinned-top"
  145. }
  146. }); // Bottom Navbars - Hide on Scroll
  147. $(".navbar-hide-on-scroll.fixed-bottom").headroom({
  148. offset: 205,
  149. tolerance: 5,
  150. classes: {
  151. // when element is initialised
  152. initial: "headroom",
  153. // when scrolling up
  154. pinned: "headroom--pinned-bottom",
  155. // when scrolling down
  156. unpinned: "headroom--unpinned-bottom"
  157. }
  158. });
  159. } // Collapsible Card
  160. $('a[data-action="collapse"]').on("click", function (e) {
  161. e.preventDefault();
  162. $(this).closest(".card").children(".card-content").collapse("toggle"); // Adding bottom padding on card collapse
  163. $(this).closest(".card").children(".card-header").css("padding-bottom", "1.5rem");
  164. $(this).closest(".card").find('[data-action="collapse"]').toggleClass("rotate");
  165. }); // Toggle fullscreen
  166. $('a[data-action="expand"]').on("click", function (e) {
  167. e.preventDefault();
  168. $(this).closest(".card").find('[data-action="expand"] i').toggleClass("icon-maximize icon-minimize");
  169. $(this).closest(".card").toggleClass("card-fullscreen");
  170. }); // Notifications & messages scrollable
  171. $(".scrollable-container").each(function () {
  172. var scrollable_container = new PerfectScrollbar($(this)[0], {
  173. wheelPropagation: false
  174. });
  175. }); // Reload Card
  176. $('a[data-action="reload"]').on("click", function () {
  177. var block_ele = $(this).closest(".card").find(".card-content");
  178. var reloadActionOverlay;
  179. if ($body.hasClass("dark-layout")) {
  180. var reloadActionOverlay = "#10163a";
  181. } else {
  182. var reloadActionOverlay = "#fff";
  183. } // Block Element
  184. block_ele.block({
  185. message: '<div class="feather icon-refresh-cw icon-spin font-medium-2 text-primary"></div>',
  186. timeout: 2000,
  187. //unblock after 2 seconds
  188. overlayCSS: {
  189. backgroundColor: reloadActionOverlay,
  190. cursor: "wait"
  191. },
  192. css: {
  193. border: 0,
  194. padding: 0,
  195. backgroundColor: "none"
  196. }
  197. });
  198. }); // Close Card
  199. $('a[data-action="close"]').on("click", function () {
  200. $(this).closest(".card").removeClass().slideUp("fast");
  201. }); // Match the height of each card in a row
  202. setTimeout(function () {
  203. $(".row.match-height").each(function () {
  204. $(this).find(".card").not(".card .card").matchHeight(); // Not .card .card prevents collapsible cards from taking height
  205. });
  206. }, 500);
  207. $('.card .heading-elements a[data-action="collapse"]').on("click", function () {
  208. var $this = $(this),
  209. card = $this.closest(".card");
  210. var cardHeight;
  211. if (parseInt(card[0].style.height, 10) > 0) {
  212. cardHeight = card.css("height");
  213. card.css("height", "").attr("data-height", cardHeight);
  214. } else {
  215. if (card.data("height")) {
  216. cardHeight = card.data("height");
  217. card.css("height", cardHeight).attr("data-height", "");
  218. }
  219. }
  220. }); // Add sidebar group active class to active menu
  221. $(".main-menu-content").find("li.active").parents("li").addClass("sidebar-group-active"); // Add open class to parent list item if subitem is active except compact menu
  222. var menuType = $body.data("menu");
  223. if (menuType != "horizontal-menu" && compactMenu === false) {
  224. $(".main-menu-content").find("li.active").parents("li").addClass("open");
  225. }
  226. if (menuType == "horizontal-menu") {
  227. $(".main-menu-content").find("li.active").parents("li:not(.nav-item)").addClass("open");
  228. $(".main-menu-content").find('li.active').closest('li.nav-item').addClass('sidebar-group-active open'); // $(".main-menu-content")
  229. // .find("li.active")
  230. // .parents("li")
  231. // .addClass("active");
  232. } //card heading actions buttons small screen support
  233. $(".heading-elements-toggle").on("click", function () {
  234. $(this).next(".heading-elements").toggleClass("visible");
  235. }); // Dynamic height for the chartjs div for the chart animations to work
  236. var chartjsDiv = $(".chartjs"),
  237. canvasHeight = chartjsDiv.children("canvas").attr("height"),
  238. mainMenu = $(".main-menu");
  239. chartjsDiv.css("height", canvasHeight);
  240. if ($body.hasClass("boxed-layout")) {
  241. if ($body.hasClass("vertical-overlay-menu")) {
  242. var menuWidth = mainMenu.width();
  243. var contentPosition = $(".app-content").position().left;
  244. var menuPositionAdjust = contentPosition - menuWidth;
  245. if ($body.hasClass("menu-flipped")) {
  246. mainMenu.css("right", menuPositionAdjust + "px");
  247. } else {
  248. mainMenu.css("left", menuPositionAdjust + "px");
  249. }
  250. }
  251. } //Custom File Input
  252. $(".custom-file input").change(function (e) {
  253. $(this).next(".custom-file-label").html(e.target.files[0].name);
  254. });
  255. /* Text Area Counter Set Start */
  256. $(".char-textarea").on("keyup", function (event) {
  257. checkTextAreaMaxLength(this, event); // to later change text color in dark layout
  258. $(this).addClass("active");
  259. });
  260. /*
  261. Checks the MaxLength of the Textarea
  262. -----------------------------------------------------
  263. @prerequisite: textBox = textarea dom element
  264. e = textarea event
  265. length = Max length of characters
  266. */
  267. function checkTextAreaMaxLength(textBox, e) {
  268. var maxLength = parseInt($(textBox).data("length")),
  269. counterValue = $(".counter-value"),
  270. charTextarea = $(".char-textarea");
  271. if (!checkSpecialKeys(e)) {
  272. if (textBox.value.length < maxLength - 1) textBox.value = textBox.value.substring(0, maxLength);
  273. }
  274. $(".char-count").html(textBox.value.length);
  275. if (textBox.value.length > maxLength) {
  276. counterValue.css("background-color", $danger);
  277. charTextarea.css("color", $danger); // to change text color after limit is maxedout out
  278. charTextarea.addClass("max-limit");
  279. } else {
  280. counterValue.css("background-color", $primary);
  281. charTextarea.css("color", $textcolor);
  282. charTextarea.removeClass("max-limit");
  283. }
  284. return true;
  285. }
  286. /*
  287. Checks if the keyCode pressed is inside special chars
  288. -------------------------------------------------------
  289. @prerequisite: e = e.keyCode object for the key pressed
  290. */
  291. function checkSpecialKeys(e) {
  292. if (e.keyCode != 8 && e.keyCode != 46 && e.keyCode != 37 && e.keyCode != 38 && e.keyCode != 39 && e.keyCode != 40) return false;else return true;
  293. }
  294. $(".content-overlay").on("click", function () {
  295. $(".search-list").removeClass("show");
  296. $(".app-content").removeClass("show-overlay");
  297. $(".bookmark-wrapper .bookmark-input").removeClass("show");
  298. }); // To show shadow in main menu when menu scrolls
  299. var container = document.getElementsByClassName("main-menu-content");
  300. if (container.length > 0) {
  301. container[0].addEventListener("ps-scroll-y", function () {
  302. if ($(this).find(".ps__thumb-y").position().top > 0) {
  303. $(".shadow-bottom").css("display", "block");
  304. } else {
  305. $(".shadow-bottom").css("display", "none");
  306. }
  307. });
  308. }
  309. }); // Hide overlay menu on content overlay click on small screens
  310. $(document).on("click", ".sidenav-overlay", function (e) {
  311. // Hide menu
  312. $.app.menu.hide();
  313. return false;
  314. }); // Execute below code only if we find hammer js for touch swipe feature on small screen
  315. if (typeof Hammer !== "undefined") {
  316. // Swipe menu gesture
  317. var swipeInElement = document.querySelector(".drag-target");
  318. if ($(swipeInElement).length > 0) {
  319. var swipeInMenu = new Hammer(swipeInElement);
  320. swipeInMenu.on("panright", function (ev) {
  321. if ($body.hasClass("vertical-overlay-menu")) {
  322. $.app.menu.open();
  323. return false;
  324. }
  325. });
  326. } // menu swipe out gesture
  327. setTimeout(function () {
  328. var swipeOutElement = document.querySelector(".main-menu");
  329. var swipeOutMenu;
  330. if ($(swipeOutElement).length > 0) {
  331. swipeOutMenu = new Hammer(swipeOutElement);
  332. swipeOutMenu.get("pan").set({
  333. direction: Hammer.DIRECTION_ALL,
  334. threshold: 100
  335. });
  336. swipeOutMenu.on("panleft", function (ev) {
  337. if ($body.hasClass("vertical-overlay-menu")) {
  338. $.app.menu.hide();
  339. return false;
  340. }
  341. });
  342. }
  343. }, 300); // menu overlay swipe out gestrue
  344. var swipeOutOverlayElement = document.querySelector(".sidenav-overlay");
  345. if ($(swipeOutOverlayElement).length > 0) {
  346. var swipeOutOverlayMenu = new Hammer(swipeOutOverlayElement);
  347. swipeOutOverlayMenu.on("panleft", function (ev) {
  348. if ($body.hasClass("vertical-overlay-menu")) {
  349. $.app.menu.hide();
  350. return false;
  351. }
  352. });
  353. }
  354. }
  355. $(document).on("click", ".menu-toggle, .modern-nav-toggle", function (e) {
  356. e.preventDefault(); // Toggle menu
  357. $.app.menu.toggle();
  358. setTimeout(function () {
  359. $(window).trigger("resize");
  360. }, 200);
  361. if ($("#collapse-sidebar-switch").length > 0) {
  362. setTimeout(function () {
  363. if ($body.hasClass("menu-expanded") || $body.hasClass("menu-open")) {
  364. $("#collapse-sidebar-switch").prop("checked", false);
  365. } else {
  366. $("#collapse-sidebar-switch").prop("checked", true);
  367. }
  368. }, 50);
  369. } // Hides dropdown on click of menu toggle
  370. // $('[data-toggle="dropdown"]').dropdown('hide');
  371. // Hides collapse dropdown on click of menu toggle
  372. if ($(".vertical-overlay-menu .navbar-with-menu .navbar-container .navbar-collapse").hasClass("show")) {
  373. $(".vertical-overlay-menu .navbar-with-menu .navbar-container .navbar-collapse").removeClass("show");
  374. }
  375. return false;
  376. }); // Add Children Class
  377. $(".navigation").find("li").has("ul").addClass("has-sub");
  378. $(".carousel").carousel({
  379. interval: 2000
  380. }); // Page full screen
  381. $(".nav-link-expand").on("click", function (e) {
  382. if (typeof screenfull != "undefined") {
  383. if (screenfull.isEnabled) {
  384. screenfull.toggle();
  385. }
  386. }
  387. });
  388. if (typeof screenfull != "undefined") {
  389. if (screenfull.isEnabled) {
  390. $(document).on(screenfull.raw.fullscreenchange, function () {
  391. if (screenfull.isFullscreen) {
  392. $(".nav-link-expand").find("i").toggleClass("icon-minimize icon-maximize");
  393. $("html").addClass("full-screen");
  394. } else {
  395. $(".nav-link-expand").find("i").toggleClass("icon-maximize icon-minimize");
  396. $("html").removeClass("full-screen");
  397. }
  398. });
  399. }
  400. }
  401. $(document).ready(function () {
  402. /**********************************
  403. * Form Wizard Step Icon
  404. **********************************/
  405. $(".step-icon").each(function () {
  406. var $this = $(this);
  407. if ($this.siblings("span.step").length > 0) {
  408. $this.siblings("span.step").empty();
  409. $(this).appendTo($(this).siblings("span.step"));
  410. }
  411. });
  412. }); // Update manual scroller when window is resized
  413. $(window).resize(function () {
  414. $.app && $.app.menu.manualScroller.updateHeight();
  415. });
  416. $("#sidebar-page-navigation").on("click", "a.nav-link", function (e) {
  417. e.preventDefault();
  418. e.stopPropagation();
  419. var $this = $(this),
  420. href = $this.attr("href");
  421. var offset = $(href).offset();
  422. var scrollto = offset.top - 80; // minus fixed header height
  423. $("html, body").animate({
  424. scrollTop: scrollto
  425. }, 0);
  426. setTimeout(function () {
  427. $this.parent(".nav-item").siblings(".nav-item").children(".nav-link").removeClass("active");
  428. $this.addClass("active");
  429. }, 100);
  430. }); // main menu internationalization
  431. // init i18n and load language file
  432. // i18next.use(window.i18nextXHRBackend).init({
  433. // debug: false,
  434. // fallbackLng: "en",
  435. // backend: {
  436. // loadPath: "data/locales/{{lng}}.json"
  437. // },
  438. // returnObjects: true
  439. // },
  440. // function (err, t) {
  441. // // resources have been loaded
  442. // jqueryI18next.init(i18next, $);
  443. // }
  444. // );
  445. // change language according to data-language of dropdown item
  446. $(".dropdown-language .dropdown-item").on("click", function () {
  447. var $this = $(this);
  448. $this.siblings(".selected").removeClass("selected");
  449. $this.addClass("selected");
  450. var selectedLang = $this.text();
  451. var selectedFlag = $this.find(".flag-icon").attr("class");
  452. $("#dropdown-flag .selected-language").text(selectedLang);
  453. $("#dropdown-flag .flag-icon").removeClass().addClass(selectedFlag); // var currentLanguage = $this.data("language");
  454. // i18next.changeLanguage(currentLanguage, function (err, t) {
  455. // $(".main-menu, .horizontal-menu-wrapper").localize();
  456. // });
  457. });
  458. /********************* Bookmark & Search ***********************/
  459. // This variable is used for mouseenter and mouseleave events of search list
  460. var $filename = $(".search-input input").data("search"),
  461. bookmarkWrapper = $(".bookmark-wrapper"),
  462. bookmarkStar = $(".bookmark-wrapper .bookmark-star"),
  463. bookmarkInput = $(".bookmark-wrapper .bookmark-input"),
  464. navLinkSearch = $(".nav-link-search"),
  465. searchInput = $(".search-input"),
  466. searchInputInputfield = $(".search-input input"),
  467. searchList = $(".search-input .search-list"),
  468. appContent = $(".app-content"),
  469. bookmarkSearchList = $(".bookmark-input .search-list"); // Bookmark icon click
  470. bookmarkStar.on("click", function (e) {
  471. e.stopPropagation();
  472. bookmarkInput.toggleClass("show");
  473. bookmarkInput.find("input").val("");
  474. bookmarkInput.find("input").blur();
  475. bookmarkInput.find("input").focus();
  476. bookmarkWrapper.find(".search-list").addClass("show");
  477. var arrList = $("ul.nav.navbar-nav.bookmark-icons li"),
  478. $arrList = "",
  479. $activeItemClass = "";
  480. $("ul.search-list li").remove();
  481. for (var i = 0; i < arrList.length; i++) {
  482. if (i === 0) {
  483. $activeItemClass = "current_item";
  484. } else {
  485. $activeItemClass = "";
  486. }
  487. $arrList += '<li class="auto-suggestion d-flex align-items-center justify-content-between cursor-pointer ' + $activeItemClass + '">' + '<a class="d-flex align-items-center justify-content-between w-100" href=' + arrList[i].firstChild.href + ">" + '<div class="d-flex justify-content-start align-items-center">' + '<span class="mr-75 ' + arrList[i].firstChild.firstChild.className + '" data-icon="' + arrList[i].firstChild.firstChild.className + '"></span>' + "<span>" + arrList[i].firstChild.dataset.originalTitle + "</span>" + "</div>" + '<span class="float-right bookmark-icon feather icon-star warning"></span>' + "</a>" + "</li>";
  488. }
  489. $("ul.search-list").append($arrList);
  490. }); // Navigation Search area Open
  491. navLinkSearch.on("click", function () {
  492. var $this = $(this);
  493. var searchInput = $(this).parent(".nav-search").find(".search-input");
  494. searchInput.addClass("open");
  495. searchInputInputfield.focus();
  496. searchList.find("li").remove();
  497. bookmarkInput.removeClass("show");
  498. }); // Navigation Search area Close
  499. $(".search-input-close i").on("click", function () {
  500. var $this = $(this),
  501. searchInput = $(this).closest(".search-input");
  502. if (searchInput.hasClass("open")) {
  503. searchInput.removeClass("open");
  504. searchInputInputfield.val("");
  505. searchInputInputfield.blur();
  506. searchList.removeClass("show");
  507. appContent.removeClass("show-overlay");
  508. }
  509. }); // Filter
  510. if ($('.search-list-main').length) {
  511. var searchListMain = new PerfectScrollbar(".search-list-main", {
  512. wheelPropagation: false
  513. });
  514. }
  515. if ($('.search-list-bookmark').length) {
  516. var searchListBookmark = new PerfectScrollbar(".search-list-bookmark", {
  517. wheelPropagation: false
  518. });
  519. } // update Perfect Scrollbar on hover
  520. $(".search-list-main").mouseenter(function () {
  521. searchListMain.update();
  522. });
  523. searchInputInputfield.on("keyup", function (e) {
  524. $(this).closest(".search-list").addClass("show");
  525. if (e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 13) {
  526. if (e.keyCode == 27) {
  527. appContent.removeClass("show-overlay");
  528. bookmarkInput.find("input").val("");
  529. bookmarkInput.find("input").blur();
  530. searchInputInputfield.val("");
  531. searchInputInputfield.blur();
  532. searchInput.removeClass("open");
  533. if (searchInput.hasClass("show")) {
  534. $(this).removeClass("show");
  535. searchInput.removeClass("show");
  536. }
  537. } // Define variables
  538. var value = $(this).val().toLowerCase(),
  539. //get values of input on keyup
  540. activeClass = "",
  541. bookmark = false,
  542. liList = $("ul.search-list li"); // get all the list items of the search
  543. liList.remove(); // To check if current is bookmark input
  544. if ($(this).parent().hasClass("bookmark-input")) {
  545. bookmark = true;
  546. } // If input value is blank
  547. if (value != "") {
  548. appContent.addClass("show-overlay"); // condition for bookmark and search input click
  549. if (bookmarkInput.focus()) {
  550. bookmarkSearchList.addClass("show");
  551. } else {
  552. searchList.addClass("show");
  553. bookmarkSearchList.removeClass("show");
  554. }
  555. if (bookmark === false) {
  556. searchList.addClass("show");
  557. bookmarkSearchList.removeClass("show");
  558. }
  559. var $startList = "",
  560. $otherList = "",
  561. $htmlList = "",
  562. $bookmarkhtmlList = "",
  563. $pageList = '<li class=" d-flex align-items-center">' + '<a href="#" class="pb-25">' + '<h6 class="text-primary mb-0">Pages</h6>' + '</a>' + '</li>',
  564. $activeItemClass = "",
  565. $bookmarkIcon = "",
  566. $defaultList = "",
  567. a = 0; // getting json data from file for search results
  568. $.getJSON("data/" + $filename + ".json", function (data) {
  569. for (var i = 0; i < data.listItems.length; i++) {
  570. // if current is bookmark then give class to star icon
  571. if (bookmark === true) {
  572. activeClass = ""; // resetting active bookmark class
  573. var arrList = $("ul.nav.navbar-nav.bookmark-icons li"),
  574. $arrList = ""; // Loop to check if current seach value match with the bookmarks already there in navbar
  575. for (var j = 0; j < arrList.length; j++) {
  576. if (data.listItems[i].name === arrList[j].firstChild.dataset.originalTitle) {
  577. activeClass = " warning";
  578. break;
  579. } else {
  580. activeClass = "";
  581. }
  582. }
  583. $bookmarkIcon = '<span class="float-right bookmark-icon feather icon-star' + activeClass + '"></span>';
  584. } // Search list item start with entered letters and create list
  585. if (data.listItems[i].name.toLowerCase().indexOf(value) == 0 && a < 5) {
  586. if (a === 0) {
  587. $activeItemClass = "current_item";
  588. } else {
  589. $activeItemClass = "";
  590. }
  591. $startList += '<li class="auto-suggestion d-flex align-items-center justify-content-between cursor-pointer ' + $activeItemClass + '">' + '<a class="d-flex align-items-center justify-content-between w-100" href=' + data.listItems[i].url + ">" + '<div class="d-flex justify-content-start align-items-center">' + '<span class="mr-75 ' + data.listItems[i].icon + '" data-icon="' + data.listItems[i].icon + '"></span>' + "<span>" + data.listItems[i].name + "</span>" + "</div>" + $bookmarkIcon + "</a>" + "</li>";
  592. a++;
  593. }
  594. }
  595. for (var i = 0; i < data.listItems.length; i++) {
  596. if (bookmark === true) {
  597. activeClass = ""; // resetting active bookmark class
  598. var arrList = $("ul.nav.navbar-nav.bookmark-icons li"),
  599. $arrList = ""; // Loop to check if current seach value match with the bookmarks already there in navbar
  600. for (var j = 0; j < arrList.length; j++) {
  601. if (data.listItems[i].name === arrList[j].firstChild.dataset.originalTitle) {
  602. activeClass = " warning";
  603. } else {
  604. activeClass = "";
  605. }
  606. }
  607. $bookmarkIcon = '<span class="float-right bookmark-icon feather icon-star' + activeClass + '"></span>';
  608. } // Search list item not start with letters and create list
  609. if (!(data.listItems[i].name.toLowerCase().indexOf(value) == 0) && data.listItems[i].name.toLowerCase().indexOf(value) > -1 && a < 5) {
  610. if (a === 0) {
  611. $activeItemClass = "current_item";
  612. } else {
  613. $activeItemClass = "";
  614. }
  615. $otherList += '<li class="auto-suggestion d-flex align-items-center justify-content-between cursor-pointer ' + $activeItemClass + '">' + '<a class="d-flex align-items-center justify-content-between w-100" href=' + data.listItems[i].url + ">" + '<div class="d-flex justify-content-start align-items-center">' + '<span class="mr-75 ' + data.listItems[i].icon + '" data-icon="' + data.listItems[i].icon + '"></span>' + "<span>" + data.listItems[i].name + "</span>" + "</div>" + $bookmarkIcon + "</a>" + "</li>";
  616. a++;
  617. }
  618. }
  619. $defaultList = $(".main-search-list-defaultlist").html();
  620. if ($startList == "" && $otherList == "") {
  621. $otherList = $(".main-search-list-defaultlist-other-list").html();
  622. } // concatinating startlist, otherlist, defalutlist with pagelist
  623. $htmlList = $pageList.concat($startList, $otherList, $defaultList);
  624. $("ul.search-list").html($htmlList); // concatinating otherlist with startlist
  625. $bookmarkhtmlList = $startList.concat($otherList);
  626. $("ul.search-list-bookmark").html($bookmarkhtmlList);
  627. });
  628. } else {
  629. if (bookmark === true) {
  630. var arrList = $("ul.nav.navbar-nav.bookmark-iconss li"),
  631. $arrList = "";
  632. for (var i = 0; i < arrList.length; i++) {
  633. if (i === 0) {
  634. $activeItemClass = "current_item";
  635. } else {
  636. $activeItemClass = "";
  637. }
  638. $arrList += '<li class="auto-suggestion d-flex align-items-center justify-content-between cursor-pointer">' + '<a class="d-flex align-items-center justify-content-between w-100" href=' + arrList[i].firstChild.href + ">" + '<div class="d-flex justify-content-start align-items-center">' + '<span class="mr-75 ' + arrList[i].firstChild.firstChild.className + '" data-icon="' + arrList[i].firstChild.firstChild.className + '"></span>' + "<span>" + arrList[i].firstChild.dataset.originalTitle + "</span>" + "</div>" + '<span class="float-right bookmark-icon feather icon-star warning"></span>' + "</a>" + "</li>";
  639. }
  640. $("ul.search-list").append($arrList);
  641. } else {
  642. // if search input blank, hide overlay
  643. if (appContent.hasClass("show-overlay")) {
  644. appContent.removeClass("show-overlay");
  645. } // If filter box is empty
  646. if (searchList.hasClass("show")) {
  647. searchList.removeClass("show");
  648. }
  649. }
  650. }
  651. }
  652. }); // Add class on hover of the list
  653. $(document).on("mouseenter", ".search-list li", function (e) {
  654. $(this).siblings().removeClass("current_item");
  655. $(this).addClass("current_item");
  656. });
  657. $(document).on("click", ".search-list li", function (e) {
  658. e.stopPropagation();
  659. });
  660. $("html").on("click", function ($this) {
  661. if (!$($this.target).hasClass("bookmark-icon")) {
  662. if (bookmarkSearchList.hasClass("show")) {
  663. bookmarkSearchList.removeClass("show");
  664. }
  665. if (bookmarkInput.hasClass("show")) {
  666. bookmarkInput.removeClass("show");
  667. }
  668. }
  669. }); // Prevent closing bookmark dropdown on input textbox click
  670. $(document).on("click", ".bookmark-input input", function (e) {
  671. bookmarkInput.addClass("show");
  672. bookmarkSearchList.addClass("show");
  673. }); // Favorite star click
  674. $(document).on("click", ".bookmark-input .search-list .bookmark-icon", function (e) {
  675. e.stopPropagation();
  676. if ($(this).hasClass("warning")) {
  677. $(this).removeClass("warning");
  678. var arrList = $("ul.nav.navbar-nav.bookmark-icons li");
  679. for (var i = 0; i < arrList.length; i++) {
  680. if (arrList[i].firstChild.dataset.originalTitle == $(this).parent()[0].innerText) {
  681. arrList[i].remove();
  682. }
  683. }
  684. e.preventDefault();
  685. } else {
  686. var arrList = $("ul.nav.navbar-nav.bookmark-icons li");
  687. $(this).addClass("warning");
  688. e.preventDefault();
  689. var $url = $(this).parent()[0].href,
  690. $name = $(this).parent()[0].innerText,
  691. $icon = $(this).parent()[0].firstChild.firstChild.dataset.icon,
  692. $listItem = "",
  693. $listItemDropdown = "";
  694. $listItem = '<li class="nav-item d-none d-lg-block">' + '<a class="nav-link" href="' + $url + '" data-toggle="tooltip" data-placement="top" title="" data-original-title="' + $name + '">' + '<i class="ficon ' + $icon + '"></i>' + "</a>" + "</li>";
  695. $("ul.nav.bookmark-icons").append($listItem);
  696. $('[data-toggle="tooltip"]').tooltip();
  697. }
  698. }); // If we use up key(38) Down key (40) or Enter key(13)
  699. $(window).on("keydown", function (e) {
  700. var $current = $(".search-list li.current_item"),
  701. $next,
  702. $prev;
  703. if (e.keyCode === 40) {
  704. $next = $current.next();
  705. $current.removeClass("current_item");
  706. $current = $next.addClass("current_item");
  707. } else if (e.keyCode === 38) {
  708. $prev = $current.prev();
  709. $current.removeClass("current_item");
  710. $current = $prev.addClass("current_item");
  711. }
  712. if (e.keyCode === 13 && $(".search-list li.current_item").length > 0) {
  713. var selected_item = $(".search-list li.current_item a");
  714. window.location = selected_item.attr("href");
  715. $(selected_item).trigger("click");
  716. }
  717. }); // Waves Effect
  718. Waves.init();
  719. Waves.attach(".btn", ["waves-light"]);
  720. })(window, document, jQuery);
  721. /***/ }),
  722. /***/ 5:
  723. /*!***********************************************!*\
  724. !*** multi ./resources/assets/js/core/app.js ***!
  725. \***********************************************/
  726. /*! no static exports found */
  727. /***/ (function(module, exports, __webpack_require__) {
  728. module.exports = __webpack_require__(/*! D:\php-project\laravel\laraveladmin\github-test\pck-dcat-admin\dcat-admin\resources\assets\js\core\app.js */"./resources/assets/js/core/app.js");
  729. /***/ })
  730. /******/ });