mirror of
https://github.com/processwire/processwire.git
synced 2025-08-16 11:44:42 +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:
@@ -85,6 +85,8 @@ function CommentFormStars() {
|
|||||||
var value = parseInt(jQuery(this).attr('data-value'));
|
var value = parseInt(jQuery(this).attr('data-value'));
|
||||||
var $parent = jQuery(this).parent();
|
var $parent = jQuery(this).parent();
|
||||||
var $input = $parent.prev('input');
|
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
|
$input.val(value).attr('value', value); // redundancy intended, val() not working on webkit mobile for some reason
|
||||||
setStars($parent, value);
|
setStars($parent, value);
|
||||||
$input.change();
|
$input.change();
|
||||||
@@ -283,4 +285,4 @@ function CommentFormInit() {
|
|||||||
*/
|
*/
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
CommentFormInit();
|
CommentFormInit();
|
||||||
});
|
});
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user