commit 9d906d8e655cb2ef146d9417e4ec4a8d21ce048b
Author: Adrian Rauth
Date: Thu Dec 3 00:07:54 2020 +0100
Initial Commit
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..ebcd1a6
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,3 @@
+# Simplicity theme
+
+For GeneRally International Forum. [Original by Arty](https://www.phpbb.com/customise/db/style/artodia_simplicity/) distributed under BSD License.
\ No newline at end of file
diff --git a/simplicity/license.txt b/simplicity/license.txt
new file mode 100644
index 0000000..a5319f7
--- /dev/null
+++ b/simplicity/license.txt
@@ -0,0 +1,33 @@
+IMPORTANT: This license does not apply to files in directory theme/fonts/
+
+Files in those directories have their own licenses, see license.txt in respective
+directories for details.
+
+-----------------------------------------------------------------------------
+
+Copyright (c) 2015, Vjacheslav Trushkin
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those
+of the authors and should not be interpreted as representing official policies,
+either expressed or implied, of the FreeBSD Project.
\ No newline at end of file
diff --git a/simplicity/style.cfg b/simplicity/style.cfg
new file mode 100644
index 0000000..d814d65
--- /dev/null
+++ b/simplicity/style.cfg
@@ -0,0 +1,32 @@
+#
+# phpBB Style Configuration File
+#
+# This file is part of the phpBB Forum Software package.
+#
+# @copyright (c) phpBB Limited
+# @license GNU General Public License, version 2 (GPL-2.0)
+#
+# For full copyright and license information, please see
+# the docs/CREDITS.txt file.
+#
+# At the left is the name, please do not change this
+# At the right the value is entered
+#
+# Values get trimmed, if you want to add a space in front or at the end of
+# the value, then enclose the value with single or double quotes.
+# Single and double quotes do not need to be escaped.
+#
+#
+
+# General Information about this style
+name = Simplicity
+copyright = Created by Arty (Vjacheslav Trushkin), http://www.artodia.com/, Modified by Gabriel Fischer
+style_version = 3.3.0
+phpbb_version = 3.3.0
+
+# Defining a different template bitfield
+# template_bitfield = lNg=
+
+# Parent style
+# Set value to empty or to this style's name if this style does not have a parent style
+parent = prosilver
diff --git a/simplicity/template/_style_config.html b/simplicity/template/_style_config.html
new file mode 100644
index 0000000..9beba3f
--- /dev/null
+++ b/simplicity/template/_style_config.html
@@ -0,0 +1,37 @@
+
+ Variables below change style behavior.
+
+ List of variables and values (do not edit!):
+ Forums list layout:
+ $STANDARD_FORUMS_LAYOUT = 0 -> Layout with topics and posts below forum title
+ $STANDARD_FORUMS_LAYOUT = 1 -> Default layout with separate columns for topics and posts
+
+ Hide forum description:
+ $HIDE_FORUM_DESCRIPTION = 0 -> Always show it
+ $HIDE_FORUM_DESCRIPTION = 1 -> Show it only when hovering forum title
+
+ Wrap header / navigation:
+ $WRAP_HEADER = 0 -> Header and navigation will not be included in global wrapper
+ $WRAP_HEADER = 1 -> Both header and navigation will be included in global wrapper
+ $WRAP_HEADER = 2 -> Header will not be included in global wrapper, navigation will be included
+
+ Wrap footer:
+ $WRAP_FOOTER = 0 -> Footer will be outside of content wrapper
+ $WRAP_FOOTER = 1 -> Footer will be inside content wrapper
+
+ Quick search position:
+ $SEARCH_IN_NAVBAR = 0 -> Search bar will be displayed in header
+ $SEARCH_IN_NAVBAR = 1 -> Search bar will be displayed in secondary navigation
+
+ Edit variables below:
+
+
+
+
+
+
+
+
+
+ Do not edit code below!
+
diff --git a/simplicity/template/ajax.js b/simplicity/template/ajax.js
new file mode 100644
index 0000000..18275a8
--- /dev/null
+++ b/simplicity/template/ajax.js
@@ -0,0 +1,394 @@
+/* global phpbb */
+
+(function($) { // Avoid conflicts with other libraries
+
+'use strict';
+
+// This callback will mark all forum icons read
+phpbb.addAjaxCallback('mark_forums_read', function(res) {
+ var readTitle = res.NO_UNREAD_POSTS;
+ var unreadTitle = res.UNREAD_POSTS;
+ var iconsArray = {
+ forum_unread: 'forum_read',
+ forum_unread_subforum: 'forum_read_subforum',
+ forum_unread_locked: 'forum_read_locked'
+ };
+
+ $('li.row').find('dl[class*="forum_unread"]').each(function() {
+ var $this = $(this);
+
+ $.each(iconsArray, function(unreadClass, readClass) {
+ if ($this.hasClass(unreadClass)) {
+ $this.removeClass(unreadClass).addClass(readClass);
+ }
+ });
+ $this.children('dt[title="' + unreadTitle + '"]').attr('title', readTitle);
+ });
+
+ // Mark subforums read
+ $('a.subforum[class*="unread"]').removeClass('unread').addClass('read').children('.icon.icon-red').removeClass('icon-red').addClass('icon-blue');
+
+ // Mark topics read if we are watching a category and showing active topics
+ if ($('#active_topics').length) {
+ phpbb.ajaxCallbacks.mark_topics_read.call(this, res, false);
+ }
+
+ // Update mark forums read links
+ $('[data-ajax="mark_forums_read"]').attr('href', res.U_MARK_FORUMS);
+
+ phpbb.closeDarkenWrapper(3000);
+});
+
+/**
+* This callback will mark all topic icons read
+*
+* @param {bool} [update_topic_links=true] Whether "Mark topics read" links
+* should be updated. Defaults to true.
+*/
+phpbb.addAjaxCallback('mark_topics_read', function(res, updateTopicLinks) {
+ var readTitle = res.NO_UNREAD_POSTS;
+ var unreadTitle = res.UNREAD_POSTS;
+ var iconsArray = {
+ global_unread: 'global_read',
+ announce_unread: 'announce_read',
+ sticky_unread: 'sticky_read',
+ topic_unread: 'topic_read'
+ };
+ var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
+ var unreadClassSelectors;
+ var classMap = {};
+ var classNames = [];
+
+ if (typeof updateTopicLinks === 'undefined') {
+ updateTopicLinks = true;
+ }
+
+ $.each(iconsArray, function(unreadClass, readClass) {
+ $.each(iconsState, function(key, value) {
+ // Only topics can be hot
+ if ((value === '_hot' || value === '_hot_mine') && unreadClass !== 'topic_unread') {
+ return true;
+ }
+ classMap[unreadClass + value] = readClass + value;
+ classNames.push(unreadClass + value);
+ });
+ });
+
+ unreadClassSelectors = '.' + classNames.join(',.');
+
+ $('li.row').find(unreadClassSelectors).each(function() {
+ var $this = $(this);
+ $.each(classMap, function(unreadClass, readClass) {
+ if ($this.hasClass(unreadClass)) {
+ $this.removeClass(unreadClass).addClass(readClass);
+ }
+ });
+ $this.children('dt[title="' + unreadTitle + '"]').attr('title', readTitle);
+ });
+
+ // Remove link to first unread post
+ $('a.unread').has('.icon-red').remove();
+
+ // Update mark topics read links
+ if (updateTopicLinks) {
+ $('[data-ajax="mark_topics_read"]').attr('href', res.U_MARK_TOPICS);
+ }
+
+ phpbb.closeDarkenWrapper(3000);
+});
+
+// This callback will mark all notifications read
+phpbb.addAjaxCallback('notification.mark_all_read', function(res) {
+ if (typeof res.success !== 'undefined') {
+ phpbb.markNotifications($('#notification_list li.bg3'), 0);
+ phpbb.closeDarkenWrapper(3000);
+ }
+});
+
+// This callback will mark a notification read
+phpbb.addAjaxCallback('notification.mark_read', function(res) {
+ if (typeof res.success !== 'undefined') {
+ var unreadCount = Number($('#notification_list_button + strong .counter').html()) - 1;
+ phpbb.markNotifications($(this).parent('li.bg3'), unreadCount);
+ }
+});
+
+/**
+ * Mark notification popup rows as read.
+ *
+ * @param {jQuery} $popup jQuery object(s) to mark read.
+ * @param {int} unreadCount The new unread notifications count.
+ */
+phpbb.markNotifications = function($popup, unreadCount) {
+ // Remove the unread status.
+ $popup.removeClass('bg3');
+ $popup.find('a.mark_read').remove();
+
+ // Update the notification link to the real URL.
+ $popup.each(function() {
+ var link = $(this).find('a');
+ link.attr('href', link.attr('data-real-url'));
+ });
+
+ // Update the unread count.
+ $('#notification_list_button + strong .counter').html(unreadCount).parents('.notifications.tab').toggleClass('non-zero', unreadCount > 0);
+ // Remove the Mark all read link and hide notification count if there are no unread notifications.
+ if (!unreadCount) {
+ $('#mark_all_notifications').remove();
+ $('#notification_list_button > strong').addClass('hidden');
+ }
+
+ // Update page title
+ var $title = $('title');
+ var originalTitle = $title.text().replace(/(\((\d+)\))/, '');
+ $title.text((unreadCount ? '(' + unreadCount + ')' : '') + originalTitle);
+};
+
+// This callback finds the post from the delete link, and removes it.
+phpbb.addAjaxCallback('post_delete', function() {
+ var $this = $(this),
+ postId;
+
+ if ($this.attr('data-refresh') === undefined) {
+ postId = $this[0].href.split('&p=')[1];
+ var post = $this.parents('#p' + postId).css('pointer-events', 'none');
+ if (post.hasClass('bg1') || post.hasClass('bg2')) {
+ var posts1 = post.nextAll('.bg1');
+ post.nextAll('.bg2').removeClass('bg2').addClass('bg1');
+ posts1.removeClass('bg1').addClass('bg2');
+ }
+ post.fadeOut(function() {
+ $(this).remove();
+ });
+ }
+});
+
+// This callback removes the approve / disapprove div or link.
+phpbb.addAjaxCallback('post_visibility', function(res) {
+ var remove = (res.visible) ? $(this) : $(this).parents('.post');
+ $(remove).css('pointer-events', 'none').fadeOut(function() {
+ $(this).remove();
+ });
+
+ if (res.visible) {
+ // Remove the "Deleted by" message from the post on restoring.
+ remove.parents('.post').find('.post_deleted_msg').css('pointer-events', 'none').fadeOut(function() {
+ $(this).remove();
+ });
+ }
+});
+
+// This removes the parent row of the link or form that fired the callback.
+phpbb.addAjaxCallback('row_delete', function() {
+ $(this).parents('tr').remove();
+});
+
+// This handles friend / foe additions removals.
+phpbb.addAjaxCallback('zebra', function(res) {
+ var zebra;
+
+ if (res.success) {
+ zebra = $('.zebra');
+ zebra.first().html(res.MESSAGE_TEXT);
+ zebra.not(':first').html(' ').prev().html(' ');
+ }
+});
+
+/**
+ * This callback updates the poll results after voting.
+ */
+phpbb.addAjaxCallback('vote_poll', function(res) {
+ if (typeof res.success !== 'undefined') {
+ var poll = $(this).closest('.topic_poll');
+ var panel = poll.find('.panel');
+ var resultsVisible = poll.find('dl:first-child .resultbar').is(':visible');
+ var mostVotes = 0;
+
+ // Set min-height to prevent the page from jumping when the content changes
+ var updatePanelHeight = function (height) {
+ height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height;
+ panel.css('min-height', height);
+ };
+ updatePanelHeight();
+
+ // Remove the View results link
+ if (!resultsVisible) {
+ poll.find('.poll_view_results').hide(500);
+ }
+
+ if (!res.can_vote) {
+ poll.find('.polls, .poll_max_votes, .poll_vote, .poll_option_select').fadeOut(500, function () {
+ poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show();
+ });
+ } else {
+ // If the user can still vote, simply slide down the results
+ poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500);
+ }
+
+ // Get the votes count of the highest poll option
+ poll.find('[data-poll-option-id]').each(function() {
+ var option = $(this);
+ var optionId = option.attr('data-poll-option-id');
+ mostVotes = (res.vote_counts[optionId] >= mostVotes) ? res.vote_counts[optionId] : mostVotes;
+ });
+
+ // Update the total votes count
+ poll.find('.poll_total_vote_cnt').html(res.total_votes);
+
+ // Update each option
+ poll.find('[data-poll-option-id]').each(function() {
+ var $this = $(this);
+ var optionId = $this.attr('data-poll-option-id');
+ var voted = (typeof res.user_votes[optionId] !== 'undefined');
+ var mostVoted = (res.vote_counts[optionId] === mostVotes);
+ var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[optionId] / res.total_votes) * 100);
+ var percentRel = (mostVotes === 0) ? 0 : Math.round((res.vote_counts[optionId] / mostVotes) * 100);
+ var altText;
+
+ altText = $this.attr('data-alt-text');
+ if (voted) {
+ $this.attr('title', $.trim(altText));
+ } else {
+ $this.attr('title', '');
+ };
+ $this.toggleClass('voted', voted);
+ $this.toggleClass('most-votes', mostVoted);
+
+ // Update the bars
+ var bar = $this.find('.resultbar div');
+ var barTimeLapse = (res.can_vote) ? 500 : 1500;
+ var newBarClass = (percent === 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1);
+
+ setTimeout(function () {
+ bar.animate({ width: percentRel + '%' }, 500)
+ .removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5')
+ .addClass(newBarClass)
+ .html(res.vote_counts[optionId]);
+
+ var percentText = percent ? percent + '%' : res.NO_VOTES;
+ $this.find('.poll_option_percent').html(percentText);
+ }, barTimeLapse);
+ });
+
+ if (!res.can_vote) {
+ poll.find('.polls').delay(400).fadeIn(500);
+ }
+
+ // Display "Your vote has been cast." message. Disappears after 5 seconds.
+ var confirmationDelay = (res.can_vote) ? 300 : 900;
+ poll.find('.vote-submitted').delay(confirmationDelay).slideDown(200, function() {
+ if (resultsVisible) {
+ updatePanelHeight();
+ }
+
+ $(this).delay(5000).fadeOut(500, function() {
+ resizePanel(300);
+ });
+ });
+
+ // Remove the gap resulting from removing options
+ setTimeout(function() {
+ resizePanel(500);
+ }, 1500);
+
+ var resizePanel = function (time) {
+ var panelHeight = panel.height();
+ var innerHeight = panel.find('.inner').outerHeight();
+
+ if (panelHeight !== innerHeight) {
+ panel.css({ minHeight: '', height: panelHeight })
+ .animate({ height: innerHeight }, time, function () {
+ panel.css({ minHeight: innerHeight, height: '' });
+ });
+ }
+ };
+ }
+});
+
+/**
+ * Show poll results when clicking View results link.
+ */
+$('.poll_view_results a').click(function(e) {
+ // Do not follow the link
+ e.preventDefault();
+
+ var $poll = $(this).parents('.topic_poll');
+
+ $poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500);
+ $poll.find('.poll_view_results').hide(500);
+});
+
+$('[data-ajax]').each(function() {
+ var $this = $(this);
+ var ajax = $this.attr('data-ajax');
+ var filter = $this.attr('data-filter');
+
+ if (ajax !== 'false') {
+ var fn = (ajax !== 'true') ? ajax : null;
+ filter = (filter !== undefined) ? phpbb.getFunctionByName(filter) : null;
+
+ phpbb.ajaxify({
+ selector: this,
+ refresh: $this.attr('data-refresh') !== undefined,
+ filter: filter,
+ callback: fn
+ });
+ }
+});
+
+
+/**
+ * This simply appends #preview to the action of the
+ * QR action when you click the Full Editor & Preview button
+ */
+$('#qr_full_editor').click(function() {
+ $('#qr_postform').attr('action', function(i, val) {
+ return val + '#preview';
+ });
+});
+
+
+/**
+ * Make the display post links to use JS
+ */
+$('.display_post').click(function(e) {
+ // Do not follow the link
+ e.preventDefault();
+
+ var postId = $(this).attr('data-post-id');
+ $('#post_content' + postId).show();
+ $('#profile' + postId).show();
+ $('#post_hidden' + postId).hide();
+});
+
+/**
+* Toggle the member search panel in memberlist.php.
+*
+* If user returns to search page after viewing results the search panel is automatically displayed.
+* In any case the link will toggle the display status of the search panel and link text will be
+* appropriately changed based on the status of the search panel.
+*/
+$('#member_search').click(function () {
+ var $memberlistSearch = $('#memberlist_search');
+
+ $memberlistSearch.slideToggle('fast');
+ phpbb.ajaxCallbacks.alt_text.call(this);
+
+ // Focus on the username textbox if it's available and displayed
+ if ($memberlistSearch.is(':visible')) {
+ $('#username').focus();
+ }
+ return false;
+});
+
+/**
+* Automatically resize textarea
+*/
+$(function() {
+ var $textarea = $('textarea:not(#message-box textarea, .no-auto-resize)');
+ phpbb.resizeTextArea($textarea, { minHeight: 75, maxHeight: 250 });
+ phpbb.resizeTextArea($('textarea', '#message-box'));
+});
+
+
+})(jQuery); // Avoid conflicts with other libraries
diff --git a/simplicity/template/feed.xml.twig b/simplicity/template/feed.xml.twig
new file mode 100644
index 0000000..91467c6
--- /dev/null
+++ b/simplicity/template/feed.xml.twig
@@ -0,0 +1,37 @@
+
+
+
+
+ {% if not FEED_TITLE is empty %}{{ FEED_TITLE }}{% endif %}
+
+ {% if not FEED_SUBTITLE is empty %}{{ FEED_SUBTITLE }}{% endif %}
+
+ {% if not FEED_LINK is empty %}{% endif %}
+
+ {{ FEED_UPDATED }}
+
+
+ {{ SELF_LINK }}
+
+ {% for row in FEED_ROWS %}
+
+ {% if not row.author is empty %}{% endif %}
+
+ {% if not row.updated is empty %}{{ row.updated }} {% else %}{{ row.published }}{% endif %}
+
+ {% if not row.published is empty %}{{ row.published }}{% endif %}
+
+ {{ row.link }}
+
+
+
+ {% if not row.category is empty and row.category_name is defined and row.category_name != '' %}
+
+ {% endif %}
+
+ {{ lang('STATISTICS') }}: {{ row.statistics }}
{% endif %}
+]]>
+
+ {% endfor %}
+
diff --git a/simplicity/template/forum_fn.js b/simplicity/template/forum_fn.js
new file mode 100644
index 0000000..74bf2a7
--- /dev/null
+++ b/simplicity/template/forum_fn.js
@@ -0,0 +1,1778 @@
+/* global phpbb */
+
+/**
+* phpBB3 forum functions
+*/
+var styleConfig = {
+ staticNavigation: true,
+ staticNavigationMinWidth: 500,
+ staticNavigationMinHeight: 400,
+ extendPosterProfile: true,
+ collapseForums: true
+};
+
+/**
+* Find a member
+*/
+function find_username(url) {
+ 'use strict';
+
+ popup(url, 760, 570, '_usersearch');
+ return false;
+}
+
+/**
+* Window popup
+*/
+function popup(url, width, height, name) {
+ 'use strict';
+
+ if (!name) {
+ name = '_popup';
+ }
+
+ window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width);
+ return false;
+}
+
+/**
+* Jump to page
+*/
+function pageJump(item) {
+ 'use strict';
+
+ var page = parseInt(item.val(), 10),
+ perPage = item.attr('data-per-page'),
+ baseUrl = item.attr('data-base-url'),
+ startName = item.attr('data-start-name');
+
+ if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) {
+ if (baseUrl.indexOf('?') === -1) {
+ document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
+ } else {
+ document.location.href = baseUrl.replace(/&/g, '&') + '&' + startName + '=' + ((page - 1) * perPage);
+ }
+ }
+}
+
+/**
+* Mark/unmark checklist
+* id = ID of parent container, name = name prefix, state = state [true/false]
+*/
+function marklist(id, name, state) {
+ 'use strict';
+
+ jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
+ var $this = jQuery(this);
+ if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) {
+ $this.prop('checked', state);
+ }
+ });
+}
+
+/**
+* Resize viewable area for attached image or topic review panel (possibly others to come)
+* e = element
+*/
+function viewableArea(e, itself) {
+ 'use strict';
+
+ if (!e) {
+ return;
+ }
+
+ if (!itself) {
+ e = e.parentNode;
+ }
+
+ if (!e.vaHeight) {
+ // Store viewable area height before changing style to auto
+ e.vaHeight = e.offsetHeight;
+ e.vaMaxHeight = e.style.maxHeight;
+ e.style.height = 'auto';
+ e.style.maxHeight = 'none';
+ e.style.overflow = 'visible';
+ } else {
+ // Restore viewable area height to the default
+ e.style.height = e.vaHeight + 'px';
+ e.style.overflow = 'auto';
+ e.style.maxHeight = e.vaMaxHeight;
+ e.vaHeight = false;
+ }
+}
+
+/**
+* Alternate display of subPanels
+*/
+jQuery(function($) {
+ 'use strict';
+
+ $('.sub-panels').each(function() {
+
+ var $childNodes = $('a[data-subpanel]', this),
+ panels = $childNodes.map(function () {
+ return this.getAttribute('data-subpanel');
+ }),
+ showPanel = this.getAttribute('data-show-panel');
+
+ if (panels.length) {
+ activateSubPanel(showPanel, panels);
+ $childNodes.click(function () {
+ activateSubPanel(this.getAttribute('data-subpanel'), panels);
+ return false;
+ });
+ }
+ });
+});
+
+/**
+* Activate specific subPanel
+*/
+function activateSubPanel(p, panels) {
+ 'use strict';
+
+ var i, showPanel;
+
+ if (typeof p === 'string') {
+ showPanel = p;
+ }
+ $('input[name="show_panel"]').val(showPanel);
+
+ if (typeof panels === 'undefined') {
+ panels = jQuery('.sub-panels a[data-subpanel]').map(function() {
+ return this.getAttribute('data-subpanel');
+ });
+ }
+
+ for (i = 0; i < panels.length; i++) {
+ jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none');
+ jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel);
+ }
+}
+
+function selectCode(a) {
+ 'use strict';
+
+ // Get ID of code block
+ var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
+ var s, r;
+
+ // Not IE and IE9+
+ if (window.getSelection) {
+ s = window.getSelection();
+ // Safari and Chrome
+ if (s.setBaseAndExtent) {
+ var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
+ try {
+ s.setBaseAndExtent(e, 0, e, l);
+ } catch (error) {
+ r = document.createRange();
+ r.selectNodeContents(e);
+ s.removeAllRanges();
+ s.addRange(r);
+ }
+ }
+ // Firefox and Opera
+ else {
+ // workaround for bug # 42885
+ if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === ' ') {
+ e.innerHTML = e.innerHTML + ' ';
+ }
+
+ r = document.createRange();
+ r.selectNodeContents(e);
+ s.removeAllRanges();
+ s.addRange(r);
+ }
+ }
+ // Some older browsers
+ else if (document.getSelection) {
+ s = document.getSelection();
+ r = document.createRange();
+ r.selectNodeContents(e);
+ s.removeAllRanges();
+ s.addRange(r);
+ }
+ // IE
+ else if (document.selection) {
+ r = document.body.createTextRange();
+ r.moveToElementText(e);
+ r.select();
+ }
+}
+
+var inAutocomplete = false;
+var lastKeyEntered = '';
+
+/**
+* Check event key
+*/
+function phpbbCheckKey(event) {
+ 'use strict';
+
+ // Keycode is array down or up?
+ if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) {
+ inAutocomplete = true;
+ }
+
+ // Make sure we are not within an "autocompletion" field
+ if (inAutocomplete) {
+ // If return pressed and key changed we reset the autocompletion
+ if (!lastKeyEntered || lastKeyEntered === event.which) {
+ inAutocomplete = false;
+ return true;
+ }
+ }
+
+ // Keycode is not return, then return. ;)
+ if (event.which !== 13) {
+ lastKeyEntered = event.which;
+ return true;
+ }
+
+ return false;
+}
+
+/**
+* Apply onkeypress event for forcing default submit button on ENTER key press
+*/
+jQuery(function($) {
+ 'use strict';
+
+ $('form input[type=text], form input[type=password]').on('keypress', function (e) {
+ var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action');
+
+ if (!defaultButton || defaultButton.length <= 0) {
+ return true;
+ }
+
+ if (phpbbCheckKey(e)) {
+ return true;
+ }
+
+ if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
+ defaultButton.click();
+ return false;
+ }
+
+ return true;
+ });
+});
+
+/**
+* Functions for user search popup
+*/
+function insertUser(formId, value) {
+ 'use strict';
+
+ var $form = jQuery(formId),
+ formName = $form.attr('data-form-name'),
+ fieldName = $form.attr('data-field-name'),
+ item = opener.document.forms[formName][fieldName];
+
+ if (item.value.length && item.type === 'textarea') {
+ value = item.value + '\n' + value;
+ }
+
+ item.value = value;
+}
+
+function insert_marked_users(formId, users) {
+ 'use strict';
+
+ $(users).filter(':checked').each(function() {
+ insertUser(formId, this.value);
+ });
+
+ window.close();
+}
+
+function insert_single_user(formId, user) {
+ 'use strict';
+
+ insertUser(formId, user);
+ window.close();
+}
+
+/**
+* Resize poster profile block
+*/
+function adjustPosterProfile(postbody) {
+ var profile = postbody.parent().prev(),
+ post = profile.parent(),
+ resized = profile.hasClass('resized');
+
+ function unresize() {
+ profile.removeClass('resized').css('min-height', '');
+ }
+
+ if (post.width() < (profile.width() + postbody.width())) {
+ if (resized) {
+ unresize();
+ }
+ return false;
+ }
+
+ if (resized) {
+ profile.css('min-height', '');
+ }
+ profile.css('min-height', Math.floor(postbody.height()) + 'px').addClass('resized');
+}
+
+/**
+* Responsive navigation
+*/
+function checkNavigation(force)
+{
+ function init(nav)
+ {
+ nav.responsive = false;
+ nav.lastWidth = 0;
+ nav.itemCount = 0;
+
+ // Copy children items
+ nav.contents = nav.menu.find('.dropdown-contents:first');
+ nav.canToggle = $();
+ nav.noToggle = $();
+ nav.contents.children('.separator:last-child').hide();
+ nav.items = nav.lists.children().not(nav.menu).each(function(i) {
+ var $this = $(this),
+ cloneClass;
+
+ if ($this.is('.not-responsive, .responsive-menu, .dropdown-container, .selected') || $this.attr('data-skip-responsive') == 'true') {
+ $this.attr('data-responsive-index', -1);
+ nav.noToggle = nav.noToggle.add($this);
+ return;
+ }
+
+ cloneClass = (
+ $this.attr('data-responsive-class') === undefined ?
+ ($this.hasClass('small-icon') ? $this.attr('class') : '') :
+ $this.attr('data-responsive-class')
+ ) + ' responsive-index-' + i;
+
+ nav.contents.append(
+ $this.clone(true).attr('class', cloneClass).addClass('responsive-clone').removeClass('tab')
+ );
+
+ $this.addClass('responsive-cloned-item').attr('data-clone-index', i);
+ nav.canToggle = nav.canToggle.add($this);
+ nav.itemCount ++;
+ });
+ nav.contents.find('a.nav-link').removeClass('nav-link');
+ nav.responsiveClones = nav.contents.children('.responsive-clone').hide();
+
+ nav.initialized = true;
+ }
+
+ function check(nav, force)
+ {
+ var containerWidth, total, width, menuWidth, hiding;
+
+ // Setup navigation
+ if (!nav.initialized) {
+ init(nav);
+ force = true;
+ }
+
+ if (!nav.itemCount) {
+ // Nothing to hide
+ return;
+ }
+
+ // Check width
+ containerWidth = nav.container.width();
+ if (!force && containerWidth == nav.lastWidth) {
+ return;
+ }
+ nav.lastWidth = containerWidth;
+
+ // Show all items
+ if (nav.responsive) {
+ nav.canToggle.show();
+ nav.responsiveClones.hide();
+ nav.menu.removeClass('showing-responsive-menu');
+ if (!nav.alwaysShowMenu) {
+ nav.menu.show();
+ }
+ }
+ nav.responsive = false;
+ menuWidth = nav.menu.outerWidth(true);
+ width = menuWidth;
+
+ // Count width of all items that cannot be hidden
+ nav.noToggle.each(function() {
+ var $this = $(this);
+ if ($this.is(':visible')) {
+ width += $this.outerWidth(true);
+ }
+ });
+
+ // Test all other items
+ hiding = (width >= containerWidth);
+ nav.canToggle.each(function() {
+ var $this = $(this),
+ itemWidth, margin;
+
+ if (!$this.is(':visible')) {
+ return;
+ }
+
+ if (!hiding) {
+ itemWidth = $this.outerWidth(true);
+ if (!itemWidth) {
+ $this.hide();
+ return;
+ }
+
+ width += itemWidth;
+ if (width >= containerWidth) {
+ hiding = true;
+ }
+ }
+
+ if (hiding) {
+ $this.hide();
+ nav.responsiveClones.filter('.responsive-index-' + $this.attr('data-clone-index')).show();
+ }
+ });
+
+ nav.responsive = hiding;
+ if (!hiding && !nav.alwaysShowMenu) {
+ nav.menu.hide();
+ }
+ else if (hiding) {
+ nav.menu.addClass('showing-responsive-menu');
+ }
+ }
+
+ for (var i=0; i 0);
+
+ // Create empty hidden menu
+ if (!menu.length) {
+ if ($this.is('.nav-tabs')) {
+ // Something went wrong - main menu must have responsive menu
+ return;
+ }
+ // Secondary menu
+ lists.eq(0).prepend('