PageSourceSearch

https://www.szugy.hu/wp-content/plugins/real-accessability/real-accessability.js?ver=1.0

js szugy.hu collected 2026-10-02 20:53:10 UTC 8,156 bytes, 278 lines download raw bytes

1/*
2 * Real Accessability
3 * Version: 1.0
4 * Author: REALMEDIA
5 * Website: https://realmedia.co.il
6 * Dual licensed under the MIT and GPL licenses.
7 */
8
9(function($) {
10	
11	"use strict";
12
13	$.RealAccessability = function( options ) {
14	 
15	    var settings = $.extend( {
16	        exclude: '#fb-root',
17	        markup: 'h1, h2, h3, h4, h5, h6, span, div, p, a, input, textarea, li, i',	
18	        hideOnScroll: true	    
19		}, options );
20	    
21		var effects = [
22			'real-accessability-grayscale',
23			'real-accessability-invert'
24		];	 
25		
26		var obj = {
27			fontSize: 0,
28			effect: null,
29			linkHighlight: false,
30			regularFont: false
31		}	
32		
33		var mustExclude = '#real-accessability, #real-accessability ul, #real-accessability li, #real-accessability a, #real-accessability i, #real-accessability div, #wpadminbar, #wpadminbar div, #wpadminbar a, #wpadminbar ul, #wpadminbar li, #wpadminbar span';	
34		
35		settings.exclude = mustExclude + ', ' + settings.exclude;
36		
37		// Init
38		var init = function() {	
39			var cookie = getCookie('real-accessability');
40			
41			if(cookie !== '') {
42				obj = JSON.parse(cookie);	
43				$(settings.markup).not(settings.exclude).each(function() {
44					var fontSize = parseInt( $(this).css('font-size') );
45					$(this).attr('data-raofz', fontSize);			
46				});
47				
48				if(obj.fontSize !== 0) {	
49					$(settings.markup).not(settings.exclude).each(function() {
50						var fontSize = parseInt( $(this).data('raofz') );
51						$(this).css('font-size', fontSize+(2*obj.fontSize));				
52					});	
53				}
54				
55				// For themes that touched the default <?php body_class(); ?> class
56				if(!$('body').hasClass(obj.effect) && obj.effect !== null) {
57					$('body').addClass(obj.effect);
58					$('#'+obj.effect).addClass('clicked');
59				}
60				
61				if(!$('body').hasClass(obj.linkHighlight) && obj.linkHighlight == true) {
62					$('body').addClass('real-accessability-linkHighlight');
63					$('#real-accessability-linkHighlight').addClass('clicked');
64				}
65				
66				if(!$('body').hasClass(obj.regularFont) && obj.regularFont == true) {
67					$('body').addClass('real-accessability-regularFont');
68					$('#real-accessability-regularFont').addClass('clicked');
69				}								
70			}			
71			
72			$('#real-accessability-btn').on('click', openToolbar);	
73			$('#real-accessability-biggerFont').on('click', increaseFont);
74			$('#real-accessability-smallerFont').on('click', decreaseFont);
75			$('.real-accessability-effect').on('click', effectChange);
76			$('#real-accessability-linkHighlight').on('click', linkHighlight);
77			$('#real-accessability-regularFont').on('click', regularFont);
78			$('#real-accessability-reset').on('click', reset);
79		}   
80	 
81		// Get saved cookie option
82		var getCookie = function(name) {
83		    var name = name + '=';
84		    var arr = document.cookie.split(';');
85		    
86		    for(var i=0; i<arr.length; i++) {
87		        var c = arr[i];
88		        while (c.charAt(0) == ' ') c = c.substring(1);
89		        if (c.indexOf(name) == 0) {
90			        return c.substring(name.length,c.length);
91			    }
92		    }
93		    
94		    return '';
95		}
96		
97		// Open toolbar 
98		function openToolbar() {
99			if($(this).parent().hasClass('open')) {
100				$(this).parent().removeClass('open');
101			} else {
102				$(this).parent().addClass('open');
103				if(getCookie('real-accessability') == '') {
104					$(settings.markup).not(settings.exclude).each(function() {
105						var fontSize = parseInt( $(this).css('font-size') );
106						$(this).attr('data-raofz', fontSize);			
107					});	
108				}			
109			}			
110		}
111		
112		// Make font bigger
113		function increaseFont() {
114			if(obj.fontSize < 3) {
115				showLoader(function() {
116					obj.fontSize++;
117					$(settings.markup).not(settings.exclude).each(function() {
118						var fontSize = parseInt( $(this).data('raofz') );
119						$(this).css('font-size', fontSize+(2*obj.fontSize));			
120					});		
121				});		
122			}				
123		}
124		
125		// Make font smaller
126		function decreaseFont() {
127			if(obj.fontSize > -3) {
128				showLoader(function() {
129					obj.fontSize--;
130					$(settings.markup).not(settings.exclude).each(function() {
131						var fontSize = parseInt( $(this).data('raofz') );
132						$(this).css('font-size', fontSize+(2*obj.fontSize));				
133					});	
134				});		
135			}					
136		}
137		
138		// Change effect
139		function effectChange() {
140			var chosenEffect = $(this).attr('id');
141			obj.effect = null;
142			
143			showLoader(function() {					
144				for(var i=0; i<effects.length; i++) {
145					if(!$('body').hasClass(chosenEffect) && chosenEffect == effects[i]) {
146						$('body').addClass(effects[i]);	
147						$('#'+effects[i]).addClass('clicked');		
148						obj.effect = effects[i];		
149					} else {
150						$('body').removeClass(effects[i]);	
151						$('#'+effects[i]).removeClass('clicked');	
152					}
153				}
154			});	
155		}
156		
157		// Highlight all the links
158		function linkHighlight() {
159			var $this = $(this);
160			
161			showLoader(function() {
162				if($('body').hasClass('real-accessability-linkHighlight')) {
163					$('body').removeClass('real-accessability-linkHighlight');
164					$this.removeClass('clicked');
165					obj.linkHighlight = false;
166				} else {
167					$('body').addClass('real-accessability-linkHighlight');	
168					$this.addClass('clicked');
169					obj.linkHighlight = true;
170				}	
171			});		
172		}	
173		
174		// Regular font / More readable font (Arial, Helvetica, sans-serif)
175		function regularFont() {
176			var $this = $(this);
177			
178			showLoader(function() {
179				if($('body').hasClass('real-accessability-regularFont')) {
180					$('body').removeClass('real-accessability-regularFont');
181					$this.removeClass('clicked');
182					obj.regularFont = false;
183				} else {
184					$('body').addClass('real-accessability-regularFont');	
185					$this.addClass('clicked');
186					obj.regularFont = true;
187				}	
188			});		
189		}				
190		
191		// Reset all
192		var reset = function() {
193			showLoader(function() {
194				$('#real-accessability ul li a').removeClass('clicked');
195				
196				$(settings.markup).not(settings.exclude).each(function() {
197					var fontSize = parseInt( $(this).data('raofz') );
198					$(this).css('font-size', fontSize);				
199				});						
200				
201				if($('body').hasClass('real-accessability-grayscale')) {
202					$('body').removeClass('real-accessability-grayscale');
203				}				
204				
205				if($('body').hasClass('real-accessability-invert')) {
206					$('body').removeClass('real-accessability-invert');
207				}			
208				
209				if($('body').hasClass('real-accessability-linkHighlight')) {
210					$('body').removeClass('real-accessability-linkHighlight');
211				}		
212				
213				if($('body').hasClass('real-accessability-regularFont')) {
214					$('body').removeClass('real-accessability-regularFont');
215				}				
216				
217				// Reset the object
218				obj.fontSize = 0;
219				obj.effect = null;
220				obj.linkHighlight = false;
221				obj.regularFont = false;
222			});			
223		}
224		
225		// Disable clicking on toolbar links
226		var disableClicking = function() {
227			$('#real-accessability a').bind('click', function(e) {
228				e.preventDefault();		
229			});			
230		}
231		
232		var showLoader = function(callback) {
233				$('a#real-accessability-btn i.real-accessability-icon').css('display', 'none');	
234				$('a#real-accessability-btn i.real-accessability-loading').show();					
235				setTimeout(function() { 
236					callback(); 
237					$('a#real-accessability-btn i.real-accessability-loading').hide();				
238					$('a#real-accessability-btn i.real-accessability-icon').show();						
239				}, 300);			
240		}
241		
242		// Hide toolbar when scrolling
243		var hideOnScroll = function() {
244			if(settings.hideOnScroll) {
245				$(window).scroll(function() {
246					if($('#real-accessability').hasClass('open')) {
247						$('#real-accessability').removeClass('open');	
248					}	
249				});
250			}				
251		}
252		
253		// Save object in cookie named 'real-accessability' when user redirect page
254		var saveOnRedirect = function() {
255			$(window).on('beforeunload', function() {
256				document.cookie = 'real-accessability=' + JSON.stringify(obj) + '; path=/';
257			});				
258		}
259		
260		// Add role="link" to all links
261		var addLinkRole = function() {
262			$('a').not(settings.exclude).attr('role', 'link');
263		}		
264		
265		var removeLinkTarget = function() {
266			$('a[target]').not(settings.exclude).removeAttr('target');
267		}
268		
269		init();
270		disableClicking();
271		hideOnScroll();
272		saveOnRedirect();
273		addLinkRole();
274		removeLinkTarget();
275	    
276	}
277
278})(jQuery);

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.