1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +02:00

Update comments.js to allow for de-selection of stars in cases where a user might accidentally click on a stars input and want to revert to no-selection.

This commit is contained in:
Ryan Cramer
2022-07-29 11:37:49 -04:00
parent 94babead9d
commit 92fefa5476
2 changed files with 4 additions and 2 deletions

View File

@@ -85,6 +85,8 @@ function CommentFormStars() {
var value = parseInt(jQuery(this).attr('data-value'));
var $parent = jQuery(this).parent();
var $input = $parent.prev('input');
var valuePrev = parseInt($input.val());
if(value === valuePrev) value = 0; // click on current value to unset
$input.val(value).attr('value', value); // redundancy intended, val() not working on webkit mobile for some reason
setStars($parent, value);
$input.change();
@@ -283,4 +285,4 @@ function CommentFormInit() {
*/
jQuery(document).ready(function() {
CommentFormInit();
});
});

File diff suppressed because one or more lines are too long