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() { ...@@ -66,13 +66,27 @@ document.addEventListener('DOMContentLoaded', function() {
////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
function replaceSelector(url, desiredSelector){ function replaceSelector(url, desiredSelector){
var parts=url.split("/"); var mainParts = url.split(/(?=[?#])/g);
var name = parts.pop(); if(!name){name=parts.pop();} var baseUrl = mainParts[0];
var bits = name.split(".");
var base = bits.shift(); var parts= baseUrl.split("/");
var extension = bits.pop(); var name = parts.pop();
parts.push(base + "." + desiredSelector + (desiredSelector?".":"") + extension); if(!name){
return parts.join("/"); name=parts.pop();
}
var bits = name.split(".");
var base = bits.shift();
var extension = bits.pop() || "html";
parts.push(base + "." + desiredSelector + (desiredSelector?".":"") + extension);
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; window.BL.replaceSelector = replaceSelector;
...@@ -316,7 +330,3 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -316,7 +330,3 @@ document.addEventListener('DOMContentLoaded', function() {
window.BL.loadLibrary(); window.BL.loadLibrary();
}, false); }, 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