This repository has been archived by the owner on Apr 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathSwitcherfunctions.js
66 lines (50 loc) · 2.4 KB
/
Switcherfunctions.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
$(document).ready(function(){
///jquery version used and source= cdn
//https://code.jquery.com/jquery-3.3.1.js
// this event listener should pop up a modal for confirmation to toggles the
// dark mode button to light like YES AND NO BUTTON
$('#dark').click(function(){
$('.modal').toggle('#myModal');
});
// when the user clicks on yes this
// sends an ajax request to a php script to set a session
// for the theme selected,for this button will toggle dark mode to light
$('#toggleToLightMode').click(function(){
$.ajax({
type: "POST",
url:"themeSwitcher.php",
data:{"themeMode":'light'},
success: function(data){
$('ul').toggleClass('active');
//on success the page reloads for php to check
// for sessions isset and do it's normal changes
window.location='settings.php';
}
});
});
// this event listener should pop up a modal for confirmation to toggles the
// light mode button to dark like YES AND NO BUTTON
$('#light').click(function(){
$('.modal').toggle('#myModal');
});
///this should close the modal when they click on no
$('#close').click(function(){
$('.modal').toggle('#myModal');
});
// when the user clicks on yes this
// sends an ajax request to a php script to set a session
// for the theme selected,for this button will toggle dark mode to light
$('#toggleToDarkMode').click(function(){
$.ajax({
type: "POST",
url:"themeSwitcher.php",
data:{"themeMode":'dark'},
success: function(data){
$('ul').toggleClass('active');
//on success the page reloads for php to check
// for sessions isset and do it's normal changes
window.location='index.php';
}
});
});
});