Changelog: https://roxy-wi.org/changelog#6_2_3
pull/343/head
Pavel Loginov 2022-11-09 22:05:47 +03:00
parent a9dc131a84
commit dd9983d513
2 changed files with 61 additions and 36 deletions

View File

@ -299,9 +299,7 @@
</table> </table>
</div> </div>
<div id="statistic" style="display: none;"> <div id="statistic" style="display: none;">
<div style="font-size: 1.1em;font-weight: bold;padding-top: 10px;"> <div style="font-size: 1em;font-weight: bold;padding-top: 10px;" id="statistic-body"></div>
Help us to improve Roxy-WI by sending anonymous statistics. No marketing.
</div>
</div> </div>
{% include 'include/change_pass_form.html' %} {% include 'include/change_pass_form.html' %}
</body> </body>

View File

@ -1526,42 +1526,69 @@ function show_version() {
} ); } );
NProgress.configure({showSpinner: true}); NProgress.configure({showSpinner: true});
} }
function httpGetAsync() { function statAgriment() {
if (localStorage.getItem('statistic') == null) { if (localStorage.getItem('statistic') == null) {
$("#statistic").dialog({ var titles = new Map()
autoOpen: true, var body = new Map()
resizable: false, var yes_ans = new Map()
height: "auto", var no_ans = new Map()
width: 600, var ver_question = randomIntFromInterval(1, 3);
modal: true, titles.set(1, 'Help us improve Roxy-WI');
title: "Help us to improve Roxy-WI", titles.set(2, 'Data collection agreement');
show: { body.set(1, 'We want to improve the user experience by collecting anonymous statistics. No marketing.');
effect: "fade", body.set(2, 'Wed like to improve your experience in Roxy-WI, so we ask for statistics collection. No personal data is collected.');
duration: 200 yes_ans.set(1, 'Yes');
}, yes_ans.set(2, 'Agree and help the Roxy-WI team');
hide: { no_ans.set(1, 'No');
effect: "fade", no_ans.set(2, 'Disagree');
duration: 200 $("#statistic").dialog({
}, autoOpen: true,
buttons: { resizable: false,
"Yes": function () { height: "auto",
localStorage.setItem('statistic', '1'); width: 600,
$(this).dialog("close"); modal: true,
httpGetAsync(); title: titles.get(second_ver_question),
}, show: {
"No": function () { effect: "fade",
localStorage.setItem('statistic', '0'); duration: 200
$(this).dialog("close"); },
} hide: {
} effect: "fade",
}); duration: 200
},
buttons: [{
"id": "statYesBut",
text: "Yes",
click: function () {
localStorage.setItem('statistic', '1');
$(this).dialog("close");
sendGet('page/ans/1/' + ver_question);
statAgriment();
},
}, {
"id": "statNoBut",
text: "No",
click: function () {
localStorage.setItem('statistic', '0');
$(this).dialog("close");
sendGet('page/ans/0/' + ver_question);
}
}]
});
$("#statYesBut").html('<span class="ui-button-text">' + yes_ans.get(ver_question) + '</span>');
$("#statNoBut").html('<span class="ui-button-text">' + no_ans.get(ver_question) + '</span>');
$("#statistic-body").html(body.get(ver_question));
} }
if (localStorage.getItem('statistic') == 1) { if (localStorage.getItem('statistic') == 1) {
var xmlHttp = new XMLHttpRequest();
var cur_url = btoa(window.location.href.split('/').pop()); var cur_url = btoa(window.location.href.split('/').pop());
var theUrl = 'https://roxy-wi.org/page/send/' + cur_url; sendGet('/page/send/'+cur_url);
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
} }
} }
window.onload = httpGetAsync; window.onload = statAgriment;
function sendGet(page) {
var xmlHttp = new XMLHttpRequest();
var cur_url = btoa(window.location.href.split('/').pop());
var theUrl = 'https://roxy-wi.org/' + page;
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}