| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/blog/components/com_kunena/template/crypsisb3/assets/js/ |
Upload File : |
/**
* Kunena Component
* @package Kunena.Template.Crypsis
*
* @copyright (C) 2008 - 2018 Kunena Team. All rights reserved.
* @license https://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/
jQuery(document).ready(function($) {
// Krating element
var krating = document.querySelector('#krating');
// Initialize
(function init() {
var topic_id = $("#topic_id").val();
if ($('#krating').length > 0) {
$.ajax({
dataType: "json",
url: $('#krating_url').val(),
data: 'topic_id=' + topic_id
}).done(function(response) {
addRatingWidget(buildItem(), response, topic_id);
}).fail(function(reponse) {
});
}
})();
// Build krating item
function buildItem(){
var ratingItem = document.createElement('div');
ratingItem.innerHTML = '<ul class="c-rating"></ul>';
krating.appendChild(ratingItem);
return ratingItem;
}
// Add krating widget
function addRatingWidget(ratingItem, rate, topicid) {
var ratingElement = ratingItem.querySelector('.c-rating');
var currentRating = rate;
var maxRating = 5;
var callback = function(rating) {
$.ajax({
dataType: "json",
url: $('#krating_submit_url').val(),
data: 'starid=' + rating + '&topic_id=' + topicid
}).done(function(response) {
if (response.success)
{
$('<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><h4>Success</h4>'+Joomla.JText._(response.message)+'</div>').appendTo('#system-message-container');
}
else
{
$('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><h4>Warning!</h4>'+Joomla.JText._(response.message)+'</div>').appendTo('#system-message-container');
}
}).fail(function(reponse) {
$('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><h4>Warning!</h4>'+reponse+'</div>').appendTo('#system-message-container');
});
};
var r = rating(ratingElement, currentRating, maxRating, callback);
}
});