Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions content/assets/javascripts/redirect_old_links.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ $(function redirect_old_links() {
var url = new URL(window.location);
var params = url.searchParams

const spec_re = /.*\?=spec.*/
const spec_re = /.*elem=.*/
const tutorials_re = /.*\?tut=.*/

var new_loc = null

if (spec_re.test(url.search)) {
if (url.pathname = "/spec/" && spec_re.test(url.search)) {
var ver = params.get('ver');
var elem = params.get('elem');
if (ver && elem) {
Expand Down Expand Up @@ -51,13 +51,13 @@ $(function redirect_old_links() {
} else {
new_loc = "/404/"
}
if (new_loc) {
var new_url = new URL('<%= @config[:base_url] %>')
new_url.pathname += new_loc
new_url.hash = url.hash
window.location.href = new_url
}
}

if (new_loc) {
var new_url = new URL('<%= @config[:base_url] %>')
new_url.pathname += new_loc
new_url.hash = url.hash
window.location.href = new_url
}

})