og: fix links to textfiles

This commit is contained in:
ed 2024-09-08 12:12:34 +00:00
parent b0de84cbc5
commit e5a836cb7d

View file

@ -4032,11 +4032,12 @@ function eval_hash() {
break; break;
} }
if (mi && img_re.exec(og_fn)) var ch = !mi ? '' :
hash0 = '#g' + mi.id; img_re.exec(og_fn) ? 'g' :
ebi('a' + mi.id) ? 'a' :
'';
if (ebi('a' + mi.id)) hash0 = ch ? ('#' + ch + mi.id) : '';
hash0 = '#a' + mi.id;
} }
var v = hash0; var v = hash0;
@ -4077,14 +4078,14 @@ function eval_hash() {
} }
} }
if (v.indexOf('#q=') === 0) { if (v.startsWith('#q=')) {
goto('search'); goto('search');
var i = ebi('q_raw'); var i = ebi('q_raw');
i.value = uricom_dec(v.slice(3)); i.value = uricom_dec(v.slice(3));
return i.onkeydown({ 'key': 'Enter' }); return i.onkeydown({ 'key': 'Enter' });
} }
if (v.indexOf('#v=') === 0) { if (v.startsWith('#v=')) {
goto(v.slice(3)); goto(v.slice(3));
return; return;
} }
@ -5244,6 +5245,12 @@ var showfile = (function () {
return srch.split(/[?&]doc=/)[1].split('&')[0]; return srch.split(/[?&]doc=/)[1].split('&')[0];
}; };
if (window.og_fn) {
var ext = og_fn.split(/\./g).pop();
if (r.map['.' + ext])
hist_replace(get_evpath() + '?doc=' + og_fn);
}
window.Prism = { 'manual': true }; window.Prism = { 'manual': true };
var em = QS('#bdoc>pre'); var em = QS('#bdoc>pre');
if (em) if (em)