PageSourceSearch

https://www.stadt-hohenmoelsen.de/res/modules/accessibility/templates/js/accessibility.js?v=v5.52.00

js stadt-hohenmoelsen.de collected 2026-10-02 16:47:55 UTC 5,175 bytes, 237 lines download raw bytes

1function GCAccessibility(options)
2{
3	this.fontsize 	= (options.fontsize && options.fontsize == 1);
4	this.monochrome = (options.monochrome && options.monochrome == 1);
5	
6	// font size
7	if (this.fontsize) 
8	{
9		this.variations	= (options.variations ? options.variations : 5);
10		this.max_step	= ( (this.variations-1) / 2 );
11		this.current	= options.current;
12		this.fontsize_target = (options.fontsize_target ? options.fontsize_target : 'html');
13		
14		var fontsizes	= options.fontsizes;
15		
16		this.fontsizes = {
17			'70'  : 70,	
18			'80'  : 80,	
19			'90'  : 90,	
20			'100' : 100,
21			'110' : 110,
22			'120' : 120,
23			'130' : 130
24		};
25		
26		// default fontsize
27		if( fontsizes.normal ){
28			this.fontsizes['100'] = fontsizes.normal;
29		}
30		
31		// negative values
32		if( fontsizes.m1 ){
33			this.fontsizes['90'] = fontsizes.m1;
34		}
35		if( fontsizes.m2 ){
36			this.fontsizes['80'] = fontsizes.m2;
37		}
38		if( fontsizes.m3 ){
39			this.fontsizes['70'] = fontsizes.m3;
40		}
41		
42		// positive values
43		if( fontsizes.p1 ){
44			this.fontsizes['110'] = fontsizes.p1;
45		}
46		if( fontsizes.p2 ){
47			this.fontsizes['120'] = fontsizes.p2;
48		}
49		if( fontsizes.p3 ){
50			this.fontsizes['130'] = fontsizes.p3;
51		}
52	}
53	
54	// Kontrstmodus
55	if( this.monochrome ) {
56		this.monochrome_target = (options.monochrome_target ? options.monochrome_target : 'html');
57	}
58	
59	// allgemein
60	this.selector	= options.selector;
61	
62	this.store		= (options.store && options.store == 1);
63	if( this.store ) {
64		this.restore();
65	}
66}
67
68GCAccessibility.prototype.init = function() 
69{
70	var context = this;
71	
72	if (this.fontsize) 
73	{
74		jQuery(this.selector).on('click', 'a.fontsize-controllers', function(event) {
75		
76			var $e  = jQuery(this);
77			var val = $e.data('value');
78			
79			if( val == 0 ) {
80				context.reset();
81			}
82			else if( val > 0 ) {
83				context.plus();
84			}
85			else {
86				context.minus();
87			}
88			
89			event.preventDefault();
90			return false;
91		});
92	}
93	
94	if (this.monochrome) 
95	{
96		jQuery(this.selector).on('click', 'a.monochrome-controllers', function(event) {
97			
98			var $e  = jQuery(this);
99			var val = $e.data('value');
100						
101			context.setMonochrome(val);
102
103			event.preventDefault();
104			return false;
105		});
106	}
107};
108
109GCAccessibility.prototype.reset = function() 
110{
111	this.current = 0;
112	this.setNewSize();
113};
114
115GCAccessibility.prototype.plus = function() 
116{
117	if( this.current+1 == 0 ) {
118		this.reset();
119	}
120	else if( this.current+1 < 0 || this.current+1 <= this.max_step ) {
121		this.current++;
122		this.setNewSize();
123	}
124};
125
126GCAccessibility.prototype.minus = function() 
127{
128	if( this.current-1 == 0 ) {
129		this.reset();
130	}
131	else if( this.current-1 > 0 || (-(this.current)) < this.max_step ) {
132		this.current--;
133		this.setNewSize();
134	}
135};
136
137GCAccessibility.prototype.setNewSize = function() 
138{
139	if( this.store ) {  
140		sessionStorage.setItem('gc_accessibility.fontsize', this.current);
141	}
142	
143	var key = String(100 + (this.current * 10));	
144	var percent = this.fontsizes[key];
145	jQuery(this.fontsize_target).css('font-size', percent+ '%');
146	
147	if( this.current >= this.max_step ) {
148		this.disable('plus');
149	}
150	else {
151		this.enable('plus');
152	}
153	
154	if( (-(this.current)) >= this.max_step ) {
155		this.disable('minus');
156	}
157	else {
158		this.enable('minus');
159	}
160	
161	if( this.current == 0 ) {
162		this.disable('reset');
163	}
164	else {
165		this.enable('reset');
166	}
167};
168
169GCAccessibility.prototype.disable = function(type) 
170{
171	jQuery(this.selector + " a[data-type='"+type+"']").addClass('inactive');
172};
173
174GCAccessibility.prototype.enable = function(type) 
175{
176	jQuery(this.selector + " a[data-type='"+type+"']").removeClass('inactive');
177};
178
179
180GCAccessibility.prototype.setMonochrome = function(val) 
181{
182	// Button state setzen
183	jQuery(this.selector + " a[data-type='mono']").each(function(idx, item){
184		var $item = jQuery(item);
185		if($item.data('value') == val ) {
186			$item.addClass('inactive');
187		}
188		else {
189			$item.removeClass('inactive');
190		}
191	});
192	
193	if( this.store ) {  
194		sessionStorage.setItem('gc_accessibility.monochrome', val);
195	}
196	
197	var whitelist = ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'span', 'div', 'table', 'th', 'td', 'ol', 'ul', 'li', 'body'];
198	var selectors = [];
199	
200	for(var i=0; i<whitelist.length; i++) {
201		selectors.push(this.monochrome_target + ' ' + whitelist[i]);
202	}
203	
204	var strSelector = selectors.join(',');
205		
206	if( val == 'rgb' ) {
207		jQuery(strSelector).removeClass('accessibility_monochrome_black_white accessibility_monochrome_blue_yellow');
208	}
209	else if( val == 'black_white' ) {
210		jQuery(strSelector).removeClass('accessibility_monochrome_blue_yellow');
211		jQuery(strSelector).not(".gc_accessibility *").addClass('accessibility_monochrome_black_white');
212	}
213	else if(  val == 'blue_yellow' ) {
214		jQuery(strSelector).removeClass('accessibility_monochrome_black_white');
215		jQuery(strSelector).not(".gc_accessibility *").addClass('accessibility_monochrome_blue_yellow');
216	}
217};
218
219GCAccessibility.prototype.restore = function() 
220{
221	if (this.fontsize) 
222	{
223		var current = sessionStorage.getItem('gc_accessibility.fontsize');
224		if( current ) {
225			this.current = parseInt(current);
226			this.setNewSize();
227		}
228	}
229	
230	if (this.monochrome) 
231	{
232		var mono = sessionStorage.getItem('gc_accessibility.monochrome');
233		if( mono ) {
234			this.setMonochrome(mono);
235		}
236	}
237};

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.