PageSourceSearch

https://dialogos-philosophie.de/styles/Milk_v2/template/forum_fn.js?assets_version=26

js dialogos-philosophie.de collected 2026-10-02 00:35:21 UTC 26,965 bytes, 1,106 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	for (var i = 0; i < users.length; i++) {
339		if (users[i].checked) {
340			insertUser(formId, users[i].value);
341		}
342	}
343
344	window.close();
345}
346
347function insert_single_user(formId, user) {
348	'use strict';
349
350	insertUser(formId, user);
351	window.close();
352}
353
354/**
355* Parse document block
356*/
357function parseDocument($container) {
358	'use strict';
359
360	var test = document.createElement('div'),
361		oldBrowser = (typeof test.style.borderRadius === 'undefined'),
362		$body = $('body');
363
364	/**
365	* Reset avatar dimensions when changing URL or EMAIL
366	*/
367	$container.find('input[data-reset-on-edit]').on('keyup', function() {
368		$(this.getAttribute('data-reset-on-edit')).val('');
369	});
370
371	/**
372	* Pagination
373	*/
374	$container.find('.pagination .page-jump-form :button').click(function() {
375		var $input = $(this).siblings('input.inputbox');
376		pageJump($input);
377	});
378
379	$container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) {
380		if (event.which === 13 || event.keyCode === 13) {
381			event.preventDefault();
382			pageJump($(this));
383		}
384	});
385
386	$container.find('.pagination .dropdown-trigger').click(function() {
387		var $dropdownContainer = $(this).parent();
388		// Wait a little bit to make sure the dropdown has activated
389		setTimeout(function() {
390			if ($dropdownContainer.hasClass('dropdown-visible')) {
391				$dropdownContainer.find('input.inputbox').focus();
392			}
393		}, 100);
394	});
395
396	/**
397	* Adjust HTML code for IE8 and older versions
398	*/
399	// if (oldBrowser) {
400	// 	// Fix .linklist.bulletin lists
401	// 	$container
402	// 		.find('ul.linklist.bulletin > li')
403	// 		.filter(':first-child, .rightside:last-child')
404	// 		.addClass('no-bulletin');
405	// }
406
407	/**
408	* Resize navigation (breadcrumbs) block to keep all links on same line
409	*/
410	$container.find('.navlinks').each(function() {
411		var $this = $(this),
412			$left = $this.children().not('.rightside'),
413			$right = $this.children('.rightside');
414
415		if ($left.length !== 1 || !$right.length) {
416			return;
417		}
418
419		function resize() {
420			var width = 0,
421				diff = $left.outerWidth(true) - $left.width(),
422				minWidth = Math.max($this.width() / 3, 240),
423				maxWidth;
424
425			$right.each(function() {
426				var $this = $(this);
427				if ($this.is(':visible')) {
428					width += $this.outerWidth(true);
429				}
430			});
431
432			maxWidth = $this.width() - width - diff;
433			$left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px');
434		}
435
436		resize();
437		$(window).resize(resize);
438	});
439
440	/**
441	* Makes breadcrumbs responsive
442	*/
443	$container.find('.breadcrumbs:not([data-skip-responsive])').each(function() {
444		var $this = $(this),
445			$links = $this.find('.crumb'),
446			length = $links.length,
447			classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'],
448			classesLength = classes.length,
449			maxHeight = 0,
450			lastWidth = false,
451			wrapped = false;
452
453		// Set tooltips
454		$this.find('a').each(function() {
455			var $link = $(this);
456			$link.attr('title', $link.text());
457		});
458
459		// Function that checks breadcrumbs
460		function check() {
461			var height = $this.height(),
462				width;
463
464			// Test max-width set in code for .navlinks above
465			width = parseInt($this.css('max-width'), 10);
466			if (!width) {
467				width = $body.width();
468			}
469
470			maxHeight = parseInt($this.css('line-height'), 10);
471			$links.each(function() {
472				if ($(this).height() > 0) {
473					maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
474				}
475			});
476
477			if (height <= maxHeight) {
478				if (!wrapped || lastWidth === false || lastWidth >= width) {
479					return;
480				}
481			}
482			lastWidth = width;
483
484			if (wrapped) {
485				$this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' '));
486				if ($this.height() <= maxHeight) {
487					return;
488				}
489			}
490
491			wrapped = true;
492			$this.addClass('wrapped');
493			if ($this.height() <= maxHeight) {
494				return;
495			}
496
497			for (var i = 0; i < classesLength; i++) {
498				for (var j = length - 1; j >= 0; j--) {
499					$links.eq(j).addClass('wrapped ' + classes[i]);
500					if ($this.height() <= maxHeight) {
501						return;
502					}
503				}
504			}
505		}
506
507		// Run function and set event
508		check();
509		$(window).resize(check);
510	});
511
512	/**
513	* Responsive link lists
514	*/
515	var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' +
516		'.postbody .post-buttons:not([data-skip-responsive])';
517	$container.find(selector).each(function() {
518		var $this = $(this),
519			filterSkip = '.breadcrumbs, [data-skip-responsive]',
520			filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
521			$linksAll = $this.children(),
522			$linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden
523			$linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first
524			$linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last
525			persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)?
526			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>',
527			slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured.
528
529		// Add a hidden drop-down menu to each links list (except those that already have one)
530		if (!persistent) {
531			if ($linksNotSkip.is('.rightside')) {
532				$linksNotSkip.filter('.rightside:first').before(html);
533				$this.children('.responsive-menu').addClass('rightside');
534			} else {
535				$this.append(html);
536			}
537		}
538
539		// Set some object references and initial states
540		var $menu = $this.children('.responsive-menu'),
541			$menuContents = $menu.find('.dropdown-contents'),
542			persistentContent = $menuContents.find('li:not(.separator)').length,
543			lastWidth = false,
544			compact = false,
545			responsive1 = false,
546			responsive2 = false,
547			copied1 = false,
548			copied2 = false,
549			maxHeight = 0;
550
551		// Find the tallest element in the list (we assume that all elements are roughly the same height)
552		$linksAll.each(function() {
553			if (!$(this).height()) {
554				return;
555			}
556			maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
557		});
558		if (maxHeight < 1) {
559			return; // Shouldn't be possible, but just in case, abort
560		} else {
561			maxHeight = maxHeight + slack;
562		}
563
564		function check() {
565			var width = $body.width();
566			// We can't make it any smaller than this, so just skip
567			if (responsive2 && compact && (width <= lastWidth)) {
568				return;
569			}
570			lastWidth = width;
571
572			// Reset responsive and compact layout
573			if (responsive1 || responsive2) {
574				$linksNotSkip.removeClass('hidden');
575				$menuContents.children('.clone').addClass('hidden');
576				responsive1 = responsive2 = false;
577			}
578			if (compact) {
579				$this.removeClass('compact');
580				compact = false;
581			}
582
583			// Unhide the quick-links menu if it has "persistent" content
584			if (persistent && persistentContent) {
585				$menu.removeClass('hidden');
586			} else {
587				$menu.addClass('hidden');
588			}
589
590			// Nothing to resize if block's height is not bigger than tallest element's height
591			if ($this.height() <= maxHeight) {
592				return;
593			}
594
595			// STEP 1: Compact
596			if (!compact) {
597				$this.addClass('compact');
598				compact = true;
599			}
600			if ($this.height() <= maxHeight) {
601				return;
602			}
603
604			// STEP 2: First responsive set - compact
605			if (compact) {
606				$this.removeClass('compact');
607				compact = false;
608			}
609			// Copy the list items to the dropdown
610			if (!copied1) {
611				var $clones1 = $linksFirst.clone();
612				$menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside'));
613
614				if ($this.hasClass('post-buttons')) {
615					$('.button', $menuContents).removeClass('button');
616					$('.sr-only', $menuContents).removeClass('sr-only');
617					$('.js-responsive-menu-link').addClass('button').addClass('button-icon-only');
618					$('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h');
619				}
620				copied1 = true;
621			}
622			if (!responsive1) {
623				$linksFirst.addClass('hidden');
624				responsive1 = true;
625				$menuContents.children('.clone-first').removeClass('hidden');
626				$menu.removeClass('hidden');
627			}
628			if ($this.height() <= maxHeight) {
629				return;
630			}
631
632			// STEP 3: First responsive set + compact
633			if (!compact) {
634				$this.addClass('compact');
635				compact = true;
636			}
637			if ($this.height() <= maxHeight) {
638				return;
639			}
640
641			// STEP 4: Last responsive set - compact
642			if (!$linksLast.length) {
643				return; // No other links to hide, can't do more
644			}
645			if (compact) {
646				$this.removeClass('compact');
647				compact = false;
648			}
649			// Copy the list items to the dropdown
650			if (!copied2) {
651				var $clones2 = $linksLast.clone();
652				$menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside'));
653				copied2 = true;
654			}
655			if (!responsive2) {
656				$linksLast.addClass('hidden');
657				responsive2 = true;
658				$menuContents.children('.clone-last').removeClass('hidden');
659			}
660			if ($this.height() <= maxHeight) {
661				return;
662			}
663
664			// STEP 5: Last responsive set + compact
665			if (!compact) {
666				$this.addClass('compact');
667				compact = true;
668			}
669		}
670
671		if (!persistent) {
672			phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false);
673		}
674
675		// If there are any images in the links list, run the check again after they have loaded
676		$linksAll.find('img').each(function() {
677			$(this).load(function() {
678				check();
679			});
680		});
681
682		check();
683		$(window).resize(check);
684	});
685
686	/**
687	* Do not run functions below for old browsers
688	*/
689	if (oldBrowser) {
690		return;
691	}
692
693	/**
694	* Adjust topiclist lists with check boxes
695	*/
696	$container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark');
697
698	/**
699	* Appends contents of all extra columns to first column in
700	* .topiclist lists for mobile devices. Copies contents as is.
701	*
702	* To add that functionality to .topiclist list simply add
703	* responsive-show-all to list of classes
704	*/
705	$container.find('.topiclist.responsive-show-all > li > dl').each(function() {
706		var $this = $(this),
707			$block = $this.find('dt .responsive-show:last-child'),
708			first = true;
709
710		// Create block that is visible only on mobile devices
711		if (!$block.length) {
712			$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
713			$block = $this.find('dt .responsive-show:last-child');
714		} else {
715			first = ($.trim($block.text()).length === 0);
716		}
717
718		// Copy contents of each column
719		$this.find('dd').not('.mark').each(function() {
720			var column = $(this),
721				$children = column.children(),
722				html = column.html();
723
724			if ($children.length === 1 && $children.text() === column.text()) {
725				html = $children.html();
726			}
727
728			$block.append((first ? '' : '<br />') + html);
729
730			first = false;
731		});
732	});
733
734	/**
735	* Same as above, but prepends text from header to each
736	* column before contents of that column.
737	*
738	* To add that functionality to .topiclist list simply add
739	* responsive-show-columns to list of classes
740	*/
741	$container.find('.topiclist.responsive-show-columns').each(function() {
742		var $list = $(this),
743			headers = [],
744			headersLength = 0;
745
746		// Find all headers, get contents
747		$list.prev('.topiclist').find('li.header dd').not('.mark').each(function() {
748			headers.push($(this).text());
749			headersLength++;
750		});
751
752		if (!headersLength) {
753			return;
754		}
755
756		// Parse each row
757		$list.find('dl').each(function() {
758			var $this = $(this),
759				$block = $this.find('dt .responsive-show:last-child'),
760				first = true;
761
762			// Create block that is visible only on mobile devices
763			if (!$block.length) {
764				$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
765				$block = $this.find('dt .responsive-show:last-child');
766			} else {
767				first = ($.trim($block.text()).length === 0);
768			}
769
770			// Copy contents of each column
771			$this.find('dd').not('.mark').each(function(i) {
772				var column = $(this),
773					children = column.children(),
774					html = column.html();
775
776				if (children.length === 1 && children.text() === column.text()) {
777					html = children.html();
778				}
779
780				// Prepend contents of matching header before contents of column
781				if (i < headersLength) {
782					html = headers[i] + ': <strong>' + html + '</strong>';
783				}
784
785				$block.append((first ? '' : '<br />') + html);
786
787				first = false;
788			});
789		});
790	});
791
792	/**
793	* Responsive tables
794	*/
795	$container.find('table.table1').not('.not-responsive').each(function() {
796		var $this = $(this),
797			$th = $this.find('thead > tr > th'),
798			headers = [],
799			totalHeaders = 0,
800			i, headersLength;
801
802		// Find each header
803		$th.each(function(column) {
804			var cell = $(this),
805				colspan = parseInt(cell.attr('colspan'), 10),
806				dfn = cell.attr('data-dfn'),
807				text = dfn ? dfn : cell.text();
808
809			colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
810
811			for (i = 0; i < colspan; i++) {
812				headers.push(text);
813			}
814			totalHeaders++;
815
816			if (dfn && !column) {
817				$this.addClass('show-header');
818			}
819		});
820
821		headersLength = headers.length;
822
823		// Add header text to each cell as <dfn>
824		$this.addClass('responsive');
825
826		if (totalHeaders < 2) {
827			$this.addClass('show-header');
828			return;
829		}
830
831		$this.find('tbody > tr').each(function() {
832			var row = $(this),
833				cells = row.children('td'),
834				column = 0;
835
836			if (cells.length === 1) {
837				row.addClass('big-column');
838				return;
839			}
840
841			cells.each(function() {
842				var cell = $(this),
843					colspan = parseInt(cell.attr('colspan'), 10),
844					text = $.trim(cell.text());
845
846				if (headersLength <= column) {
847					return;
848				}
849
850				if ((text.length && text !== '-') || cell.children().length) {
851					cell.prepend('<dfn style="display: none;">' + headers[column] + '</dfn>');
852				} else {
853					cell.addClass('empty');
854				}
855
856				colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
857				column += colspan;
858			});
859		});
860	});
861
862	/**
863	* Hide empty responsive tables
864	*/
865	$container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() {
866		var $items = $(this).children('tr');
867		if (!$items.length) {
868			$(this).parent('table:first').addClass('responsive-hide');
869		}
870	});
871
872	/**
873	* Responsive tabs
874	*/
875	$container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() {
876		var $this = $(this),
877			$ul = $this.children(),
878			$tabs = $ul.children().not('[data-skip-responsive]'),
879			$links = $tabs.children('a'),
880			$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'),
881			$menu = $item.find('.dropdown-contents'),
882			maxHeight = 0,
883			lastWidth = false,
884			responsive = false;
885
886		$links.each(function() {
887			var $this = $(this);
888			maxHeight = Math.max(maxHeight, Math.max($this.outerHeight(true), $this.parent().outerHeight(true)));
889		});
890
891		function check() {
892			var width = $body.width(),
893				height = $this.height();
894
895			if (!arguments.length && (!responsive || width <= lastWidth) && height <= maxHeight) {
896				return;
897			}
898
899			$tabs.show();
900			$item.hide();
901
902			lastWidth = width;
903			height = $this.height();
904			if (height <= maxHeight) {
905				if ($item.hasClass('dropdown-visible')) {
906					phpbb.toggleDropdown.call($item.find('a.responsive-tab-link').get(0));
907				}
908				return;
909			}
910
911			responsive = true;
912			$item.show();
913			$menu.html('');
914
915			var $availableTabs = $tabs.filter(':not(.activetab, .responsive-tab)'),
916				total = $availableTabs.length,
917				i, $tab;
918
919			for (i = total - 1; i >= 0; i--) {
920				$tab = $availableTabs.eq(i);
921				$menu.prepend($tab.clone(true).removeClass('tab'));
922				$tab.hide();
923				if ($this.height() <= maxHeight) {
924					$menu.find('a').click(function() {
925						check(true);
926					});
927					return;
928				}
929			}
930			$menu.find('a').click(function() {
931				check(true);
932			});
933		}
934
935		var $tabLink = $item.find('a.responsive-tab-link');
936		phpbb.registerDropdown($tabLink, $item.find('.dropdown'), {
937			visibleClass: 'activetab'
938		});
939
940		check(true);
941		$(window).resize(check);
942	});
943
944	/**
945	 * Hide UCP/MCP navigation if there is only 1 item
946	 */
947	$container.find('#navigation').each(function() {
948		var $items = $(this).children('ol, ul').children('li');
949		if ($items.length === 1) {
950			$(this).addClass('responsive-hide');
951		}
952	});
953
954	/**
955	* Replace responsive text
956	*/
957	$container.find('[data-responsive-text]').each(function() {
958		var $this = $(this),
959			fullText = $this.text(),
960			responsiveText = $this.attr('data-responsive-text'),
961			responsive = false;
962
963		function check() {
964			if ($(window).width() > 700) {
965				if (!responsive) {
966					return;
967				}
968				$this.text(fullText);
969				responsive = false;
970				return;
971			}
972			if (responsive) {
973				return;
974			}
975			$this.text(responsiveText);
976			responsive = true;
977		}
978
979		check();
980		$(window).resize(check);
981	});
982}
983
984/**
985* Run onload functions
986*/
987jQuery(function($) {
988	'use strict';
989
990	// Swap .nojs and .hasjs
991	$('#phpbb.nojs').toggleClass('nojs hasjs');
992	$('#phpbb').toggleClass('hastouch', phpbb.isTouch);
993	$('#phpbb.hastouch').removeClass('notouch');
994
995	// Focus forms
996	$('form[data-focus]:first').each(function() {
997		$('#' + this.getAttribute('data-focus')).focus();
998	});
999
1000	parseDocument($('body'));
1001});
1002
1003
1004/**
1005* Merlin Framework
1006*/
1007
1008// Remove colon from topic type label, but only if span.topictype exists
1009if( $('span.topic_type').length )
1010{
1011	$('span.topic_type').each(function(index, value){
1012		var topictype = $(this).html();
1013		topictype = topictype.replace(":", "");
1014		$(this).html(topictype);
1015	});
1016}
1017
1018// Activate Tooltips
1019$(document).ready(function() {
1020	$('.tooltip').tooltipster({
1021		theme: 'tooltipster-borderless',
1022		delay: 0,
1023		side: 'right',
1024	});
1025	$('.tooltip-left').tooltipster({
1026		theme: 'tooltipster-borderless',
1027		delay: 0,
1028		side: 'left',
1029	});	
1030});
1031
1032// Scroll to top
1033$(document).ready(function(){
1034
1035	//Check to see if the window is top if not then display button
1036	$(window).scroll(function(){
1037		if ($(this).scrollTop() > 100) {
1038			$('.scrollToTop').fadeIn();
1039		} else {
1040			$('.scrollToTop').fadeOut();
1041		}
1042	});
1043
1044	//Click event to scroll to top
1045	$('.scrollToTop').click(function(){
1046		$('html, body').animate({scrollTop : 0},800);
1047		return false;
1048	});
1049
1050});
1051
1052// Flashing colon in current time
1053if( $('span.current_time').length )
1054{
1055	var currenttime = $("span.current_time").html();
1056	currenttime = currenttime.replace(":", "<span class='blink'>:</span>");
1057	$("span.current_time").html(currenttime);
1058
1059	function blinker() {
1060		$('span.blink').fadeOut(500);
1061		$('span.blink').fadeIn(500);
1062	}
1063	setInterval(blinker, 1000); //Runs every second
1064}
1065
1066// Collapsible Panels
1067if( $('.collapse-trigger').length )
1068{
1069	$("#forumlist_collapse").collapse({
1070	  query: '.collapse-trigger',
1071	  persist: true,
1072	  open: function() {
1073		// The context of 'this' is applied to
1074		// the collapsed details in a jQuery wrapper
1075		this.slideDown(100);
1076	  },
1077	  close: function() {
1078		this.slideUp(100);
1079	  },
1080	});				
1081	$("#clutter_collapse").collapse({
1082	  query: '.collapse-trigger',
1083	  persist: true,
1084	  open: function() {
1085		// The context of 'this' is applied to
1086		// the collapsed details in a jQuery wrapper
1087		this.slideDown(100);
1088	  },
1089	  close: function() {
1090		this.slideUp(100);
1091	  },
1092	});
1093	
1094	$(".sidebar_right_collapse").collapse({
1095	  query: '.collapse-trigger',
1096	  persist: true,
1097	  open: function() {
1098		// The context of 'this' is applied to
1099		// the collapsed details in a jQuery wrapper
1100		this.slideDown(100);
1101	  },
1102	  close: function() {
1103		this.slideUp(100);
1104	  },
1105	});
1106}

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.