"Kelly Jones" <[EMAIL PROTECTED]> writes:

> Is there a "current_image()" or similar function to show me the URL of
> the image I'm hovering over, even if the image is inside a hyperlink?

There is no such function, but it seems easy to add one.
Try this patch.  I am not pushing it to the repository yet.

Lua: new function current_image

---
commit 7283fa030a4275738b8ecc139fb14935b3ab55dd
tree a9d2ed8dc5d97720304adf1adc3330d4ce696d5b
parent 0cb047b298c625d2dd8deff68854bf905cc557b3
author Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Mon, 30 Jul 2007 17:12:21 +0300
committer Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Mon, 30 Jul 2007 17:12:21 
+0300

 src/scripting/lua/core.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c
index 8aec3a9..10559a3 100644
--- a/src/scripting/lua/core.c
+++ b/src/scripting/lua/core.c
@@ -114,6 +114,20 @@ l_current_link(LS)
 }
 
 static int
+l_current_image(LS)
+{
+       struct link *link = get_current_session_link(lua_ses);
+
+       if (link && link->where_img) {
+               lua_pushstring(S, link->where_img);
+       } else {
+               lua_pushnil(S);
+       }
+
+       return 1;
+}
+
+static int
 l_current_title(LS)
 {
        struct document_view *doc_view = current_frame(lua_ses);
@@ -680,6 +694,7 @@ init_lua(struct module *module)
        lua_register(L, LUA_ALERT, l_alert);
        lua_register(L, "current_url", l_current_url);
        lua_register(L, "current_link", l_current_link);
+       lua_register(L, "current_image", l_current_image);
        lua_register(L, "current_title", l_current_title);
        lua_register(L, "current_document", l_current_document);
        lua_register(L, "current_document_formatted", 
l_current_document_formatted);
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users

Reply via email to