Online editor: check the url to load from a branch

This commit is contained in:
Olivier Goffart 2021-07-01 09:35:03 +02:00
parent 19d4fa17ab
commit d51ea1429d

View file

@ -61,7 +61,12 @@ export Demo := Window {
let select = (<HTMLInputElement>document.getElementById("select_combo"));
function select_combo_changed() {
if (select.value) {
load_from_url("https://raw.githubusercontent.com/sixtyfpsui/sixtyfps/master/" + select.value);
let tag = "master";
var found;
if (found = window.location.pathname.match(/releases\/([^\/]*)\/editor/)) {
tag = "v" + found[1];
}
load_from_url(`https://raw.githubusercontent.com/sixtyfpsui/sixtyfps/${tag}/${select.value}`);
} else {
clearTabs();
base_url = "";