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});
|
NProgress.configure({showSpinner: true});
|
||||||
}
|
}
|
||||||
function statAgriment() {
|
// function statAgriment() {
|
||||||
var cur_url = window.location.href.split('/').pop();
|
// var cur_url = window.location.href.split('/').pop();
|
||||||
cur_url = cur_url.split('/');
|
// cur_url = cur_url.split('/');
|
||||||
if (localStorage.getItem('statistic') == null && cur_url != 'login') {
|
// if (localStorage.getItem('statistic') == null && cur_url != 'login') {
|
||||||
var titles = new Map()
|
// var titles = new Map()
|
||||||
var body = new Map()
|
// var body = new Map()
|
||||||
var yes_ans = new Map()
|
// var yes_ans = new Map()
|
||||||
var no_ans = new Map()
|
// var no_ans = new Map()
|
||||||
var ver_question = randomIntFromInterval(1, 2);
|
// var ver_question = randomIntFromInterval(1, 2);
|
||||||
titles.set(1, 'Help us improve Roxy-WI');
|
// titles.set(1, 'Help us improve Roxy-WI');
|
||||||
titles.set(2, 'Data collection agreement');
|
// titles.set(2, 'Data collection agreement');
|
||||||
body.set(1, 'We want to improve the user experience by collecting anonymous statistics. No marketing.');
|
// 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.');
|
// 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(1, 'Yes');
|
||||||
yes_ans.set(2, 'Agree and help the Roxy-WI team');
|
// yes_ans.set(2, 'Agree and help the Roxy-WI team');
|
||||||
no_ans.set(1, 'No');
|
// no_ans.set(1, 'No');
|
||||||
no_ans.set(2, 'Disagree');
|
// no_ans.set(2, 'Disagree');
|
||||||
$("#statistic").dialog({
|
// $("#statistic").dialog({
|
||||||
autoOpen: true,
|
// autoOpen: true,
|
||||||
resizable: false,
|
// resizable: false,
|
||||||
height: "auto",
|
// height: "auto",
|
||||||
width: 600,
|
// width: 600,
|
||||||
modal: true,
|
// modal: true,
|
||||||
title: titles.get(ver_question),
|
// title: titles.get(ver_question),
|
||||||
show: {
|
// show: {
|
||||||
effect: "fade",
|
// effect: "fade",
|
||||||
duration: 200
|
// duration: 200
|
||||||
},
|
// },
|
||||||
hide: {
|
// hide: {
|
||||||
effect: "fade",
|
// effect: "fade",
|
||||||
duration: 200
|
// duration: 200
|
||||||
},
|
// },
|
||||||
buttons: [{
|
// buttons: [{
|
||||||
"id": "statYesBut",
|
// "id": "statYesBut",
|
||||||
text: "Yes",
|
// text: "Yes",
|
||||||
click: function () {
|
// click: function () {
|
||||||
localStorage.setItem('statistic', '1');
|
// localStorage.setItem('statistic', '1');
|
||||||
$(this).dialog("close");
|
// $(this).dialog("close");
|
||||||
sendGet('page/ans/1/' + ver_question);
|
// sendGet('page/ans/1/' + ver_question);
|
||||||
statAgriment();
|
// statAgriment();
|
||||||
},
|
// },
|
||||||
}, {
|
// }, {
|
||||||
"id": "statNoBut",
|
// "id": "statNoBut",
|
||||||
text: "No",
|
// text: "No",
|
||||||
click: function () {
|
// click: function () {
|
||||||
localStorage.setItem('statistic', '0');
|
// localStorage.setItem('statistic', '0');
|
||||||
$(this).dialog("close");
|
// $(this).dialog("close");
|
||||||
sendGet('page/ans/0/' + ver_question);
|
// sendGet('page/ans/0/' + ver_question);
|
||||||
}
|
// }
|
||||||
}]
|
// }]
|
||||||
});
|
// });
|
||||||
$("#statYesBut").html('<span class="ui-button-text">' + yes_ans.get(ver_question) + '</span>');
|
// $("#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>');
|
// $("#statNoBut").html('<span class="ui-button-text">' + no_ans.get(ver_question) + '</span>');
|
||||||
$("#statistic-body").html(body.get(ver_question));
|
// $("#statistic-body").html(body.get(ver_question));
|
||||||
}
|
// }
|
||||||
if (localStorage.getItem('statistic') == 1) {
|
// if (localStorage.getItem('statistic') == 1) {
|
||||||
cur_url = btoa(cur_url);
|
// cur_url = btoa(cur_url);
|
||||||
sendGet('/page/send/'+cur_url);
|
// sendGet('/page/send/'+cur_url);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
function startIntro(intro) {
|
function startIntro(intro) {
|
||||||
intro = intro.setOptions({'exitOnOverlayClick': false});
|
intro = intro.setOptions({'exitOnOverlayClick': false});
|
||||||
var intro_url = cur_url[0].split('#')[0];
|
var intro_url = cur_url[0].split('#')[0];
|
||||||
|
@ -1318,19 +1318,19 @@ function startIntro(intro) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.addEventListener("DOMContentLoaded", function(event){
|
// document.addEventListener("DOMContentLoaded", function(event){
|
||||||
statAgriment();
|
// statAgriment();
|
||||||
});
|
// });
|
||||||
function sendGet(page) {
|
function sendGet(page) {
|
||||||
var xmlHttp = new XMLHttpRequest();
|
let xmlHttp = new XMLHttpRequest();
|
||||||
var theUrl = 'https://roxy-wi.org/' + page;
|
let theUrl = 'https://roxy-wi.org/' + page;
|
||||||
xmlHttp.open("GET", theUrl, true); // true for asynchronous
|
xmlHttp.open("GET", theUrl, true); // true for asynchronous
|
||||||
xmlHttp.send(null);
|
xmlHttp.send(null);
|
||||||
}
|
}
|
||||||
function show_pretty_ansible_error(data) {
|
function show_pretty_ansible_error(data) {
|
||||||
try {
|
try {
|
||||||
data = data.split('error: ');
|
data = data.split('error: ');
|
||||||
var p_err = JSON.parse(data[1]);
|
let p_err = JSON.parse(data[1]);
|
||||||
return p_err['msg'];
|
return p_err['msg'];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return data;
|
return data;
|
||||||
|
@ -1340,12 +1340,12 @@ function openTab(tabId) {
|
||||||
$( "#tabs" ).tabs( "option", "active", tabId );
|
$( "#tabs" ).tabs( "option", "active", tabId );
|
||||||
}
|
}
|
||||||
function showPassword(input) {
|
function showPassword(input) {
|
||||||
var x = document.getElementById(input);
|
let x = document.getElementById(input);
|
||||||
if (x.type === "password") {
|
if (x.type === "password") {
|
||||||
x.type = "text";
|
x.type = "text";
|
||||||
} else {
|
} else {
|
||||||
x.type = "password";
|
x.type = "password";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function removeData() {
|
function removeData() {
|
||||||
for (let i = 0; i < charts.length; i++) {
|
for (let i = 0; i < charts.length; i++) {
|
||||||
|
@ -1377,7 +1377,7 @@ function getAllGroups() {
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
function openUserSettings(user_id) {
|
function openUserSettings(user_id) {
|
||||||
if (localStorage.getItem('disabled_alert') == '1') {
|
if (localStorage.getItem('disabled_alert') === '1') {
|
||||||
$('#disable_alerting').prop('checked', false).checkboxradio('refresh');
|
$('#disable_alerting').prop('checked', false).checkboxradio('refresh');
|
||||||
} else {
|
} else {
|
||||||
$('#disable_alerting').prop('checked', true).checkboxradio('refresh');
|
$('#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'} %}
|
{% 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/add.js"></script>
|
||||||
|
<script src="/static/js/edit_config.js"></script>
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul>
|
<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>
|
<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