Skip to content

Commit

Permalink
correct progress for getting templatepath - #9
Browse files Browse the repository at this point in the history
  • Loading branch information
TRMSC committed Nov 5, 2023
1 parent 44f0a41 commit bc03b93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,12 @@ generateScene = () => {
let templateName = document.getElementById('imagescene-template').value;

// Build path
const baseUrl = new URL(window.location.href);
let relativePath = '../templates/' + templateName + '.raw';
let absolutePath = new URL(relativePath, baseUrl).href;
let templatePath = absolutePath.includes('github') ? absolutePath.replace('/blob/', '/raw/') : relativePath;
console.log('path is ' + templatePath);
const baseUrl = window.location.href;
const originPath = 'https://raw.githubusercontent.com/TRMSC/imagescene-generator/main/templates/';
const relativePath = '../templates/';
let templatePath = baseUrl.includes('github.io') ? originPath : relativePath;
templatePath = templatePath + templateName + '.raw';
console.log(templatePath);

// Fetch template content
let templateContent = '';
Expand Down

0 comments on commit bc03b93

Please sign in to comment.