Declare some js globals as Window properties
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
edc4a0d41f
commit
f5a5983bc1
@ -67,6 +67,7 @@
|
||||
"wrap-iife": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-this-alias": "off"
|
||||
}
|
||||
|
||||
8
js/global.d.ts
vendored
8
js/global.d.ts
vendored
@ -9,6 +9,12 @@ declare var maxInputVars: number;
|
||||
|
||||
declare function sprintf(format: string, ...values: (string|number)[]): string;
|
||||
|
||||
interface Window {
|
||||
ol: any;
|
||||
|
||||
drawOpenLayers: () => any;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
getPostData: () => string;
|
||||
|
||||
@ -27,4 +33,6 @@ interface JQuery {
|
||||
|
||||
interface JQueryStatic {
|
||||
timepicker: JQueryUI.Datepicker;
|
||||
|
||||
jqplot: any;
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ var ChartType = {
|
||||
TIMELINE: 'timeline',
|
||||
SCATTER: 'scatter'
|
||||
};
|
||||
window.ChartType = ChartType;
|
||||
|
||||
/**
|
||||
* Column type enumeration
|
||||
@ -24,7 +23,6 @@ var ColumnType = {
|
||||
BOOLEAN: 'boolean',
|
||||
DATE: 'date'
|
||||
};
|
||||
window.ColumnType = ColumnType;
|
||||
|
||||
/**
|
||||
* Abstract chart factory which defines the contract for chart factories
|
||||
@ -211,8 +209,6 @@ var DataTable = function () {
|
||||
};
|
||||
};
|
||||
|
||||
window.DataTable = DataTable;
|
||||
|
||||
/** *****************************************************************************
|
||||
* JQPlot specific code
|
||||
******************************************************************************/
|
||||
@ -729,4 +725,16 @@ JQPlotChartFactory.prototype.createChart = function (type, elementId) {
|
||||
return chart;
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
ChartType: typeof ChartType;
|
||||
ColumnType: typeof ColumnType;
|
||||
DataTable: typeof DataTable;
|
||||
JQPlotChartFactory: typeof JQPlotChartFactory;
|
||||
}
|
||||
}
|
||||
|
||||
window.ChartType = ChartType;
|
||||
window.ColumnType = ColumnType;
|
||||
window.DataTable = DataTable;
|
||||
window.JQPlotChartFactory = JQPlotChartFactory;
|
||||
|
||||
@ -887,7 +887,12 @@ DesignerHistory.buildQuery = function () {
|
||||
});
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
declare global {
|
||||
interface Window {
|
||||
DesignerHistory: typeof DesignerHistory;
|
||||
}
|
||||
}
|
||||
|
||||
window.DesignerHistory = DesignerHistory;
|
||||
|
||||
export { DesignerHistory };
|
||||
|
||||
@ -319,6 +319,20 @@ AJAX.registerTeardown('designer/init.js', function () {
|
||||
$('.trigger').off('click');
|
||||
});
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
designerConfig: {
|
||||
db: string;
|
||||
scriptTables: { j_tabs: any[], h_tabs: any[] };
|
||||
scriptContr: any[];
|
||||
server: number;
|
||||
scriptDisplayField: any[];
|
||||
displayPage: number;
|
||||
tablesEnabled: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
AJAX.registerOnload('designer/init.js', function () {
|
||||
$('.trigger').on('click', function () {
|
||||
$('.panel').toggle('fast');
|
||||
@ -328,7 +342,6 @@ AJAX.registerOnload('designer/init.js', function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const configValues = window.designerConfig;
|
||||
|
||||
DesignerConfig.jTabs = configValues.scriptTables.j_tabs;
|
||||
|
||||
@ -3,6 +3,13 @@ import { AJAX } from './modules/ajax.ts';
|
||||
import { CommonParams } from './modules/common.ts';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.ts';
|
||||
import getImageTag from './modules/functions/getImageTag.ts';
|
||||
import type * as TraceKit from 'tracekit/tracekit.d.ts';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
TraceKit: typeof TraceKit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* general function, usually for data manipulation pages
|
||||
|
||||
@ -126,8 +126,6 @@ function loadJSAndGISEditor (value, field, type, inputName) {
|
||||
window.gisEditorLoaded = true;
|
||||
}
|
||||
|
||||
window.loadJSAndGISEditor = loadJSAndGISEditor;
|
||||
|
||||
/**
|
||||
* Loads the GIS editor via AJAX
|
||||
*
|
||||
@ -157,8 +155,6 @@ function loadGISEditor (value, field, type, inputName) {
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
window.loadGISEditor = loadGISEditor;
|
||||
|
||||
/**
|
||||
* Opens up the dialog for the GIS data editor.
|
||||
*/
|
||||
@ -189,8 +185,6 @@ function openGISEditor () {
|
||||
$gisEditor.fadeIn('fast');
|
||||
}
|
||||
|
||||
window.openGISEditor = openGISEditor;
|
||||
|
||||
/**
|
||||
* Prepare and insert the GIS data in Well Known Text format
|
||||
* to the input field.
|
||||
@ -402,3 +396,16 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
$noOfGeomsInput.val(noOfGeoms + 1);
|
||||
});
|
||||
});
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
gisEditorLoaded: boolean;
|
||||
loadJSAndGISEditor: typeof loadJSAndGISEditor;
|
||||
loadGISEditor: typeof loadGISEditor;
|
||||
openGISEditor: typeof openGISEditor;
|
||||
}
|
||||
}
|
||||
|
||||
window.loadJSAndGISEditor = loadJSAndGISEditor;
|
||||
window.loadGISEditor = loadGISEditor;
|
||||
window.openGISEditor = openGISEditor;
|
||||
|
||||
@ -213,7 +213,7 @@ function getIdPrefix (element) {
|
||||
let validate = {};
|
||||
|
||||
// form validator list
|
||||
window.validators = {
|
||||
const validators = {
|
||||
// regexp: numeric value
|
||||
regExpNumeric: /^[0-9]+$/,
|
||||
// regexp: extract parts from PCRE expression
|
||||
@ -842,6 +842,14 @@ const Config = {
|
||||
on: on,
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
validators: typeof validators;
|
||||
Config: typeof Config;
|
||||
}
|
||||
}
|
||||
|
||||
window.validators = validators;
|
||||
window.Config = Config;
|
||||
|
||||
export { Config };
|
||||
|
||||
@ -1565,4 +1565,10 @@ var ConsoleDebug = {
|
||||
}
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Console: typeof Console;
|
||||
}
|
||||
}
|
||||
|
||||
export { Console };
|
||||
|
||||
@ -3853,6 +3853,13 @@ $.fn.confirm = Functions.confirm;
|
||||
$.fn.sortTable = Functions.sortTable;
|
||||
$.fn.getPostData = Functions.getPostData;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
codeMirrorEditor: CodeMirror.EditorFromTextArea | boolean | null;
|
||||
Functions: typeof Functions;
|
||||
}
|
||||
}
|
||||
|
||||
window.Functions = Functions;
|
||||
|
||||
export { Functions };
|
||||
|
||||
@ -1414,6 +1414,12 @@ const Navigation = {
|
||||
update: update,
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Navigation: typeof Navigation;
|
||||
}
|
||||
}
|
||||
|
||||
window.Navigation = Navigation;
|
||||
|
||||
export { Navigation };
|
||||
|
||||
@ -1391,4 +1391,10 @@ const Sql = {
|
||||
initProfilingTables: initProfilingTables,
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Sql: typeof Sql;
|
||||
}
|
||||
}
|
||||
|
||||
window.Sql = Sql;
|
||||
|
||||
@ -224,8 +224,6 @@ function verifyAfterSearchFieldChange (index, searchFormId) {
|
||||
}
|
||||
}
|
||||
|
||||
window.verifyAfterSearchFieldChange = verifyAfterSearchFieldChange;
|
||||
|
||||
/**
|
||||
* Validate the an input contains multiple int values
|
||||
* @param {jQuery} jqueryInput the Jquery object
|
||||
@ -462,7 +460,6 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
}
|
||||
}
|
||||
|
||||
window.verificationsAfterFieldChange = verificationsAfterFieldChange;
|
||||
/* End of fields validation*/
|
||||
|
||||
/**
|
||||
@ -941,4 +938,14 @@ function changeValueFieldType (elem, searchIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
verifyAfterSearchFieldChange: typeof verifyAfterSearchFieldChange;
|
||||
verificationsAfterFieldChange: typeof verificationsAfterFieldChange;
|
||||
changeValueFieldType: typeof changeValueFieldType;
|
||||
}
|
||||
}
|
||||
|
||||
window.verifyAfterSearchFieldChange = verifyAfterSearchFieldChange;
|
||||
window.verificationsAfterFieldChange = verificationsAfterFieldChange;
|
||||
window.changeValueFieldType = changeValueFieldType;
|
||||
|
||||
@ -40,8 +40,6 @@ function zoomAndPan () {
|
||||
$('path.vector', gisSvg).attr('stroke-width', 0.5 / scale);
|
||||
}
|
||||
|
||||
window.zoomAndPan = zoomAndPan;
|
||||
|
||||
/**
|
||||
* Initially loads either SVG or OSM visualization based on the choice.
|
||||
*/
|
||||
@ -53,8 +51,6 @@ function selectVisualization () {
|
||||
}
|
||||
}
|
||||
|
||||
window.selectVisualization = selectVisualization;
|
||||
|
||||
/**
|
||||
* Adds necessary styles to the div that contains the openStreetMap.
|
||||
*/
|
||||
@ -69,8 +65,6 @@ function styleOSM () {
|
||||
$('#openlayersmap').css(cssObj);
|
||||
}
|
||||
|
||||
window.styleOSM = styleOSM;
|
||||
|
||||
/**
|
||||
* Store a reference to the gis svg element.
|
||||
*/
|
||||
@ -78,8 +72,6 @@ function storeGisSvgRef () {
|
||||
gisSvg = $('#placeholder').find('svg').get(0);
|
||||
}
|
||||
|
||||
window.storeGisSvgRef = storeGisSvgRef;
|
||||
|
||||
/**
|
||||
* Adds controls for zooming and panning.
|
||||
*/
|
||||
@ -102,8 +94,6 @@ function addZoomPanControllers () {
|
||||
);
|
||||
}
|
||||
|
||||
window.addZoomPanControllers = addZoomPanControllers;
|
||||
|
||||
/**
|
||||
* Resizes the GIS visualization to fit into the space available.
|
||||
*/
|
||||
@ -370,3 +360,19 @@ AJAX.registerOnload('table/gis_visualization.js', function () {
|
||||
$('#tooltip').remove();
|
||||
});
|
||||
});
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
zoomAndPan: typeof zoomAndPan;
|
||||
selectVisualization: typeof selectVisualization;
|
||||
styleOSM: typeof styleOSM;
|
||||
storeGisSvgRef: typeof storeGisSvgRef;
|
||||
addZoomPanControllers: typeof addZoomPanControllers;
|
||||
}
|
||||
}
|
||||
|
||||
window.zoomAndPan = zoomAndPan;
|
||||
window.selectVisualization = selectVisualization;
|
||||
window.styleOSM = styleOSM;
|
||||
window.storeGisSvgRef = storeGisSvgRef;
|
||||
window.addZoomPanControllers = addZoomPanControllers;
|
||||
|
||||
@ -25,4 +25,10 @@ function extendingValidatorMessages () {
|
||||
});
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
extendingValidatorMessages: typeof extendingValidatorMessages;
|
||||
}
|
||||
}
|
||||
|
||||
window.extendingValidatorMessages = extendingValidatorMessages;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user