152
| <![CDATA[<script>
var url = '/poll';
jQ = jQuery.noConflict();
// jQ.noConflict();
jQ(function() {
configureCaptcha();
refreshCaptcha();
var rating = jQ( ".divRating" );
var sendRating = jQ( "#sendRating" );
rating.popup({
position:'bottom left'
});
rating.hover(function() {
jQ('.iconCustom').transition('jiggle');
});
rating.click(function() {
sendRating.addClass("disabled");
jQ('#modalRating').modal({
onVisible: function () {
rating.popup({
position:'bottom left'
});
}
}).modal('show');
jQ('.iconCustom').transition('jiggle');
});
sendRating.click(function() {
var result = parseInt(jQ('.captchaV1').text())+ parseInt(jQ('.captchaV2').text());
if(parseInt(result) === parseInt(jQ('input.resultCaptcha').val())){
// console.log(jQ('#ratingForm').rating('get rating'));
sendEvaluation(url);
}else
jQ('.iconCustom').transition('jiggle');
});
});
function refreshCaptcha() {
jQ('.refreshCaptcha').click(function() {
a = Math.ceil(Math.random() * 10);
b = Math.ceil(Math.random() * 10);
c = jQ('input.resultCaptcha').val('');
jQ('.captchaV1').text(a);
jQ('.captchaV2').text(b);
jQ('input.resultCaptcha').focus();
jQ('#sendRating').addClass("disabled");
});
}
function configureCaptcha() {
jQ('input.resultCaptcha').on('input',function(e){
var result = parseInt(jQ('.captchaV1').text())+ parseInt(jQ('.captchaV2').text());
// console.log(result);
// console.log(jQ('input.resultCaptcha').val());
if(parseInt(result) === parseInt(jQ('input.resultCaptcha').val())){
jQ('#sendRating').removeClass("disabled");
}else{
jQ('#sendRating').addClass("disabled");
}
});
jQ('#ratingForm').rating({
initialRating: 3,
maxRating: 5
});
var a = Math.ceil(Math.random() * 10);
var b = Math.ceil(Math.random() * 10);
jQ('.captchaV1').text(a);
jQ('.captchaV2').text(b);
}
function sendEvaluation(url) {
var resultCaptcha = parseInt(jQ('.captchaV1').text()) + parseInt(jQ('.captchaV2').text());
var validateCaptcha = jQ('input.resultCaptcha').val();
var ratingValue = jQ('#ratingForm').rating('get rating');
var data = {operation: "saveEvaluation",
ratingValue: ratingValue,
resultCaptcha: resultCaptcha,
validateCaptcha: validateCaptcha
};
jQ.post(url, data, function (res) {
// console.log(res);
if(res.indexOf("success") >= 0){
jQ('#modalRating').modal('hide');
jQ('div.divRating')
.popup({
delay: {
hide: 900
},
position : 'right center',
target : 'div.divRating',
title : 'Avaliação!',
content : 'Sua avaliação foi registrada, Obrigado!'
}).popup('show');
}else{
jQ('#modalRating').modal('hide');
jQ('div.divRating')
.popup({
delay: {
hide: 900
},
position : 'right center',
target : 'div.divRating',
title : 'Avaliação incorreta!',
content : 'Avaliação não foi registrada!'
}).popup('show');
}
});
}
</script>]]>
|
665
| <![CDATA[<script>
jQ.noConflict();
var monthlyLabel = [];
var monthlyValues = [];
jQ(function () {
jQ('#monthlyViews').each(function (spanIndexY, spanYear) {
// console.log(spanYear);
jQ(spanYear).children("div").each(function (spanIndexM, spanMonthly) {
jQ(spanMonthly).children("div").each(function (ii, tt) {
// console.log(spanIndexM);
/* console.log(jQ(this).children("div.monthlyName").html());
console.log(jQ(this).children("div.monthlyValue").html());*/
monthlyLabel.push(jQ(this).children("div.monthlyName").text());
monthlyValues.push(jQ(this).children("div.monthlyValue").text());
});
});
});
xstartChart();
});
function xstartChart() {
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: monthlyLabel,
datasets: [{
label: 'Quantidade de acessos',
data: monthlyValues,
backgroundColor: ["red", "orange", "yellow", "lightseagreen", "green", "blue", "blueviolet", "gray", "aqua", "yellowgreen", "aquamarine", "darkblue"],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}],
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
}
</script>]]>
|