PageSourceSearch

https://www.forodecampistas.com/styles/elegance/template/forum_fn.js?assets_version=398

js forodecampistas.com collected 2026-10-02 07:13:31 UTC 43,303 bytes, 1,778 lines download raw bytes

1/* global phpbb */
2
3/**
4* phpBB3 forum functions
5*/
6var styleConfig = {
7	staticNavigation: true,
8	staticNavigationMinWidth: 500,
9	staticNavigationMinHeight: 400,
10	extendPosterProfile: true,
11	collapseForums: true
12};
13
14/**
15* Find a member
16*/
17function find_username(url) {
18	'use strict';
19
20	popup(url, 760, 570, '_usersearch');
21	return false;
22}
23
24/**
25* Window popup
26*/
27function popup(url, width, height, name) {
28	'use strict';
29
30	if (!name) {
31		name = '_popup';
32	}
33
34	window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width);
35	return false;
36}
37
38/**
39* Jump to page
40*/
41function pageJump(item) {
42	'use strict';
43
44	var page = parseInt(item.val(), 10),
45		perPage = item.attr('data-per-page'),
46		baseUrl = item.attr('data-base-url'),
47		startName = item.attr('data-start-name');
48
49	if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) {
50		if (baseUrl.indexOf('?') === -1) {
51			document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
52		} else {
53			document.location.href = baseUrl.replace(/&/g, '&') + '&' + startName + '=' + ((page - 1) * perPage);
54		}
55	}
56}
57
58/**
59* Mark/unmark checklist
60* id = ID of parent container, name = name prefix, state = state [true/false]
61*/
62function marklist(id, name, state) {
63	'use strict';
64
65	jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
66		var $this = jQuery(this);
67		if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) {
68			$this.prop('checked', state);
69		}
70	});
71}
72
73/**
74* Resize viewable area for attached image or topic review panel (possibly others to come)
75* e = element
76*/
77function viewableArea(e, itself) {
78	'use strict';
79
80	if (!e) {
81		return;
82	}
83
84	if (!itself) {
85		e = e.parentNode;
86	}
87
88	if (!e.vaHeight) {
89		// Store viewable area height before changing style to auto
90		e.vaHeight = e.offsetHeight;
91		e.vaMaxHeight = e.style.maxHeight;
92		e.style.height = 'auto';
93		e.style.maxHeight = 'none';
94		e.style.overflow = 'visible';
95	} else {
96		// Restore viewable area height to the default
97		e.style.height = e.vaHeight + 'px';
98		e.style.overflow = 'auto';
99		e.style.maxHeight = e.vaMaxHeight;
100		e.vaHeight = false;
101	}
102}
103
104/**
105* Alternate display of subPanels
106*/
107jQuery(function($) {
108	'use strict';
109
110	$('.sub-panels').each(function() {
111
112		var $childNodes = $('a[data-subpanel]', this),
113			panels = $childNodes.map(function () {
114				return this.getAttribute('data-subpanel');
115			}),
116			showPanel = this.getAttribute('data-show-panel');
117
118		if (panels.length) {
119			activateSubPanel(showPanel, panels);
120			$childNodes.click(function () {
121				activateSubPanel(this.getAttribute('data-subpanel'), panels);
122				return false;
123			});
124		}
125	});
126});
127
128/**
129* Activate specific subPanel
130*/
131function activateSubPanel(p, panels) {
132	'use strict';
133
134	var i, showPanel;
135
136	if (typeof p === 'string') {
137		showPanel = p;
138	}
139	$('input[name="show_panel"]').val(showPanel);
140
141	if (typeof panels === 'undefined') {
142		panels = jQuery('.sub-panels a[data-subpanel]').map(function() {
143			return this.getAttribute('data-subpanel');
144		});
145	}
146
147	for (i = 0; i < panels.length; i++) {
148		jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none');
149		jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel);
150	}
151}
152
153function selectCode(a) {
154	'use strict';
155
156	// Get ID of code block
157	var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
158	var s, r;
159
160	// Not IE and IE9+
161	if (window.getSelection) {
162		s = window.getSelection();
163		// Safari and Chrome
164		if (s.setBaseAndExtent) {
165			var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
166			try {
167				s.setBaseAndExtent(e, 0, e, l);
168			} catch (error) {
169				r = document.createRange();
170				r.selectNodeContents(e);
171				s.removeAllRanges();
172				s.addRange(r);
173			}
174		}
175		// Firefox and Opera
176		else {
177			// workaround for bug # 42885
178			if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '<BR>') {
179				e.innerHTML = e.innerHTML + '&nbsp;';
180			}
181
182			r = document.createRange();
183			r.selectNodeContents(e);
184			s.removeAllRanges();
185			s.addRange(r);
186		}
187	}
188	// Some older browsers
189	else if (document.getSelection) {
190		s = document.getSelection();
191		r = document.createRange();
192		r.selectNodeContents(e);
193		s.removeAllRanges();
194		s.addRange(r);
195	}
196	// IE
197	else if (document.selection) {
198		r = document.body.createTextRange();
199		r.moveToElementText(e);
200		r.select();
201	}
202}
203
204var inAutocomplete = false;
205var lastKeyEntered = '';
206
207/**
208* Check event key
209*/
210function phpbbCheckKey(event) {
211	'use strict';
212
213	// Keycode is array down or up?
214	if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) {
215		inAutocomplete = true;
216	}
217
218	// Make sure we are not within an "autocompletion" field
219	if (inAutocomplete) {
220		// If return pressed and key changed we reset the autocompletion
221		if (!lastKeyEntered || lastKeyEntered === event.which) {
222			inAutocomplete = false;
223			return true;
224		}
225	}
226
227	// Keycode is not return, then return. ;)
228	if (event.which !== 13) {
229		lastKeyEntered = event.which;
230		return true;
231	}
232
233	return false;
234}
235
236/**
237* Apply onkeypress event for forcing default submit button on ENTER key press
238*/
239jQuery(function($) {
240	'use strict';
241
242	$('form input[type=text], form input[type=password]').on('keypress', function (e) {
243		var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action');
244
245		if (!defaultButton || defaultButton.length <= 0) {
246			return true;
247		}
248
249		if (phpbbCheckKey(e)) {
250			return true;
251		}
252
253		if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
254			defaultButton.click();
255			return false;
256		}
257
258		return true;
259	});
260});
261
262/**
263* Functions for user search popup
264*/
265function insertUser(formId, value) {
266	'use strict';
267
268	var $form = jQuery(formId),
269		formName = $form.attr('data-form-name'),
270		fieldName = $form.attr('data-field-name'),
271		item = opener.document.forms[formName][fieldName];
272
273	if (item.value.length && item.type === 'textarea') {
274		value = item.value + '\n' + value;
275	}
276
277	item.value = value;
278}
279
280function insert_marked_users(formId, users) {
281    'use strict';
282
283    $(users).filter(':checked').each(function() {
284        insertUser(formId, this.value);
285    });
286
287    window.close();
288}
289
290function insert_single_user(formId, user) {
291	'use strict';
292
293	insertUser(formId, user);
294	window.close();
295}
296
297/**
298* Resize poster profile block
299*/
300function adjustPosterProfile(postbody) {
301	var profile = postbody.parent().prev(),
302		post = profile.parent(),
303		resized = profile.hasClass('resized');
304
305	function unresize() {
306		profile.removeClass('resized').css('min-height', '');
307	}
308
309	if (post.width() < (profile.width() + postbody.width())) {
310		if (resized) {
311			unresize();
312		}
313		return false;
314	}
315
316	if (resized) {
317		profile.css('min-height', '');
318	}
319	profile.css('min-height', Math.floor(postbody.height()) + 'px').addClass('resized');
320}
321
322/**
323* Responsive navigation
324*/
325function checkNavigation(force)
326{
327	function init(nav)
328	{
329		nav.responsive = false;
330		nav.lastWidth = 0;
331		nav.itemCount = 0;
332
333		// Copy children items
334		nav.contents = nav.menu.find('.dropdown-contents:first');
335		nav.canToggle = $();
336		nav.noToggle = $();
337		nav.contents.children('.separator:last-child').hide();
338		nav.items = nav.lists.children().not(nav.menu).each(function(i) {
339			var $this = $(this),
340				cloneClass;
341
342			if ($this.is('.not-responsive, .responsive-menu, .dropdown-container, .selected') || $this.attr('data-skip-responsive') == 'true') {
343				$this.attr('data-responsive-index', -1);
344				nav.noToggle = nav.noToggle.add($this);
345				return;
346			}
347
348			cloneClass = (
349					$this.attr('data-responsive-class') === undefined ? 
350						($this.hasClass('small-icon') ? $this.attr('class') : '') : 
351						$this.attr('data-responsive-class')
352				) + ' responsive-index-' + i;
353
354			nav.contents.append(
355				$this.clone(true).attr('class', cloneClass).addClass('responsive-clone').removeClass('tab')
356			);
357
358			$this.addClass('responsive-cloned-item').attr('data-clone-index', i);
359			nav.canToggle = nav.canToggle.add($this);
360			nav.itemCount ++;
361		});
362		nav.contents.find('a.nav-link').removeClass('nav-link');
363		nav.responsiveClones = nav.contents.children('.responsive-clone').hide();
364
365		nav.initialized = true;
366	}
367
368	function check(nav, force)
369	{
370		var containerWidth, total, width, menuWidth, hiding;
371
372		// Setup navigation
373		if (!nav.initialized) {
374			init(nav);
375			force = true;
376		}
377
378		if (!nav.itemCount) {
379			// Nothing to hide
380			return;
381		}
382
383		// Check width
384		containerWidth = nav.container.width();
385		if (!force && containerWidth == nav.lastWidth) {
386			return;
387		}
388		nav.lastWidth = containerWidth;
389
390		// Show all items
391		if (nav.responsive) {
392			nav.canToggle.show();
393			nav.responsiveClones.hide();
394			nav.menu.removeClass('showing-responsive-menu');
395			if (!nav.alwaysShowMenu) {
396				nav.menu.show();
397			}
398		}
399		nav.responsive = false;
400		menuWidth = nav.menu.outerWidth(true);
401		width = menuWidth;
402
403		// Count width of all items that cannot be hidden
404		nav.noToggle.each(function() {
405			var $this = $(this);
406			if ($this.is(':visible')) {
407				width += $this.outerWidth(true);
408			}
409		});
410
411		// Test all other items
412		hiding = (width >= containerWidth);
413		nav.canToggle.each(function() {
414			var $this = $(this),
415				itemWidth, margin;
416
417			if (!$this.is(':visible')) {
418				return;
419			}
420
421			if (!hiding) {
422				itemWidth = $this.outerWidth(true);
423				if (!itemWidth) {
424					$this.hide();
425					return;
426				}
427
428				width += itemWidth;
429				if (width >= containerWidth) {
430					hiding = true;
431				}
432			}
433
434			if (hiding) {
435				$this.hide();
436				nav.responsiveClones.filter('.responsive-index-' + $this.attr('data-clone-index')).show();
437			}
438		});
439
440		nav.responsive = hiding;
441		if (!hiding && !nav.alwaysShowMenu) {
442			nav.menu.hide();
443		}
444		else if (hiding) {
445			nav.menu.addClass('showing-responsive-menu');
446		}
447	}
448
449	for (var i=0; i<styleConfig._responsiveNavigation.length; i++) {
450		check(styleConfig._responsiveNavigation[i], force);
451	}
452}
453
454function initResponsiveNavigation()
455{
456	styleConfig._responsiveNavigation = [];
457
458	$('.nav-tabs, .navbar.secondary').each(function() {
459		var $this = $(this),
460			lists = $this.children('ul'),
461			menu = lists.children('.responsive-menu:first'),
462			alwaysShowMenu = (menu.length > 0);
463
464		// Create empty hidden menu
465		if (!menu.length) {
466			if ($this.is('.nav-tabs')) {
467				// Something went wrong - main menu must have responsive menu
468				return;
469			}
470			// Secondary menu
471			lists.eq(0).prepend('<li class="responsive-menu dropdown-container" style="display: none;"><a href="#" class="dropdown-trigger dropdown-toggle">...</a>' +
472					'<div class="dropdown hidden">' + 
473						'<div class="pointer"><div class="pointer-inner"></div></div>' + 
474						'<ul class="dropdown-contents" /></ul>' +
475					'</div>' +
476				'</li>');
477			menu = lists.children('.responsive-menu:first');
478			phpbb.registerDropdown(menu.find('.dropdown-toggle'), menu.find('.dropdown'));
479		}
480
481		styleConfig._responsiveNavigation.push({
482			container: $this,
483			lists: lists,
484			menu: menu,
485			initialized: false,
486			alwaysShowMenu: alwaysShowMenu
487		});
488	});
489}
490
491/**
492* Parse document block
493*/
494function parseDocument($container) {
495	'use strict';
496
497	var test = document.createElement('div'),
498		oldBrowser = (typeof test.style.borderRadius === 'undefined'),
499		$body = $('body');
500
501	/**
502	 * Change stuff for extensions
503	 */
504	$('#top_five.forabg').removeClass('forabg').addClass('forumbg');
505
506	/**
507	* Adjust navigation tabs
508	*/
509	$container.find('.nav-tabs').each(function() {
510		var tabs = $(this).children().children();
511
512		// Fix tabs structure
513		tabs.not('.tab').each(function() {
514			var tab = $(this),
515				className = tab.attr('class'),
516				i;
517
518			className = className ? className.split(' ') : '';
519			tab.attr('class', 'tab');
520			for (i=0; i<className.length; i++) {
521				if (className[i].substr(0, 5) == 'icon-') {
522					tab.addClass(className[i].substr(5));
523				}
524			}
525		}).children(':first-child').addClass('nav-link');
526
527		// Tooltips for tabs
528		tabs.each(function() {
529			var $this = $(this),
530				title = '';
531			if (!$this.attr('title')) {
532				title = $this.children('.nav-link').text().trim();
533				if (!title.length) return;
534
535				$this.children('.nav-link + strong').each(function() {
536					title += ' (' + $(this).text().trim() + ')';
537				});
538				$this.attr('title', title);
539			}
540		});
541	});
542
543	/**
544	* Switch selected tab
545	*/
546	$container.find('.nav-tabs[data-current-page]').each(function() {
547		var tabs = $(this),
548			current = tabs.attr('data-current-page'),
549			found = false,
550			content, classes, i, key;
551
552		$('.tab[data-select-match]', this).each(function() {
553			var matches = $(this).attr('data-select-match').split(','),
554				i, match, item;
555			
556			for (i=0; i<matches.length; i++) {
557				match = matches[i].trim();
558				if (current.indexOf(match) != -1) {
559					// Found a match!
560					item = $(this);
561					if (!item.hasClass('selected')) {
562						tabs.find('.tab.selected').removeClass('selected');
563						item.addClass('selected');
564					}
565					found = true;
566					return false;
567				}
568			}
569		});
570
571		// Check for known extensions
572		if (found) {
573			return;
574		}
575
576		content = $container.find('.content.pages-content');
577		if (content.length) {
578			// Get page content class, try to find matching link
579			classes = content.prop('class').split(' ');
580			for (i = 0; i < classes.length && !found; i++) {
581				key = classes[i].trim();
582				if (key !== 'content' && key !== 'pages-content') {
583					$container.find('.tab.pages.' + key).each(function() {
584						tabs.find('.tab.selected').removeClass('selected');
585						$(this).addClass('selected');
586						found = true;
587					});
588				}
589			}
590			if (found) {
591				return;
592			}
593
594			// Get first page link
595			$container.find('.tab.pages:first').each(function() {
596				tabs.find('.tab.selected').removeClass('selected');
597				$(this).addClass('selected');
598				found = true;
599			});
600		}
601	});
602
603	/**
604	* Reset avatar dimensions when changing URL or EMAIL
605	*/
606	$container.find('input[data-reset-on-edit]').on('keyup', function() {
607		$(this.getAttribute('data-reset-on-edit')).val('');
608	});
609
610	/**
611	* Pagination
612	*/
613	$container.find('.pagination .page-jump-form :button').click(function() {
614		var $input = $(this).siblings('input.inputbox');
615		pageJump($input);
616	});
617
618	$container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) {
619		if (event.which === 13 || event.keyCode === 13) {
620			event.preventDefault();
621			pageJump($(this));
622		}
623	});
624
625	$container.find('.pagination .dropdown-trigger').click(function() {
626		var $dropdownContainer = $(this).parent();
627		// Wait a little bit to make sure the dropdown has activated
628		setTimeout(function() {
629			if ($dropdownContainer.hasClass('dropdown-visible')) {
630				$dropdownContainer.find('input.inputbox').focus();
631			}
632		}, 100);
633	});
634
635	/**
636	* Adjust HTML code for IE8 and older versions
637	*/
638	// if (oldBrowser) {
639	// 	// Fix .linklist.bulletin lists
640	// 	$container
641	// 		.find('ul.linklist.bulletin > li')
642	// 		.filter(':first-child, .rightside:last-child')
643	// 		.addClass('no-bulletin');
644	// }
645
646	/**
647	* Resize navigation (breadcrumbs) block to keep all links on same line
648	*/
649	$container.find('.navlinks').each(function() {
650		var $this = $(this),
651			$left = $this.children().not('.rightside'),
652			$right = $this.children('.rightside'),
653			queued = false,
654			throttled = false;
655
656		if ($left.length !== 1 || !$right.length) {
657			return;
658		}
659
660		function resize() {
661			var width = 0,
662				diff = $left.outerWidth(true) - $left.width(),
663				minWidth = Math.max($this.width() / 3, 240),
664				maxWidth;
665
666			throttled = false;
667			$right.each(function() {
668				var $this = $(this);
669				if ($this.is(':visible')) {
670					width += $this.outerWidth(true);
671				}
672			});
673
674			maxWidth = $this.width() - width - diff;
675			$left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px');
676		}
677
678		resize();
679		$(window).resize(function() {
680			if (throttled) {
681				queued = true;
682			}
683			else {
684				resize();
685				throttled = true;
686				queued = false;
687				setTimeout(function() {
688					throttled = false;
689					if (queued) {
690						resize();
691					}
692				}, 250);
693			}
694		});
695	});
696
697	/**
698	* Makes breadcrumbs responsive
699	*/
700	$container.find('.breadcrumbs:not([data-skip-responsive])').each(function() {
701		var $this = $(this),
702			$links = $this.find('.crumb'),
703			length = $links.length,
704			classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'],
705			classesLength = classes.length,
706			maxHeight = 0,
707			lastWidth = false,
708			wrapped = false,
709			queued = false,
710			throttled = false;
711
712		// Set tooltips
713		$this.find('a').each(function() {
714			var $link = $(this);
715			$link.attr('title', $link.text());
716		});
717
718		// Function that checks breadcrumbs
719		function check() {
720			var height = $this.height(),
721				width;
722
723			// Test max-width set in code for .navlinks above
724			width = parseInt($this.css('max-width'), 10);
725			if (!width) {
726				width = $body.width();
727			}
728
729			throttled = false;
730			maxHeight = parseInt($this.css('line-height'), 10);
731			$links.each(function() {
732				if ($(this).height() > 0) {
733					maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
734				}
735			});
736
737			if (height <= maxHeight) {
738				if (!wrapped || lastWidth === false || lastWidth >= width) {
739					return;
740				}
741			}
742			lastWidth = width;
743
744			if (wrapped) {
745				$this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' '));
746				if ($this.height() <= maxHeight) {
747					return;
748				}
749			}
750
751			wrapped = true;
752			$this.addClass('wrapped');
753			if ($this.height() <= maxHeight) {
754				return;
755			}
756
757			for (var i = 0; i < classesLength; i++) {
758				for (var j = length - 1; j >= 0; j--) {
759					$links.eq(j).addClass('wrapped ' + classes[i]);
760					if ($this.height() <= maxHeight) {
761						return;
762					}
763				}
764			}
765		}
766
767		// Run function and set event
768		check();
769		$(window).resize(function() {
770			if (throttled) {
771				queued = true;
772			}
773			else {
774				check();
775				throttled = true;
776				queued = false;
777				setTimeout(function() {
778					throttled = false;
779					if (queued) {
780						check();
781					}
782				}, 250);
783			}
784		});
785	});
786
787	/**
788	* Responsive link lists
789	*/
790	var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' +
791		'.postbody .post-buttons:not([data-skip-responsive])';
792	$container.find(selector).each(function() {
793		var $this = $(this),
794			filterSkip = '.breadcrumbs, [data-skip-responsive]',
795			filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
796			$linksAll = $this.children(),
797			$linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden
798			$linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first
799			$linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last
800			persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)?
801			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>',
802			slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured.
803
804		// Add a hidden drop-down menu to each links list (except those that already have one)
805		if (!persistent) {
806			if ($linksNotSkip.is('.rightside')) {
807				$linksNotSkip.filter('.rightside:first').before(html);
808				$this.children('.responsive-menu').addClass('rightside');
809			} else {
810				$this.append(html);
811			}
812		}
813
814		// Set some object references and initial states
815		var $menu = $this.children('.responsive-menu'),
816			$menuContents = $menu.find('.dropdown-contents'),
817			persistentContent = $menuContents.find('li:not(.separator)').length,
818			lastWidth = false,
819			compact = false,
820			responsive1 = false,
821			responsive2 = false,
822			copied1 = false,
823			copied2 = false,
824			maxHeight = 0;
825
826		// Find the tallest element in the list (we assume that all elements are roughly the same height)
827		$linksAll.each(function() {
828			if (!$(this).height()) {
829				return;
830			}
831			maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
832		});
833		if (maxHeight < 1) {
834			return; // Shouldn't be possible, but just in case, abort
835		} else {
836			maxHeight = maxHeight + slack;
837		}
838
839		function check() {
840			var width = $body.width();
841			// We can't make it any smaller than this, so just skip
842			if (responsive2 && compact && (width <= lastWidth)) {
843				return;
844			}
845			lastWidth = width;
846
847			// Reset responsive and compact layout
848			if (responsive1 || responsive2) {
849				$linksNotSkip.removeClass('hidden');
850				$menuContents.children('.clone').addClass('hidden');
851				responsive1 = responsive2 = false;
852			}
853			if (compact) {
854				$this.removeClass('compact');
855				compact = false;
856			}
857
858			// Unhide the quick-links menu if it has "persistent" content
859			if (persistent && persistentContent) {
860				$menu.removeClass('hidden');
861			} else {
862				$menu.addClass('hidden');
863			}
864
865			// Nothing to resize if block's height is not bigger than tallest element's height
866			if ($this.height() <= maxHeight) {
867				return;
868			}
869
870			// STEP 1: Compact
871			if (!compact) {
872				$this.addClass('compact');
873				compact = true;
874			}
875			if ($this.height() <= maxHeight) {
876				return;
877			}
878
879			// STEP 2: First responsive set - compact
880			if (compact) {
881				$this.removeClass('compact');
882				compact = false;
883			}
884			// Copy the list items to the dropdown
885			if (!copied1) {
886				var $clones1 = $linksFirst.clone();
887				$menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside'));
888
889				if ($this.hasClass('post-buttons')) {
890					$('.button', $menuContents).removeClass('button');
891					$('.sr-only', $menuContents).removeClass('sr-only');
892					$('.js-responsive-menu-link').addClass('button').addClass('button-icon-only');
893					$('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h');
894				}
895				copied1 = true;
896			}
897			if (!responsive1) {
898				$linksFirst.addClass('hidden');
899				responsive1 = true;
900				$menuContents.children('.clone-first').removeClass('hidden');
901				$menu.removeClass('hidden');
902			}
903			if ($this.height() <= maxHeight) {
904				return;
905			}
906
907			// STEP 3: First responsive set + compact
908			if (!compact) {
909				$this.addClass('compact');
910				compact = true;
911			}
912			if ($this.height() <= maxHeight) {
913				return;
914			}
915
916			// STEP 4: Last responsive set - compact
917			if (!$linksLast.length) {
918				return; // No other links to hide, can't do more
919			}
920			if (compact) {
921				$this.removeClass('compact');
922				compact = false;
923			}
924			// Copy the list items to the dropdown
925			if (!copied2) {
926				var $clones2 = $linksLast.clone();
927				$menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside'));
928				copied2 = true;
929			}
930			if (!responsive2) {
931				$linksLast.addClass('hidden');
932				responsive2 = true;
933				$menuContents.children('.clone-last').removeClass('hidden');
934			}
935			if ($this.height() <= maxHeight) {
936				return;
937			}
938
939			// STEP 5: Last responsive set + compact
940			if (!compact) {
941				$this.addClass('compact');
942				compact = true;
943			}
944		}
945
946		if (!persistent) {
947			phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false);
948		}
949
950		// If there are any images in the links list, run the check again after they have loaded
951		$linksAll.find('img').each(function() {
952            $(this).on('load', function() {
953				check();
954			});
955		});
956
957		check();
958		$(window).resize(check);
959	});
960
961	/**
962	* Fix container for messages
963	*/
964	$container.find('.postbody').each(function() {
965		var $this = $(this),
966			children = $this.children();
967
968		if (children.length == 1 && children.is('div')) {
969			return;
970		}
971
972		$this.wrapInner('<div class="postbody-inner" />');
973	});
974
975	/**
976	* Adjust post z-index for post profiles for all posts
977	*/
978	$('.postprofile').each(function(i) {
979		var z = Math.max(28 - i, 2);
980		$(this).css('z-index', z);
981	});
982
983	/**
984	* Do not run functions below for old browsers
985	*/
986	if (oldBrowser) {
987		return;
988	}
989
990	/**
991	* Adjust topiclist lists with check boxes
992	*/
993	$container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark');
994
995	/**
996	* Appends contents of all extra columns to first column in
997	* .topiclist lists for mobile devices. Copies contents as is.
998	*
999	* To add that functionality to .topiclist list simply add
1000	* responsive-show-all to list of classes
1001	*/
1002	$container.find('.topiclist.responsive-show-all > li > dl').each(function() {
1003		var $this = $(this),
1004			$block = $this.find('dt .responsive-show:last-child'),
1005			first = true;
1006
1007		// Create block that is visible only on mobile devices
1008		if (!$block.length) {
1009			$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
1010			$block = $this.find('dt .responsive-show:last-child');
1011		} else {
1012			first = ($.trim($block.text()).length === 0);
1013		}
1014
1015		// Copy contents of each column
1016		$this.find('dd').not('.mark').each(function() {
1017			var column = $(this),
1018				$children = column.children(),
1019				html = column.html();
1020
1021			if ($children.length === 1 && $children.text() === column.text()) {
1022				html = $children.html();
1023			}
1024
1025			$block.append((first ? '' : '<br />') + html);
1026
1027			first = false;
1028		});
1029	});
1030
1031	/**
1032	* Same as above, but prepends text from header to each
1033	* column before contents of that column.
1034	*
1035	* To add that functionality to .topiclist list simply add
1036	* responsive-show-columns to list of classes
1037	*/
1038	$container.find('.topiclist.responsive-show-columns').each(function() {
1039		var $list = $(this),
1040			headers = [],
1041			headersLength = 0;
1042
1043		// Find all headers, get contents
1044		$list.prev('.topiclist').find('li.header dd').not('.mark').each(function() {
1045			headers.push($(this).text());
1046			headersLength++;
1047		});
1048
1049		if (!headersLength) {
1050			return;
1051		}
1052
1053		// Parse each row
1054		$list.find('dl').each(function() {
1055			var $this = $(this),
1056				$block = $this.find('dt .responsive-show:last-child'),
1057				first = true;
1058
1059			// Create block that is visible only on mobile devices
1060			if (!$block.length) {
1061				$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
1062				$block = $this.find('dt .responsive-show:last-child');
1063			} else {
1064				first = ($.trim($block.text()).length === 0);
1065			}
1066
1067			// Copy contents of each column
1068			$this.find('dd').not('.mark').each(function(i) {
1069				var column = $(this),
1070					children = column.children(),
1071					html = column.html();
1072
1073				if (children.length === 1 && children.text() === column.text()) {
1074					html = children.html();
1075				}
1076
1077				// Prepend contents of matching header before contents of column
1078				if (i < headersLength) {
1079					html = headers[i] + ': <strong>' + html + '</strong>';
1080				}
1081
1082				$block.append((first ? '' : '<br />') + html);
1083
1084				first = false;
1085			});
1086		});
1087	});
1088
1089	/**
1090	* Responsive tables
1091	*/
1092	$container.find('table.table1').not('.not-responsive').each(function() {
1093		var $this = $(this),
1094			$th = $this.find('thead > tr > th'),
1095			headers = [],
1096			totalHeaders = 0,
1097			i, headersLength;
1098
1099		// Find each header
1100		$th.each(function(column) {
1101			var cell = $(this),
1102				colspan = parseInt(cell.attr('colspan'), 10),
1103				dfn = cell.attr('data-dfn'),
1104				text = dfn ? dfn : cell.text();
1105
1106			colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
1107
1108			for (i = 0; i < colspan; i++) {
1109				headers.push(text);
1110			}
1111			totalHeaders++;
1112
1113			if (dfn && !column) {
1114				$this.addClass('show-header');
1115			}
1116		});
1117
1118		headersLength = headers.length;
1119
1120		// Add header text to each cell as <dfn>
1121		$this.addClass('responsive');
1122
1123		if (totalHeaders < 2) {
1124			$this.addClass('show-header');
1125			return;
1126		}
1127
1128		$this.find('tbody > tr').each(function() {
1129			var row = $(this),
1130				cells = row.children('td'),
1131				column = 0;
1132
1133			if (cells.length === 1) {
1134				row.addClass('big-column');
1135				return;
1136			}
1137
1138			cells.each(function() {
1139				var cell = $(this),
1140					colspan = parseInt(cell.attr('colspan'), 10),
1141					text = $.trim(cell.text());
1142
1143				if (headersLength <= column) {
1144					return;
1145				}
1146
1147				if ((text.length && text !== '-') || cell.children().length) {
1148					cell.prepend('<dfn style="display: none;">' + headers[column] + '</dfn>');
1149				} else {
1150					cell.addClass('empty');
1151				}
1152
1153				colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan;
1154				column += colspan;
1155			});
1156		});
1157	});
1158
1159	/**
1160	* Hide empty responsive tables
1161	*/
1162	$container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() {
1163		var $items = $(this).children('tr');
1164		if (!$items.length) {
1165			$(this).parent('table:first').addClass('responsive-hide');
1166		}
1167	});
1168
1169	/**
1170	* Responsive tabs
1171	*/
1172	$container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() {
1173		var $this = $(this),
1174			$ul = $this.children(),
1175			$tabs = $ul.children().not('[data-skip-responsive]'),
1176			$links = $tabs.children('a'),
1177			$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'),
1178			$menu = $item.find('.dropdown-contents'),
1179			maxHeight = 0,
1180			lastWidth = false,
1181			responsive = false;
1182
1183		$links.each(function() {
1184			var $this = $(this);
1185			maxHeight = Math.max(maxHeight, Math.max($this.outerHeight(true), $this.parent().outerHeight(true)));
1186		});
1187
1188		function check() {
1189			var width = $body.width(),
1190				height = $this.height();
1191
1192			if (!arguments.length && (!responsive || width <= lastWidth) && height <= maxHeight) {
1193				return;
1194			}
1195
1196			$tabs.show();
1197			$item.hide();
1198
1199			lastWidth = width;
1200			height = $this.height();
1201			if (height <= maxHeight) {
1202				if ($item.hasClass('dropdown-visible')) {
1203					phpbb.toggleDropdown.call($item.find('a.responsive-tab-link').get(0));
1204				}
1205				return;
1206			}
1207
1208			responsive = true;
1209			$item.show();
1210			$menu.html('');
1211
1212			var $availableTabs = $tabs.filter(':not(.activetab, .responsive-tab)'),
1213				total = $availableTabs.length,
1214				i, $tab;
1215
1216			for (i = total - 1; i >= 0; i--) {
1217				$tab = $availableTabs.eq(i);
1218				$menu.prepend($tab.clone(true).removeClass('tab'));
1219				$tab.hide();
1220				if ($this.height() <= maxHeight) {
1221					$menu.find('a').click(function() {
1222						check(true);
1223					});
1224					return;
1225				}
1226			}
1227			$menu.find('a').click(function() {
1228				check(true);
1229			});
1230		}
1231
1232		var $tabLink = $item.find('a.responsive-tab-link');
1233		phpbb.registerDropdown($tabLink, $item.find('.dropdown'), {
1234			visibleClass: 'activetab'
1235		});
1236
1237		check(true);
1238		$(window).resize(check);
1239	});
1240
1241	/**
1242	 * Hide UCP/MCP navigation if there is only 1 item
1243	 */
1244	$container.find('#navigation').each(function() {
1245		var $items = $(this).children('ol, ul').children('li');
1246		if ($items.length === 1) {
1247			$(this).addClass('responsive-hide');
1248		}
1249	});
1250
1251	/**
1252	* Replace responsive text
1253	*/
1254	$container.find('[data-responsive-text]').each(function() {
1255		var $this = $(this),
1256			fullText = $this.text(),
1257			responsiveText = $this.attr('data-responsive-text'),
1258			responsive = false;
1259
1260		function check() {
1261			if ($(window).width() > 700) {
1262				if (!responsive) {
1263					return;
1264				}
1265				$this.text(fullText);
1266				responsive = false;
1267				return;
1268			}
1269			if (responsive) {
1270				return;
1271			}
1272			$this.text(responsiveText);
1273			responsive = true;
1274		}
1275
1276		check();
1277		$(window).resize(check);
1278	});
1279
1280	/**
1281	* Static navigation
1282	*/
1283	if (styleConfig.staticNavigation) {
1284		$container.find('.navbar.tabbed > .inner').each(function(i) {
1285			var nav = this,
1286				navigation = $(nav),
1287				isStatic = false,
1288				parent = navigation.parent(),
1289				dummy,
1290				inner,
1291				$w = $(window),
1292				minTopPosition = 0,
1293				minWidth = styleConfig.staticNavigationMinWidth,
1294				minHeight = styleConfig.staticNavigationMinHeight,
1295				windowWidth, navHeight,
1296				queued = false,
1297				throttled = false;
1298
1299			navigation.before('<div class="static-nav-dummy inner" style="display:none;" />');
1300			dummy = navigation.prev();
1301
1302			navigation.wrapInner('<div class="static-inner" />');
1303			inner = navigation.children();
1304
1305			function enableStatic()
1306			{
1307				dummy.css('height', Math.floor(navigation.height()) + 'px').show();
1308				navigation.addClass('static');
1309				parent.removeClass('not-static');
1310				isStatic = true;
1311				checkNavigation(true);
1312			}
1313
1314			function disableStatic()
1315			{
1316				dummy.hide();
1317				navigation.removeClass('static');
1318				parent.addClass('not-static');
1319				isStatic = false;
1320				checkNavigation(true);
1321			}
1322
1323			function testHash()
1324			{
1325				var hash = (window.location.hash) ? window.location.hash : '';
1326				if (!hash)
1327				{
1328					return;
1329				}
1330				window.scrollTo($w.scrollLeft(), $w.scrollTop() - navigation.height());
1331			}
1332
1333			function check(checkHash)
1334			{
1335				var windowTop = 0,
1336					windowWidth = Math.floor($w.width()),
1337					top;
1338
1339				if (windowWidth < minWidth || $w.height() < minHeight) {
1340					if (isStatic) {
1341						disableStatic();
1342					}
1343					return;
1344				}
1345				if (!isStatic)
1346				{
1347					navHeight = navigation.height();
1348					top = nav.getBoundingClientRect().top;
1349					if (top > 0) {
1350						return;
1351					}
1352					minTopPosition = $w.scrollTop() + top;
1353					enableStatic();
1354					if (checkHash) {
1355						testHash();
1356					}
1357					return;
1358				}
1359				if ($w.scrollTop() < minTopPosition) {
1360					disableStatic();
1361				} else if (checkHash) {
1362					testHash();
1363				}
1364			}
1365
1366			$w.on('scroll resize', function() { 
1367				if (!isStatic) {
1368					check(false);
1369				}
1370				else {
1371					if (!throttled) {
1372						check(false);
1373						throttled = true;
1374						queued = false;
1375						setTimeout(function() {
1376							throttled = false;
1377							if (queued) {
1378								check(false);
1379							}
1380						}, 250);
1381					}
1382					else {
1383						queued = true;
1384					}
1385				}
1386			});
1387			$w.on('load', function() { check(true); });
1388			$w.on('hashchange', function() { check(true); });
1389		});
1390	}
1391
1392	/**
1393	* Empty last post column
1394	*/
1395	$container.find('dd.lastpost > span:only-child > br:only-child').parents('dd.lastpost').addClass('empty');
1396
1397	/**
1398	* Forum descriptions
1399	*/
1400	var animatedDescription = false;
1401	$container.find('.forabg').each(function(i) {
1402		var $b = $('body'),
1403			$w = $(window),
1404			rtl = $('#phpbb').hasClass('rtl'),
1405			hide = $(this).attr('data-hide-description') == '1';
1406
1407		$('a.forumtitle + .forum-description', this).each(function(j) {
1408			var $this = $(this);
1409
1410			if (!hide) {
1411				$this.parents('dl.icon').addClass('with-description');
1412				return;
1413			}
1414
1415			var title = $this.prev(),
1416				id = 'forumdesc-' + i + '-' + j,
1417				item, top, left, width, rect, rectWidth;
1418
1419			$b.append($this);
1420			$this.attr('id', id).append('<span class="arrow" />');
1421
1422			title.attr('title', '').hover(function() {
1423				// Hide previous animation
1424				if (animatedDescription !== false) {
1425					animatedDescription.item.stop(true, true).hide();
1426				}
1427				animatedDescription = {
1428					item: $this,
1429					i: i,
1430					j: j,
1431					fading: false
1432				};
1433
1434				// Calculate position
1435				rect = this.getBoundingClientRect();
1436				rectWidth = rect.width ? rect.width : $(this).width();
1437				// $this.attr('data-rect', 'top: ' + rect.top + ', left: ' + rect.left + ', width: ' + rectWidth + ', window: ' + $w.width());
1438				top = Math.floor($w.scrollTop() + rect.top);
1439				if ((rect.left + rectWidth + 300) > $w.width()) {
1440					$this.addClass('no-arrow');
1441					top += Math.floor(rect.height ? rect.height : $(this).height());
1442
1443					if (!rtl) {
1444						left = Math.floor($w.scrollLeft() + rect.left);
1445						$this.css({
1446							position: 'absolute',
1447							top: top + 'px',
1448							left: left + 'px'
1449						});
1450					}
1451					else {
1452						left = Math.floor($w.scrollLeft() + rect.left + rectWidth);
1453						$this.css({
1454							position: 'absolute',
1455							top: top + 'px',
1456							right: left + 'px'
1457						});
1458					}
1459				}
1460				else if (!rtl) {
1461					$this.removeClass('no-arrow');
1462					left = Math.floor($w.scrollLeft() + rect.left + rectWidth + 10);
1463					$this.css({
1464						position: 'absolute',
1465						top: top + 'px',
1466						left: left + 'px'
1467					});
1468				}
1469				else {
1470					$this.removeClass('no-arrow');
1471					left = Math.floor($w.scrollLeft() + rect.left - 10);
1472					$this.css({
1473						position: 'absolute',
1474						top: top + 'px',
1475						right: left + 'px'
1476					});
1477				}
1478
1479				// Show
1480				$this.stop(true, true).fadeIn(200);
1481			}, function() {
1482				// Hide
1483				animatedDescription.fading = true;
1484				setTimeout(700, function() {
1485					if (animatedDescription !== false && animatedDescription.i == i && animatedDescription.j == j && animatedDescription.fading) {
1486						animatedDescription = false;
1487					}
1488				});
1489				$this.delay(500).fadeOut(200);
1490			});
1491
1492			$this.addClass('toggle').click(function() {
1493				// Hide
1494				$this.stop(true, true).fadeOut(100);
1495				if (animatedDescription !== false && animatedDescription.i == i && animatedDescription.j == j) {
1496					animatedDescription = false;
1497				}
1498			});
1499		});
1500	});
1501
1502	/**
1503	* HD images
1504	*/
1505	if (window.matchMedia && window.matchMedia('(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 1.5dppx)').matches) {
1506		$container.find('img[data-src-hd]').each(function() {
1507			var img = this,
1508				$this = $(this),
1509				hdImage = new Image(),
1510				hdLoaded = false,
1511				normalLoaded = false;
1512
1513			function replaceImage() 
1514			{
1515				$this.css('width', (img.naturalWidth ? img.naturalWidth : img.width) + 'px');
1516				img.setAttribute('src', img.getAttribute('data-src-hd'));
1517			}
1518
1519			if (img.complete) {
1520				normalLoaded = true;
1521			}
1522			else {
1523				img.onload = function() {
1524					if (normalLoaded) {
1525						return;
1526					}
1527					normalLoaded = true;
1528					if (hdLoaded) {
1529						replaceImage();
1530					}
1531				};
1532			}
1533
1534			hdImage.onload = function() {
1535				hdLoaded = true;
1536				if (normalLoaded) {
1537					replaceImage();
1538				}
1539			};
1540			hdImage.src = img.getAttribute('data-src-hd');
1541		});
1542	}
1543
1544	/**
1545	* Split buttons
1546	*/
1547	$container.find('div.buttons a.button.icon-button').each(function() {
1548		var $this = $(this),
1549			words;
1550
1551		if ($this.children().length) return;
1552
1553		words = $this.text().trim().split(' ');
1554		if (words.length > 1) {
1555			$this.text(words.shift() + ' ').append('<strong />');
1556			$this.find('strong').text(words.join(' '));
1557		}
1558	});
1559
1560	/**
1561	* Add online status
1562	*/
1563	$('#phpbb.can-transform[data-online-text]').each(function() {
1564		var text = $(this).attr('data-online-text');
1565
1566		$container.find('.online').each(function() {
1567			var $this = $(this);
1568
1569			$this.css('position', 'relative').append('<span class="online-ribbon"><span>' + text + '</span><span>' + text + '</span></span>');
1570		});
1571	});
1572
1573	/**
1574	* Extend poster profile
1575	*/
1576	if (styleConfig._loaded) {
1577		$container.find('.postprofile + .postbody > div:only-child').each(function() {
1578			adjustPosterProfile($(this));
1579		});
1580	}
1581
1582	/**
1583	* Collapse forums
1584	*/
1585	if (styleConfig.collapseForums) {
1586		$container.find('.forabg li.header').each(function() {
1587			var $this = $(this),
1588				forum = $this.parent().next('ul.forums'),
1589				id = 0,
1590				toggled = false,
1591				toggle;
1592
1593			if (forum.length != 1) {
1594				return;
1595			}
1596
1597			// Find category id
1598			$('a[data-id]', $this).each(function() {
1599				id = parseInt(this.getAttribute('data-id'));
1600			});
1601			if (!id) {
1602				forum.find('.forumtitle[data-id]:first').each(function() {
1603					id = parseInt(this.getAttribute('data-id'));
1604					if (!isNaN(id)) {
1605						id = 'f' + id;
1606					}
1607				});
1608			}
1609			if (!id) {
1610				return;
1611			}
1612
1613			// Add toggle code
1614			$this.append('<a class="forum-toggle" href="#"></a>');
1615			toggle = $this.find('.forum-toggle');
1616			toggle.click(function(event) {
1617				event.preventDefault();
1618				if (toggled) {
1619					forum.stop(true, true).slideDown(200);
1620					toggled = false;
1621					toggle.removeClass('toggled');
1622					phpbb.deleteCookie('toggled-' + id, styleConfig.cookieConfig);
1623					return;
1624				}
1625				forum.stop(true, true).slideUp(200);
1626				toggled = true;
1627				toggle.addClass('toggled');
1628				phpbb.setCookie('toggled-' + id, '1', styleConfig.cookieConfig);
1629			});
1630
1631			// Check default state
1632			if (phpbb.getCookie('toggled-' + id, styleConfig.cookieConfig) == '1') {
1633				forum.stop(true, true).slideUp(0);
1634				toggled = true;
1635				toggle.addClass('toggled');
1636			}
1637		});
1638	}
1639}
1640
1641/**
1642* Run onload functions
1643*/
1644jQuery(function($) {
1645	'use strict';
1646
1647	function processResizeEvent()
1648	{
1649		styleConfig._resizeThrottled = false;
1650
1651		checkNavigation(false);
1652
1653		if (styleConfig.extendPosterProfile) {
1654			$('.postprofile + .postbody > div:only-child').each(function() {
1655				adjustPosterProfile($(this));
1656			});
1657		}
1658	}
1659
1660	var transforms = ['transform', 'webkitTransform', 'msTransform'],
1661		i, test;
1662
1663	// Cookie configuration
1664	styleConfig.cookieConfig = {
1665		prefix: '',
1666		path: '/',
1667		expires: new Date()
1668	};
1669	styleConfig.cookieConfig.expires.setFullYear(styleConfig.cookieConfig.expires.getFullYear() + 1);
1670
1671	// Swap .nojs and .hasjs
1672	$('#phpbb.nojs').toggleClass('nojs hasjs');
1673	$('#phpbb').toggleClass('hastouch', phpbb.isTouch);
1674	$('#phpbb.hastouch').removeClass('notouch');
1675
1676	// Focus forms
1677	$('form[data-focus]:first').each(function() {
1678		$('#' + this.getAttribute('data-focus')).focus();
1679	});
1680
1681	// Check for transformations
1682	test = $('#phpbb').get(0);
1683	for (i=0; i<transforms.length; i++) {
1684		if (typeof(test.style[transforms[i]]) != 'undefined') {
1685			$('#phpbb').addClass('can-transform');
1686			break;
1687		}
1688	}
1689
1690	// Cookies
1691	phpbb.setCookie = function(name, value, config) {
1692		config = $.extend({
1693			prefix: '',
1694			path: '/'
1695		}, typeof config === 'object' ? config : {});
1696
1697		document.cookie = config.prefix + name + '=' + encodeURIComponent(value)
1698			+ (config.expires === undefined ? '' : ';expires=' + config.expires.toUTCString())
1699			+ (config.path  ? ';path=' + config.path : '')
1700			+ (config.domain ? ';domain=' + config.domain : '');
1701
1702		return value;
1703	};
1704
1705	phpbb.getCookie = function(name, config) {
1706		var expr, cookie;
1707
1708		config = $.extend({
1709			prefix: '',
1710			path: '/'
1711		}, typeof config === 'object' ? config : {});
1712
1713		expr = new RegExp('(^| )' + config.prefix + name + '=([^;]+)(;|$)');
1714		cookie = expr.exec(document.cookie);
1715
1716		if (cookie)
1717		{
1718			return decodeURIComponent(cookie[2]);
1719		}
1720		else
1721		{
1722			return null;
1723		}
1724	};
1725
1726	phpbb.deleteCookie = function(name, config) {
1727		config = $.extend({
1728			prefix: '',
1729			path: '/'
1730		}, typeof config === 'object' ? config : {});
1731
1732		document.cookie = config.prefix + name + '='
1733			+ (config.path  ? '; path=' + config.path : '')
1734			+ (config.domain ? '; domain=' + config.domain : '')
1735			+ '; expires=Thu, 01-Jan-70 00:00:01 GMT';
1736
1737		return null;
1738	};
1739
1740	// Responsive navigation
1741	initResponsiveNavigation();
1742
1743	// Parse body
1744	parseDocument($('body'));
1745
1746	// Check responsive navigation
1747	checkNavigation(true);
1748
1749	// Events
1750	styleConfig._loaded = true;
1751	styleConfig._resizeThrottled = false;
1752	styleConfig._resizeQueued = false;
1753
1754	$(window).load(function() {
1755		checkNavigation(true);
1756		if (styleConfig.extendPosterProfile) {
1757			$('.postprofile + .postbody > div:only-child').each(function() {
1758				adjustPosterProfile($(this));
1759			});
1760		}
1761	});
1762
1763	$(window).resize(function() {
1764		if (!styleConfig._resizeThrottled) {
1765			processResizeEvent();
1766			styleConfig._resizeThrottled = true;
1767			styleConfig._resizeQueued = false;
1768			setTimeout(function() {
1769				styleConfig._resizeThrottled = false;
1770				if (styleConfig._resizeQueued) {
1771					processResizeEvent();
1772				}
1773			}, 500);
1774		} else {
1775			styleConfig._resizeQueued = true;
1776		}
1777	});
1778});

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.