}).catch(error => alert(error));
return false;
};
+
+ let imgpreview = document.getElementById('sourcepreview');
+ if (imgpreview) {
+ let imginput = document.getElementById('source');
+ let previewbutton = imginput.parentNode.appendChild(document.createElement('button'));
+ previewbutton.type = 'button';
+ previewbutton.append('View');
+ previewbutton.onclick = () => {
+ previewbutton.childNodes[0].nodeValue = imgpreview.hidden ? 'Hide' : 'View';
+ imgpreview.hidden = !imgpreview.hidden;
+ };
+ }
});
select {
padding: .3rem .2rem; /* TODO: input */
}
-form > ul li img {
- max-width: 300px;
-}
ul.popup {
display: flex;
form => 'Translation',
alt => 'Synonyms',
wptitle => 'Wikipedia',
- source => 'Image URL',
+ source => 'Image',
thumb => 'Convert options',
prio => 'Level',
cover => undef, # included with prio
}
else {
printf '<input id="%s" name="%1$s" value="%s" />', $col, Entity($val);
- -e and printf '<img src="/%s" alt="%s" />', $_, $row->{form} for
- $col eq 'source' ? "data/word/org/$row->{id}.jpg" :
- $col eq 'thumb' ? "data/word/eng/$row->{form}.jpg" :
- ();
+ -e and printf '<img src="/%s" alt="%s" />', $_, $row->{form}
+ for $col eq 'thumb' ? "data/word/eng/$row->{form}.jpg" : ();
}
print '</span>';
+ -e and printf('<img id="%spreview" src="/%s" alt="%s" hidden />',
+ $col, $_, $row->{form}
+ ) for $col eq 'source' ? "data/word/org/$row->{id}.jpg" : ();
say '</p></li>';
}
:>