PageSourceSearch

https://psghghana.org/public/v4/assets/js/switcher-custom.js

js psghghana.org collected 2026-10-05 02:51:34 UTC 11,213 bytes, 344 lines download raw bytes

1/***************** LIGHT THEME *********************/
2$('#myonoffswitch56').click(function() {
3	if (this.checked) {
4		$('body').addClass('light-theme');
5		$('body').removeClass('dark-theme');
6
7		localStorage.removeItem("medzdark");
8		localStorage.setItem("medzlight", true);
9		checkOptions();
10
11		const root = document.querySelector(':root');
12		root.style = "";
13		names()
14	} 
15	localStorageBackup();
16});
17/***************** LIGHT THEME *********************/
18
19/***************** DARK THEME *********************/
20$('#myonoffswitch57').click(function() {
21	if (this.checked) {
22		$('body').addClass('dark-theme');
23		$('body').removeClass('light-theme');
24
25		localStorage.removeItem("medzlight");
26		localStorage.setItem("medzdark", true);
27		checkOptions();
28
29		localStorage.removeItem("medzbgColor");
30		localStorage.removeItem("medzthemeColor");
31
32		localStorage.setItem('dark-theme', true);
33		localStorage.removeItem('light-theme', false);
34
35		const root = document.querySelector(':root');
36		root.style = "";
37		names()
38	} 
39	localStorageBackup()
40});
41/***************** DARK THEME *********************/
42
43/***************** LTR *********************/
44$('#myonoffswitch54').click(function() {
45	if (this.checked) {
46		$('body').addClass('ltr');
47		$('body').removeClass('rtl');
48		$("html[lang=en]").attr("dir", "ltr");
49		$(".select2-container").attr("dir", "ltr");
50		localStorage.setItem("rtl", "false");
51		$("head link#style").attr("href", $(this));
52		(document.getElementById("style")?.setAttribute("href", "../assets/plugins/bootstrap/css/bootstrap.min.css" ));
53		var carousel = $('.owl-carousel');
54		$.each(carousel ,function( index, element ) {
55		// element == this
56			var carouselData = $(element).data('owl.carousel');
57			carouselData.settings.rtl = false; //don't know if both are necessary
58			carouselData.options.rtl = false;
59			$(element).trigger('refresh.owl.carousel');
60		});
61		
62		localStorage.removeItem("medzrtl");
63		localStorage.setItem("medzltr", true);
64	} 
65});
66/***************** LTR *********************/
67
68/***************** RTL *********************/
69$('#myonoffswitch55').click(function() {
70	if (this.checked) {
71		$('body').addClass('rtl');
72		$('body').removeClass('ltr');
73		$("html[lang=en]").attr("dir", "rtl");
74		$(".select2-container").attr("dir", "rtl");
75		$("head link#style").attr("href", $(this));
76		(document.getElementById("style")?.setAttribute("href","../assets/plugins/bootstrap/css/bootstrap.rtl.min.css"));
77		var carousel = $('.owl-carousel');
78		$.each(carousel ,function( index, element ) {
79		// element == this
80			var carouselData = $(element).data('owl.carousel');
81			carouselData.settings.rtl = true; //don't know if both are necessary
82			carouselData.options.rtl = true;
83			$(element).trigger('refresh.owl.carousel');
84		});
85		localStorage.setItem("medzrtl", true);
86		localStorage.removeItem("medzltr");
87	}
88});
89/***************** RTL *********************/
90
91
92/***************** Header Style 1 *********************/
93	$(document).on('click', '#myonoffswitch', function(e){
94		if (this.checked) {
95			$('body').addClass('headerstyle1');
96			$('body').removeClass('headerstyle3');
97			$('body').removeClass('headerstyle2');
98			localStorage.setItem("headerstyle1", "True");
99		}
100		else {
101			$('body').removeClass('headerstyle3');
102			localStorage.setItem("headerstyle3", "false");
103		}
104	});
105
106	
107/***************** Header Style 2 *********************/
108	$(document).on('click', '#myonoffswitch1', function(e){
109		if (this.checked) {
110			$('body').addClass('headerstyle3');
111			$('body').removeClass('dark-header');
112			$('body').removeClass('headerstyle2');
113			$('body').removeClass('headerstyle1');
114			localStorage.setItem("headerstyle3", "True");
115		}
116		else {
117			$('body').removeClass('headerstyle3');
118			localStorage.setItem("headerstyle3", "false");
119		}
120	});
121
122	
123/***************** Header Style 3 *********************/
124	$(document).on('click', '#myonoffswitch2', function(e){
125		if (this.checked) {
126			$('body').addClass('headerstyle2');
127			$('body').removeClass('headerstyle3');
128			$('body').removeClass('headerstyle1');
129			localStorage.setItem("headerstyle2", "True");
130		}
131		else {
132			$('body').removeClass('headerstyle2');
133			localStorage.setItem("headerstyle2", "false");
134		}
135	});
136
137/***************** Horizontal-Menu Style 1 *********************/
138	$(document).on('click', '#myonoffswitch3', function(e){
139		if (this.checked) {
140			$('body').addClass('default-menu');
141			$('body').removeClass('menu-style1');
142			$('body').removeClass('menu-style2');
143			localStorage.setItem("default-menu", "True");
144		}
145		else {
146			$('body').removeClass('default-menu');
147			localStorage.setItem("default-menu", "false");
148		}
149	});
150
151/***************** Horizontal-Menu Style 2 *********************/
152
153	$(document).on('click', '#myonoffswitch4', function(e){
154		if (this.checked) {
155			$('body').addClass('menu-style1');
156			$('body').removeClass('default-menu');
157			$('body').removeClass('menu-style2');
158			localStorage.setItem("menu-style1", "True");
159		}
160		else {
161			$('body').removeClass('menu-style1');
162			localStorage.setItem("menu-style1", "false");
163		}
164	});
165
166/***************** Horizontal-Menu Style 3 *********************/
167	$(document).on('click', '#myonoffswitch5', function(e){
168		if (this.checked) {
169			$('body').addClass('menu-style2');
170			$('body').removeClass('default-menu');
171			$('body').removeClass('menu-style1');
172			localStorage.setItem("menu-style2", "True");
173		}
174		else {
175			$('body').removeClass('menu-style2');
176			localStorage.setItem("menu-style2", "false");
177		}
178	});
179
180
181
182function checkOptions() {
183	// rtl
184	if (document.querySelector('body').classList.contains('rtl')) {
185		$('#myonoffswitch55').prop('checked', true);
186	}
187	// ltr
188	if (document.querySelector('body').classList.contains('ltr')) {
189		$('#myonoffswitch54').prop('checked', true);
190	}
191	// Light-Theme
192	if (document.querySelector('body').classList.contains('light-theme')) {
193		$('#myonoffswitch56').prop('checked', true);
194	}
195	// Dark-Theme
196	if (document.querySelector('body').classList.contains('dark-theme')) {
197		$('#myonoffswitch57').prop('checked', true);
198	}
199	// Default-Header
200	if (document.querySelector('body').classList.contains('headerstyle1')) {
201		$('#onoffswitch2').prop('checked', true);
202	}
203	// Default-menu
204	if (document.querySelector('body').classList.contains('default-menu')) {
205		$('#onoffswitch3').prop('checked', true);
206	}
207}
208
209/***************** RESET *********************/
210function resetData() {
211	$('#myonoffswitch54').prop('checked', true);
212	$('#myonoffswitch56').prop('checked', true);
213	$('#myonoffswitch3').prop('checked', true);
214	$('#myonoffswitch').prop('checked', true);
215	$('#myonoffswitch57').prop('checked', false);
216	$('#myonoffswitch55').prop('checked', false);
217	names();
218	$('body')?.removeClass('light-theme');
219	$('body')?.removeClass('dark-theme');
220	$('body')?.removeClass('rtl');
221	$('body')?.removeClass('ltr');
222	$('body')?.removeClass('headerstyle3');
223	$('body')?.removeClass('headerstyle2');
224	$('body')?.removeClass('menu-style1');
225	$('body')?.removeClass('menu-style2');
226	$('body').addClass('headerstyle1');
227	$('body').addClass('ltr');
228	$('body').removeClass('rtl');
229	$("html[lang=en]").attr("dir", "ltr");
230	$(".select2-container--default").attr("dir", "ltr");
231	$(".select2-dropdown--below").attr("dir", "ltr");
232	$("head link#style").attr("href", $(this));
233	(document.getElementById("style").setAttribute("href", "../assets/plugins/bootstrap/css/bootstrap.min.css"));
234	var carousel = $('.owl-carousel');
235	$.each(carousel, function (index, element) {
236		// element == this
237		var carouselData = $(element).data('owl.carousel');
238		carouselData.settings.rtl = false; //don't know if both are necessary
239		carouselData.options.rtl = false;
240		$(element).trigger('refresh.owl.carousel');
241		window.dispatchEvent(new Event('resize'));
242	});
243}
244/***************** RESET *********************/
245
246
247	/***************** Add Switcher Classes *********************/
248
249	if (!localStorage.getItem('medzrtl') && !localStorage.getItem('medzltr')) {
250
251		/***************** RTL *********************/
252		// $('body').addClass('rtl');
253		/***************** RTL *********************/
254
255		/***************** LTR *********************/
256		// $('body').addClass('ltr');
257		/***************** LTR *********************/
258
259	}
260
261	/***************** Add Switcher Classes *********************/
262
263	if (!localStorage.getItem('medzrtl') && !localStorage.getItem('medzltr')) {
264
265		/***************** RTL *********************/
266		// $('body').addClass('rtl');
267		/***************** RTL *********************/
268
269		/***************** LTR *********************/
270		// $('body').addClass('ltr');
271		/***************** LTR *********************/
272
273	}
274
275	if (!localStorage.getItem('medzlight') && !localStorage.getItem('medzdark')) {
276
277		/***************** Light THEME *********************/
278		$('body').addClass('light-theme');
279		/***************** Light THEME *********************/
280
281		/***************** DARK THEME *********************/
282		// $('body').addClass('dark-theme');
283		/***************** Dark THEME *********************/
284	}
285	
286	/***************** Default Header Start *********************/
287		// $('body').addClass('headerstyle1');
288		// $('body').removeClass('headerstyle2');
289		// $('body').removeClass('headerstyle3');
290	/***************** Default Header End *********************/
291
292	/***************** Header Style 1 Start *********************/
293		// $('body').addClass('headerstyle2');
294		// $('body').removeClass('headerstyle1');
295		// $('body').removeClass('headerstyle3');
296	/***************** Header Style 1 End *********************/
297
298	/***************** Header Style 2 Start *********************/
299		// $('body').addClass('headerstyle3');
300		// $('body').removeClass('headerstyle2');
301		// $('body').removeClass('headerstyle1');
302	/***************** Header Style 2 End *********************/
303
304	/***************** Default Menu Start *********************/
305		// $('body').addClass('default-menu');
306	/***************** Default Menu End *********************/
307
308	/***************** Menu Style 1 Start *********************/
309		// $('body').addClass('menu-style1');
310	/***************** Menu Style 1 End *********************/
311
312	/***************** Menu Style 2 Start *********************/
313		// $('body').addClass('menu-style2');
314	/***************** Menu Style 2 End *********************/
315
316	/***************** Add Switcher Classes *********************/
317
318
319$(function () {
320	"use strict";
321
322	/***************** RTL HAs Class *********************/
323
324	let bodyRtl = $('body').hasClass('rtl');
325	if (bodyRtl) {
326		$('body').addClass('rtl');
327		$('body').removeClass('ltr');
328		$("html[lang=en]").attr("dir", "rtl");
329		$(".select2-container--default").attr("dir", "rtl");
330		$(".select2-dropdown--below").attr("dir", "rtl");
331		$("head link#style").attr("href", $(this));
332		(document.getElementById("style").setAttribute("href", "../assets/plugins/bootstrap/css/bootstrap.rtl.min.css"));
333		var carousel = $('.owl-carousel');
334		$.each(carousel ,function( index, element ) {
335		// element == this
336			var carouselData = $(element).data('owl.carousel');
337			carouselData.settings.rtl = true; //don't know if both are necessary
338			carouselData.options.rtl = true;
339			$(element).trigger('refresh.owl.carousel');
340		});
341	}
342	/***************** RTL HAs Class *********************/
343    
344});

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.