commit eb67dc610ff82bdfec80810e356cd1c4ecd466a7
parent 8ee85627690fa96ff1662d37174dedb05f940923
Author: Alexander Burger <abu@software-lab.de>
Date: Sun, 10 Mar 2013 07:25:38 +0100
'+Img' class generalized, JS part
Diffstat:
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/lib/form.js b/lib/form.js
@@ -1,4 +1,4 @@
-/* 27feb13abu
+/* 09mar13abu
* (c) Software Lab. Alexander Burger
*/
@@ -151,8 +151,30 @@ function post(form, file) {
fld.href = decodeURIComponent(txt[i++].substr(1));
}
}
- else if (fld.tagName == "IMG")
+ else if (fld.tagName == "IMG") {
+ var parent = fld.parentNode;
+
fld.src = val;
+ fld.alt = txt[i++];
+ if (parent.tagName == "A") {
+ if (txt[i])
+ parent.href = decodeURIComponent(txt[i]);
+ else {
+ grand = parent.parentNode;
+ grand.removeChild(parent);
+ grand.appendChild(fld);
+ }
+ }
+ else if (txt[i]) {
+ var a = document.createElement("A");
+
+ parent.removeChild(fld);
+ parent.appendChild(a);
+ a.appendChild(fld);
+ a.href = decodeURIComponent(txt[i]);
+ }
+ ++i;
+ }
else {
if (fld.custom != null)
putCustom(fld.custom, val);
diff --git a/lib/form.l b/lib/form.l
@@ -1,4 +1,4 @@
-# 05mar13abu
+# 09mar13abu
# (c) Software Lab. Alexander Burger
# *PRG *Top *Gui *Btn *Get *Got *Form *Evt *Lock *Spans
@@ -1491,7 +1491,10 @@
(super) )
(dm js> ()
- (ht:Fmt (sesId (or (: img) "@img/no.png"))) )
+ (pack
+ (ht:Fmt (sesId (or (: img) "@img/no.png"))) '&
+ (eval (: alt)) '&
+ (and (eval (: url)) (ht:Fmt (sesId @))) ) )
(dm show> ("Var")
(showFld