| 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/awebpaca/blog/components/com_kunena/template/crypsis/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($) {
/**
* Get the number of field options inserted in form
*/
function getOptionsNumber()
{
var myoptions = $('#kbbcode-poll-options').children('div.polloption');
return myoptions.length;
}
/**
* This function will insert directly in DOM the new field for poll with attibutes
*/
function createNewOptionField() {
var options = getOptionsNumber();
options++;
var polldiv = $('<div></div>').attr('class','polloption').appendTo('#kbbcode-poll-options');
var label = $('<label>').text(Joomla.JText._('COM_KUNENA_POLL_OPTION_NAME')+' '+options+' ');
polldiv.append(label);
newInput = document.createElement('input');
newInput.setAttribute('name', 'polloptionsID[new'+options+']');
newInput.setAttribute('id', 'field_option'+options);
newInput.setAttribute('class', 'inputbox inputpollclear');
newInput.setAttribute('maxlength', '100');
newInput.setAttribute('type', 'text');
polldiv.append(newInput);
}
if( $('#kbutton-poll-add') != undefined ) {
$('#kbutton-poll-add').click(function() {
var nboptionsmax = $('#nb_options_allowed').val();
var koptions = getOptionsNumber();
if(!nboptionsmax || (koptions < nboptionsmax && koptions >= 2) ){
createNewOptionField();
} else if (!nboptionsmax || koptions < 2) {
createNewOptionField();
createNewOptionField();
} else {
// Set error message with alert bootstrap way
$('#kpoll-alert-error').show();
$('#kbutton-poll-add').hide();
}
});
}
if( $('#kbutton-poll-rem') != undefined ) {
$('#kbutton-poll-rem').click(function() {
var koption = $ ('div.polloption:last');
if(koption) {
var isvisible = $('#kpoll-alert-error').is(":visible");
if (isvisible){
$('#kpoll-alert-error').hide();
$('#kbutton-poll-add').show();
}
koption.remove();
}
});
}
if( $('#postcatid') != undefined ) {
$('#postcatid').change(function() {
var catid = $('select#postcatid option').filter(':selected').val();
if ( pollcategoriesid[catid] !== undefined ) {
$('.pollbutton').show();
} else {
$('.pollbutton').hide();
}
});
}
$('#kpoll_go_results').click(function() {
if($('#poll-results').is(':visible')==true)
{
$('#poll-results').hide();
$('#kpoll_hide_results').hide();
}
else
{
$('#poll-results').show();
$('#kpoll_hide_results').show();
$('#kpoll_go_results').hide();
}
});
$('#kpoll_hide_results').click(function() {
if($('#poll-results').is(':visible')==true)
{
$('#poll-results').hide();
$('#kpoll_go_results').show();
$('#kpoll_hide_results').hide();
}
else
{
$('#poll-results').show();
$('#kpoll_hide_results').show();
$('#kpoll_go_results').hide();
}
});
$('#kpoll-moreusers').click(function() {
$('#kpoll-moreusers-div').show();
});
});