From d1265cbfd3916dce1cad4dc38af845d32572c500 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 9 May 2013 14:10:38 +0200 Subject: [PATCH] Updates JavaScript for checking/unchecking checkboxes --- wcfsetup/install/files/js/WCF.ACL.js | 48 ++++++++++++++-------------- wcfsetup/install/files/js/WCF.js | 16 +++++----- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.ACL.js b/wcfsetup/install/files/js/WCF.ACL.js index 25fee24a42..738940d56a 100644 --- a/wcfsetup/install/files/js/WCF.ACL.js +++ b/wcfsetup/install/files/js/WCF.ACL.js @@ -144,7 +144,7 @@ WCF.ACL.List = Class.extend({ this._containerElements.searchInput.val(''); // deselect all input elements - this._containerElements.permissionList.hide().find('input[type=checkbox]').removeAttr('checked'); + this._containerElements.permissionList.hide().find('input[type=checkbox]').prop('checked', false); }, /** @@ -179,7 +179,7 @@ WCF.ACL.List = Class.extend({ this._search.addExcludedSearchValue(data.label); // uncheck all option values - this._containerElements.permissionList.find('input[type=checkbox]').removeAttr('checked'); + this._containerElements.permissionList.find('input[type=checkbox]').prop('checked', false); // clear search input this._containerElements.searchInput.val(''); @@ -382,26 +382,26 @@ WCF.ACL.List = Class.extend({ if ($checkbox.is(':checked')) { if ($type === 'deny') { - $('#grant' + $optionID).removeAttr('checked'); + $('#grant' + $optionID).prop('checked', false); if (this._containerElements.grantAll !== null) { - this._containerElements.grantAll.removeAttr('checked'); + this._containerElements.grantAll.prop('checked', false); } } else { - $('#deny' + $optionID).removeAttr('checked'); + $('#deny' + $optionID).prop('checked', false); if (this._containerElements.denyAll !== null) { - this._containerElements.denyAll.removeAttr('checked'); + this._containerElements.denyAll.prop('checked', false); } } } else { if ($type === 'deny' && this._containerElements.denyAll !== null) { - this._containerElements.denyAll.removeAttr('checked'); + this._containerElements.denyAll.prop('checked', false); } else if ($type === 'grant' && this._containerElements.grantAll !== null) { - this._containerElements.grantAll.removeAttr('checked'); + this._containerElements.grantAll.prop('checked', false); } } @@ -418,14 +418,14 @@ WCF.ACL.List = Class.extend({ }); if ($type == 'deny') { if (this._containerElements.denyAll !== null) { - if ($allChecked) this._containerElements.denyAll.prop('checked', 'checked') - else this._containerElements.denyAll.removeAttr('checked'); + if ($allChecked) this._containerElements.denyAll.prop('checked', true) + else this._containerElements.denyAll.prop('checked', false); } } else { if (this._containerElements.grantAll !== null) { - if ($allChecked) this._containerElements.grantAll.prop('checked', 'checked') - else this._containerElements.grantAll.removeAttr('checked'); + if ($allChecked) this._containerElements.grantAll.prop('checked', true) + else this._containerElements.grantAll.prop('checked', false); } } }, @@ -441,48 +441,48 @@ WCF.ACL.List = Class.extend({ if ($checkbox.is(':checked')) { if ($type === 'deny') { - this._containerElements.grantAll.removeAttr('checked'); + this._containerElements.grantAll.prop('checked', false); this._containerElements.permissionList.find('input[type=checkbox]').each(function(index, item) { var $item = $(item); if ($item.data('type') === 'deny' && $item.attr('id') !== 'denyAll') { - $item.prop('checked', 'checked').trigger('change'); + $item.prop('checked', true).trigger('change'); } }); } else { - this._containerElements.denyAll.removeAttr('checked'); + this._containerElements.denyAll.prop('checked', false); this._containerElements.permissionList.find('input[type=checkbox]').each(function(index, item) { var $item = $(item); if ($item.data('type') === 'grant' && $item.attr('id') !== 'grantAll') { - $item.prop('checked', 'checked').trigger('change'); + $item.prop('checked', true).trigger('change'); } }); } } else { if ($type === 'deny') { - this._containerElements.grantAll.removeAttr('checked'); + this._containerElements.grantAll.prop('checked', false); this._containerElements.permissionList.find('input[type=checkbox]').each(function(index, item) { var $item = $(item); if ($item.data('type') === 'deny' && $item.attr('id') !== 'denyAll') { - $item.removeAttr('checked').trigger('change'); + $item.prop('checked', false).trigger('change'); } }); } else { - this._containerElements.denyAll.removeAttr('checked'); + this._containerElements.denyAll.prop('checked', false); this._containerElements.permissionList.find('input[type=checkbox]').each(function(index, item) { var $item = $(item); if ($item.data('type') === 'grant' && $item.attr('id') !== 'grantAll') { - $item.removeAttr('checked').trigger('change'); + $item.prop('checked', false).trigger('change'); } }); } @@ -497,16 +497,16 @@ WCF.ACL.List = Class.extend({ */ _setupPermissions: function(type, objectID) { // reset all checkboxes to unchecked - this._containerElements.permissionList.find("input[type='checkbox']").removeAttr('checked'); + this._containerElements.permissionList.find("input[type='checkbox']").prop('checked', false); // use stored permissions if applicable if (this._values[type] && this._values[type][objectID]) { for (var $optionID in this._values[type][objectID]) { if (this._values[type][objectID][$optionID] == 1) { - $('#grant' + $optionID).attr('checked', 'checked').trigger('change'); + $('#grant' + $optionID).prop('checked', true).trigger('change'); } else { - $('#deny' + $optionID).attr('checked', 'checked').trigger('change'); + $('#deny' + $optionID).prop('checked', true).trigger('change'); } } } @@ -540,7 +540,7 @@ WCF.ACL.List = Class.extend({ self._values[$type][$objectID][$optionID] = $optionValue; // reset value afterwards - $checkbox.removeAttr('checked'); + $checkbox.prop('checked', false); } else if (self._values[$type] && self._values[$type][$objectID] && self._values[$type][$objectID][$optionID] && self._values[$type][$objectID][$optionID] == $optionValue) { delete self._values[$type][$objectID][$optionID]; diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 6cf5264268..64e66089f5 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1008,7 +1008,7 @@ WCF.Clipboard = { $container.find('input.jsClipboardItem').each($.proxy(function(innerIndex, item) { var $item = $(item); if (WCF.inArray($item.data('objectID'), this._markedObjectIDs)) { - $item.attr('checked', 'checked'); + $item.prop('checked', true); // add marked class for element container $item.parents('.jsClipboardObject').addClass('jsMarked'); @@ -1027,7 +1027,7 @@ WCF.Clipboard = { }); if ($allItemsMarked) { - $(markAll).attr('checked', 'checked'); + $(markAll).prop('checked', true); } }); }, this)); @@ -1044,7 +1044,7 @@ WCF.Clipboard = { this._containers.each(function(index, container) { var $container = $(container); - $container.find('input.jsClipboardItem, input.jsClipboardMarkAll').removeAttr('checked'); + $container.find('input.jsClipboardItem, input.jsClipboardMarkAll').prop('checked', false); $container.find('.jsClipboardObject').removeClass('jsMarked'); }); }, @@ -1121,10 +1121,10 @@ WCF.Clipboard = { // simulate a ticked 'markAll' checkbox $container.find('.jsClipboardMarkAll').each(function(index, markAll) { if ($markedAll) { - $(markAll).attr('checked', 'checked'); + $(markAll).prop('checked', true); } else { - $(markAll).removeAttr('checked'); + $(markAll).prop('checked', false); } }); } @@ -1162,14 +1162,14 @@ WCF.Clipboard = { var $objectID = $containerItem.data('objectID'); if ($isMarked) { if (!$containerItem.prop('checked')) { - $containerItem.attr('checked', 'checked'); + $containerItem.prop('checked', true); this._markedObjectIDs.push($objectID); $objectIDs.push($objectID); } } else { if ($containerItem.prop('checked')) { - $containerItem.removeAttr('checked'); + $containerItem.prop('checked', false); this._markedObjectIDs = $.removeArrayValue(this._markedObjectIDs, $objectID); $objectIDs.push($objectID); } @@ -1277,7 +1277,7 @@ WCF.Clipboard = { for (var $__containerID in this._containers) { var $__container = $(this._containers[$__containerID]); if ($__container.data('type') == $typeName) { - $__container.find('.jsClipboardMarkAll, .jsClipboardItem').removeAttr('checked'); + $__container.find('.jsClipboardMarkAll, .jsClipboardItem').prop('checked', false); break; } } -- 2.20.1