Updates JavaScript for checking/unchecking checkboxes
authorMatthias Schmidt <gravatronics@live.com>
Thu, 9 May 2013 12:10:38 +0000 (14:10 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 9 May 2013 12:10:38 +0000 (14:10 +0200)
wcfsetup/install/files/js/WCF.ACL.js
wcfsetup/install/files/js/WCF.js

index 25fee24a4272f588aef7c7a07550c74f8bf8c2d4..738940d56aca8992eb803b1487606d8c929eb4d7 100644 (file)
@@ -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];
index 6cf526426806df5e73695b5df7405318edf0bbc5..64e66089f58d40cbc190c79e6cffca0fbb8db08b 100755 (executable)
@@ -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;
                                                }
                                        }