PageSourceSearch

https://geschichte-wissen.de/foren/styles/Milk_v2/template/forum_fn.js?assets_version=81

js geschichte-wissen.de collected 2026-10-02 08:03:46 UTC 27,036 bytes, 1,105 lines download raw bytes

1/* global phpbb */
2
3/**
4* phpBB3 forum functions
5*/
6
7/**
8* Find a member
9*/
10function find_username(url) {
11	'use strict';
12
13	popup(url, 760, 570, '_usersearch');
14	return false;
15}
16
17/**
18* Window popup
19*/
20function popup(url, width, height, name) {
21	'use strict';
22
23	if (!name) {
24		name = '_popup';
25	}
26
27	window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width);
28	return false;
29}
30
31/**
32* Jump to page
33*/
34function pageJump(item) {
35	'use strict';
36
37	var page = parseInt(item.val(), 10),
38		perPage = item.attr('data-per-page'),
39		baseUrl = item.attr('data-base-url'),
40		startName = item.attr('data-start-name');
41
42	if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) {
43		if (baseUrl.indexOf('?') === -1) {
44			document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
45		} else {
46			document.location.href = baseUrl.replace(/&/g, '&') + '&' + startName + '=' + ((page - 1) * perPage);
47		}
48	}
49}
50
51/**
52* Mark/unmark checklist
53* id = ID of parent container, name = name prefix, state = state [true/false]
54*/
55function marklist(id, name, state) {
56	'use strict';
57
58	jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
59		var $this = jQuery(this);
60		if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) {
61			$this.prop('checked', state);
62		}
63	});
64}
65
66/**
67* Resize viewable area for attached image or topic review panel (possibly others to come)
68* e = element
69*/
70function viewableArea(e, itself) {
71	'use strict';
72
73	if (!e) {
74		return;
75	}
76
77	if (!itself) {
78		e = e.parentNode;
79	}
80
81	if (!e.vaHeight) {
82		// Store viewable area height before changing style to auto
83		e.vaHeight = e.offsetHeight;
84		e.vaMaxHeight = e.style.maxHeight;
85		e.style.height = 'auto';
86		e.style.maxHeight = 'none';
87		e.style.overflow = 'visible';
88	} else {
89		// Restore viewable area height to the default
90		e.style.height = e.vaHeight + 'px';
91		e.style.overflow = 'auto';
92		e.style.maxHeight = e.vaMaxHeight;
93		e.vaHeight = false;
94	}
95}
96
97/**
98* Alternate display of subPanels
99*/
100jQuery(function($) {
101	'use strict';
102
103	$('.sub-panels').each(function() {
104
105		var $childNodes = $('a[data-subpanel]', this),
106			panels = $childNodes.map(function () {
107				return this.getAttribute('data-subpanel');
108			}),
109			showPanel = this.getAttribute('data-show-panel');
110
111		if (panels.length) {
112			activateSubPanel(showPanel, panels);
113			$childNodes.click(function () {
114				activateSubPanel(this.getAttribute('data-subpanel'), panels);
115				return false;
116			});
117		}
118	});
119});
120
121/**
122* Activate specific subPanel
123*/
124function activateSubPanel(p, panels) {
125	'use strict';
126
127	var i, showPanel;
128
129	if (typeof p === 'string') {
130		showPanel = p;
131	}
132	$('input[name="show_panel"]').val(showPanel);
133
134	if (typeof panels === 'undefined') {
135		panels = jQuery('.sub-panels a[data-subpanel]').map(function() {
136			return this.getAttribute('data-subpanel');
137		});
138	}
139
140	for (i = 0; i < panels.length; i++) {
141		jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none');
142		jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel);
143	}
144}
145
146function selectCode(a) {
147	'use strict';
148
149	// Get ID of code block
150	var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
151	var s, r;
152
153	// Not IE and IE9+
154	if (window.getSelection) {
155		s = window.getSelection();
156		// Safari and Chrome
157		if (s.setBaseAndExtent) {
158			var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
159			try {
160				s.setBaseAndExtent(e, 0, e, l);
161			} catch (error) {
162				r = document.createRange();
163				r.selectNodeContents(e);
164				s.removeAllRanges();
165				s.addRange(r);
166			}
167		}
168		// Firefox and Opera
169		else {
170			// workaround for bug # 42885
171			if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '<BR>') {
172				e.innerHTML = e.innerHTML + '&nbsp;';
173			}
174
175			r = document.createRange();
176			r.selectNodeContents(e);
177			s.removeAllRanges();
178			s.addRange(r);
179		}
180	}
181	// Some older browsers
182	else if (document.getSelection) {
183		s = document.getSelection();
184		r = document.createRange();
185		r.selectNodeContents(e);
186		s.removeAllRanges();
187		s.addRange(r);
188	}
189	// IE
190	else if (document.selection) {
191		r = document.body.createTextRange();
192		r.moveToElementText(e);
193		r.select();
194	}
195}
196
197/**
198* Play quicktime file by determining it's width/height
199* from the displayed rectangle area
200*/
201function play_qt_file(obj) {
202	'use strict';
203
204	var rectangle = obj.GetRectangle();
205	var width, height;
206
207	if (rectangle) {
208		rectangle = rectangle.split(',');
209		var x1 = parseInt(rectangle[0], 10);
210		var x2 = parseInt(rectangle[2], 10);
211		var y1 = parseInt(rectangle[1], 10);
212		var y2 = parseInt(rectangle[3], 10);
213
214		width = (x1 < 0) ? (x1 * -1) + x2 : x2 - x1;
215		height = (y1 < 0) ? (y1 * -1) + y2 : y2 - y1;
216	} else {
217		width = 200;
218		height = 0;
219	}
220
221	obj.width = width;
222	obj.height = height + 16;
223
224	obj.SetControllerVisible(true);
225	obj.Play();
226}
227
228/**
229* Play quicktime file by determining it's width/height
230* from the displayed rectangle area
231*/
232function play_qt_file(obj) {
233	'use strict';
234
235	var rectangle = obj.GetRectangle();
236	var width, height;
237
238	if (rectangle) {
239		rectangle = rectangle.split(',');
240		var x1 = parseInt(rectangle[0], 10);
241		var x2 = parseInt(rectangle[2], 10);
242		var y1 = parseInt(rectangle[1], 10);
243		var y2 = parseInt(rectangle[3], 10);
244
245		width = (x1 < 0) ? (x1 * -1) + x2 : x2 - x1;
246		height = (y1 < 0) ? (y1 * -1) + y2 : y2 - y1;
247	} else {
248		width = 200;
249		height = 0;
250	}
251
252	obj.width = width;
253	obj.height = height + 16;
254
255	obj.SetControllerVisible(true);
256	obj.Play();
257}
258
259var inAutocomplete = false;
260var lastKeyEntered = '';
261
262/**
263* Check event key
264*/
265function phpbbCheckKey(event) {
266	'use strict';
267
268	// Keycode is array down or up?
269	if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) {
270		inAutocomplete = true;
271	}
272
273	// Make sure we are not within an "autocompletion" field
274	if (inAutocomplete) {
275		// If return pressed and key changed we reset the autocompletion
276		if (!lastKeyEntered || lastKeyEntered === event.which) {
277			inAutocomplete = false;
278			return true;
279		}
280	}
281
282	// Keycode is not return, then return. ;)
283	if (event.which !== 13) {
284		lastKeyEntered = event.which;
285		return true;
286	}
287
288	return false;
289}
290
291/**
292* Apply onkeypress event for forcing default submit button on ENTER key press
293*/
294jQuery(function($) {
295	'use strict';
296
297	$('form input[type=text], form input[type=password]').on('keypress', function (e) {
298		var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action');
299
300		if (!defaultButton || defaultButton.length <= 0) {
301			return true;
302		}
303
304		if (phpbbCheckKey(e)) {
305			return true;
306		}
307
308		if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
309			defaultButton.click();
310			return false;
311		}
312
313		return true;
314	});
315});
316
317/**
318* Functions for user search popup
319*/
320function insertUser(formId, value) {
321	'use strict';
322
323	var $form = jQuery(formId),
324		formName = $form.attr('data-form-name'),
325		fieldName = $form.attr('data-field-name'),
326		item = opener.document.forms[formName][fieldName];
327
328	if (item.value.length && item.type === 'textarea') {
329		value = item.value + '\n' + value;
330	}
331
332	item.value = value;
333}
334
335function insert_marked_users(formId, users) {
336	'use strict';
337
338	$(users).filter(':checked').each(function() {
339		insertUser(formId, this.value);
340	});
341
342	window.close();
343}
344
345function insert_single_user(formId, user) {
346	'use strict';
347
348	insertUser(formId, user);
349	window.close();
350}
351
352/**
353* Parse document block
354*/
355function parseDocument($container) {
356	'use strict';
357
358	var test = document.createElement('div'),
359		oldBrowser = (typeof test.style.borderRadius === 'undefined'),
360		$body = $('body');
361
362	/**
363	* Reset avatar dimensions when changing URL or EMAIL
364	*/
365	$container.find('input[data-reset-on-edit]').on('keyup', function() {
366		$(this.getAttribute('data-reset-on-edit')).val('');
367	});
368
369	/**
370	* Pagination
371	*/
372	$container.find('.pagination .page-jump-form :button').click(function() {
373		var $input = $(this).siblings('input.inputbox');
374		pageJump($input);
375	});
376
377	$container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) {
378		if (event.which === 13 || event.keyCode === 13) {
379			event.preventDefault();
380			pageJump($(this));
381		}
382	});
383
384	$container.find('.pagination .dropdown-trigger').click(function() {
385		var $dropdownContainer = $(this).parent();
386		// Wait a little bit to make sure the dropdown has activated
387		setTimeout(function() {
388			if ($dropdownContainer.hasClass('dropdown-visible')) {
389				$dropdownContainer.find('input.inputbox').focus();
390			}
391		}, 100);
392	});
393
394	/**
395	* Resize navigation (breadcrumbs) block to keep all links on same line
396	*/
397	$container.find('.navlinks').each(function() {
398		var $this = $(this),
399			$left = $this.children().not('.rightside'),
400			$right = $this.children('.rightside');
401
402		if ($left.length !== 1 || !$right.length) {
403			return;
404		}
405
406		function resize() {
407			var width = 0,
408				diff = $left.outerWidth(true) - $left.width(),
409				minWidth = Math.max($this.width() / 3, 240),
410				maxWidth;
411
412			$right.each(function() {
413				var $this = $(this);
414				if ($this.is(':visible')) {
415					width += $this.outerWidth(true);
416				}
417			});
418
419			maxWidth = $this.width() - width - diff;
420			$left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px');
421		}
422
423		resize();
424		$(window).resize(resize);
425	});
426
427	/**
428	* Makes breadcrumbs responsive
429	*/
430	$container.find('.breadcrumbs:not([data-skip-responsive])').each(function() {
431		var $this = $(this),
432			$links = $this.find('.crumb'),
433			length = $links.length,
434			classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'],
435			classesLength = classes.length,
436			maxHeight = 0,
437			lastWidth = false,
438			wrapped = false;
439
440		// Set tooltips
441		$this.find('a').each(function() {
442			var $link = $(this);
443			$link.attr('title', $link.text());
444		});
445
446		// Function that checks breadcrumbs
447		function check() {
448			var height = $this.height(),
449				width;
450
451			// Test max-width set in code for .navlinks above
452			width = parseInt($this.css('max-width'), 10);
453			if (!width) {
454				width = $body.width();
455			}
456
457			maxHeight = parseInt($this.css('line-height'), 10);
458			$links.each(function() {
459				if ($(this).height() > 0) {
460					maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
461				}
462			});
463
464			if (height <= maxHeight) {
465				if (!wrapped || lastWidth === false || lastWidth >= width) {
466					return;
467				}
468			}
469			lastWidth = width;
470
471			if (wrapped) {
472				$this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' '));
473				if ($this.height() <= maxHeight) {
474					return;
475				}
476			}
477
478			wrapped = true;
479			$this.addClass('wrapped');
480			if ($this.height() <= maxHeight) {
481				return;
482			}
483
484			for (var i = 0; i < classesLength; i++) {
485				for (var j = length - 1; j >= 0; j--) {
486					$links.eq(j).addClass('wrapped ' + classes[i]);
487					if ($this.height() <= maxHeight) {
488						return;
489					}
490				}
491			}
492		}
493
494		// Run function and set event
495		check();
496		$(window).resize(check);
497	});
498
499	/**
500	* Responsive link lists
501	*/
502	var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' +
503		'.postbody .post-buttons:not([data-skip-responsive])';
504	$container.find(selector).each(function() {
505		var $this = $(this),
506			filterSkip = '.breadcrumbs, [data-skip-responsive]',
507			filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
508			$linksAll = $this.children(),
509			$linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden
510			$linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first
511			$linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last
512			persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)?
513			html = '<li class="responsive-menu hidden"><a href="javascript:void(0);" class="js-responsive-menu-link responsive-menu-link"><i class="icon fa-bars fa-fw" aria-hidden="true"></i></a><div class="dropdown"><div class="pointer"><div class="pointer-inner"></div></div><ul class="dropdown-contents" /></div></li>',
514			slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occurred.
515
516		// Add a hidden drop-down menu to each links list (except those that already have one)
517		if (!persistent) {
518			if ($linksNotSkip.is('.rightside')) {
519				$linksNotSkip.filter('.rightside:first').before(html);
520				$this.children('.responsive-menu').addClass('rightside');
521			} else {
522				$this.append(html);
523			}
524		}
525
526		// Set some object references and initial states
527		var $menu = $this.children('.responsive-menu'),
528			$menuContents = $menu.find('.dropdown-contents'),
529			persistentContent = $menuContents.find('li:not(.separator)').length,
530			lastWidth = false,
531			compact = false,
532			responsive1 = false,
533			responsive2 = false,
534			copied1 = false,
535			copied2 = false,
536			maxHeight = 0;
537
538		// Find the tallest element in the list (we assume that all elements are roughly the same height)
539		$linksAll.each(function() {
540			if (!$(this).height()) {
541				return;
542			}
543			maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
544		});
545		if (maxHeight < 1) {
546			return; // Shouldn't be possible, but just in case, abort
547		} else {
548			maxHeight = maxHeight + slack;
549		}
550
551		function check() {
552			var width = $body.width();
553			// We can't make it any smaller than this, so just skip
554			if (responsive2 && compact && (width <= lastWidth)) {
555				return;
556			}
557			lastWidth = width;
558
559			// Reset responsive and compact layout
560			if (responsive1 || responsive2) {
561				$linksNotSkip.removeClass('hidden');
562				$menuContents.children('.clone').addClass('hidden');
563				responsive1 = responsive2 = false;
564			}
565			if (compact) {
566				$this.removeClass('compact');
567				compact = false;
568			}
569
570			// Unhide the quick-links menu if it has "persistent" content
571			if (persistent && persistentContent) {
572				$menu.removeClass('hidden');
573			} else {
574				$menu.addClass('hidden');
575			}
576
577			// Nothing to resize if block's height is not bigger than tallest element's height
578			if ($this.height() <= maxHeight) {
579				return;
580			}
581
582			// STEP 1: Compact
583			if (!compact) {
584				$this.addClass('compact');
585				compact = true;
586			}
587			if ($this.height() <= maxHeight) {
588				return;
589			}
590
591			// STEP 2: First responsive set - compact
592			if (compact) {
593				$this.removeClass('compact');
594				compact = false;
595			}
596			// Copy the list items to the dropdown
597			if (!copied1) {
598				var $clones1 = $linksFirst.clone(true);
599				$menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside'));
600
601				if ($this.hasClass('post-buttons')) {
602					$('.button', $menuContents).removeClass('button');
603					$('.sr-only', $menuContents).removeClass('sr-only');
604					$('.js-responsive-menu-link').addClass('button').addClass('button-icon-only');
605					$('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h');
606				}
607				copied1 = true;
608			}
609			if (!responsive1) {
610				$linksFirst.addClass('hidden');
611				responsive1 = true;
612				$menuContents.children('.clone-first').removeClass('hidden');
613				$menu.removeClass('hidden');
614			}
615			if ($this.height() <= maxHeight) {
616				return;
617			}
618
619			// STEP 3: First responsive set + compact
620			if (!compact) {
621				$this.addClass('compact');
622				compact = true;
623			}
624			if ($this.height() <= maxHeight) {
625				return;
626			}
627
628			// STEP 4: Last responsive set - compact
629			if (!$linksLast.length) {
630				return; // No other links to hide, can't do more
631			}
632			if (compact) {
633				$this.removeClass('compact');
634				compact = false;
635			}
636			// Copy the list items to the dropdown
637			if (!copied2) {
638				var $clones2 = $linksLast.clone();
639				$menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside'));
640				copied2 = true;
641			}
642			if (!responsive2) {
643				$linksLast.addClass('hidden');
644				responsive2 = true;
645				$menuContents.children('.clone-last').removeClass('hidden');
646			}
647			if ($this.height() <= maxHeight) {
648				return;
649			}
650
651			// STEP 5: Last responsive set + compact
652			if (!compact) {
653				$this.addClass('compact');
654				compact = true;
655			}
656		}
657
658		if (!persistent) {
659			phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false);
660		}
661
662		// If there are any images in the links list, run the check again after they have loaded
663		$linksAll.find('img').each(function() {
664			$(this).on('load', function() {
665				check();
666			});
667		});
668
669		check();
670		$(window).resize(check);
671	});
672
673	/**
674	* Do not run functions below for old browsers
675	*/
676	if (oldBrowser) {
677		return;
678	}
679
680	/**
681	* Adjust topiclist lists with check boxes
682	*/
683	$container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark');
684
685	/**
686	* Appends contents of all extra columns to first column in
687	* .topiclist lists for mobile devices. Copies contents as is.
688	*
689	* To add that functionality to .topiclist list simply add
690	* responsive-show-all to list of classes
691	*/
692	$container.find('.topiclist.responsive-show-all > li > dl').each(function() {
693		var $this = $(this),
694			$block = $this.find('dt .responsive-show:last-child'),
695			first = true;
696
697		// Create block that is visible only on mobile devices
698		if (!$block.length) {
699			$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
700			$block = $this.find('dt .responsive-show:last-child');
701		} else {
702			first = ($.trim($block.text()).length === 0);
703		}
704
705		// Copy contents of each column
706		$this.find('dd').not('.mark').each(function() {
707			var column = $(this),
708				$children = column.children(),
709				html = column.html();
710
711			if ($children.length === 1 && $children.text() === column.text()) {
712				html = $children.html();
713			}
714
715			$block.append((first ? '' : '<br>') + html);
716
717			first = false;
718		});
719	});
720
721	/**
722	* Same as above, but prepends text from header to each
723	* column before contents of that column.
724	*
725	* To add that functionality to .topiclist list simply add
726	* responsive-show-columns to list of classes
727	*/
728	$container.find('.topiclist.responsive-show-columns').each(function() {
729		var $list = $(this),
730			headers = [],
731			headersLength = 0;
732
733		// Find all headers, get contents
734		$list.prev('.topiclist').find('li.header dd').not('.mark').each(function() {
735			headers.push($("<div>").text($(this).text()).html());
736			headersLength++;
737		});
738
739		if (!headersLength) {
740			return;
741		}
742
743		// Parse each row
744		$list.find('dl').each(function() {
745			var $this = $(this),
746				$block = $this.find('dt .responsive-show:last-child'),
747				first = true;
748
749			// Create block that is visible only on mobile devices
750			if (!$block.length) {
751				$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
752				$block = $this.find('dt .responsive-show:last-child');
753			} else {
754				first = ($.trim($block.text()).length === 0);
755			}
756
757			// Copy contents of each column
758			$this.find('dd').not('.mark').each(function(i) {
759				var column = $(this),
760					children = column.children(),
761					html = column.html();
762
763				if (children.length === 1 && children.text() === column.text()) {
764					html = children.html();
765				}
766
767				// Prepend contents of matching header before contents of column
768				if (i < headersLength) {
769					html = headers[i] + ': <strong>' + html + '</strong>';
770				}
771
772				$block.append((first ? '' : '<br>') + html);
773
774				first = false;
775			});
776		});
777	});
778
779	/**
780	* Responsive tables
781	*/
782	$container.find('table.table1').not('.not-responsive').each(function() {
783		var $this = $(this),
784			$th = $this.find('thead > tr > th'),
785			headers = [],
786			totalHeaders = 0,
787			i, headersLength;
788
789		// Find each header
790		$th.each(function(column) {
791			var cell = $(this),
792				colspan = parseInt(cell.attr('colspan'), 10),
793				dfn = cell.attr('data-dfn'),
794				text = dfn ? dfn : cell.text();
795
796			colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
797
798			for (i = 0; i < colspan; i++) {
799				headers.push(text);
800			}
801			totalHeaders++;
802
803			if (dfn && !column) {
804				$this.addClass('show-header');
805			}
806		});
807
808		headersLength = headers.length;
809
810		// Add header text to each cell as <dfn>
811		$this.addClass('responsive');
812
813		if (totalHeaders < 2) {
814			$this.addClass('show-header');
815			return;
816		}
817
818		$this.find('tbody > tr').each(function() {
819			var row = $(this),
820				cells = row.children('td'),
821				column = 0;
822
823			if (cells.length === 1) {
824				row.addClass('big-column');
825				return;
826			}
827
828			cells.each(function() {
829				var cell = $(this),
830					colspan = parseInt(cell.attr('colspan'), 10),
831					text = $.trim(cell.text());
832
833				if (headersLength <= column) {
834					return;
835				}
836
837				if ((text.length && text !== '-') || cell.children().length) {
838					if (headers[column].length) {
839						cell.prepend($("<dfn>").css('display', 'none').text(headers[column]));
840					}
841				} else {
842					cell.addClass('empty');
843				}
844
845				colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
846				column += colspan;
847			});
848		});
849	});
850
851	/**
852	* Hide empty responsive tables
853	*/
854	$container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() {
855		var $items = $(this).children('tr');
856		if (!$items.length) {
857			$(this).parent('table:first').addClass('responsive-hide');
858		}
859	});
860
861	/**
862	* Responsive tabs
863	*/
864	$container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() {
865		var $this = $(this),
866			$ul = $this.children(),
867			$tabs = $ul.children().not('[data-skip-responsive]'),
868			$links = $tabs.children('a'),
869			$item = $ul.append('<li class="tab responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link">&nbsp;</a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner"></div></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'),
870			$menu = $item.find('.dropdown-contents'),
871			maxHeight = 0,
872			lastWidth = false,
873			responsive = false;
874
875		$links.each(function() {
876			var $this = $(this);
877			maxHeight = Math.max(maxHeight, Math.max($this.outerHeight(true), $this.parent().outerHeight(true)));
878		});
879
880		function check() {
881			var width = $body.width(),
882				height = $this.height();
883
884			if (!arguments.length && (!responsive || width <= lastWidth) && height <= maxHeight) {
885				return;
886			}
887
888			$tabs.show();
889			$item.hide();
890
891			lastWidth = width;
892			height = $this.height();
893			if (height <= maxHeight) {
894				if ($item.hasClass('dropdown-visible')) {
895					phpbb.toggleDropdown.call($item.find('a.responsive-tab-link').get(0));
896				}
897				return;
898			}
899
900			responsive = true;
901			$item.show();
902			$menu.html('');
903
904			var $availableTabs = $tabs.filter(':not(.activetab, .responsive-tab)'),
905				total = $availableTabs.length,
906				i, $tab;
907
908			for (i = total - 1; i >= 0; i--) {
909				$tab = $availableTabs.eq(i);
910				$menu.prepend($tab.clone(true).removeClass('tab'));
911				$tab.hide();
912				if ($this.height() <= maxHeight) {
913					$menu.find('a').click(function() {
914						check(true);
915					});
916					return;
917				}
918			}
919			$menu.find('a').click(function() {
920				check(true);
921			});
922		}
923
924		var $tabLink = $item.find('a.responsive-tab-link');
925		phpbb.registerDropdown($tabLink, $item.find('.dropdown'), {
926			visibleClass: 'activetab'
927		});
928
929		check(true);
930		$(window).resize(check);
931	});
932
933	/**
934	 * Hide UCP/MCP navigation if there is only 1 item
935	 */
936	$container.find('#navigation').each(function() {
937		var $items = $(this).children('ol, ul').children('li');
938		if ($items.length === 1) {
939			$(this).addClass('responsive-hide');
940		}
941	});
942
943	/**
944	* Replace responsive text
945	*/
946	$container.find('[data-responsive-text]').each(function() {
947		var $this = $(this),
948			fullText = $this.text(),
949			responsiveText = $this.attr('data-responsive-text'),
950			responsive = false;
951
952		function check() {
953			if ($(window).width() > 700) {
954				if (!responsive) {
955					return;
956				}
957				$this.text(fullText);
958				responsive = false;
959				return;
960			}
961			if (responsive) {
962				return;
963			}
964			$this.text(responsiveText);
965			responsive = true;
966		}
967
968		check();
969		$(window).resize(check);
970	});
971}
972
973/**
974* Run onload functions
975*/
976jQuery(function($) {
977	'use strict';
978
979	// Swap .nojs and .hasjs
980	$('#phpbb.nojs').toggleClass('nojs hasjs');
981	$('#phpbb').toggleClass('hastouch', phpbb.isTouch);
982	$('#phpbb.hastouch').removeClass('notouch');
983
984	// Focus forms
985	$('form[data-focus]:first').each(function() {
986		$('#' + this.getAttribute('data-focus')).focus();
987	});
988
989	parseDocument($('body'));
990});
991
992
993/**
994* Merlin Framework
995*/
996
997// Remove colon from topic type label, but only if span.topictype exists
998if( $('span.topic_type').length )
999{
1000	$('span.topic_type').each(function(index, value){
1001		var topictype = $(this).html();
1002		topictype = topictype.replace(":", "");
1003		$(this).html(topictype);
1004	});
1005}
1006
1007// Activate Tooltips
1008$(document).ready(function() {
1009	$('.tooltip').tooltipster({
1010		theme: 'tooltipster-borderless',
1011		delay: 0,
1012		side: 'right',
1013	});
1014	$('.tooltip-left').tooltipster({
1015		theme: 'tooltipster-borderless',
1016		delay: 0,
1017		side: 'left',
1018	});
1019});
1020
1021// Scroll to top
1022$(document).ready(function(){
1023
1024	//Check to see if the window is top if not then display button
1025	$(window).scroll(function(){
1026		if ($(this).scrollTop() > 100) {
1027			$('.scrollToTop').fadeIn();
1028		} else {
1029			$('.scrollToTop').fadeOut();
1030		}
1031	});
1032
1033	//Click event to scroll to top
1034	$('.scrollToTop').click(function(){
1035		$('html, body').animate({scrollTop : 0},800);
1036		return false;
1037	});
1038
1039});
1040
1041// Flashing colon in current time
1042if( $('span.current_time').length )
1043{
1044	var currenttime = $("span.current_time").html();
1045	currenttime = currenttime.replace(":", "<span class='blink'>:</span>");
1046	$("span.current_time").html(currenttime);
1047
1048	function blinker() {
1049		$('span.blink').fadeOut(500);
1050		$('span.blink').fadeIn(500);
1051	}
1052	setInterval(blinker, 1000); //Runs every second
1053}
1054
1055
1056// Collapsible Panels
1057if( $('.collapse-trigger').length )
1058{
1059	$("#forumlist_collapse").collapse({
1060	  query: '.collapse-trigger',
1061	  persist: true,
1062	  open: function() {
1063		// The context of 'this' is applied to
1064		// the collapsed details in a jQuery wrapper
1065		this.slideDown(100);
1066	  },
1067	  close: function() {
1068		this.slideUp(100);
1069	  },
1070	});
1071	$("#clutter_collapse").collapse({
1072	  query: '.collapse-trigger',
1073	  persist: true,
1074	  open: function() {
1075		// The context of 'this' is applied to
1076		// the collapsed details in a jQuery wrapper
1077		this.slideDown(100);
1078	  },
1079	  close: function() {
1080		this.slideUp(100);
1081	  },
1082	});
1083
1084	$(".sidebar_right_collapse").collapse({
1085	  query: '.collapse-trigger',
1086	  persist: true,
1087	  open: function() {
1088		// The context of 'this' is applied to
1089		// the collapsed details in a jQuery wrapper
1090		this.slideDown(100);
1091	  },
1092	  close: function() {
1093		this.slideUp(100);
1094	  },
1095	});
1096
1097	// Add user icon in front of forumlist mods
1098	$("span.forumlist_mods a").each(function(i) {
1099		$(this).prepend("<i class='icon fa-shield fa-fw'></i>");
1100	});
1101	// Remove the comma seperator
1102	$("span.forumlist_mods").each(function() {
1103		$(this).html($(this).html().replace(/,/g , ''));
1104	});	
1105}

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.