[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 /** 2 * phpBB3 ACP functions 3 */ 4 5 /** 6 * Parse document block 7 */ 8 function parse_document(container) 9 { 10 var test = document.createElement('div'), 11 oldBrowser = (typeof test.style.borderRadius == 'undefined'); 12 13 delete test; 14 15 /** 16 * Navigation 17 */ 18 container.find('#menu').each(function() { 19 var menu = $(this), 20 blocks = menu.children('.menu-block'); 21 22 if (!blocks.length) { 23 return; 24 } 25 26 // Set onclick event 27 blocks.children('a.header').click(function() { 28 var parent = $(this).parent(); 29 if (!parent.hasClass('active')) { 30 parent.siblings().removeClass('active'); 31 } 32 parent.toggleClass('active'); 33 }); 34 35 // Set active menu 36 menu.find('#activemenu').parents('.menu-block').addClass('active'); 37 38 // Check if there is active menu 39 if (!blocks.filter('.active').length) { 40 blocks.filter(':first').addClass('active'); 41 } 42 }); 43 44 /** 45 * Responsive tables 46 */ 47 container.find('table').not('.not-responsive').each(function() { 48 var $this = $(this), 49 th = $this.find('thead > tr > th'), 50 columns = th.length, 51 headers = [], 52 totalHeaders = 0, 53 i, headersLength; 54 55 // Find columns 56 $this.find('colgroup:first').children().each(function(i) { 57 var column = $(this); 58 $this.find('td:nth-child(' + (i + 1) + ')').addClass(column.prop('className')); 59 }); 60 61 // Styles table 62 if ($this.hasClass('styles')) { 63 $this.find('td:first-child[style]').each(function() { 64 var style = $(this).attr('style'); 65 if (style.length) { 66 $(this).parent('tr').attr('style', style.toLowerCase().replace('padding', 'margin')).addClass('responsive-style-row'); 67 } 68 }); 69 } 70 71 // Find each header 72 if (!$this.data('no-responsive-header')) 73 { 74 th.each(function(column) { 75 var cell = $(this), 76 colspan = parseInt(cell.attr('colspan')), 77 dfn = cell.attr('data-dfn'), 78 text = dfn ? dfn : $.trim(cell.text()); 79 80 if (text == ' ') text = ''; 81 colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; 82 83 for (i=0; i<colspan; i++) { 84 headers.push(text); 85 } 86 totalHeaders ++; 87 88 if (dfn && !column) { 89 $this.addClass('show-header'); 90 } 91 }); 92 } 93 94 headersLength = headers.length; 95 96 // Add header text to each cell as <dfn> 97 $this.addClass('responsive'); 98 99 if (totalHeaders < 2) { 100 $this.addClass('show-header'); 101 return; 102 } 103 104 $this.find('tbody > tr').each(function() { 105 var row = $(this), 106 cells = row.children('td'), 107 column = 0; 108 109 if (cells.length == 1) { 110 row.addClass('big-column'); 111 return; 112 } 113 114 cells.each(function() { 115 var cell = $(this), 116 colspan = parseInt(cell.attr('colspan')), 117 text = $.trim(cell.text()); 118 119 if (headersLength <= column) { 120 return; 121 } 122 123 if ((text.length && text !== '-') || cell.children().length) { 124 if (headers[column] != '') { 125 cell.prepend('<dfn style="display: none;">' + headers[column] + '</dfn>'); 126 } 127 } 128 else { 129 cell.addClass('empty'); 130 } 131 132 colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; 133 column += colspan; 134 }); 135 }); 136 137 // Remove <dfn> in disabled extensions list 138 $this.find('tr.ext_disabled > .empty:nth-child(2) + .empty').siblings(':first-child').children('dfn').remove(); 139 }); 140 141 /** 142 * Hide empty responsive tables 143 */ 144 container.find('table.responsive > tbody').each(function() { 145 var items = $(this).children('tr'); 146 if (items.length == 0) 147 { 148 $(this).parent('table:first').addClass('responsive-hide'); 149 } 150 }); 151 152 /** 153 * Fieldsets with empty <span> 154 */ 155 container.find('fieldset dt > span:last-child').each(function() { 156 var $this = $(this); 157 if ($this.html() == ' ') { 158 $this.addClass('responsive-hide'); 159 } 160 161 }); 162 163 /** 164 * Responsive tabs 165 */ 166 container.find('#tabs').not('[data-skip-responsive]').each(function() { 167 var $this = $(this), 168 $body = $('body'), 169 ul = $this.children(), 170 tabs = ul.children().not('[data-skip-responsive]'), 171 links = tabs.children('a'), 172 item = ul.append('<li class="tab responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link"> </a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'), 173 menu = item.find('.dropdown-contents'), 174 maxHeight = 0, 175 lastWidth = false, 176 responsive = false; 177 178 links.each(function() { 179 var link = $(this); 180 maxHeight = Math.max(maxHeight, Math.max(link.outerHeight(true), link.parent().outerHeight(true))); 181 }) 182 183 function check() { 184 var width = $body.width(), 185 height = $this.height(); 186 187 if (arguments.length == 0 && (!responsive || width <= lastWidth) && height <= maxHeight) { 188 return; 189 } 190 191 tabs.show(); 192 item.hide(); 193 194 lastWidth = width; 195 height = $this.height(); 196 if (height <= maxHeight) { 197 responsive = false; 198 if (item.hasClass('dropdown-visible')) { 199 phpbb.toggleDropdown.call(item.find('a.responsive-tab-link').get(0)); 200 } 201 return; 202 } 203 204 responsive = true; 205 item.show(); 206 menu.html(''); 207 208 var availableTabs = tabs.filter(':not(.activetab, .responsive-tab)'), 209 total = availableTabs.length, 210 i, tab; 211 212 for (i = total - 1; i >= 0; i --) { 213 tab = availableTabs.eq(i); 214 menu.prepend(tab.clone(true).removeClass('tab')); 215 tab.hide(); 216 if ($this.height() <= maxHeight) { 217 menu.find('a').click(function() { check(true); }); 218 return; 219 } 220 } 221 menu.find('a').click(function() { check(true); }); 222 } 223 224 phpbb.registerDropdown(item.find('a.responsive-tab-link'), item.find('.dropdown'), {visibleClass: 'activetab', verticalDirection: 'down'}); 225 226 check(true); 227 $(window).resize(check); 228 }); 229 } 230 231 /** 232 * Run onload functions 233 */ 234 (function($) { 235 $(document).ready(function() { 236 // Swap .nojs and .hasjs 237 $('body.nojs').toggleClass('nojs hasjs'); 238 239 // Focus forms 240 $('form[data-focus]:first').each(function() { 241 $('#' + this.getAttribute('data-focus')).focus(); 242 }); 243 244 parse_document($('body')); 245 246 // Hide configlist and success message in send statistics page 247 phpbb.toggleDisplay('configlist', -1); 248 phpbb.toggleDisplay('questionnaire-thanks', -1); 249 }); 250 })(jQuery);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |