PageSourceSearch

https://kaunieciams.lt/wp-content/plugins/directorist/assets/js/account.js?ver=1791441845

js kaunieciams.lt collected 2026-10-08 06:44:49 UTC 18,823 bytes, 457 lines download raw bytes

1/******/ (function() { // webpackBootstrap
2/******/ 	var __webpack_modules__ = ({
3
4/***/ "./assets/src/js/global/components/modal.js":
5/*!**************************************************!*\
6  !*** ./assets/src/js/global/components/modal.js ***!
7  \**************************************************/
8/***/ (function() {
9
10var $ = jQuery;
11$(document).ready(function () {
12  modalToggle();
13});
14function modalToggle() {
15  $('.atbdp_recovery_pass').on('click', function (e) {
16    e.preventDefault();
17    $('#recover-pass-modal').slideToggle().show();
18  });
19
20  // Contact form [on modal closed]
21  $('#atbdp-contact-modal').on('hidden.bs.modal', function (e) {
22    $('#atbdp-contact-message').val('');
23    $('#atbdp-contact-message-display').html('');
24  });
25
26  // Template Restructured
27  // Modal
28  // Store original parent references for modals
29  var modalOriginalParents = new Map();
30
31  // Function to restore modal to its original position
32  function restoreModalToOriginalPosition(modalElement) {
33    if (!modalElement || !modalOriginalParents.has(modalElement)) {
34      return;
35    }
36    var originalData = modalOriginalParents.get(modalElement);
37    var originalParent = originalData.parent;
38
39    // Only restore if original parent still exists in the DOM
40    if (originalParent && document.body.contains(originalParent)) {
41      // Restore to original position using nextSibling if available
42      if (originalData.nextSibling && originalParent.contains(originalData.nextSibling)) {
43        originalParent.insertBefore(modalElement, originalData.nextSibling);
44      } else {
45        originalParent.appendChild(modalElement);
46      }
47    }
48  }
49  $('body').on('click', '.directorist-btn-modal-js', function (e) {
50    e.preventDefault();
51    var data_target = $(this).attr('data-directorist_target');
52    var modalElement = document.querySelector(".".concat(data_target));
53    if (!modalElement) {
54      return;
55    }
56
57    // Move modal to body if not already a direct child of body
58    if (modalElement.parentElement !== document.body) {
59      // Store original parent if not already stored
60      if (!modalOriginalParents.has(modalElement)) {
61        modalOriginalParents.set(modalElement, {
62          parent: modalElement.parentElement,
63          nextSibling: modalElement.nextSibling
64        });
65      }
66
67      // Move to body
68      document.body.appendChild(modalElement);
69    }
70
71    // Show modal
72    modalElement.classList.add('directorist-show');
73  });
74  $('body').on('click', '.directorist-modal-close-js', function (e) {
75    e.preventDefault();
76    var modalElement = $(this).closest('.directorist-modal-js');
77
78    // Hide modal
79    modalElement.removeClass('directorist-show');
80
81    // Restore to original position
82    restoreModalToOriginalPosition(modalElement[0]);
83  });
84
85  // Close modal when clicking backdrop (not content inside)
86  $('body').on('click', '.directorist-modal-js', function (e) {
87    // Only close if clicking the backdrop itself, not children
88    if (e.target === this && $(this).hasClass('directorist-show')) {
89      $(this).removeClass('directorist-show');
90      restoreModalToOriginalPosition(this);
91    }
92  });
93}
94
95/***/ }),
96
97/***/ "./assets/src/js/public/components/directoristAlert.js":
98/*!*************************************************************!*\
99  !*** ./assets/src/js/public/components/directoristAlert.js ***!
100  \*************************************************************/
101/***/ (function() {
102
103(function ($) {
104  // Make sure the codes in this file runs only once, even if enqueued twice
105  if (typeof window.directorist_alert_executed === 'undefined') {
106    window.directorist_alert_executed = true;
107  } else {
108    return;
109  }
110  window.addEventListener('load', function () {
111    /* Directorist alert dismiss */
112    var getUrl = window.location.href;
113    var newUrl = getUrl.replace('notice=1', '');
114    if ($('.directorist-alert__close') !== null) {
115      $('.directorist-alert__close').each(function (i, e) {
116        $(e).on('click', function (e) {
117          e.preventDefault();
118          history.pushState({}, null, newUrl);
119          $(this).closest('.directorist-alert').remove();
120        });
121      });
122    }
123  });
124})(jQuery);
125
126/***/ }),
127
128/***/ "./assets/src/js/public/components/login.js":
129/*!**************************************************!*\
130  !*** ./assets/src/js/public/components/login.js ***!
131  \**************************************************/
132/***/ (function() {
133
134(function ($) {
135  // Make sure the codes in this file runs only once, even if enqueued twice
136  if (typeof window.directorist_loginjs_executed === 'undefined') {
137    window.directorist_loginjs_executed = true;
138  } else {
139    return;
140  }
141  function initPasswordToggle() {
142    var passwordGroups = document.querySelectorAll('.directorist-password-group');
143    passwordGroups.forEach(function (group) {
144      var passwordInput = group.querySelector('.directorist-password-group-input');
145      var togglePassword = group.querySelector('.directorist-password-group-toggle');
146      var eyeIcon = group.querySelector('.directorist-password-group-eyeIcon');
147      if (passwordInput && togglePassword) {
148        togglePassword.addEventListener('click', function () {
149          var type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
150          passwordInput.setAttribute('type', type);
151
152          // Toggle eye icon (simple swap for open/closed)
153          if (eyeIcon) {
154            if (type === 'text') {
155              eyeIcon.innerHTML = "\n\t\t\t\t\t\t\t\t<path stroke=\"#888\" stroke-width=\"2\" d=\"M1.5 12S5.5 5.5 12 5.5 22.5 12 22.5 12 18.5 18.5 12 18.5 1.5 12 1.5 12Z\"/>\n\t\t\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"3.5\" stroke=\"#888\" stroke-width=\"2\"/>\n\t\t\t\t\t\t\t\t<line x1=\"5\" y1=\"19\" x2=\"19\" y2=\"5\" stroke=\"#888\" stroke-width=\"2\"/>\n\t\t\t\t\t\t\t";
156            } else {
157              eyeIcon.innerHTML = "\n\t\t\t\t\t\t\t\t<path stroke=\"#888\" stroke-width=\"2\" d=\"M1.5 12S5.5 5.5 12 5.5 22.5 12 22.5 12 18.5 18.5 12 18.5 1.5 12 1.5 12Z\"/>\n\t\t\t\t\t\t\t\t<circle cx=\"12\" cy=\"12\" r=\"3.5\" stroke=\"#888\" stroke-width=\"2\"/>\n\t\t\t\t\t\t\t";
158            }
159          }
160        });
161      }
162    });
163  }
164
165  // Call the function after DOM is ready
166  document.addEventListener('DOMContentLoaded', initPasswordToggle);
167
168  // Trigger reset on form change
169  $('.directorist-authentication__btn').on('click', function () {
170    // Reset all forms with the specified class
171    $('.directorist__authentication__signin').each(function () {
172      this.reset(); // Reset the individual form
173    });
174
175    // Reset error and warning messages
176    $('#directorist__authentication__login p.status').hide().empty();
177  });
178  window.addEventListener('load', function () {
179    // Perform AJAX login on form submit
180    $('form#directorist__authentication__login').on('submit', function (e) {
181      e.preventDefault();
182      var $this = $(this);
183      var $button = $(this).find('.directorist-authentication__form__btn');
184      $button.addClass('directorist-btn-loading'); // Added loading class
185
186      $('#directorist__authentication__login p.status').show().html('<div class="directorist-alert directorist-alert-info"><span>' + directorist.loading_message + '</span></div>');
187      var form_data = {
188        action: 'ajaxlogin',
189        username: $this.find('#username').val(),
190        password: $this.find('#password').val(),
191        rememberme: $this.find('#keep_signed_in').is(':checked') ? 1 : 0,
192        security: $this.find('#security').val()
193      };
194      $.ajax({
195        type: 'POST',
196        dataType: 'json',
197        url: directorist.ajax_url,
198        data: form_data,
199        success: function success(data) {
200          // Removed loading class
201          setTimeout(function () {
202            return $button.removeClass('directorist-btn-loading');
203          }, 1000);
204          if ('nonce_faild' in data && data.nonce_faild) {
205            $('p.status').html('<div class="directorist-alert directorist-alert-success"><span>' + data.message + '</span></div>');
206          }
207          if (data.loggedin == true) {
208            $('p.status').html('<div class="directorist-alert directorist-alert-success"><span>' + data.message + '</span></div>');
209            document.location.href = directorist.redirect_url;
210          } else {
211            $('p.status').html('<div class="directorist-alert directorist-alert-danger"><span>' + data.message + '</span></div>');
212          }
213        },
214        error: function error(data) {
215          if ('nonce_faild' in data && data.nonce_faild) {
216            $('p.status').html('<div class="directorist-alert directorist-alert-success"><span>' + data.message + '</span></div>');
217          }
218          $('p.status').show().html('<div class="directorist-alert directorist-alert-danger"><span>' + directorist.login_error_message + '</span></div>');
219        }
220      });
221      e.preventDefault();
222    });
223    $('form#directorist__authentication__login .status').on('click', 'a', function (e) {
224      e.preventDefault();
225      if ($(this).attr('href') === '#atbdp_recovery_pass') {
226        $('#recover-pass-modal').slideDown().show();
227        window.scrollTo({
228          top: $('#recover-pass-modal').offset().top - 100,
229          behavior: 'smooth'
230        });
231      } else {
232        location.href = $(this).attr('href');
233      }
234    });
235
236    // Alert users to login (only if applicable)
237    $('.atbdp-require-login, .directorist-action-report-not-loggedin').on('click', function (e) {
238      e.preventDefault();
239      alert(directorist.login_alert_message);
240      return false;
241    });
242
243    // Remove URL params to avoid show message again and again
244    var current_url = location.href;
245    var url = new URL(current_url);
246    url.searchParams.delete('registration_status');
247    url.searchParams.delete('errors');
248    // url.searchParams.delete('key');
249    url.searchParams.delete('password_reset');
250    url.searchParams.delete('confirm_mail');
251    // url.searchParams.delete('user');
252    url.searchParams.delete('verification');
253    url.searchParams.delete('send_verification_email');
254    window.history.pushState(null, null, url.toString());
255
256    // Authentication Form Toggle
257    $('body').on('click', '.directorist-authentication__btn, .directorist-authentication__toggle', function (e) {
258      e.preventDefault();
259      $('.directorist-login-wrapper').toggleClass('active');
260      $('.directorist-registration-wrapper').toggleClass('active');
261    });
262  });
263})(jQuery);
264
265/***/ }),
266
267/***/ "./assets/src/js/public/components/register-form.js":
268/*!**********************************************************!*\
269  !*** ./assets/src/js/public/components/register-form.js ***!
270  \**********************************************************/
271/***/ (function() {
272
273jQuery(function ($) {
274  // Trigger reset on form change
275  $('.directorist-authentication__btn').on('click', function () {
276    // Reset the form values
277    $('.directorist__authentication__signup').each(function () {
278      this.reset(); // Reset the individual form
279    });
280
281    // Reset error and warning messages
282    $('.directorist-alert ').hide().empty();
283    $('.directorist-register-error').hide().empty();
284  });
285  $('.directorist__authentication__signup .directorist-authentication__form__btn').on('click', function (e) {
286    e.preventDefault();
287    $this = $(this);
288    $this.addClass('directorist-btn-loading'); // Added loading class
289    var form = $this.closest('.directorist__authentication__signup')[0];
290
291    // Trigger native validation
292    if (!form.checkValidity()) {
293      form.reportValidity(); // Display browser-native warnings for invalid fields
294      $this.removeClass('directorist-btn-loading'); // Removed loading class
295      return; // Stop submission if validation fails
296    }
297    var formData = new FormData(form);
298    formData.append('action', 'directorist_register_form');
299    formData.append('params', JSON.stringify(directorist_signin_signup_params));
300    $.ajax({
301      url: directorist.ajaxurl,
302      type: 'POST',
303      data: formData,
304      contentType: false,
305      processData: false,
306      cache: false
307    }).done(function (_ref) {
308      var data = _ref.data,
309        success = _ref.success;
310      // Removed loading class
311      setTimeout(function () {
312        return $this.removeClass('directorist-btn-loading');
313      }, 1000);
314      if (!success) {
315        $('.directorist-register-error').empty().show().append(data.error);
316        return;
317      }
318      $('.directorist-register-error').hide();
319      if (data.message) {
320        $('.directorist-register-error').empty().show().append(data.message).css({
321          color: '#009114',
322          'background-color': '#d9efdc'
323        });
324      }
325      if (data.redirect_url) {
326        setTimeout(function () {
327          return window.location.href = data.redirect_url;
328        }, 500);
329      }
330    });
331  });
332});
333
334/***/ }),
335
336/***/ "./assets/src/js/public/components/reset-password.js":
337/*!***********************************************************!*\
338  !*** ./assets/src/js/public/components/reset-password.js ***!
339  \***********************************************************/
340/***/ (function() {
341
342jQuery(function ($) {
343  $('.directorist-ResetPassword').on('submit', function () {
344    var form = $(this);
345    if (form.find('#password_1').val() != form.find('#password_2').val()) {
346      form.find('.password-not-match').show();
347      return false;
348    }
349    form.find('.password-not-match').hide();
350    return true;
351  });
352});
353
354/***/ })
vendor: 5,330 bytes, lines 354-457
354
355
356/******/ 	});
357/************************************************************************/
358/******/ 	// The module cache
359/******/ 	var __webpack_module_cache__ = {};
360/******/ 	
361/******/ 	// The require function
362/******/ 	function __webpack_require__(moduleId) {
363/******/ 		// Check if module is in cache
364/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
365/******/ 		if (cachedModule !== undefined) {
366/******/ 			return cachedModule.exports;
367/******/ 		}
368/******/ 		// Create a new module (and put it into the cache)
369/******/ 		var module = __webpack_module_cache__[moduleId] = {
370/******/ 			// no module.id needed
371/******/ 			// no module.loaded needed
372/******/ 			exports: {}
373/******/ 		};
374/******/ 	
375/******/ 		// Execute the module function
376/******/ 		if (!(moduleId in __webpack_modules__)) {
377/******/ 			delete __webpack_module_cache__[moduleId];
378/******/ 			var e = new Error("Cannot find module '" + moduleId + "'");
379/******/ 			e.code = 'MODULE_NOT_FOUND';
380/******/ 			throw e;
381/******/ 		}
382/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
383/******/ 	
384/******/ 		// Return the exports of the module
385/******/ 		return module.exports;
386/******/ 	}
387/******/ 	
388/************************************************************************/
389/******/ 	/* webpack/runtime/compat get default export */
390/******/ 	!function() {
391/******/ 		// getDefaultExport function for compatibility with non-harmony modules
392/******/ 		__webpack_require__.n = function(module) {
393/******/ 			var getter = module && module.__esModule ?
394/******/ 				function() { return module['default']; } :
395/******/ 				function() { return module; };
396/******/ 			__webpack_require__.d(getter, { a: getter });
397/******/ 			return getter;
398/******/ 		};
399/******/ 	}();
400/******/ 	
401/******/ 	/* webpack/runtime/define property getters */
402/******/ 	!function() {
403/******/ 		// define getter functions for harmony exports
404/******/ 		__webpack_require__.d = function(exports, definition) {
405/******/ 			for(var key in definition) {
406/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
407/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
408/******/ 				}
409/******/ 			}
410/******/ 		};
411/******/ 	}();
412/******/ 	
413/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
414/******/ 	!function() {
415/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
416/******/ 	}();
417/******/ 	
418/******/ 	/* webpack/runtime/make namespace object */
419/******/ 	!function() {
420/******/ 		// define __esModule on exports
421/******/ 		__webpack_require__.r = function(exports) {
422/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
423/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
424/******/ 			}
425/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
426/******/ 		};
427/******/ 	}();
428/******/ 	
429/************************************************************************/
430var __webpack_exports__ = {};
431// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
432!function() {
433"use strict";
434/*!*************************************************!*\
435  !*** ./assets/src/js/public/modules/account.js ***!
436  \*************************************************/
437__webpack_require__.r(__webpack_exports__);
438/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/directoristAlert */ "./assets/src/js/public/components/directoristAlert.js");
439/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_directoristAlert__WEBPACK_IMPORTED_MODULE_0__);
440/* harmony import */ var _components_login__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/login */ "./assets/src/js/public/components/login.js");
441/* harmony import */ var _components_login__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_login__WEBPACK_IMPORTED_MODULE_1__);
442/* harmony import */ var _components_reset_password__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/reset-password */ "./assets/src/js/public/components/reset-password.js");
443/* harmony import */ var _components_reset_password__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_components_reset_password__WEBPACK_IMPORTED_MODULE_2__);
444/* harmony import */ var _components_register_form__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/register-form */ "./assets/src/js/public/components/register-form.js");
445/* harmony import */ var _components_register_form__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_components_register_form__WEBPACK_IMPORTED_MODULE_3__);
446/* harmony import */ var _global_components_modal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../global/components/modal */ "./assets/src/js/global/components/modal.js");
447/* harmony import */ var _global_components_modal__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_global_components_modal__WEBPACK_IMPORTED_MODULE_4__);
448// General Components
449
450
451
452
453
454}();
455/******/ })()
456;
457//# sourceMappingURL=account.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.