Removed some unnecessary HTML code

Displaying it with JavaScript instead
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2013-02-26 02:18:39 +01:00
parent f72cec984e
commit 4bb7dfadbc
3 changed files with 27 additions and 13 deletions

View File

@ -4,21 +4,20 @@ var passwords_visible = false;
function pwitem_update() { function pwitem_update() {
$('#error').html(''); $('#error').html('');
$('#passwordinfo').html('Fetching...'); $('#passwordinfo').hide();
$('#info').html('Fetching...');
$.post('getpw.php', { id: $(this).attr('id').replace(/^pw_/, '') }, function(pwxml) { $.post('getpw.php', { id: $(this).attr('id').replace(/^pw_/, '') }, function(pwxml) {
pwinfo = $('result', pwxml); pwinfo = $('result', pwxml);
if (pwinfo.length > 0) if (pwinfo.length > 0)
{ {
$('#passwordinfo').html( $('#passwordinfo > ul > li:eq(0) > span').html($('short', pwinfo).text());
'<ul>' + $('#passwordinfo > ul > li:eq(1) > span').html($('long', pwinfo).text());
'<li>Short description: ' + $('short', pwinfo).text() + '</li>' + $('#passwordinfo > ul > li:eq(2) > span').html($('username', pwinfo).text());
'<li>Long description: ' + $('long', pwinfo).text() + '</li>' + $('#passwordinfo > ul > li:eq(3) > span').html($('password', pwinfo).text());
'<li>Username: ' + $('username', pwinfo).text() + '</li>' + $('#passwordinfo > ul > li:eq(4) > span').html($('additional', pwinfo).text());
'<li>Password: ' + $('password', pwinfo).text() + '</li>' + $('#info').html('');
'<li>Additional information: ' + $('additional', pwinfo).text() + '</li>' + $('#passwordinfo').show();
'</ul>'
);
} }
}); });
}; };
@ -78,7 +77,7 @@ $(document).ready(function() {
$('#error').html(''); $('#error').html('');
$('#info').html(''); $('#info').html('');
$('#results').html(''); $('#results').html('');
$('#passwordinfo').html(''); $('#passwordinfo').hide();
$('#query').val(''); $('#query').val('');
if (groups_visible) if (groups_visible)
{ {
@ -131,7 +130,7 @@ $(document).ready(function() {
$('#showpasswordgroups').click(function(e) { $('#showpasswordgroups').click(function(e) {
$('#passwordgroups').show(); $('#passwordgroups').show();
$('#passwords').hide(); $('#passwords').hide();
$('#passwordinfo').html(''); $('#passwordinfo').hide();
}); });
}); });

View File

@ -70,3 +70,7 @@ span.button {
display: none; display: none;
} }
#passwordinfo {
display: none;
}

View File

@ -73,5 +73,16 @@
</div> </div>
<span id="showpasswordgroups" class="button">Back to password groups</span> <span id="showpasswordgroups" class="button">Back to password groups</span>
</div> </div>
<div id="passwordinfo"></div> <div id="passwordinfo">
<ul>
<li><strong>Short description</strong>: <span></span></li>
<li><strong>Long description</strong>: <span></span></li>
<li><strong>Username</strong>: <span></span></li>
<li><strong>Password</strong>: <span></span></li>
<li>
<strong>Additional information</strong>:<br />
<span></span>
</li>
</ul>
</div>
{include file="foot.tpl"} {include file="foot.tpl"}