-
Notifications
You must be signed in to change notification settings - Fork 0
/
js.js
92 lines (79 loc) · 3.14 KB
/
js.js
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
80
81
82
83
84
85
86
87
88
89
90
91
92
// // Function to update the switch state based on the stored value
// function updateSwitchState() {
// var isChecked = localStorage.getItem('switchState') === 'true';
// $('.switch3 input[type="checkbox"]').prop('checked', isChecked);
// handleSwitchChange.call($('.switch3 input[type="checkbox"]'));
// }
// // Function to handle the switch change event
// function handleSwitchChange() {
// var isChecked = $(this).is(':checked');
// var dad = $(this).parent();
// if (isChecked) {
// dad.addClass('switch3-checked');
// $("body").css("background-color", "#393E46")
// $(".links a").css('color', '#EEEEEE');
// $("#nav").css('background-color', '#222831').css('color', '#EEEEEE');
// } else {
// dad.removeClass('switch3-checked');
// $("body").css("background-color", "#F2F2F2")
// $(".links a").css('color', '#000000');
// $("#nav").css('background-color', '#FFFFFF').css('color', '#000000');
// }
// // Store the switch state in localStorage
// localStorage.setItem('switchState', isChecked);
// }
// // Bind the switch change event
// $('.switch3 input[type="checkbox"]').on('change', handleSwitchChange);
// // Update the switch state when the page loads
// updateSwitchState();
function updateSwitchState() {
var isChecked = localStorage.getItem('switchState') === 'true';
$('.switch3 input[type="checkbox"]').prop('checked', isChecked);
handleSwitchChange.call($('.switch3 input[type="checkbox"]'));
}
function handleSwitchChange() {
var isChecked = $(this).is(':checked');
var dad = $(this).parent();
if (isChecked) {
dad.addClass('switch3-checked');
$("body").css("background-color", "#393E46");
$(".links a").css('color', '#EEEEEE');
$("#nav").css('background-color', '#222831').css('color', '#EEEEEE');
} else {
dad.removeClass('switch3-checked');
$("body").css("background-color", "#F2F2F2");
$(".links a").css('color', '#000000');
$("#nav").css('background-color', '#FFFFFF').css('color', '#000000');
}
// Update the text color within the Facebook iframe
changeFacebookTextColor(isChecked ? '#EEEEEE' : '#000000');
// Store the switch state in localStorage
localStorage.setItem('switchState', isChecked);
}
// Function to modify the text color in the Facebook iframe
function changeFacebookTextColor(color) {
// Access the Facebook iframe element
var iframe = document.getElementById('facebook');
// Check if the iframe exists
if (iframe) {
// Access the iframe's content window
var iframeWindow = iframe.contentWindow;
// Check if the iframe has loaded
if (iframeWindow && iframeWindow.postMessage) {
// Send a postMessage to the iframe with the text color data
iframeWindow.postMessage(color, '*');
}
}
}
// Bind the switch change event
$('.switch3 input[type="checkbox"]').on('change', handleSwitchChange);
// Update the switch state when the page loads
updateSwitchState();
$(document).ready(function() {
$('.slideshow').slick({
dots: true, // Display navigation dots
arrows: true, // Display navigation arrows
autoplay: true, // Enable autoplay
autoplaySpeed: 2000 // Set autoplay speed in milliseconds
});
});