tazpanel rev 428
tazpanel.ttf: add icon for '(Un)block'; tazpanel.js: simplify checkBoxes(), add functions for counting selected packages.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Apr 01 04:32:19 2015 +0300 (2015-04-01) |
parents | b4817a7f661b |
children | f377f6c7e32e |
files | lib/tazpanel.js styles/default/tazpanel.ttf |
line diff
1.1 --- a/lib/tazpanel.js Mon Mar 30 11:49:48 2015 +0300 1.2 +++ b/lib/tazpanel.js Wed Apr 01 04:32:19 2015 +0300 1.3 @@ -170,7 +170,7 @@ 1.4 tHeadTr.children[0].style.setProperty('width', tHeadTrO.children[0].offsetWidth -1 + 'px', 1); 1.5 tHeadTr.children[1].style.setProperty('width', tHeadTrO.children[1].offsetWidth -1 + 'px', 1); 1.6 tHeadTr.children[2].style.setProperty('width', tHeadTrO.children[2].offsetWidth -1 + 'px', 1); 1.7 - tHeadTr.children[3].style.setProperty('width', tHeadTrO.children[3].offsetWidth -1 + 'px', 1); 1.8 + //tHeadTr.children[3].style.setProperty('width', tHeadTrO.children[3].offsetWidth -1 + 'px', 1); 1.9 1.10 } 1.11 1.12 @@ -412,21 +412,44 @@ 1.13 // Toggle all checkboxes on a page 1.14 // 1.15 1.16 -function checkBoxes(w) { 1.17 - try { 1.18 - var inputs = w.document.getElementsByTagName('input'); 1.19 - for (var i = 0; i < inputs.length; i++) { 1.20 - if (inputs[i].type && inputs[i].type == 'checkbox') { 1.21 - inputs[i].checked = !inputs[i].checked; 1.22 - } 1.23 - } 1.24 - } catch (e){} 1.25 - if (w.frames && w.frames.length>0) { 1.26 - for (var i = 0; i < w.frames.length;i++) { 1.27 - var fr = w.frames[i]; 1.28 - checkFrames(fr); 1.29 +function checkBoxes() { 1.30 + var inputs = document.getElementsByTagName('input'); 1.31 + for (var i = 0; i < inputs.length; i++) { 1.32 + if (inputs[i].type && inputs[i].type == 'checkbox') { 1.33 + inputs[i].checked = !inputs[i].checked; 1.34 + countSelPkgs(inputs[i]); 1.35 } 1.36 } 1.37 - return false 1.38 } 1.39 1.40 + 1.41 +// 1.42 +// Count selected packages on the packages list 1.43 +// 1.44 + 1.45 +function countSelPkgs(el) { 1.46 + countSelected = countSelectedSpan.innerText; 1.47 + if (countSelected == '') countSelected = 0; 1.48 + 1.49 + element = (el.type == 'change' ? this : el); 1.50 + 1.51 + if (element.checked) 1.52 + countSelected++; 1.53 + else 1.54 + countSelected--; 1.55 + 1.56 + countSelectedSpan.innerText = countSelected; 1.57 +} 1.58 + 1.59 +// Attach event handler 1.60 +function setCountSelPkgs() { 1.61 + // The change event does not bubble to the form container 1.62 + pkglist = document.getElementById('pkglist'); 1.63 + if (pkglist) { 1.64 + var checkboxes = pkglist.getElementsByTagName('input'); 1.65 + for (i = 0; i < checkboxes.length; i++) { 1.66 + checkboxes[i].onchange = countSelPkgs; 1.67 + } 1.68 + } 1.69 + countSelectedSpan = document.getElementById('countSelected'); 1.70 +}
2.1 Binary file styles/default/tazpanel.ttf has changed