Bonjour,
Je cherche à coloré les etoile quand on click dessus exmple si on click sur 3 le 3 etoile seron en jaune code Js :
(function($) {
/**
* @param {HTMLElement} el
* @return {undefined}
*/
XenForo.RatingTc = function(el) {
/** @type {null} */
var g = null;
/** @type {null} */
var exports = null;
var self = el.find(".Hint").each(function() {
var block = $(this);
block.data("text", block.text());
});
var line = el.find(".RatingValue .Number");
var element = el.find("button").each(function() {
var element = $(this);
element.data("hint", element.attr("title")).removeAttr("title");
});
/**
* @param {?} top
* @return {undefined}
*/
var fn = function(top) {
element.each(function(scrollY) {
$(this).toggleClass("Full", top >= scrollY + 1).toggleClass("Half", top >= scrollY + 0.5 && top < scrollY + 1);
});
};
/**
* @return {undefined}
*/
var access = function() {
fn(line.text());
self.text(self.data("text"));
};
element.bind({
/**
* @param {?} event
* @return {undefined}
*/
mouseenter : function(event) {
event.preventDefault();
fn($(this).val());
self.text($(this).data("hint"));
},
/**
* @param {Function} e
* @return {undefined}
*/
click : function(e) {
e.preventDefault();
if (exports) {
exports.load();
} else {
var rating = $(this).val();
var input = document.getElementById('ratingsIn');
if(input === null){
createInput(rating);
}else{
$(input).val(rating);
}
}
}
}); el.mouseleave(function() {
if (g === null) {
access();
}
});
};
XenForo.register("form.RatingTc", "XenForo.RatingTc");
})(jQuery, this, document);
/**
* Create Input
* Value | Rating
* @param rating
*/
function createInput (rating) {
var input = $('<input>');
input.attr('type', 'text');
input.attr('name', 'rating');
input.attr('id', 'ratingsIn');
input.attr('value', rating);
input.appendTo(".ratingCache");
}