-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathtech-stack.js
More file actions
79 lines (70 loc) · 2.4 KB
/
Copy pathtech-stack.js
File metadata and controls
79 lines (70 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
=========================================================================
=========================================================================
Template Name: SaasAble - Tailwind Multipurpose UI Kit
Author: Phoenixcoded
Support: https://phoenixcoded.authordesk.app
File: tech-stack.js
Description: this file will contains code for handling Buynow link.
=========================================================================
=========================================================================
*/
var BuyNowLink = '';
var ref = "";
function getQueryStringParameters() {
const queryString = window.location.search;
const params = new URLSearchParams(queryString);
if (params.get('ref') == 'tf') {
ref = "tf"
sessionStorage.setItem('ref', ref);
}
check_auth();
function check_auth() {
if (sessionStorage.getItem('ref', ref)) {
BuyNowLink = 'https://codedthemes.com/item/saasable-tailwind-ui-kit/';
} else {
try {
BuyNowLink = 'https://codedthemes.com/item/saasable-tailwind-ui-kit/';
if (ref == "tf") {
BuyNowLink = 'https://codedthemes.com/item/saasable-tailwind-ui-kit/';
}
} catch (err) {
BuyNowLink = 'https://codedthemes.com/item/saasable-tailwind-ui-kit/';
}
}
}
document.addEventListener('DOMContentLoaded', function () {
var elem = document.querySelectorAll('.buy_now_link');
for (var j = 0; j < elem.length; j++) {
elem[j].setAttribute('href', BuyNowLink);
}
});
}
getQueryStringParameters();
function changebrand(word) {
// Map brand names to their corresponding classes
const brandClasses = {
Themeforest: 'tf',
Codedthemes: 'ct'
};
// Get the class to show based on the word
const showClass = brandClasses[word] || null;
if (!showClass) return; // Exit if no matching brand
// Select all elements for both classes
const tfElements = document.querySelectorAll('.tf');
const ctElements = document.querySelectorAll('.ct');
// Helper to toggle display
function toggleDisplay(elements, show) {
elements.forEach(el => el.style.display = show ? '' : 'none');
}
// Show elements with the matched class, hide others
toggleDisplay(tfElements, showClass === 'tf');
toggleDisplay(ctElements, showClass === 'ct');
}
document.addEventListener('DOMContentLoaded', () => {
if (ref === "tf") {
changebrand('Themeforest');
} else {
changebrand('Codedthemes');
}
})