mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
web: fix js error on journal select field
This commit is contained in:
parent
a415759022
commit
43eee83c33
@ -379,7 +379,7 @@ addform _ vd@VD{..} = [hamlet|
|
||||
|
||||
journalselect :: [(FilePath,String)] -> HtmlUrl AppRoute
|
||||
journalselect journalfiles = [hamlet|
|
||||
<select id=journalselect name=journal onchange="journalSelect(event)">
|
||||
<select id=journalselect name=journal onchange="/*journalSelect(event)*/">
|
||||
$forall f <- journalfiles
|
||||
<option value=#{fst f}>#{fst f}
|
||||
|]
|
||||
|
@ -247,25 +247,6 @@ function addformDeletePosting() {
|
||||
if (focuslost) $('#addform tr.posting:last > td:first input:last').focus();
|
||||
}
|
||||
|
||||
function journalSelect(ev) {
|
||||
var textareas = $('textarea', $('form#editform'));
|
||||
for (i=0; i<textareas.length; i++) {
|
||||
textareas[i].style.display = 'none';
|
||||
textareas[i].disabled = true;
|
||||
}
|
||||
var targ = getTarget(ev);
|
||||
if (targ.value) {
|
||||
var journalid = targ.value+'_textarea';
|
||||
var textarea = document.getElementById(journalid);
|
||||
}
|
||||
else {
|
||||
var textarea = textareas[0];
|
||||
}
|
||||
textarea.style.display = 'block';
|
||||
textarea.disabled = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// SIDEBAR
|
||||
|
||||
@ -314,15 +295,32 @@ function enableTypeahead($el, suggester) {
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
// Get the current event's target in a robust way.
|
||||
// http://www.quirksmode.org/js/events_properties.html
|
||||
function getTarget(ev) {
|
||||
var targ;
|
||||
if (!ev) var ev = window.event;
|
||||
if (ev.target) targ = ev.target;
|
||||
else if (ev.srcElement) targ = ev.srcElement;
|
||||
if (targ.nodeType == 3) targ = targ.parentNode;
|
||||
return targ;
|
||||
}
|
||||
*/
|
||||
// function journalSelect(ev) {
|
||||
// var textareas = $('textarea', $('form#editform'));
|
||||
// for (i=0; i<textareas.length; i++) {
|
||||
// textareas[i].style.display = 'none';
|
||||
// textareas[i].disabled = true;
|
||||
// }
|
||||
// var targ = getTarget(ev);
|
||||
// if (targ.value) {
|
||||
// var journalid = targ.value+'_textarea';
|
||||
// var textarea = document.getElementById(journalid);
|
||||
// }
|
||||
// else {
|
||||
// var textarea = textareas[0];
|
||||
// }
|
||||
// textarea.style.display = 'block';
|
||||
// textarea.disabled = false;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// // Get the current event's target in a robust way.
|
||||
// // http://www.quirksmode.org/js/events_properties.html
|
||||
// function getTarget(ev) {
|
||||
// var targ;
|
||||
// if (!ev) var ev = window.event;
|
||||
// if (ev.target) targ = ev.target;
|
||||
// else if (ev.srcElement) targ = ev.srcElement;
|
||||
// if (targ.nodeType == 3) targ = targ.parentNode;
|
||||
// return targ;
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user