fahrplan_download.js: moar link mangling for srsly broken pentabarf exports
does not affect links to static pentabarf assets, they are fucked up beyond repair
This commit is contained in:
parent
5d132a207a
commit
a1fb5a31ad
|
@ -141,7 +141,8 @@ function Spider() {
|
||||||
this.see('/schedule/' + conference_id + '/index.de.html');
|
this.see('/schedule/' + conference_id + '/index.de.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
var normalizePath = function(path, from) {
|
/* link to download location */
|
||||||
|
function normalizePath(path, from) {
|
||||||
from = from || 'https://cccv.pentabarf.org/';
|
from = from || 'https://cccv.pentabarf.org/';
|
||||||
var uri = URL.parse(URL.resolve('https://cccv.pentabarf.org/', path));
|
var uri = URL.parse(URL.resolve('https://cccv.pentabarf.org/', path));
|
||||||
if (uri.hostname !== 'cccv.pentabarf.org')
|
if (uri.hostname !== 'cccv.pentabarf.org')
|
||||||
|
@ -149,11 +150,12 @@ var normalizePath = function(path, from) {
|
||||||
return uri.pathname;
|
return uri.pathname;
|
||||||
};
|
};
|
||||||
|
|
||||||
var manglePath = function(path) {
|
/* link rewriting for xhtml files */
|
||||||
|
function manglePath(path) {
|
||||||
var m;
|
var m;
|
||||||
if ((m = path.match(/^\/schedule\/\d+\/(.+)$/)))
|
if ((m = path.match(/^\/schedule\/\d+\/(.+)$/))) {
|
||||||
return baseDir + '/' + m[1];
|
return baseDir + '/' + m[1];
|
||||||
else if ((m = path.match(/^\/(xml|ical|xcal)\/(schedule|conference)\/\d+/))) {
|
} else if ((m = path.match(/^\/(xml|ical|xcal)\/(schedule|conference)\/\d+/))) {
|
||||||
var ext;
|
var ext;
|
||||||
switch(m[1]) {
|
switch(m[1]) {
|
||||||
case 'ical':
|
case 'ical':
|
||||||
|
@ -166,6 +168,10 @@ var manglePath = function(path) {
|
||||||
ext = m[1];
|
ext = m[1];
|
||||||
}
|
}
|
||||||
return baseDir + '/schedule.' + ext;
|
return baseDir + '/schedule.' + ext;
|
||||||
|
} else if ((m = path.match(/datenspuren\.de\/fahrplan\/(.*)$/))) {
|
||||||
|
var f = m[1];
|
||||||
|
f = f.replace(/day_(.+)\.html/, 'day/$1.html');
|
||||||
|
return '/fahrplan/' + f;
|
||||||
} else if (path.indexOf('://') >= 0)
|
} else if (path.indexOf('://') >= 0)
|
||||||
return path;
|
return path;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue