summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-12-27 13:36:38 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-12-27 13:43:46 +0100
commit6ceec76e7d27798aeaf968afe2b800bffb9b30f1 (patch)
tree3aba4999aa50189203eb7a16e08a2dffc2b68550 /public
parent02b775684d643850e4a4ea3d9ac7028b6af3b469 (diff)
feature request: filter angel types based on account settings, closes #362
Diffstat (limited to 'public')
-rw-r--r--public/js/forms.js37
1 files changed, 21 insertions, 16 deletions
diff --git a/public/js/forms.js b/public/js/forms.js
index c7f4a095..1efd80bb 100644
--- a/public/js/forms.js
+++ b/public/js/forms.js
@@ -1,20 +1,25 @@
/**
- * Runs through the DOM under the element with the given id, finds all
- * checkboxes and sets them to the wanted state.
+ * Sets all checkboxes to the wanted state
*
- * @param String
- * id Id of the element containing all the checkboxes
- * @param Boolean
- * checked True if the checkboxes should be checked
+ * @param {string} id Id of the element containing all the checkboxes
+ * @param {bool} checked True if the checkboxes should be checked
*/
function checkAll(id, checked) {
- var obj = document.getElementById(id);
- var boxes = obj.getElementsByTagName("input");
- for (var i = 0; i < boxes.length; i++) {
- if (boxes[i].type === "checkbox" && !boxes[i].disabled) {
- boxes[i].checked = checked;
- }
- }
+ $("#" + id + " input[type='checkbox']").each(function () {
+ this.checked = checked;
+ });
+}
+
+/**
+ * Sets the checkboxes according to the given type
+ *
+ * @param {string} id The elements ID
+ * @param {list} shifts_list A list of numbers
+ */
+function checkOwnTypes(id, shifts_list) {
+ $('#' + id + ' input[type=checkbox]').each(function () {
+ this.checked = $.inArray(parseInt(this.value), shifts_list);
+ });
}
/**
@@ -82,8 +87,8 @@ $(function () {
$("input[type='submit']").prop("readonly", true).addClass("disabled");
return true;
});
-
- $(".dropdown-menu").css("max-height", function() {
- return ($(window).height() - 50) + "px";
+
+ $(".dropdown-menu").css("max-height", function () {
+ return ($(window).height() - 50) + "px";
}).css("overflow-y", "scroll");
});