From 8567adf5dbfc1d6363deb78b6ebf25a76857c9ac Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 25 Oct 2013 18:32:31 +0300 Subject: [ticket/11957] Include admin.js in footer Include admin.js in footer, swap .hasjs and .nojs PHPBB3-11957 --- phpBB/adm/style/admin.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 phpBB/adm/style/admin.js (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js new file mode 100644 index 0000000000..9b2c9313ac --- /dev/null +++ b/phpBB/adm/style/admin.js @@ -0,0 +1,18 @@ +/** +* phpBB3 ACP functions +*/ + +/** +* Run onload functions +*/ +(function($) { + $(document).ready(function() { + // Swap .nojs and .hasjs + $('body.nojs').toggleClass('nojs hasjs'); + + // Focus forms + $('form[data-focus]:first').each(function() { + $('#' + this.getAttribute('data-focus')).focus(); + }); + }); +})(jQuery); -- cgit v1.2.1 From 43b9314390db962aaef2411e22642f86730a6eb6 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 25 Oct 2013 19:59:45 +0300 Subject: [ticket/11957] Enhance responsive nav with JS PHPBB3-11957 --- phpBB/adm/style/admin.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 9b2c9313ac..208afedce8 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -2,6 +2,26 @@ * phpBB3 ACP functions */ +/** +* Parse document block +*/ +function parse_document(container) +{ + var test = document.createElement('div'), + oldBrowser = (typeof test.style.borderRadius == 'undefined'); + + delete test; + + /** + * Navigation + */ + container.find('#menu .menu-block > a.header').click(function() { + $(this).parent().toggleClass('active'); + }); + + container.find('#activemenu').parents('.menu-block').addClass('active'); +} + /** * Run onload functions */ @@ -14,5 +34,7 @@ $('form[data-focus]:first').each(function() { $('#' + this.getAttribute('data-focus')).focus(); }); + + parse_document($('body')); }); })(jQuery); -- cgit v1.2.1 From 1b3daa1ad876e9b3adf87bca754ee313a0cdaa13 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 25 Oct 2013 21:40:39 +0300 Subject: [ticket/11957] Adjustments to ACP layout, menu and some elements PHPBB3-11957 --- phpBB/adm/style/admin.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 208afedce8..a9e00ab9d7 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -15,11 +15,27 @@ function parse_document(container) /** * Navigation */ - container.find('#menu .menu-block > a.header').click(function() { - $(this).parent().toggleClass('active'); - }); + container.find('#menu').each(function() { + var menu = $(this), + blocks = menu.children('.menu-block'); + + if (!blocks.length) { + return; + } + + // Set onclick event + blocks.children('a.header').click(function() { + $(this).parent().toggleClass('active'); + }); + + // Set active menu + menu.find('#activemenu').parents('.menu-block').addClass('active'); - container.find('#activemenu').parents('.menu-block').addClass('active'); + // Check if there is active menu + if (!blocks.filter('.active').length) { + blocks.filter(':first').addClass('active'); + } + }); } /** -- cgit v1.2.1 From b80f213995df6456cf35897a7a35d7943baa5ebb Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 00:46:20 +0300 Subject: [ticket/11957] Responsive ACP tables PHPBB3-11957 --- phpBB/adm/style/admin.js | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index a9e00ab9d7..385e49dc87 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -36,6 +36,103 @@ function parse_document(container) blocks.filter(':first').addClass('active'); } }); + + /** + * Responsive tables + */ + container.find('table').not('.not-responsive').each(function() { + var $this = $(this), + th = $this.find('thead > tr > th'), + columns = th.length, + headers = [], + totalHeaders = 0, + i, headersLength; + + // Find columns + $this.find('colgroup:first').children().each(function(i) { + var column = $(this); + if (column.hasClass('col1')) { + $this.find('td:nth-child(' + (i + 1) + ')').addClass('col1'); + } + if (column.hasClass('col2')) { + $this.find('td:nth-child(' + (i + 1) + ')').addClass('col2'); + } + }); + + // Find each header + if (!$this.data('no-responsive-header')) + { + th.each(function(column) { + var cell = $(this), + colspan = parseInt(cell.attr('colspan')), + dfn = cell.attr('data-dfn'), + text = dfn ? dfn : cell.text(); + + colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; + + for (i=0; i + $this.addClass('responsive'); + + if (totalHeaders < 2) { + $this.addClass('show-header'); + return; + } + + $this.find('tbody > tr').each(function() { + var row = $(this), + cells = row.children('td'), + column = 0; + + if (cells.length == 1) { + row.addClass('big-column'); + return; + } + + cells.each(function() { + var cell = $(this), + colspan = parseInt(cell.attr('colspan')), + text = cell.text().trim(); + + if (headersLength <= column) { + return; + } + + if (text.length && text !== '-') { + cell.prepend('' + headers[column] + ''); + } + else { + cell.addClass('empty'); + } + + colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; + column += colspan; + }); + }); + }); + + /** + * Hide empty responsive tables + */ + container.find('table.responsive > tbody').each(function() { + var items = $(this).children('tr'); + if (items.length == 0) + { + $(this).parent('table:first').addClass('responsive-hide'); + } + }); } /** -- cgit v1.2.1 From 365d07ff6c481e604cd83425abe128eff3af70f0 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 09:51:07 +0300 Subject: [ticket/11957] Responsive forms PHPBB3-11957 --- phpBB/adm/style/admin.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 385e49dc87..342859ce54 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -133,6 +133,17 @@ function parse_document(container) $(this).parent('table:first').addClass('responsive-hide'); } }); + + /** + * Fieldsets with empty + */ + container.find('fieldset dt > span:last-child').each(function() { + var $this = $(this); + if ($this.html() == ' ') { + $this.addClass('responsive-hide'); + } + + }); } /** -- cgit v1.2.1 From b107b4c0e2ff5f946e71eb962622295ded7f54ea Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 11:01:23 +0300 Subject: [ticket/11957] Responsive forums list PHPBB3-11957 --- phpBB/adm/style/admin.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 342859ce54..648d542325 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -51,12 +51,7 @@ function parse_document(container) // Find columns $this.find('colgroup:first').children().each(function(i) { var column = $(this); - if (column.hasClass('col1')) { - $this.find('td:nth-child(' + (i + 1) + ')').addClass('col1'); - } - if (column.hasClass('col2')) { - $this.find('td:nth-child(' + (i + 1) + ')').addClass('col2'); - } + $this.find('td:nth-child(' + (i + 1) + ')').addClass(column.prop('className')); }); // Find each header -- cgit v1.2.1 From 49e30b12432966711e31a884feb8460dd3555d92 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 11:56:03 +0300 Subject: [ticket/11957] Responsive styles list PHPBB3-11957 --- phpBB/adm/style/admin.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 648d542325..b466c02071 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -54,6 +54,16 @@ function parse_document(container) $this.find('td:nth-child(' + (i + 1) + ')').addClass(column.prop('className')); }); + // Styles table + if ($this.hasClass('styles')) { + $this.find('td:first-child[style]').each(function() { + var style = $(this).attr('style'); + if (style.length) { + $(this).parent('tr').attr('style', style.toLowerCase().replace('padding', 'margin')).addClass('responsive-style-row'); + } + }); + } + // Find each header if (!$this.data('no-responsive-header')) { -- cgit v1.2.1 From c1ca57fcdb60ee772434e577de34107b2aa88cb1 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 12:21:38 +0300 Subject: [ticket/11957] Misc responsive changes PHPBB3-11957 --- phpBB/adm/style/admin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index b466c02071..45cec5f716 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -115,7 +115,7 @@ function parse_document(container) return; } - if (text.length && text !== '-') { + if ((text.length && text !== '-') || cell.children().length) { cell.prepend('' + headers[column] + ''); } else { -- cgit v1.2.1 From e9c0c9d5d2fa808476c52a6dce13df6da56394a6 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 21:04:44 +0300 Subject: [ticket/11957] Responsive ACP tabs PHPBB3-11957 --- phpBB/adm/style/admin.js | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 45cec5f716..f34002c568 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -149,6 +149,73 @@ function parse_document(container) } }); + + /** + * Responsive tabs + */ + container.find('#tabs').not('[data-skip-responsive]').each(function() { + var $this = $(this), + $body = $('body'), + ul = $this.children(), + tabs = ul.children().not('[data-skip-responsive]'), + links = tabs.children('a'), + item = ul.append('').find('li.responsive-tab'), + menu = item.find('.dropdown-contents'), + maxHeight = 0, + lastWidth = false, + responsive = false; + + links.each(function() { + var link = $(this); + maxHeight = Math.max(maxHeight, Math.max(link.outerHeight(true), link.parent().outerHeight(true))); + }) + + function check() { + var width = $body.width(), + height = $this.height(); + + if (arguments.length == 0 && (!responsive || width <= lastWidth) && height <= maxHeight) { + return; + } + + tabs.show(); + item.hide(); + + lastWidth = width; + height = $this.height(); + if (height <= maxHeight) { + responsive = false; + if (item.hasClass('dropdown-visible')) { + phpbb.toggleDropdown.call(item.find('a.responsive-tab-link').get(0)); + } + return; + } + + responsive = true; + item.show(); + menu.html(''); + + var availableTabs = tabs.filter(':not(.activetab, .responsive-tab)'), + total = availableTabs.length, + i, tab; + + for (i = total - 1; i >= 0; i --) { + tab = availableTabs.eq(i); + menu.prepend(tab.clone(true)); + tab.hide(); + if ($this.height() <= maxHeight) { + menu.find('a').click(function() { check(true); }); + return; + } + } + menu.find('a').click(function() { check(true); }); + } + + phpbb.registerDropdown(item.find('a.responsive-tab-link'), item.find('.dropdown'), {visibleClass: 'activetab', verticalDirection: 'down'}); + + check(true); + $(window).resize(check); + }); } /** -- cgit v1.2.1 From 00734741af240ed4bcde1195e3584b48a998ee67 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 21:08:24 +0300 Subject: [ticket/11957] Do not add empty headers to responsive tables PHPBB3-11957 --- phpBB/adm/style/admin.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index f34002c568..08d93a2689 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -71,8 +71,9 @@ function parse_document(container) var cell = $(this), colspan = parseInt(cell.attr('colspan')), dfn = cell.attr('data-dfn'), - text = dfn ? dfn : cell.text(); + text = dfn ? dfn : cell.text().trim(); + if (text == ' ') text = ''; colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; for (i=0; i' + headers[column] + ''); + if (headers[column] != '') { + cell.prepend('' + headers[column] + ''); + } } else { cell.addClass('empty'); -- cgit v1.2.1 From 1cdb9a80572843c6eea2de6dfb16bc066c2a9edf Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 26 Oct 2013 22:11:55 +0300 Subject: [ticket/11957] Hide other navigation items when one is activated PHPBB3-11957 --- phpBB/adm/style/admin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 08d93a2689..e9f0f1e512 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -25,7 +25,11 @@ function parse_document(container) // Set onclick event blocks.children('a.header').click(function() { - $(this).parent().toggleClass('active'); + var parent = $(this).parent(); + if (!parent.hasClass('active')) { + parent.siblings().removeClass('active'); + } + parent.toggleClass('active'); }); // Set active menu -- cgit v1.2.1 From 796e22d67557f15fe2902130eead74809b481177 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Wed, 30 Oct 2013 19:17:00 +0200 Subject: [ticket/11984] Hide for invalid extensions PHPBB3-11984 --- phpBB/adm/style/admin.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/adm/style/admin.js') diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index e9f0f1e512..dd46124f97 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -133,6 +133,9 @@ function parse_document(container) column += colspan; }); }); + + // Remove in disabled extensions list + $this.find('tr.ext_disabled > .empty:nth-child(2) + .empty').siblings(':first-child').children('dfn').remove(); }); /** -- cgit v1.2.1