Skip to content

Commit

Permalink
Merge pull request #62 from NMSCD/dev
Browse files Browse the repository at this point in the history
fix input validation limits
  • Loading branch information
Lenni009 authored Jun 5, 2024
2 parents 2184c8f + 583a0bf commit 882bb15
Show file tree
Hide file tree
Showing 20 changed files with 437 additions and 385 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ updates:
target-branch: 'dev'
schedule:
interval: 'weekly'

- package-ecosystem: 'github-actions'
directory: '/'
target-branch: 'dev'
schedule:
interval: 'weekly'
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ console.log(galacticConversionResult); /*
import type { VoxelCoordinates } from '@nmscd/coordinate-conversion';

type VoxelCoordinates = {
voxelX: number;
voxelY: number;
voxelZ: number;
solarSystemIndex: number;
planetIndex: number;
VoxelX: number;
VoxelY: number;
VoxelZ: number;
SolarSystemIndex: number;
PlanetIndex: number;
};
```

Expand Down
4 changes: 2 additions & 2 deletions example/assets/custom.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

hljs.highlightAll();

const voxelObj = { "voxelX": 563, "voxelY": 86, "voxelZ": 181, "solarSystemIndex": 5, "planetIndex": 1 };
const voxelObj = { "VoxelX": 563, "VoxelY": 86, "VoxelZ": 181, "SolarSystemIndex": 5, "PlanetIndex": 1 };
const voxelString = JSON.stringify(voxelObj, null, ' ');

const portalToVoxElem = document.getElementById('portaltoVoxel');
Expand Down Expand Up @@ -114,4 +114,4 @@ function onVoxelCoord(disableInputValidation) {

onPortalCode(true);
onGalacticCoord(true);
onVoxelCoord(true);
onVoxelCoord(true);
18 changes: 11 additions & 7 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@
<script type="text/javascript" defer src="./assets/highlight.min.js"></script>

<script>
let coordinateConversionJsFile = 'https://nmscd.com/Coordinate-Conversion/bundle.js';
const currentUrl = window.location.href;
if (currentUrl.includes('localhost') || currentUrl.includes('file://')) {
let coordinateConversionJsFile = './assets/bundle.js';
const localHosts = ['127.0.0.1', 'localhost'];
if (localHosts.includes(location.hostname) || window.location.protocol === 'file:') {
console.log('Adding local version of library');
coordinateConversionJsFile = '../dist/coordinate-conversion.umd.cjs'
}
const script = document.createElement('script');
script.setAttribute('src', '');
script.setAttribute('defer', true);
script.src = coordinateConversionJsFile;
script.defer = true;
document.head.appendChild(script);

const customScript = document.createElement('script');
customScript.src = './assets/custom.js';
customScript.defer = true;

script.onload = () => document.head.appendChild(customScript);
</script>
</head>

Expand Down Expand Up @@ -141,8 +147,6 @@ <h2 class="noselect">Example conversions</h2>
<span>Styled with with <a href="https://picocss.com">Pico</a></span>
</small>
</footer>

<script type="text/javascript" defer src="./assets/custom.js"></script>
</body>

</html>
Loading

0 comments on commit 882bb15

Please sign in to comment.