Skip to content
Snippets Groups Projects
Commit 59e7dae6 authored by Benedikt's avatar Benedikt
Browse files

changed to plain javaScript

parent 83328e63
Branches
Tags
No related merge requests found
Showing
with 33 additions and 75 deletions
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="bokeh" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/dcc-viewer.iml" filepath="$PROJECT_DIR$/.idea/dcc-viewer.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<head> <head>
<meta charset='UTF-8'> <meta charset='UTF-8'>
<title>DCC Viewer</title> <title>DCC Viewer</title>
<script type='module' src='dist/main.js'></script> <script type='module' src='/src/main.js'></script>
<link rel='stylesheet' href='styles.css'> <link rel='stylesheet' href='/styles.css'>
</head> </head>
<body> <body>
<input type='file' id='file-input' accept='.xml'> <input type='file' id='file-input' accept='.xml'>
......
export class BaseViewer {
constructor(sectionData) {
this.sectionData = sectionData;
}
render() {
throw new Error('render() must be implemented in subclasses');
}
}
\ No newline at end of file
export abstract class BaseViewer {
protected sectionData: any;
constructor(sectionData: any) {
this.sectionData = sectionData;
}
abstract render(): HTMLElement;
}
\ No newline at end of file
import { BaseViewer } from './BaseViewer'; import { BaseViewer } from './BaseViewer.js';
export class JSONTreeViewer extends BaseViewer { export class JSONTreeViewer extends BaseViewer {
render(): HTMLElement { render() {
const container = document.createElement('pre'); const container = document.createElement('pre');
container.textContent = JSON.stringify(this.sectionData, null, 2); container.textContent = JSON.stringify(this.sectionData, null, 2);
return container; return container;
......
export const globalData = {};
\ No newline at end of file
export const globalData: { [key: string]: any } = {};
\ No newline at end of file
File moved
export const idRegistry = {};
\ No newline at end of file
export const idRegistry: { [id: string]: any } = {};
\ No newline at end of file
import { convertXMLToJSON } from './xmlToJson'; import { convertXMLToJSON } from './xmlToJson.js';
import { JSONTreeViewer } from './components/JSONTreeViewer'; import { JSONTreeViewer } from './components/JSONTreeViewer.js';
const fileInput = document.getElementById('file-input') as HTMLInputElement; const fileInput = document.getElementById('file-input');
const container = document.getElementById('json-container') as HTMLElement; const container = document.getElementById('json-container');
fileInput.addEventListener('change', async (event) => { fileInput.addEventListener('change', async (event) => {
const file = (event.target as HTMLInputElement).files?.[0]; const file = event.target.files?.[0];
if (!file) return; if (!file) return;
const reader = new FileReader(); const reader = new FileReader();
reader.onload = async () => { reader.onload = async () => {
const xmlString = reader.result as string; const xmlString = reader.result;
const jsonData = await convertXMLToJSON(xmlString); const jsonData = await convertXMLToJSON(xmlString);
const viewer = new JSONTreeViewer(jsonData); const viewer = new JSONTreeViewer(jsonData);
container.innerHTML = ''; container.innerHTML = '';
......
import { globalOptions } from '../globalOptions'; import { globalOptions } from '../globalOptions.js';
const languageSelect = document.getElementById('language-select') as HTMLSelectElement; const languageSelect = document.getElementById('language-select');
languageSelect.addEventListener('change', (event) => { languageSelect.addEventListener('change', (event) => {
globalOptions.preferredLanguage = (event.target as HTMLSelectElement).value; globalOptions.preferredLanguage = event.target.value;
}); });
\ No newline at end of file
const themeToggle = document.getElementById('theme-toggle') as HTMLButtonElement; const themeToggle = document.getElementById('theme-toggle');
themeToggle.addEventListener('click', () => { themeToggle.addEventListener('click', () => {
document.body.classList.toggle('dark-mode'); document.body.classList.toggle('dark-mode');
}); });
\ No newline at end of file
export function getLocalizedText(elements: any[]): string { export function getLocalizedText(elements) {
if (!Array.isArray(elements)) return elements; if (!Array.isArray(elements)) return elements;
return elements[0]._ || ''; return elements[0]._ || '';
} }
\ No newline at end of file
import { JSONTreeViewer } from './components/JSONTreeViewer.js';
export function getViewerForElement() {
return JSONTreeViewer;
}
\ No newline at end of file
import { JSONTreeViewer } from './components/JSONTreeViewer';
export function getViewerForElement(): any {
return JSONTreeViewer;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment