0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-09-21 19:46:23 -04:00

SMJS: Give user scripts access to the view_state

Introduce the view_state object to ECMAScript with properties .uri and
.plain and pass the current view_state to preformat hooks.
This commit is contained in:
Miciah Dashiel Butler Masters
2006-01-28 03:23:17 +00:00
committed by Miciah Dashiel Butler Masters
parent 3b183c1685
commit 495fb2805b
6 changed files with 137 additions and 9 deletions

View File

@@ -8,9 +8,9 @@ elinks.keymaps.main["@"] = function () {
};
elinks.preformat_html_hooks = new Array();
elinks.preformat_html = function (cached) {
elinks.preformat_html = function (cached, vs) {
for (var i in elinks.preformat_html_hooks)
if (!elinks.preformat_html_hooks[i](cached))
if (!elinks.preformat_html_hooks[i](cached, vs))
return false;
return true;
@@ -36,13 +36,13 @@ elinks.follow_url_hook = function (url) {
return url;
};
function root_w00t(cached) {
function root_w00t(cached, vs) {
cached.content = cached.content.replace(/root/g, "w00t");
return true;
};
elinks.preformat_html_hooks.push(root_w00t);
function mangle_deb_bugnumbers(cached) {
function mangle_deb_bugnumbers(cached, vs) {
if (!cached.uri.match(/^[a-z0-9]+:\/\/[a-z0-9A-Z.-]+debian\.org/)
&& !cached.uri.match(/changelog\.Debian/))
return true;