1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 12:14:06 +02:00

Merge branch '3.1.x'

This commit is contained in:
Marc Alexander
2015-05-31 14:15:19 +02:00
6 changed files with 218 additions and 96 deletions

View File

@@ -9,9 +9,9 @@ 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'
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() {
@@ -39,7 +39,7 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) {
phpbb.closeDarkenWrapper(3000);
});
/**
/**
* This callback will mark all topic icons read
*
* @param {bool} [update_topic_links=true] Whether "Mark topics read" links
@@ -49,10 +49,10 @@ 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'
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;
@@ -223,7 +223,7 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
// 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);
@@ -252,7 +252,7 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
var newBarClass = (percent === 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1);
setTimeout(function () {
bar.animate({width: percentRel + '%'}, 500)
bar.animate({ width: percentRel + '%' }, 500)
.removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5')
.addClass(newBarClass)
.html(res.vote_counts[optionId]);
@@ -287,10 +287,10 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
var panelHeight = panel.height();
var innerHeight = panel.find('.inner').outerHeight();
if (panelHeight != innerHeight) {
panel.css({'min-height': '', 'height': panelHeight})
.animate({height: innerHeight}, time, function () {
panel.css({'min-height': innerHeight, 'height': ''});
if (panelHeight !== innerHeight) {
panel.css({ minHeight: '', height: panelHeight })
.animate({ height: innerHeight }, time, function () {
panel.css({ minHeight: innerHeight, height: '' });
});
}
};
@@ -377,7 +377,8 @@ $('#member_search').click(function () {
* Automatically resize textarea
*/
$(function() {
phpbb.resizeTextArea($('textarea:not(#message-box textarea, .no-auto-resize)'), {minHeight: 75, maxHeight: 250});
var $textarea = $('textarea:not(#message-box textarea, .no-auto-resize)');
phpbb.resizeTextArea($textarea, { minHeight: 75, maxHeight: 250 });
phpbb.resizeTextArea($('textarea', '#message-box'));
});

View File

@@ -1,3 +1,5 @@
/* global phpbb */
/**
* phpBB3 forum functions
*/
@@ -37,7 +39,7 @@ function pageJump(item) {
baseUrl = item.attr('data-base-url'),
startName = item.attr('data-start-name');
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) {
if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) {
if (baseUrl.indexOf('?') === -1) {
document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
} else {
@@ -124,7 +126,7 @@ function activateSubPanel(p, panels) {
var i, showPanel;
if (typeof(p) === 'string') {
if (typeof p === 'string') {
showPanel = p;
}
$('input[name="show_panel"]').val(showPanel);
@@ -277,8 +279,7 @@ jQuery(function($) {
/**
* Functions for user search popup
*/
function insertUser(formId, value)
{
function insertUser(formId, value) {
'use strict';
var $form = jQuery(formId),
@@ -286,7 +287,7 @@ function insertUser(formId, value)
fieldName = $form.attr('data-field-name'),
item = opener.document.forms[formName][fieldName];
if (item.value.length && item.type == 'textarea') {
if (item.value.length && item.type === 'textarea') {
value = item.value + '\n' + value;
}
@@ -319,7 +320,7 @@ function parseDocument($container) {
'use strict';
var test = document.createElement('div'),
oldBrowser = (typeof test.style.borderRadius == 'undefined'),
oldBrowser = (typeof test.style.borderRadius === 'undefined'),
$body = $('body');
/**
@@ -359,7 +360,10 @@ function parseDocument($container) {
*/
if (oldBrowser) {
// Fix .linklist.bulletin lists
$container.find('ul.linklist.bulletin > li:first-child, ul.linklist.bulletin > li.rightside:last-child').addClass('no-bulletin');
$container
.find('ul.linklist.bulletin > li')
.filter(':first-child, .rightside:last-child')
.addClass('no-bulletin');
}
/**
@@ -420,12 +424,12 @@ function parseDocument($container) {
width;
// Test max-width set in code for .navlinks above
width = parseInt($this.css('max-width'));
width = parseInt($this.css('max-width'), 10);
if (!width) {
width = $body.width();
width = $body.width();
}
maxHeight = parseInt($this.css('line-height'));
maxHeight = parseInt($this.css('line-height'), 10);
$links.each(function() {
if ($(this).height() > 0) {
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
@@ -452,8 +456,8 @@ function parseDocument($container) {
return;
}
for (var i = 0; i < classesLength; i ++) {
for (var j = length - 1; j >= 0; j --) {
for (var i = 0; i < classesLength; i++) {
for (var j = length - 1; j >= 0; j--) {
$links.eq(j).addClass('wrapped ' + classes[i]);
if ($this.height() <= maxHeight) {
return;
@@ -470,7 +474,9 @@ function parseDocument($container) {
/**
* Responsive link lists
*/
$container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons:not([data-skip-responsive])').each(function() {
var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' +
'.postbody .post-buttons:not([data-skip-responsive])';
$container.find(selector).each(function() {
var $this = $(this),
filterSkip = '.breadcrumbs, [data-skip-responsive]',
filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
@@ -478,7 +484,7 @@ function parseDocument($container) {
$linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden
$linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first
$linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last
persistent = $this.attr('id') == 'nav-main', // Does this list already have a menu (such as quick-links)?
persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)?
html = '<li class="responsive-menu hidden"><a href="javascript:void(0);" class="responsive-menu-link">&nbsp;</a><div class="dropdown hidden"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>',
slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured.
@@ -675,7 +681,7 @@ function parseDocument($container) {
$children = column.children(),
html = column.html();
if ($children.length == 1 && $children.text() == column.text()) {
if ($children.length === 1 && $children.text() === column.text()) {
html = $children.html();
}
@@ -717,8 +723,7 @@ function parseDocument($container) {
if (!$block.length) {
$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
$block = $this.find('dt .responsive-show:last-child');
}
else {
} else {
first = ($.trim($block.text()).length === 0);
}
@@ -728,7 +733,7 @@ function parseDocument($container) {
children = column.children(),
html = column.html();
if (children.length == 1 && children.text() == column.text()) {
if (children.length === 1 && children.text() === column.text()) {
html = children.html();
}
@@ -757,7 +762,7 @@ function parseDocument($container) {
// Find each header
$th.each(function(column) {
var cell = $(this),
colspan = parseInt(cell.attr('colspan')),
colspan = parseInt(cell.attr('colspan'), 10),
dfn = cell.attr('data-dfn'),
text = dfn ? dfn : cell.text();
@@ -788,14 +793,14 @@ function parseDocument($container) {
cells = row.children('td'),
column = 0;
if (cells.length == 1) {
if (cells.length === 1) {
row.addClass('big-column');
return;
}
cells.each(function() {
var cell = $(this),
colspan = parseInt(cell.attr('colspan')),
colspan = parseInt(cell.attr('colspan'), 10),
text = $.trim(cell.text());
if (headersLength <= column) {
@@ -871,19 +876,26 @@ function parseDocument($container) {
total = $availableTabs.length,
i, $tab;
for (i = total - 1; i >= 0; i --) {
for (i = total - 1; i >= 0; i--) {
$tab = $availableTabs.eq(i);
$menu.prepend($tab.clone(true).removeClass('tab'));
$tab.hide();
if ($this.height() <= maxHeight) {
$menu.find('a').click(function() { check(true); });
$menu.find('a').click(function() {
check(true);
});
return;
}
}
$menu.find('a').click(function() { check(true); });
$menu.find('a').click(function() {
check(true);
});
}
phpbb.registerDropdown($item.find('a.responsive-tab-link'), $item.find('.dropdown'), {visibleClass: 'activetab'});
var $tabLink = $item.find('a.responsive-tab-link');
phpbb.registerDropdown($tabLink, $item.find('.dropdown'), {
visibleClass: 'activetab'
});
check(true);
$(window).resize(check);