mamamia5x / markdownpedia

A site similar to Wikipedia written in Markdown.
https://markdownpedia.tk/
Other
16 stars 33 forks source link

Is the script to format the URL necessary? #38

Open ssgabrieldev opened 3 years ago

ssgabrieldev commented 3 years ago

First I'm sorry for the English.

img1

I realized that what was generating this error was the javasscript scripts in the templates.html file:

var source = document.getElementById('icon').href.replace('markdownpedia.tk', window.location.hostname);

document.getElementById('icon').href = source;
source = document.getElementById('style').href.replace('markdownpedia.tk', window.location.hostname);
document.getElementById('style').href = source;

var tag = document.createElement('script');
var things = 'https://markdownpedia.tk/server/vital/search.js';

tag.src = things.replace('markdownpedia.tk', window.location.hostname);
document.getElementsByTagName('head')[0].appendChild(tag);

It swaps the host from markdownpedia.tk to the local host, but does not change the protocol. As it was running locally the protocol used is http, but to load the css it used https.

So analyzing the code more I realized that this script is not necessary, (or maybe it is depending on how you are hosting the site, in this case i'm sorry for opening this issue), because HTML itself is already capable of doing this replacement.

img2

OBS: If this is confirmed as a problem and not something intentional, I put myself at your disposal to make a PR fixing the problem

mamamia5x commented 3 years ago

This is an issue, I created that script because I didn't want the sites css to be used. While you can do server/vital/style.css as the source, I was planning on changing the css URL, so I wasn't sure what to do. If you'd like to replace all the references with relative URLs, you can go right ahead and do so. Thanks for your help.

shatanov commented 2 years ago

Hi, the task seems to me necessary, if it is free, I could try to do it?