Commits

Hideya OHASHI committed 60efaef

user jquery instead of prototype.js

Comments (0)

Files changed (2)

 <title>jspass</title>
 <script type="text/javascript" src="md5.js"></script>
 <script type="text/javascript" src="base64.js"></script>
-<script type="text/javascript" src="prototype.js"></script>
+<script type="text/javascript" src="jquery-1.5.min.js"></script>
 <script type="text/javascript" src="password.js"></script>
 <script type="text/javascript" src="accounts.js"></script>
 </head>
-(function() {
+$(function() {
 	function hexstr2bin(str) {
 		var binstr = '';
 		for (var i = 0; i < str.length; i += 2) {
 		return html;
 	}
 
-	function handler() {
-		Event.stopObserving(window, "focus", handler);
-		setTimeout(function() {$('master_pass').focus();}, 100);
+	$('#master_pass').focus();
+	$('#password_table').html(getlinks());
+	for (var i = 0; i < accounts.length; i++) {
+		var account = accounts[i];
+		if (!accounts) break;
+		$('#p' + i).click(function() {
+			var master_pass = $('#master_pass').val();
+			if ($(this).text() != '?') return;
+			var no = $(this).attr('id').substr(1);
+			var account = accounts[no];
+			var url = account[0];
+			var user = account[1];
+			var salt = account[2];
+			var strlen = account[3];
+			var times = account[4];
+			var str = url + salt + user + master_pass;
+			if (times) {
+				for (var j = 0; j < times; j++) { str = str + str; }
+			}
+			var md5str = hex_md5(str);
+			var md5bin = hexstr2bin(md5str);
+			$(this).text(base64encode(md5bin).substr(0, strlen));
+		});
 	}
-
-	Event.observe(window, "focus", handler);
-	Event.observe(window, "load", function() {
-		$('password_table').innerHTML = getlinks();
-		for (var i = 0; i < accounts.length; i++) {
-			var account = accounts[i];
-			if (!accounts) break;
-			Event.observe($('p' + i), 'click', function() {
-				var master_pass = $('master_pass').value;
-				if (this.innerHTML != '?') return;
-				var no = this.id.substr(1);
-				var account = accounts[no];
-				var url = account[0];
-				var user = account[1];
-				var salt = account[2];
-				var strlen = account[3];
-				var times = account[4];
-				var str = url + salt + user + master_pass;
-				if (times) {
-					for (var j = 0; j < times; j++) { str = str + str; }
-				}
-				var md5str = hex_md5(str);
-				var md5bin = hexstr2bin(md5str);
-				this.innerHTML = base64encode(md5bin).substr(0, strlen);
-			});
-		}
-	});
-})();
+});