aboutsummaryrefslogtreecommitdiff
path: root/themes/alps/assets/helpers.js
blob: 344dd1758e3de7bec1371cb526dec4d2cb76fc95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(function() {
	var sheet = document.styleSheets[0];
	var addCSSRule = function(selector, rules, index) {
		if ("insertRule" in sheet) {
			sheet.insertRule(selector + "{" + rules + "}", index);
			return;
		}
		if ("addRule" in sheet) {
			sheet.addRule(selector, rules, index);
		}
	};

	var checkboxAll = document.getElementById("action-checkbox-all");
	if (checkboxAll) {
		addCSSRule(".message-list-checkbox", "display: table-cell !important;");
		checkboxAll.addEventListener("click", function(ev) {
			var allChecked = this.checked;
			var inputs = document.querySelectorAll("tr .message-list-checkbox input");
			Array.prototype.slice.apply().forEach(function(cb) {
				cb.checked = allChecked;
			});
		});
	}
})();