diff options
author | Callum Macrae <callum@macr.ae> | 2015-05-30 15:03:56 +0200 |
---|---|---|
committer | Callum Macrae <callum@macr.ae> | 2015-05-30 15:03:56 +0200 |
commit | 27a70f573f4e3a99e9ca25ed0a2c456c17d93577 (patch) | |
tree | d331ca9c103596c98f98235f36343b5f9a9cf970 /phpBB/styles/prosilver/template | |
parent | a39a421acb3d0e2c6b8d8f20974e90ea3625b065 (diff) | |
download | forums-27a70f573f4e3a99e9ca25ed0a2c456c17d93577.tar forums-27a70f573f4e3a99e9ca25ed0a2c456c17d93577.tar.gz forums-27a70f573f4e3a99e9ca25ed0a2c456c17d93577.tar.bz2 forums-27a70f573f4e3a99e9ca25ed0a2c456c17d93577.tar.xz forums-27a70f573f4e3a99e9ca25ed0a2c456c17d93577.zip |
[ticket/13898] Fixed all the forum_fn.js violations I understood
PHPBB3-13898
Diffstat (limited to 'phpBB/styles/prosilver/template')
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 7a377a4973..ccedf19604 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -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"> </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); |