mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-29 20:36:45 +00:00
refactor(gui): linting
Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
This commit is contained in:
@@ -1,42 +1,43 @@
|
||||
// Ref : https://stackoverflow.com/a/12002275
|
||||
|
||||
//Tested in Mozilla Firefox browser, Chrome
|
||||
function ReadFileAllBrowsers(FileElement, CallBackFunction) {
|
||||
// Tested in Mozilla Firefox browser, Chrome
|
||||
function ReadFileAllBrowsers (FileElement, CallBackFunction) {
|
||||
try {
|
||||
if (!FileElement.files || !FileElement.files.length) return CallBackFunction();
|
||||
if (!FileElement.files || !FileElement.files.length) { return CallBackFunction() }
|
||||
|
||||
const file = FileElement.files[0];
|
||||
const file = FileElement.files[0]
|
||||
|
||||
if (file) {
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(file, "UTF-8");
|
||||
const reader = new FileReader()
|
||||
reader.readAsText(file, 'UTF-8')
|
||||
reader.onload = function (evt) {
|
||||
CallBackFunction(evt.target.result);
|
||||
CallBackFunction(evt.target.result)
|
||||
}
|
||||
reader.onerror = function (evt) {
|
||||
CallBackFunction()
|
||||
}
|
||||
}
|
||||
} catch (Exception) {
|
||||
const fall_back = ieReadFile(FileElement.value);
|
||||
if (fall_back != false) {
|
||||
CallBackFunction(fall_back);
|
||||
const fallBack = ieReadFile(FileElement.value)
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (fallBack != false) {
|
||||
CallBackFunction(fallBack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///Reading files with Internet Explorer
|
||||
function ieReadFile(filename) {
|
||||
/// Reading files with Internet Explorer
|
||||
function ieReadFile (filename) {
|
||||
try {
|
||||
const fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
const fh = fso.OpenTextFile(filename, 1);
|
||||
const contents = fh.ReadAll();
|
||||
fh.Close();
|
||||
return contents;
|
||||
// eslint-disable-next-line no-undef
|
||||
const fso = new ActiveXObject('Scripting.FileSystemObject')
|
||||
const fh = fso.OpenTextFile(filename, 1)
|
||||
const contents = fh.ReadAll()
|
||||
fh.Close()
|
||||
return contents
|
||||
} catch (Exception) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default ReadFileAllBrowsers;
|
||||
export default ReadFileAllBrowsers
|
||||
|
||||
Reference in New Issue
Block a user