initial commit
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTCareersApply = function () {
|
||||
var submitButton;
|
||||
var validator;
|
||||
var form;
|
||||
|
||||
// Init form inputs
|
||||
var initForm = function() {
|
||||
// Team assign. For more info, plase visit the official plugin site: https://select2.org/
|
||||
$(form.querySelector('[name="position"]')).on('change', function() {
|
||||
// Revalidate the field when an option is chosen
|
||||
validator.revalidateField('position');
|
||||
});
|
||||
|
||||
// Start date. For more info, please visit the official plugin site: https://flatpickr.js.org/
|
||||
var startDate = $(form.querySelector('[name="start_date"]'));
|
||||
startDate.flatpickr({
|
||||
enableTime: false,
|
||||
dateFormat: "d, M Y",
|
||||
});
|
||||
}
|
||||
|
||||
// Handle form validation and submittion
|
||||
var handleForm = function() {
|
||||
// Stepper custom navigation
|
||||
|
||||
// Init form validation rules. For more info check the FormValidation plugin's official documentation:https://formvalidation.io/
|
||||
validator = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
'first_name': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'First name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'last_name': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Last name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'age': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Age is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'city': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'City is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'email': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Email address is required'
|
||||
},
|
||||
emailAddress: {
|
||||
message: 'The value is not a valid email address'
|
||||
}
|
||||
}
|
||||
},
|
||||
'salary': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Expected salary is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'position': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Position is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'start_date': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Start date is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row',
|
||||
eleInvalidClass: '',
|
||||
eleValidClass: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Action buttons
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Validate form before submit
|
||||
if (validator) {
|
||||
validator.validate().then(function (status) {
|
||||
console.log('validated!');
|
||||
|
||||
if (status == 'Valid') {
|
||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
submitButton.disabled = true;
|
||||
|
||||
setTimeout(function() {
|
||||
submitButton.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
submitButton.disabled = false;
|
||||
|
||||
Swal.fire({
|
||||
text: "Form has been successfully submitted!",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
//form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
//form.submit(); // Submit form
|
||||
}, 2000);
|
||||
} else {
|
||||
// Scroll top
|
||||
|
||||
// Show error popuo. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "Sorry, looks like there are some errors detected, please try again.",
|
||||
icon: "error",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
KTUtil.scrollTop();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public functions
|
||||
init: function () {
|
||||
// Elements
|
||||
form = document.querySelector('#kt_careers_form');
|
||||
submitButton = document.getElementById('kt_careers_submit_button');
|
||||
|
||||
initForm();
|
||||
handleForm();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function () {
|
||||
KTCareersApply.init();
|
||||
});
|
||||
@@ -0,0 +1,206 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTContactApply = function () {
|
||||
var submitButton;
|
||||
var validator;
|
||||
var form;
|
||||
var selectedlocation;
|
||||
|
||||
// Private functions
|
||||
var initMap = function(elementId) {
|
||||
// Check if Leaflet is included
|
||||
if (!L) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Define Map Location
|
||||
var leaflet = L.map(elementId, {
|
||||
center: [40.725, -73.985],
|
||||
zoom: 30
|
||||
});
|
||||
|
||||
// Init Leaflet Map. For more info check the plugin's documentation: https://leafletjs.com/
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(leaflet);
|
||||
|
||||
// Set Geocoding
|
||||
var geocodeService;
|
||||
if (typeof L.esri.Geocoding === 'undefined') {
|
||||
geocodeService = L.esri.geocodeService();
|
||||
} else {
|
||||
geocodeService = L.esri.Geocoding.geocodeService();
|
||||
}
|
||||
|
||||
// Define Marker Layer
|
||||
var markerLayer = L.layerGroup().addTo(leaflet);
|
||||
|
||||
// Set Custom SVG icon marker
|
||||
var leafletIcon = L.divIcon({
|
||||
html: `<span class="svg-icon svg-icon-primary shadow svg-icon-3x"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><rect x="0" y="24" width="24" height="0"/><path d="M5,10.5 C5,6 8,3 12.5,3 C17,3 20,6.75 20,10.5 C20,12.8325623 17.8236613,16.03566 13.470984,20.1092932 C12.9154018,20.6292577 12.0585054,20.6508331 11.4774555,20.1594925 C7.15915182,16.5078313 5,13.2880005 5,10.5 Z M12.5,12 C13.8807119,12 15,10.8807119 15,9.5 C15,8.11928813 13.8807119,7 12.5,7 C11.1192881,7 10,8.11928813 10,9.5 C10,10.8807119 11.1192881,12 12.5,12 Z" fill="#000000" fill-rule="nonzero"/></g></svg></span>`,
|
||||
bgPos: [10, 10],
|
||||
iconAnchor: [20, 37],
|
||||
popupAnchor: [0, -37],
|
||||
className: 'leaflet-marker'
|
||||
});
|
||||
|
||||
// Show current address
|
||||
L.marker([40.724716, -73.984789], { icon: leafletIcon }).addTo(markerLayer).bindPopup('430 E 6th St, New York, 10009.', { closeButton: false }).openPopup();
|
||||
|
||||
// Map onClick Action
|
||||
leaflet.on('click', function (e) {
|
||||
geocodeService.reverse().latlng(e.latlng).run(function (error, result) {
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
markerLayer.clearLayers();
|
||||
selectedlocation = result.address.Match_addr;
|
||||
L.marker(result.latlng, { icon: leafletIcon }).addTo(markerLayer).bindPopup(result.address.Match_addr, { closeButton: false }).openPopup();
|
||||
|
||||
// Show popup confirmation. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
html: 'Your selected - <b>"' + selectedlocation + ' - ' + result.latlng + '"</b>.',
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
// Confirmed
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Init form inputs
|
||||
var initForm = function() {
|
||||
// Team assign. For more info, plase visit the official plugin site: https://select2.org/
|
||||
$(form.querySelector('[name="position"]')).on('change', function() {
|
||||
// Revalidate the field when an option is chosen
|
||||
validator.revalidateField('position');
|
||||
});
|
||||
}
|
||||
|
||||
// Handle form validation and submittion
|
||||
var handleForm = function() {
|
||||
// Stepper custom navigation
|
||||
|
||||
// Init form validation rules. For more info check the FormValidation plugin's official documentation:https://formvalidation.io/
|
||||
validator = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
'name': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'email': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Email address is required'
|
||||
},
|
||||
emailAddress: {
|
||||
message: 'The value is not a valid email address'
|
||||
}
|
||||
}
|
||||
},
|
||||
'message': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Message is required'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row',
|
||||
eleInvalidClass: '',
|
||||
eleValidClass: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Action buttons
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Validate form before submit
|
||||
if (validator) {
|
||||
validator.validate().then(function (status) {
|
||||
console.log('validated!');
|
||||
|
||||
if (status == 'Valid') {
|
||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
submitButton.disabled = true;
|
||||
|
||||
setTimeout(function() {
|
||||
submitButton.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
submitButton.disabled = false;
|
||||
|
||||
Swal.fire({
|
||||
text: "Form has been successfully submitted!",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
//form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
//form.submit(); // Submit form
|
||||
}, 2000);
|
||||
} else {
|
||||
// Scroll top
|
||||
|
||||
// Show error popuo. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "Sorry, looks like there are some errors detected, please try again.",
|
||||
icon: "error",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
KTUtil.scrollTop();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public functions
|
||||
init: function () {
|
||||
// Elements
|
||||
form = document.querySelector('#kt_contact_form');
|
||||
submitButton = document.getElementById('kt_contact_submit_button');
|
||||
|
||||
initForm();
|
||||
handleForm();
|
||||
initMap('kt_contact_map');
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function () {
|
||||
KTContactApply.init();
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTPosSystem = function () {
|
||||
var form;
|
||||
|
||||
var moneyFormat = wNumb({
|
||||
mark: '.',
|
||||
thousand: ',',
|
||||
decimals: 2,
|
||||
prefix: '$',
|
||||
});
|
||||
|
||||
var calculateTotals = function() {
|
||||
var items = [].slice.call(form.querySelectorAll('[data-kt-pos-element="item-total"]'));
|
||||
var total = 0;
|
||||
var tax = 12;
|
||||
var discount = 8;
|
||||
var grantTotal = 0;
|
||||
|
||||
items.map(function (item) {
|
||||
total += moneyFormat.from(item.innerHTML);
|
||||
});
|
||||
|
||||
grantTotal = total;
|
||||
grantTotal -= discount;
|
||||
grantTotal += tax * 8 / 100;
|
||||
|
||||
form.querySelector('[data-kt-pos-element="total"]').innerHTML = moneyFormat.to(total);
|
||||
form.querySelector('[data-kt-pos-element="grant-total"]').innerHTML = moneyFormat.to(grantTotal);
|
||||
}
|
||||
|
||||
var handleQuantity = function() {
|
||||
var dialers = [].slice.call(form.querySelectorAll('[data-kt-pos-element="item"] [data-kt-dialer="true"]'));
|
||||
|
||||
dialers.map(function (dialer) {
|
||||
var dialerObject = KTDialer.getInstance(dialer);
|
||||
|
||||
dialerObject.on('kt.dialer.changed', function(){
|
||||
var quantity = parseInt(dialerObject.getValue());
|
||||
var item = dialerObject.getElement().closest('[data-kt-pos-element="item"]');
|
||||
var value = parseInt(item.getAttribute("data-kt-pos-item-price"));
|
||||
var total = quantity * value;
|
||||
|
||||
item.querySelector('[data-kt-pos-element="item-total"]').innerHTML = moneyFormat.to(total);
|
||||
|
||||
calculateTotals();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public functions
|
||||
init: function () {
|
||||
// Elements
|
||||
form = document.querySelector('#kt_pos_form');
|
||||
|
||||
handleQuantity();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function () {
|
||||
KTPosSystem.init();
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTPricingGeneral = function () {
|
||||
// Private variables
|
||||
var element;
|
||||
var planPeriodMonthButton;
|
||||
var planPeriodAnnualButton;
|
||||
|
||||
var changePlanPrices = function(type) {
|
||||
var items = [].slice.call(element.querySelectorAll('[data-kt-plan-price-month]'));
|
||||
|
||||
items.map(function (item) {
|
||||
var monthPrice = item.getAttribute('data-kt-plan-price-month');
|
||||
var annualPrice = item.getAttribute('data-kt-plan-price-annual');
|
||||
|
||||
if ( type === 'month' ) {
|
||||
item.innerHTML = monthPrice;
|
||||
} else if ( type === 'annual' ) {
|
||||
item.innerHTML = annualPrice;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var handlePlanPeriodSelection = function(e) {
|
||||
|
||||
// Handle period change
|
||||
planPeriodMonthButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
planPeriodMonthButton.classList.add('active');
|
||||
planPeriodAnnualButton.classList.remove('active');
|
||||
|
||||
changePlanPrices('month');
|
||||
});
|
||||
|
||||
planPeriodAnnualButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
planPeriodMonthButton.classList.remove('active');
|
||||
planPeriodAnnualButton.classList.add('active');
|
||||
|
||||
changePlanPrices('annual');
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
element = document.querySelector('#kt_pricing');
|
||||
planPeriodMonthButton = element.querySelector('[data-kt-plan="month"]');
|
||||
planPeriodAnnualButton = element.querySelector('[data-kt-plan="annual"]');
|
||||
|
||||
// Handlers
|
||||
handlePlanPeriodSelection();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTPricingGeneral.init();
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTSocialFeeds = function () {
|
||||
// init variables
|
||||
var morePostsBtn = document.getElementById('kt_social_feeds_more_posts_btn');
|
||||
var morePosts = document.getElementById('kt_social_feeds_more_posts');
|
||||
var posts = document.getElementById('kt_social_feeds_posts');
|
||||
|
||||
var postInput = document.getElementById('kt_social_feeds_post_input');
|
||||
var postBtn = document.getElementById('kt_social_feeds_post_btn');
|
||||
var newPost = document.getElementById('kt_social_feeds_new_post');
|
||||
|
||||
// Private functions
|
||||
var handleMorePosts = function () {
|
||||
// Show more click
|
||||
morePostsBtn.addEventListener('click', function (e) {
|
||||
// Cancel default behavior
|
||||
e.preventDefault();
|
||||
|
||||
// Show indicator
|
||||
morePostsBtn.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
morePostsBtn.disabled = true;
|
||||
|
||||
// Simulate form submission process
|
||||
setTimeout(function() {
|
||||
// Hide loading indication
|
||||
morePostsBtn.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
morePostsBtn.disabled = false;
|
||||
|
||||
// Hide button
|
||||
morePostsBtn.classList.add('d-none');
|
||||
|
||||
// Show card
|
||||
morePosts.classList.remove('d-none');
|
||||
|
||||
// Scroll to
|
||||
KTUtil.scrollTo(morePosts, 200);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
// Private functions
|
||||
var handleNewPost = function () {
|
||||
// Show more click
|
||||
postBtn.addEventListener('click', function (e) {
|
||||
// Cancel default behavior
|
||||
e.preventDefault();
|
||||
|
||||
// Show indicator
|
||||
postBtn.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
postBtn.disabled = true;
|
||||
|
||||
// Simulate form submission process
|
||||
setTimeout(function() {
|
||||
// Hide loading indication
|
||||
postBtn.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
postBtn.disabled = false;
|
||||
|
||||
var message = postInput.value;
|
||||
var post = newPost.querySelector('.card').cloneNode(true);
|
||||
|
||||
posts.prepend(post);
|
||||
|
||||
if (message.length > 0) {
|
||||
post.querySelector('[data-kt-post-element="content"]').innerHTML = message;
|
||||
}
|
||||
|
||||
// Scroll to post
|
||||
KTUtil.scrollTo(post, 200);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
handleMorePosts();
|
||||
handleNewPost();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTSocialFeeds.init();
|
||||
});
|
||||
@@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTProfileGeneral = function () {
|
||||
// init variables
|
||||
var showMoreButton;
|
||||
var showMoreCards;
|
||||
var followBtn;
|
||||
var profileNav;
|
||||
var pageToolbar;
|
||||
|
||||
// Private functions
|
||||
var handleShowMore = function () {
|
||||
if (!showMoreButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show more click
|
||||
showMoreButton.addEventListener('click', function (e) {
|
||||
showMoreButton.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
showMoreButton.disabled = true;
|
||||
|
||||
setTimeout(function() {
|
||||
// Hide loading indication
|
||||
showMoreButton.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
showMoreButton.disabled = false;
|
||||
|
||||
// Hide button
|
||||
showMoreButton.classList.add('d-none');
|
||||
|
||||
// Show card
|
||||
showMoreCards.classList.remove('d-none');
|
||||
|
||||
// Scroll to card
|
||||
KTUtil.scrollTo(showMoreCards, 200);
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
// Follow button
|
||||
var handleUFollow = function() {
|
||||
if (!followBtn) {
|
||||
return;
|
||||
}
|
||||
|
||||
followBtn.addEventListener('click', function(e){
|
||||
// Prevent default action
|
||||
e.preventDefault();
|
||||
|
||||
// Show indicator
|
||||
followBtn.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
followBtn.disabled = true;
|
||||
|
||||
// Check button state
|
||||
if (followBtn.classList.contains("btn-success")) {
|
||||
setTimeout(function() {
|
||||
followBtn.removeAttribute('data-kt-indicator');
|
||||
followBtn.classList.remove("btn-success");
|
||||
followBtn.classList.add("btn-light");
|
||||
followBtn.querySelector(".svg-icon").classList.add("d-none");
|
||||
followBtn.querySelector(".indicator-label").innerHTML = 'Follow';
|
||||
followBtn.disabled = false;
|
||||
}, 1500);
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
followBtn.removeAttribute('data-kt-indicator');
|
||||
followBtn.classList.add("btn-success");
|
||||
followBtn.classList.remove("btn-light");
|
||||
followBtn.querySelector(".svg-icon").classList.remove("d-none");
|
||||
followBtn.querySelector(".indicator-label").innerHTML = 'Following';
|
||||
followBtn.disabled = false;
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var handleFollowers = function() {
|
||||
KTUtil.on(document.body, '[data-kt-follow-btn="true"]', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var el = this;
|
||||
var label = el.querySelector(".indicator-label");
|
||||
var following = el.querySelector(".following");
|
||||
var follow = el.querySelector(".follow");
|
||||
|
||||
el.setAttribute('data-kt-indicator', 'on');
|
||||
el.disabled = true;
|
||||
follow.classList.add("d-none");
|
||||
following.classList.add("d-none")
|
||||
|
||||
setTimeout(function() {
|
||||
el.removeAttribute('data-kt-indicator');
|
||||
el.disabled = false;
|
||||
|
||||
if (el.classList.contains("btn-light-primary")) { // following
|
||||
el.classList.remove("btn-light-primary");
|
||||
el.classList.add("btn-light");
|
||||
|
||||
follow.classList.remove("d-none");
|
||||
|
||||
label.innerHTML = "Follow";
|
||||
} else { // follow
|
||||
el.classList.add("btn-light-primary");
|
||||
el.classList.remove("btn-light");
|
||||
|
||||
following.classList.remove("d-none");
|
||||
|
||||
label.innerHTML = "Following";
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
var handlePageScroll = function() {
|
||||
if ( profileNav && profileNav.getAttribute("data-kt-sticky") && KTUtil.isBreakpointUp('lg')) {
|
||||
|
||||
if ( localStorage.getItem('nav-initialized') === "1") {
|
||||
window.scroll({
|
||||
top: parseInt(profileNav.getAttribute("data-kt-page-scroll-position")),
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
|
||||
localStorage.setItem('nav-initialized', "1");
|
||||
}
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
showMoreButton = document.querySelector('#kt_followers_show_more_button');
|
||||
showMoreCards = document.querySelector('#kt_followers_show_more_cards');
|
||||
followBtn = document.querySelector('#kt_user_follow_button');
|
||||
profileNav = document.querySelector('#kt_user_profile_nav');
|
||||
|
||||
handleShowMore();
|
||||
handleUFollow();
|
||||
handleFollowers();
|
||||
handlePageScroll();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTProfileGeneral.init();
|
||||
});
|
||||
Reference in New Issue
Block a user