PageSourceSearch

https://www.bachproject.net/forum/styles/prosilver/template/forum_fn.js?assets_version=4

js bachproject.net collected 2026-09-25 21:05:27 UTC 23,420 bytes, 939 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
197var inAutocomplete = false;
198var lastKeyEntered = '';
199
200/**
201* Check event key
202*/
203function phpbbCheckKey(event) {
204	'use strict';
205
206	// Keycode is array down or up?
207	if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) {
208		inAutocomplete = true;
209	}
210
211	// Make sure we are not within an "autocompletion" field
212	if (inAutocomplete) {
213		// If return pressed and key changed we reset the autocompletion
214		if (!lastKeyEntered || lastKeyEntered === event.which) {
215			inAutocomplete = false;
216			return true;
217		}
218	}
219
220	// Keycode is not return, then return. ;)
221	if (event.which !== 13) {
222		lastKeyEntered = event.which;
223		return true;
224	}
225
226	return false;
227}
228
229/**
230* Apply onkeypress event for forcing default submit button on ENTER key press
231*/
232jQuery(function($) {
233	'use strict';
234
235	$('form input[type=text], form input[type=password]').on('keypress', function (e) {
236		var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action');
237
238		if (!defaultButton || defaultButton.length <= 0) {
239			return true;
240		}
241
242		if (phpbbCheckKey(e)) {
243			return true;
244		}
245
246		if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
247			defaultButton.click();
248			return false;
249		}
250
251		return true;
252	});
253});
254
255/**
256* Functions for user search popup
257*/
258function insertUser(formId, value) {
259	'use strict';
260
261	var $form = jQuery(formId),
262		formName = $form.attr('data-form-name'),
263		fieldName = $form.attr('data-field-name'),
264		item = opener.document.forms[formName][fieldName];
265
266	if (item.value.length && item.type === 'textarea') {
267		value = item.value + '\n' + value;
268	}
269
270	item.value = value;
271}
272
273function insert_marked_users(formId, users) {
274	'use strict';
275
276	for (var i = 0; i < users.length; i++) {
277		if (users[i].checked) {
278			insertUser(formId, users[i].value);
279		}
280	}
281
282	window.close();
283}
284
285function insert_single_user(formId, user) {
286	'use strict';
287
288	insertUser(formId, user);
289	window.close();
290}
291
292/**
293* Parse document block
294*/
295function parseDocument($container) {
296	'use strict';
297
298	var test = document.createElement('div'),
299		oldBrowser = (typeof test.style.borderRadius === 'undefined'),
300		$body = $('body');
301
302	/**
303	* Reset avatar dimensions when changing URL or EMAIL
304	*/
305	$container.find('input[data-reset-on-edit]').on('keyup', function() {
306		$(this.getAttribute('data-reset-on-edit')).val('');
307	});
308
309	/**
310	* Pagination
311	*/
312	$container.find('.pagination .page-jump-form :button').click(function() {
313		var $input = $(this).siblings('input.inputbox');
314		pageJump($input);
315	});
316
317	$container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) {
318		if (event.which === 13 || event.keyCode === 13) {
319			event.preventDefault();
320			pageJump($(this));
321		}
322	});
323
324	$container.find('.pagination .dropdown-trigger').click(function() {
325		var $dropdownContainer = $(this).parent();
326		// Wait a little bit to make sure the dropdown has activated
327		setTimeout(function() {
328			if ($dropdownContainer.hasClass('dropdown-visible')) {
329				$dropdownContainer.find('input.inputbox').focus();
330			}
331		}, 100);
332	});
333
334	/**
335	* Adjust HTML code for IE8 and older versions
336	*/
337	// if (oldBrowser) {
338	// 	// Fix .linklist.bulletin lists
339	// 	$container
340	// 		.find('ul.linklist.bulletin > li')
341	// 		.filter(':first-child, .rightside:last-child')
342	// 		.addClass('no-bulletin');
343	// }
344
345	/**
346	* Resize navigation (breadcrumbs) block to keep all links on same line
347	*/
348	$container.find('.navlinks').each(function() {
349		var $this = $(this),
350			$left = $this.children().not('.rightside'),
351			$right = $this.children('.rightside');
352
353		if ($left.length !== 1 || !$right.length) {
354			return;
355		}
356
357		function resize() {
358			var width = 0,
359				diff = $left.outerWidth(true) - $left.width(),
360				minWidth = Math.max($this.width() / 3, 240),
361				maxWidth;
362
363			$right.each(function() {
364				var $this = $(this);
365				if ($this.is(':visible')) {
366					width += $this.outerWidth(true);
367				}
368			});
369
370			maxWidth = $this.width() - width - diff;
371			$left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px');
372		}
373
374		resize();
375		$(window).resize(resize);
376	});
377
378	/**
379	* Makes breadcrumbs responsive
380	*/
381	$container.find('.breadcrumbs:not([data-skip-responsive])').each(function() {
382		var $this = $(this),
383			$links = $this.find('.crumb'),
384			length = $links.length,
385			classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'],
386			classesLength = classes.length,
387			maxHeight = 0,
388			lastWidth = false,
389			wrapped = false;
390
391		// Set tooltips
392		$this.find('a').each(function() {
393			var $link = $(this);
394			$link.attr('title', $link.text());
395		});
396
397		// Function that checks breadcrumbs
398		function check() {
399			var height = $this.height(),
400				width;
401
402			// Test max-width set in code for .navlinks above
403			width = parseInt($this.css('max-width'), 10);
404			if (!width) {
405				width = $body.width();
406			}
407
408			maxHeight = parseInt($this.css('line-height'), 10);
409			$links.each(function() {
410				if ($(this).height() > 0) {
411					maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
412				}
413			});
414
415			if (height <= maxHeight) {
416				if (!wrapped || lastWidth === false || lastWidth >= width) {
417					return;
418				}
419			}
420			lastWidth = width;
421
422			if (wrapped) {
423				$this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' '));
424				if ($this.height() <= maxHeight) {
425					return;
426				}
427			}
428
429			wrapped = true;
430			$this.addClass('wrapped');
431			if ($this.height() <= maxHeight) {
432				return;
433			}
434
435			for (var i = 0; i < classesLength; i++) {
436				for (var j = length - 1; j >= 0; j--) {
437					$links.eq(j).addClass('wrapped ' + classes[i]);
438					if ($this.height() <= maxHeight) {
439						return;
440					}
441				}
442			}
443		}
444
445		// Run function and set event
446		check();
447		$(window).resize(check);
448	});
449
450	/**
451	* Responsive link lists
452	*/
453	var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' +
454		'.postbody .post-buttons:not([data-skip-responsive])';
455	$container.find(selector).each(function() {
456		var $this = $(this),
457			filterSkip = '.breadcrumbs, [data-skip-responsive]',
458			filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
459			$linksAll = $this.children(),
460			$linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden
461			$linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first
462			$linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last
463			persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)?
464			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><ul class="dropdown-contents" /></div></li>',
465			slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured.
466
467		// Add a hidden drop-down menu to each links list (except those that already have one)
468		if (!persistent) {
469			if ($linksNotSkip.is('.rightside')) {
470				$linksNotSkip.filter('.rightside:first').before(html);
471				$this.children('.responsive-menu').addClass('rightside');
472			} else {
473				$this.append(html);
474			}
475		}
476
477		// Set some object references and initial states
478		var $menu = $this.children('.responsive-menu'),
479			$menuContents = $menu.find('.dropdown-contents'),
480			persistentContent = $menuContents.find('li:not(.separator)').length,
481			lastWidth = false,
482			compact = false,
483			responsive1 = false,
484			responsive2 = false,
485			copied1 = false,
486			copied2 = false,
487			maxHeight = 0;
488
489		// Find the tallest element in the list (we assume that all elements are roughly the same height)
490		$linksAll.each(function() {
491			if (!$(this).height()) {
492				return;
493			}
494			maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
495		});
496		if (maxHeight < 1) {
497			return; // Shouldn't be possible, but just in case, abort
498		} else {
499			maxHeight = maxHeight + slack;
500		}
501
502		function check() {
503			var width = $body.width();
504			// We can't make it any smaller than this, so just skip
505			if (responsive2 && compact && (width <= lastWidth)) {
506				return;
507			}
508			lastWidth = width;
509
510			// Reset responsive and compact layout
511			if (responsive1 || responsive2) {
512				$linksNotSkip.removeClass('hidden');
513				$menuContents.children('.clone').addClass('hidden');
514				responsive1 = responsive2 = false;
515			}
516			if (compact) {
517				$this.removeClass('compact');
518				compact = false;
519			}
520
521			// Unhide the quick-links menu if it has "persistent" content
522			if (persistent && persistentContent) {
523				$menu.removeClass('hidden');
524			} else {
525				$menu.addClass('hidden');
526			}
527
528			// Nothing to resize if block's height is not bigger than tallest element's height
529			if ($this.height() <= maxHeight) {
530				return;
531			}
532
533			// STEP 1: Compact
534			if (!compact) {
535				$this.addClass('compact');
536				compact = true;
537			}
538			if ($this.height() <= maxHeight) {
539				return;
540			}
541
542			// STEP 2: First responsive set - compact
543			if (compact) {
544				$this.removeClass('compact');
545				compact = false;
546			}
547			// Copy the list items to the dropdown
548			if (!copied1) {
549				var $clones1 = $linksFirst.clone();
550				$menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside'));
551
552				if ($this.hasClass('post-buttons')) {
553					$('.button', $menuContents).removeClass('button');
554					$('.sr-only', $menuContents).removeClass('sr-only');
555					$('.js-responsive-menu-link').addClass('button').addClass('button-icon-only');
556					$('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h');
557				}
558				copied1 = true;
559			}
560			if (!responsive1) {
561				$linksFirst.addClass('hidden');
562				responsive1 = true;
563				$menuContents.children('.clone-first').removeClass('hidden');
564				$menu.removeClass('hidden');
565			}
566			if ($this.height() <= maxHeight) {
567				return;
568			}
569
570			// STEP 3: First responsive set + compact
571			if (!compact) {
572				$this.addClass('compact');
573				compact = true;
574			}
575			if ($this.height() <= maxHeight) {
576				return;
577			}
578
579			// STEP 4: Last responsive set - compact
580			if (!$linksLast.length) {
581				return; // No other links to hide, can't do more
582			}
583			if (compact) {
584				$this.removeClass('compact');
585				compact = false;
586			}
587			// Copy the list items to the dropdown
588			if (!copied2) {
589				var $clones2 = $linksLast.clone();
590				$menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside'));
591				copied2 = true;
592			}
593			if (!responsive2) {
594				$linksLast.addClass('hidden');
595				responsive2 = true;
596				$menuContents.children('.clone-last').removeClass('hidden');
597			}
598			if ($this.height() <= maxHeight) {
599				return;
600			}
601
602			// STEP 5: Last responsive set + compact
603			if (!compact) {
604				$this.addClass('compact');
605				compact = true;
606			}
607		}
608
609		if (!persistent) {
610			phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false);
611		}
612
613		// If there are any images in the links list, run the check again after they have loaded
614		$linksAll.find('img').each(function() {
615			$(this).load(function() {
616				check();
617			});
618		});
619
620		check();
621		$(window).resize(check);
622	});
623
624	/**
625	* Do not run functions below for old browsers
626	*/
627	if (oldBrowser) {
628		return;
629	}
630
631	/**
632	* Adjust topiclist lists with check boxes
633	*/
634	$container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark');
635
636	/**
637	* Appends contents of all extra columns to first column in
638	* .topiclist lists for mobile devices. Copies contents as is.
639	*
640	* To add that functionality to .topiclist list simply add
641	* responsive-show-all to list of classes
642	*/
643	$container.find('.topiclist.responsive-show-all > li > dl').each(function() {
644		var $this = $(this),
645			$block = $this.find('dt .responsive-show:last-child'),
646			first = true;
647
648		// Create block that is visible only on mobile devices
649		if (!$block.length) {
650			$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
651			$block = $this.find('dt .responsive-show:last-child');
652		} else {
653			first = ($.trim($block.text()).length === 0);
654		}
655
656		// Copy contents of each column
657		$this.find('dd').not('.mark').each(function() {
658			var column = $(this),
659				$children = column.children(),
660				html = column.html();
661
662			if ($children.length === 1 && $children.text() === column.text()) {
663				html = $children.html();
664			}
665
666			$block.append((first ? '' : '<br />') + html);
667
668			first = false;
669		});
670	});
671
672	/**
673	* Same as above, but prepends text from header to each
674	* column before contents of that column.
675	*
676	* To add that functionality to .topiclist list simply add
677	* responsive-show-columns to list of classes
678	*/
679	$container.find('.topiclist.responsive-show-columns').each(function() {
680		var $list = $(this),
681			headers = [],
682			headersLength = 0;
683
684		// Find all headers, get contents
685		$list.prev('.topiclist').find('li.header dd').not('.mark').each(function() {
686			headers.push($(this).text());
687			headersLength++;
688		});
689
690		if (!headersLength) {
691			return;
692		}
693
694		// Parse each row
695		$list.find('dl').each(function() {
696			var $this = $(this),
697				$block = $this.find('dt .responsive-show:last-child'),
698				first = true;
699
700			// Create block that is visible only on mobile devices
701			if (!$block.length) {
702				$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
703				$block = $this.find('dt .responsive-show:last-child');
704			} else {
705				first = ($.trim($block.text()).length === 0);
706			}
707
708			// Copy contents of each column
709			$this.find('dd').not('.mark').each(function(i) {
710				var column = $(this),
711					children = column.children(),
712					html = column.html();
713
714				if (children.length === 1 && children.text() === column.text()) {
715					html = children.html();
716				}
717
718				// Prepend contents of matching header before contents of column
719				if (i < headersLength) {
720					html = headers[i] + ': <strong>' + html + '</strong>';
721				}
722
723				$block.append((first ? '' : '<br />') + html);
724
725				first = false;
726			});
727		});
728	});
729
730	/**
731	* Responsive tables
732	*/
733	$container.find('table.table1').not('.not-responsive').each(function() {
734		var $this = $(this),
735			$th = $this.find('thead > tr > th'),
736			headers = [],
737			totalHeaders = 0,
738			i, headersLength;
739
740		// Find each header
741		$th.each(function(column) {
742			var cell = $(this),
743				colspan = parseInt(cell.attr('colspan'), 10),
744				dfn = cell.attr('data-dfn'),
745				text = dfn ? dfn : cell.text();
746
747			colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
748
749			for (i = 0; i < colspan; i++) {
750				headers.push(text);
751			}
752			totalHeaders++;
753
754			if (dfn && !column) {
755				$this.addClass('show-header');
756			}
757		});
758
759		headersLength = headers.length;
760
761		// Add header text to each cell as <dfn>
762		$this.addClass('responsive');
763
764		if (totalHeaders < 2) {
765			$this.addClass('show-header');
766			return;
767		}
768
769		$this.find('tbody > tr').each(function() {
770			var row = $(this),
771				cells = row.children('td'),
772				column = 0;
773
774			if (cells.length === 1) {
775				row.addClass('big-column');
776				return;
777			}
778
779			cells.each(function() {
780				var cell = $(this),
781					colspan = parseInt(cell.attr('colspan'), 10),
782					text = $.trim(cell.text());
783
784				if (headersLength <= column) {
785					return;
786				}
787
788				if ((text.length && text !== '-') || cell.children().length) {
789					cell.prepend('<dfn style="display: none;">' + headers[column] + '</dfn>');
790				} else {
791					cell.addClass('empty');
792				}
793
794				colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
795				column += colspan;
796			});
797		});
798	});
799
800	/**
801	* Hide empty responsive tables
802	*/
803	$container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() {
804		var $items = $(this).children('tr');
805		if (!$items.length) {
806			$(this).parent('table:first').addClass('responsive-hide');
807		}
808	});
809
810	/**
811	* Responsive tabs
812	*/
813	$container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() {
814		var $this = $(this),
815			$ul = $this.children(),
816			$tabs = $ul.children().not('[data-skip-responsive]'),
817			$links = $tabs.children('a'),
818			$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><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'),
819			$menu = $item.find('.dropdown-contents'),
820			maxHeight = 0,
821			lastWidth = false,
822			responsive = false;
823
824		$links.each(function() {
825			var $this = $(this);
826			maxHeight = Math.max(maxHeight, Math.max($this.outerHeight(true), $this.parent().outerHeight(true)));
827		});
828
829		function check() {
830			var width = $body.width(),
831				height = $this.height();
832
833			if (!arguments.length && (!responsive || width <= lastWidth) && height <= maxHeight) {
834				return;
835			}
836
837			$tabs.show();
838			$item.hide();
839
840			lastWidth = width;
841			height = $this.height();
842			if (height <= maxHeight) {
843				if ($item.hasClass('dropdown-visible')) {
844					phpbb.toggleDropdown.call($item.find('a.responsive-tab-link').get(0));
845				}
846				return;
847			}
848
849			responsive = true;
850			$item.show();
851			$menu.html('');
852
853			var $availableTabs = $tabs.filter(':not(.activetab, .responsive-tab)'),
854				total = $availableTabs.length,
855				i, $tab;
856
857			for (i = total - 1; i >= 0; i--) {
858				$tab = $availableTabs.eq(i);
859				$menu.prepend($tab.clone(true).removeClass('tab'));
860				$tab.hide();
861				if ($this.height() <= maxHeight) {
862					$menu.find('a').click(function() {
863						check(true);
864					});
865					return;
866				}
867			}
868			$menu.find('a').click(function() {
869				check(true);
870			});
871		}
872
873		var $tabLink = $item.find('a.responsive-tab-link');
874		phpbb.registerDropdown($tabLink, $item.find('.dropdown'), {
875			visibleClass: 'activetab'
876		});
877
878		check(true);
879		$(window).resize(check);
880	});
881
882	/**
883	 * Hide UCP/MCP navigation if there is only 1 item
884	 */
885	$container.find('#navigation').each(function() {
886		var $items = $(this).children('ol, ul').children('li');
887		if ($items.length === 1) {
888			$(this).addClass('responsive-hide');
889		}
890	});
891
892	/**
893	* Replace responsive text
894	*/
895	$container.find('[data-responsive-text]').each(function() {
896		var $this = $(this),
897			fullText = $this.text(),
898			responsiveText = $this.attr('data-responsive-text'),
899			responsive = false;
900
901		function check() {
902			if ($(window).width() > 700) {
903				if (!responsive) {
904					return;
905				}
906				$this.text(fullText);
907				responsive = false;
908				return;
909			}
910			if (responsive) {
911				return;
912			}
913			$this.text(responsiveText);
914			responsive = true;
915		}
916
917		check();
918		$(window).resize(check);
919	});
920}
921
922/**
923* Run onload functions
924*/
925jQuery(function($) {
926	'use strict';
927
928	// Swap .nojs and .hasjs
929	$('#phpbb.nojs').toggleClass('nojs hasjs');
930	$('#phpbb').toggleClass('hastouch', phpbb.isTouch);
931	$('#phpbb.hastouch').removeClass('notouch');
932
933	// Focus forms
934	$('form[data-focus]:first').each(function() {
935		$('#' + this.getAttribute('data-focus')).focus();
936	});
937
938	parseDocument($('body'));
939});

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.