First attempt at adding ZeroClipboard auto-copy.

This commit is contained in:
Andrew Tomaka 2011-12-06 00:53:47 -05:00
parent 6bcf3071bf
commit 9df7a9671b
3 changed files with 43 additions and 8 deletions

View file

@ -65,8 +65,13 @@ input:focus {
button { button {
width: 100%; width: 100%;
cursor: pointer;
} }
.form_row { .form_row {
margin-bottom: 10px; margin-bottom: 10px;
} }
.hidden {
/*text-indent: -9999px;*/
}

View file

@ -18,7 +18,7 @@
<h1>Passwdgen v1.0</h1> <h1>Passwdgen v1.0</h1>
</div> </div>
<div id="generate"> <div id="generate">
<form action="" method="post" id="generate"> <!-- <form action="" method="post" id="generate"> -->
<div class="form_row"> <div class="form_row">
<label for="root">Root Domain:</label> <label for="root">Root Domain:</label>
<input type="text" id="root" name="root" /> <input type="text" id="root" name="root" />
@ -29,26 +29,44 @@
</div> </div>
<div class="form_row"> <div class="form_row">
<button type="submit">Generate</button> <button type="submit" id="submit">Generate and Copy to Clipboard</button>
</div> </div>
</form> <!-- </form> -->
<div class="form_row">
<label for="master">Site Password:</label>
<input type="password" id="password" name="password" autocomplete="off" />
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="hidden">
<input type="text" id="password" /> <button id="copy">Copy</button>
</div>
<script type="text/javascript"> <script type="text/javascript">
head.js('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js'); head.js('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js');
head.js('js/jquery.corner.min.js'); head.js('js/jquery.corner.min.js');
head.js('js/jquery.zclip.min.js');
head.ready(function() { head.ready(function() {
$('input').corner('round 4px'); $('input').corner('round 4px');
$('button').corner('round 4px'); $('button').corner('round 4px');
$('#box').corner('round bottom'); $('#box').corner('round bottom');
$('#submit').click(function() {
$.post('generate.php', {
root: $('#root').val(),
master: $('#master').val()
},
function(data) {
$('#password').val(data.password);
$('#copy').zclip({
path: 'http://zeroclipboard.googlecode.com/svn-history/r10/trunk/ZeroClipboard.swf',
copy: $('#password').val(),
});
$('#copy').click();
},
'json'
);
});
}); });
</script> </script>
</body> </body>

12
js/jquery.zclip.min.js vendored Executable file

File diff suppressed because one or more lines are too long