Codacy var names part 1

This commit is contained in:
Matteo Gheza 2021-04-05 18:57:52 +02:00
parent f5675cd008
commit 6f62fdeddf
9 changed files with 52 additions and 52 deletions

View File

@ -193,7 +193,7 @@ class tools
header("data: ".$response_data);
header("Content-type: application/json");
if(!is_null($debugbar)) $debugbar->sendDataInHeaders(true);
if(isset($_GET["old_data"]) && $_GET["old_data"] !== $response_data){
if(isset($_GET["oldData"]) && $_GET["oldData"] !== $response_data){
print($json_response);
} else {
print("{}");

View File

@ -1,11 +1,11 @@
import {default as createUnityInstance} from './ld46.loader.js';
import build_size_data from './ld46.data.gz';
import build_size_framework from './ld46.framework.js.gz';
import buildSizeFramework from './ld46.framework.js.gz';
import build_size_wasm from './ld46.wasm.gz';
console.log("data "+build_size_data);
console.log("framework "+build_size_framework);
console.log("framework "+buildSizeFramework);
console.log("wasm "+build_size_wasm);
export default class {

View File

@ -62,12 +62,12 @@ $(document).on("pjax:start", function () {
if (document.getElementById("topNavBar") !== undefined) {
document.getElementById("topNavBar").className = "topnav";
}
old_data = "null";
oldData = "null";
fillTable = undefined;
table_engine = "datatables";
if (window.loadTable_interval !== undefined) {
clearInterval(window.loadTable_interval);
window.loadTable_interval = undefined;
tableEngine = "datatables";
if (window.loadTableInterval !== undefined) {
clearInterval(window.loadTableInterval);
window.loadTableInterval = undefined;
}
});
@ -145,19 +145,19 @@ $(document).ready(function () {
});
const offline = false;
const loadTable_interval = undefined;
var old_data = "null";
var table_engine = "datatables";
const loadTableInterval = undefined;
var oldData = "null";
var tableEngine = "datatables";
var fillTable = undefined;
async function loadTable ({ table_page, set_interval = true, interval = 10000, onlineReload = false, use_custom_table_engine = false, callback = false }) {
async function loadTable ({ tablePage, set_interval = true, interval = 10000, onlineReload = false, use_custom_tableEngine = false, callback = false }) {
if (typeof fillTable === "undefined") {
if (use_custom_table_engine !== false) {
table_engine = use_custom_table_engine;
if (use_custom_tableEngine !== false) {
tableEngine = use_custom_tableEngine;
} else if ("connection" in navigator && navigator.connection.saveData) {
table_engine = "default";
tableEngine = "default";
}
fillTable = await import(`./table_engine_${table_engine}.js`)
fillTable = await import(`./tableEngine_${tableEngine}.js`)
.then(({ default: _ }) => {
return _;
});
@ -172,19 +172,19 @@ async function loadTable ({ table_page, set_interval = true, interval = 10000, o
if ("deviceMemory" in navigator && navigator.deviceMemory < 0.2) {
return;
}
const replaceLatLngWithMap = table_page === "services" || table_page === "trainings";
const replaceLatLngWithMap = tablePage === "services" || tablePage === "trainings";
$.getJSON({
url: "resources/ajax/ajax_" + table_page + ".php",
data: { old_data: old_data },
url: "resources/ajax/ajax_" + tablePage + ".php",
data: { oldData: oldData },
success: function (data, status, xhr) {
old_data = xhr.getResponseHeader("data"); // TODO: refactoring and adding comments
oldData = xhr.getResponseHeader("data"); // TODO: refactoring and adding comments
console.log(data);
if (data.length > 0) {
fillTable({ data, replaceLatLngWithMap, callback });
const headers = new Headers();
headers.append("date", Date.now());
caches.open("tables-1").then((cache) => {
cache.put("/table_" + table_page + ".json", new Response(xhr.responseText, { headers: headers }));
cache.put("/table_" + tablePage + ".json", new Response(xhr.responseText, { headers: headers }));
});
}
if (window.offline) { // if xhr request successful, client is online
@ -200,11 +200,11 @@ async function loadTable ({ table_page, set_interval = true, interval = 10000, o
}).fail(function (data, status) {
if (status === "parsererror") {
if ($("#table_body").children().length === 0) { // this is a server-side authentication error on some cheap hosting providers
loadTable(table_page, set_interval, interval); // retry
loadTable(tablePage, set_interval, interval); // retry
} // else nothing
} else {
caches.open("tables-1").then(cache => {
cache.match("/table_" + table_page + ".json").then(response => {
cache.match("/table_" + tablePage + ".json").then(response => {
response.json().then(data => {
fillTable({ data, replaceLatLngWithMap, callback });
console.log("Table loaded from cache");
@ -223,8 +223,8 @@ async function loadTable ({ table_page, set_interval = true, interval = 10000, o
interval += 5000;
}
console.log("table_load interval " + interval);
window.loadTable_interval = setInterval(function () {
window.loadTable({ table_page, set_interval: false, interval, onlineReload, use_custom_table_engine, callback: false });
window.loadTableInterval = setInterval(function () {
window.loadTable({ tablePage, set_interval: false, interval, onlineReload, use_custom_tableEngine, callback: false });
}, interval);
}
}
@ -245,7 +245,7 @@ function menu () {
}
}
window.loadTable_interval = loadTable_interval;
window.loadTableInterval = loadTableInterval;
window.loadTable = loadTable;
window.setCookie = setCookie;
window.getCookie = getCookie;

View File

@ -103,15 +103,15 @@ function load_map (lat = undefined, lng = undefined, selector_id = undefined, se
}
// from unknown source in the Internet
function chooseAddr (addr_lat, addr_lng, zoom = undefined, lat1 = undefined, lng1 = undefined, lat2 = undefined, lng2 = undefined, osm_type = undefined) {
addr_lat = addr_lat.replace(",", ".");
addr_lng = addr_lng.replace(",", ".");
function chooseAddr (addrLat, addrLng, zoom = undefined, lat1 = undefined, lng1 = undefined, lat2 = undefined, lng2 = undefined, osm_type = undefined) {
addrLat = addrLat.replace(",", ".");
addrLng = addrLng.replace(",", ".");
if (lat1 !== undefined && lng1 !== undefined && lat2 !== undefined && lng2 !== undefined && osm_type !== undefined) {
const loc1 = new L.LatLng(lat1, lng1);
const loc2 = new L.LatLng(lat2, lng2);
const bounds = new L.LatLngBounds(loc1, loc2);
console.log(lat1, lng1, lat2, lng2, osm_type);
set_marker(new L.LatLng(addr_lat, addr_lng));
set_marker(new L.LatLng(addrLat, addrLng));
if (feature) {
map.removeLayer(feature);
}
@ -124,8 +124,8 @@ function chooseAddr (addr_lat, addr_lng, zoom = undefined, lat1 = undefined, lng
feature = L.polyline([loc1, loc4, loc2, loc3, loc1], { color: "red" }).addTo(map);
map.fitBounds(bounds);
}
} else if (addr_lat !== undefined && addr_lng !== undefined) {
const loc = new L.LatLng(addr_lat, addr_lng);
} else if (addrLat !== undefined && addrLng !== undefined) {
const loc = new L.LatLng(addrLat, addrLng);
console.log(loc);
set_marker(loc);
if (zoom !== undefined) {

View File

@ -44,11 +44,11 @@ const removeSourceMapUrlAfterBuild = () => {
});
}
var config_file = require("./config.json");
const sentry_enabled = config_file.sentry_enabled &&
config_file.sentry_auth_token &&
config_file.sentry_organization &&
config_file.sentry_project;
var configFile = require("./config.json");
const sentry_enabled = configFile.sentry_enabled &&
configFile.sentry_auth_token &&
configFile.sentry_organization &&
configFile.sentry_project;
var prod_config = {
mode: "production",
@ -84,10 +84,10 @@ module.exports = (env) => {
//run webpack build with "--env sentry_environment=custom-sentry-env" to replace Sentry environment
if(env.sentry_environment){
console.log(colors.green("INFO using custom sentry_environment "+env.sentry_environment));
config_file.sentry_environment = env.sentry_environment;
configFile.sentry_environment = env.sentry_environment;
}
if(!config_file.sentry_environment){
config_file.sentry_environment = "prod";
if(!configFile.sentry_environment){
configFile.sentry_environment = "prod";
}
if(sentry_enabled){
@ -97,9 +97,9 @@ module.exports = (env) => {
}),
new SentryWebpackPlugin({
authToken: config_file.sentry_auth_token,
org: config_file.sentry_organization,
project: config_file.sentry_project,
authToken: configFile.sentry_auth_token,
org: configFile.sentry_organization,
project: configFile.sentry_project,
urlPrefix: "~/dist",
include: "./dist",
setCommits: {
@ -123,7 +123,7 @@ module.exports = (env) => {
GIT_AUTHOR_DATE: git("log -1 --format=%aI"),
BUNDLE_DATE: Date.now(),
BUNDLE_MODE: "production",
config: config_file
config: configFile
})
);
return merge(common, prod_config);

View File

@ -67,8 +67,8 @@
},
success: function (data) {
toastr.success(`{{ 'Thanks, %s, you have given %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
clearInterval(window.loadTable_interval); //stop reloading
loadTable({table_page: "list", use_custom_table_engine: "default"});
clearInterval(window.loadTableInterval); //stop reloading
loadTable({tablePage: "list", use_custom_tableEngine: "default"});
}
});
}
@ -84,8 +84,8 @@
},
success: function (data) {
toastr.success(`{{ 'Thanks, %s, you have removed %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
clearInterval(window.loadTable_interval); //stop reloading
loadTable({table_page: "list", use_custom_table_engine: "default"});
clearInterval(window.loadTableInterval); //stop reloading
loadTable({tablePage: "list", use_custom_tableEngine: "default"});
}
});
}
@ -114,7 +114,7 @@
</tbody>
</table>
<script>
loadTable({table_page: "list", use_custom_table_engine: "default"});
loadTable({tablePage: "list", use_custom_tableEngine: "default"});
</script>
</div>

View File

@ -19,7 +19,7 @@
</tbody>
</table>
<script>
loadTable({table_page: "log", set_interval: false, callback: function(table_dt) {
loadTable({tablePage: "log", set_interval: false, callback: function(table_dt) {
table_dt
.column( '3:visible' )
.order( 'desc' )

View File

@ -36,7 +36,7 @@
</tbody>
</table>
<script>
loadTable({table_page: "services", interval: 120000});
loadTable({tablePage: "services", interval: 120000});
</script>
</div>
<br>

View File

@ -34,7 +34,7 @@
</tbody>
</table>
<script>
loadTable({table_page: "trainings", interval: 120000});
loadTable({tablePage: "trainings", interval: 120000});
</script>
</div>
<br>