Add extra directories to Download library

Former-commit-id: 407bef0caa3810a477130a050accadf5ac03aaa7 [formerly 1e7d26c1b2de0e03c271dee033e5c87722b2582f [formerly 375a407d68fd5dd7fd9d3fd22cbb8f320bf60859]]
Former-commit-id: f4d5c70d538b00ae721bf6d48830c2d76d1153f6
Former-commit-id: f92cf2932565cdc6ab76d5be2b6cfd83a26dd45b
This commit is contained in:
Jaifroid 2021-08-11 07:37:33 +03:00
parent 964b869bc1
commit 6339fce284

View File

@ -527,6 +527,11 @@ define([], function () {
// Remove unused README file
doc = doc.replace(/^<a\s+href\b[^<]+README.+$[\r\n]*/m, '');
}
// Add in some directories from hidden
if (/wikipedia\//.test(doc)) {
doc = doc.replace(/^(<a\b.+gutenberg\/)(<\/a>\s\s)([^<]+)/m, '<a href="#">custom_apps/</a>$3$1$2$3');
doc = doc.replace(/^(<a\b.+gutenberg\/)(<\/a>)([^<]+)/m, '<a href="#">endless/$2 $3$1$2$3');
}
var stDoc; // Placeholder for standardized doc to be used to get arrays
if (/^[^_\n\r]+_([^_\n\r]+)_.+\.zi[mp].+$/m.test(doc)) {
//Delete lines that do not match regexpFilter (this ensures packaged apps only show ZIMs appropriate to the package)
@ -753,11 +758,14 @@ define([], function () {
var dateID = dateSel ? dateSel.value : '';
var subjID = subjSel ? subjSel.value : '';
var replaceURL = URL + this.text;
replaceURL = /custom_apps\//.test(this.text) ? URL + '.hidden/' + this.text : replaceURL;
replaceURL = /endless\//.test(this.text) ? URL + '.hidden/' + this.text : replaceURL;
//Allow both zim and zip format
if (/\.zi[mp]$/i.test(this.text)) {
replaceURL = replaceURL + ".meta4";
} else if (/parent\s*directory/i.test(this.text)) {
replaceURL = URL.replace(/\/[^\/]*\/$/i, '\/');
replaceURL = replaceURL.replace(/\.hidden\//, '');
} else if (/Name|Size|Last\smodified|Description/.test(this.text)) {
replaceURL = this.getAttribute('href').replace(/;/g, '&');
replaceURL = URL + replaceURL;