phpBB

Code Changes

File: styles/prosilver/template/forum_fn.js

  Unmodified   Added   Modified   Removed
Line 1Line 1
 
/* global phpbb */


/**
* phpBB3 forum functions
*/

/**
* phpBB3 forum functions
*/

Line 32Line 34
function pageJump(item) {
'use strict';


function pageJump(item) {
'use strict';


	var page = item.val(),

	var page = parseInt(item.val(), 10),

		perPage = item.attr('data-per-page'),
baseUrl = item.attr('data-base-url'),
startName = item.attr('data-start-name');


		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 (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) {

		if (baseUrl.indexOf('?') === -1) {
document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
} else {

		if (baseUrl.indexOf('?') === -1) {
document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
} else {

Line 55Line 57

jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
var $this = jQuery(this);


jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
var $this = jQuery(this);

		if ($this.attr('name').substr(0, name.length) === name) {

		if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) {

			$this.prop('checked', state);
}
});

			$this.prop('checked', state);
}
});

Line 124Line 126

var i, showPanel;



var i, showPanel;


	if (typeof(p) === 'string') {

	if (typeof p === 'string') {

		showPanel = p;
}
$('input[name="show_panel"]').val(showPanel);

		showPanel = p;
}
$('input[name="show_panel"]').val(showPanel);

Line 154Line 156
		// Safari and Chrome
if (s.setBaseAndExtent) {
var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;

		// Safari and Chrome
if (s.setBaseAndExtent) {
var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;

 
			try {

			s.setBaseAndExtent(e, 0, e, l);

			s.setBaseAndExtent(e, 0, e, l);

 
			} catch (error) {
r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}

		}
// Firefox and Opera
else {

		}
// Firefox and Opera
else {

Line 277Line 286
/**
* Functions for user search popup
*/

/**
* Functions for user search popup
*/

function insertUser(formId, value)
{

function insertUser(formId, value) {


	'use strict';

var $form = jQuery(formId),

	'use strict';

var $form = jQuery(formId),

Line 286Line 294
		fieldName = $form.attr('data-field-name'),
item = opener.document.forms[formName][fieldName];


		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;
}


		value = item.value + '\n' + value;
}


Line 319Line 327
	'use strict';

var test = document.createElement('div'),

	'use strict';

var test = document.createElement('div'),

		oldBrowser = (typeof test.style.borderRadius == 'undefined'),

		oldBrowser = (typeof test.style.borderRadius === 'undefined'),

		$body = $('body');

/**

		$body = $('body');

/**

Line 359Line 367
	*/
if (oldBrowser) {
// Fix .linklist.bulletin lists

	*/
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');

	}

/**

	}

/**

Line 420Line 431
				width;

// Test max-width set in code for .navlinks above

				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();
}


			if (!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));

			$links.each(function() {
if ($(this).height() > 0) {
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));

Line 452Line 463
				return;
}


				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;

					$links.eq(j).addClass('wrapped ' + classes[i]);
if ($this.height() <= maxHeight) {
return;

Line 470Line 481
	/**
* Responsive link lists
*/

	/**
* 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]',

		var $this = $(this),
filterSkip = '.breadcrumbs, [data-skip-responsive]',
filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',

Line 478Line 491
			$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

			$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.


			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.


Line 675Line 688
				$children = column.children(),
html = column.html();


				$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();
}


				html = $children.html();
}


Line 717Line 730
			if (!$block.length) {
$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
$block = $this.find('dt .responsive-show:last-child');

			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);
}


				first = ($.trim($block.text()).length === 0);
}


Line 728Line 740
					children = column.children(),
html = column.html();


					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();
}


					html = children.html();
}


Line 757Line 769
		// Find each header
$th.each(function(column) {
var cell = $(this),

		// 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();


				dfn = cell.attr('data-dfn'),
text = dfn ? dfn : cell.text();


Line 788Line 800
				cells = row.children('td'),
column = 0;


				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),

				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) {

					text = $.trim(cell.text());

if (headersLength <= column) {

Line 871Line 883
				total = $availableTabs.length,
i, $tab;


				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) {

				$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;
}
}

					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);


check(true);
$(window).resize(check);