Commit 741bd990 authored by Michael Seaholm's avatar Michael Seaholm

Merge branch 'feature/cs-165' of gitlab.entropy.cc:blacklight/bl-edit into release

parents 85a7e6f1 875747f1
......@@ -66,13 +66,27 @@ document.addEventListener('DOMContentLoaded', function() {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function replaceSelector(url, desiredSelector){
var parts=url.split("/");
var name = parts.pop(); if(!name){name=parts.pop();}
var mainParts = url.split(/(?=[?#])/g);
var baseUrl = mainParts[0];
var parts= baseUrl.split("/");
var name = parts.pop();
if(!name){
name=parts.pop();
}
var bits = name.split(".");
var base = bits.shift();
var extension = bits.pop();
var extension = bits.pop() || "html";
parts.push(base + "." + desiredSelector + (desiredSelector?".":"") + extension);
return parts.join("/");
var fullPath = parts.join("/");
//add back the hash and query if they exist.
var addOns = mainParts.slice(1);
if(addOns) {
fullPath = fullPath + addOns.join("");
}
return fullPath;
}
window.BL.replaceSelector = replaceSelector;
......@@ -316,7 +330,3 @@ document.addEventListener('DOMContentLoaded', function() {
window.BL.loadLibrary();
}, false);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment