mirror of https://github.com/Aidaho12/haproxy-wi
v8.2: Remove statAgriment function and improve variable declarations.
Commented out the unused statAgriment function and its associated event listener. Replaced var with let in various parts of the script for better scope handling and used triple equals for strict comparison. Also added a new script to the add.html template.pull/399/head
parent
7ec162244f
commit
18f9b11f35
|
@ -1198,66 +1198,66 @@ function show_version() {
|
|||
} );
|
||||
NProgress.configure({showSpinner: true});
|
||||
}
|
||||
function statAgriment() {
|
||||
var cur_url = window.location.href.split('/').pop();
|
||||
cur_url = cur_url.split('/');
|
||||
if (localStorage.getItem('statistic') == null && cur_url != 'login') {
|
||||
var titles = new Map()
|
||||
var body = new Map()
|
||||
var yes_ans = new Map()
|
||||
var no_ans = new Map()
|
||||
var ver_question = randomIntFromInterval(1, 2);
|
||||
titles.set(1, 'Help us improve Roxy-WI');
|
||||
titles.set(2, 'Data collection agreement');
|
||||
body.set(1, 'We want to improve the user experience by collecting anonymous statistics. No marketing.');
|
||||
body.set(2, 'We’d like to improve your experience in Roxy-WI, so we ask for statistics collection. No personal data is collected.');
|
||||
yes_ans.set(1, 'Yes');
|
||||
yes_ans.set(2, 'Agree and help the Roxy-WI team');
|
||||
no_ans.set(1, 'No');
|
||||
no_ans.set(2, 'Disagree');
|
||||
$("#statistic").dialog({
|
||||
autoOpen: true,
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: 600,
|
||||
modal: true,
|
||||
title: titles.get(ver_question),
|
||||
show: {
|
||||
effect: "fade",
|
||||
duration: 200
|
||||
},
|
||||
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) {
|
||||
cur_url = btoa(cur_url);
|
||||
sendGet('/page/send/'+cur_url);
|
||||
}
|
||||
}
|
||||
// function statAgriment() {
|
||||
// var cur_url = window.location.href.split('/').pop();
|
||||
// cur_url = cur_url.split('/');
|
||||
// if (localStorage.getItem('statistic') == null && cur_url != 'login') {
|
||||
// var titles = new Map()
|
||||
// var body = new Map()
|
||||
// var yes_ans = new Map()
|
||||
// var no_ans = new Map()
|
||||
// var ver_question = randomIntFromInterval(1, 2);
|
||||
// titles.set(1, 'Help us improve Roxy-WI');
|
||||
// titles.set(2, 'Data collection agreement');
|
||||
// body.set(1, 'We want to improve the user experience by collecting anonymous statistics. No marketing.');
|
||||
// body.set(2, 'We’d like to improve your experience in Roxy-WI, so we ask for statistics collection. No personal data is collected.');
|
||||
// yes_ans.set(1, 'Yes');
|
||||
// yes_ans.set(2, 'Agree and help the Roxy-WI team');
|
||||
// no_ans.set(1, 'No');
|
||||
// no_ans.set(2, 'Disagree');
|
||||
// $("#statistic").dialog({
|
||||
// autoOpen: true,
|
||||
// resizable: false,
|
||||
// height: "auto",
|
||||
// width: 600,
|
||||
// modal: true,
|
||||
// title: titles.get(ver_question),
|
||||
// show: {
|
||||
// effect: "fade",
|
||||
// duration: 200
|
||||
// },
|
||||
// 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) {
|
||||
// cur_url = btoa(cur_url);
|
||||
// sendGet('/page/send/'+cur_url);
|
||||
// }
|
||||
// }
|
||||
function startIntro(intro) {
|
||||
intro = intro.setOptions({'exitOnOverlayClick': false});
|
||||
var intro_url = cur_url[0].split('#')[0];
|
||||
|
@ -1318,19 +1318,19 @@ function startIntro(intro) {
|
|||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", function(event){
|
||||
statAgriment();
|
||||
});
|
||||
// document.addEventListener("DOMContentLoaded", function(event){
|
||||
// statAgriment();
|
||||
// });
|
||||
function sendGet(page) {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
var theUrl = 'https://roxy-wi.org/' + page;
|
||||
let xmlHttp = new XMLHttpRequest();
|
||||
let theUrl = 'https://roxy-wi.org/' + page;
|
||||
xmlHttp.open("GET", theUrl, true); // true for asynchronous
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
function show_pretty_ansible_error(data) {
|
||||
try {
|
||||
data = data.split('error: ');
|
||||
var p_err = JSON.parse(data[1]);
|
||||
let p_err = JSON.parse(data[1]);
|
||||
return p_err['msg'];
|
||||
} catch (e) {
|
||||
return data;
|
||||
|
@ -1340,7 +1340,7 @@ function openTab(tabId) {
|
|||
$( "#tabs" ).tabs( "option", "active", tabId );
|
||||
}
|
||||
function showPassword(input) {
|
||||
var x = document.getElementById(input);
|
||||
let x = document.getElementById(input);
|
||||
if (x.type === "password") {
|
||||
x.type = "text";
|
||||
} else {
|
||||
|
@ -1377,7 +1377,7 @@ function getAllGroups() {
|
|||
return groups;
|
||||
}
|
||||
function openUserSettings(user_id) {
|
||||
if (localStorage.getItem('disabled_alert') == '1') {
|
||||
if (localStorage.getItem('disabled_alert') === '1') {
|
||||
$('#disable_alerting').prop('checked', false).checkboxradio('refresh');
|
||||
} else {
|
||||
$('#disable_alerting').prop('checked', true).checkboxradio('refresh');
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
{% set force_close = {'0':'Off','1':'Server only','2':'Force close','3':'Pretend keep alive'} %}
|
||||
|
||||
<script src="/static/js/add.js"></script>
|
||||
<script src="/static/js/edit_config.js"></script>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#create" title="{{lang.words.add|title()}} {{lang.words.proxy}}: {{lang.words.create|title()}} {{lang.words.proxy}} - Roxy-WI">{{lang.words.create|title()}} {{lang.words.proxy}}</a></li>
|
||||
|
|
Loading…
Reference in New Issue