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("data: ".$response_data);
header("Content-type: application/json"); header("Content-type: application/json");
if(!is_null($debugbar)) $debugbar->sendDataInHeaders(true); 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); print($json_response);
} else { } else {
print("{}"); print("{}");

View File

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

View File

@ -62,12 +62,12 @@ $(document).on("pjax:start", function () {
if (document.getElementById("topNavBar") !== undefined) { if (document.getElementById("topNavBar") !== undefined) {
document.getElementById("topNavBar").className = "topnav"; document.getElementById("topNavBar").className = "topnav";
} }
old_data = "null"; oldData = "null";
fillTable = undefined; fillTable = undefined;
table_engine = "datatables"; tableEngine = "datatables";
if (window.loadTable_interval !== undefined) { if (window.loadTableInterval !== undefined) {
clearInterval(window.loadTable_interval); clearInterval(window.loadTableInterval);
window.loadTable_interval = undefined; window.loadTableInterval = undefined;
} }
}); });
@ -145,19 +145,19 @@ $(document).ready(function () {
}); });
const offline = false; const offline = false;
const loadTable_interval = undefined; const loadTableInterval = undefined;
var old_data = "null"; var oldData = "null";
var table_engine = "datatables"; var tableEngine = "datatables";
var fillTable = undefined; 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 (typeof fillTable === "undefined") {
if (use_custom_table_engine !== false) { if (use_custom_tableEngine !== false) {
table_engine = use_custom_table_engine; tableEngine = use_custom_tableEngine;
} else if ("connection" in navigator && navigator.connection.saveData) { } 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: _ }) => { .then(({ default: _ }) => {
return _; return _;
}); });
@ -172,19 +172,19 @@ async function loadTable ({ table_page, set_interval = true, interval = 10000, o
if ("deviceMemory" in navigator && navigator.deviceMemory < 0.2) { if ("deviceMemory" in navigator && navigator.deviceMemory < 0.2) {
return; return;
} }
const replaceLatLngWithMap = table_page === "services" || table_page === "trainings"; const replaceLatLngWithMap = tablePage === "services" || tablePage === "trainings";
$.getJSON({ $.getJSON({
url: "resources/ajax/ajax_" + table_page + ".php", url: "resources/ajax/ajax_" + tablePage + ".php",
data: { old_data: old_data }, data: { oldData: oldData },
success: function (data, status, xhr) { 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); console.log(data);
if (data.length > 0) { if (data.length > 0) {
fillTable({ data, replaceLatLngWithMap, callback }); fillTable({ data, replaceLatLngWithMap, callback });
const headers = new Headers(); const headers = new Headers();
headers.append("date", Date.now()); headers.append("date", Date.now());
caches.open("tables-1").then((cache) => { 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 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) { }).fail(function (data, status) {
if (status === "parsererror") { if (status === "parsererror") {
if ($("#table_body").children().length === 0) { // this is a server-side authentication error on some cheap hosting providers 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 nothing
} else { } else {
caches.open("tables-1").then(cache => { 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 => { response.json().then(data => {
fillTable({ data, replaceLatLngWithMap, callback }); fillTable({ data, replaceLatLngWithMap, callback });
console.log("Table loaded from cache"); console.log("Table loaded from cache");
@ -223,8 +223,8 @@ async function loadTable ({ table_page, set_interval = true, interval = 10000, o
interval += 5000; interval += 5000;
} }
console.log("table_load interval " + interval); console.log("table_load interval " + interval);
window.loadTable_interval = setInterval(function () { window.loadTableInterval = setInterval(function () {
window.loadTable({ table_page, set_interval: false, interval, onlineReload, use_custom_table_engine, callback: false }); window.loadTable({ tablePage, set_interval: false, interval, onlineReload, use_custom_tableEngine, callback: false });
}, interval); }, interval);
} }
} }
@ -245,7 +245,7 @@ function menu () {
} }
} }
window.loadTable_interval = loadTable_interval; window.loadTableInterval = loadTableInterval;
window.loadTable = loadTable; window.loadTable = loadTable;
window.setCookie = setCookie; window.setCookie = setCookie;
window.getCookie = getCookie; 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 // 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) { function chooseAddr (addrLat, addrLng, zoom = undefined, lat1 = undefined, lng1 = undefined, lat2 = undefined, lng2 = undefined, osm_type = undefined) {
addr_lat = addr_lat.replace(",", "."); addrLat = addrLat.replace(",", ".");
addr_lng = addr_lng.replace(",", "."); addrLng = addrLng.replace(",", ".");
if (lat1 !== undefined && lng1 !== undefined && lat2 !== undefined && lng2 !== undefined && osm_type !== undefined) { if (lat1 !== undefined && lng1 !== undefined && lat2 !== undefined && lng2 !== undefined && osm_type !== undefined) {
const loc1 = new L.LatLng(lat1, lng1); const loc1 = new L.LatLng(lat1, lng1);
const loc2 = new L.LatLng(lat2, lng2); const loc2 = new L.LatLng(lat2, lng2);
const bounds = new L.LatLngBounds(loc1, loc2); const bounds = new L.LatLngBounds(loc1, loc2);
console.log(lat1, lng1, lat2, lng2, osm_type); 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) { if (feature) {
map.removeLayer(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); feature = L.polyline([loc1, loc4, loc2, loc3, loc1], { color: "red" }).addTo(map);
map.fitBounds(bounds); map.fitBounds(bounds);
} }
} else if (addr_lat !== undefined && addr_lng !== undefined) { } else if (addrLat !== undefined && addrLng !== undefined) {
const loc = new L.LatLng(addr_lat, addr_lng); const loc = new L.LatLng(addrLat, addrLng);
console.log(loc); console.log(loc);
set_marker(loc); set_marker(loc);
if (zoom !== undefined) { if (zoom !== undefined) {

View File

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

View File

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

View File

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

View File

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

View File

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