-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
120 lines (113 loc) · 7.31 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script>
// Minified version of isMobile included in the HTML since it's small
!function(a){var b=/iPhone/i,c=/iPod/i,d=/iPad/i,e=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,f=/Android/i,g=/(?=.*\bAndroid\b)(?=.*\bSD4930UR\b)/i,h=/(?=.*\bAndroid\b)(?=.*\b(?:KFOT|KFTT|KFJWI|KFJWA|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|KFARWI|KFASWI|KFSAWI|KFSAWA)\b)/i,i=/IEMobile/i,j=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,k=/BlackBerry/i,l=/BB10/i,m=/Opera Mini/i,n=/(CriOS|Chrome)(?=.*\bMobile\b)/i,o=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,p=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),q=function(a,b){return a.test(b)},r=function(a){var r=a||navigator.userAgent,s=r.split("[FBAN");return"undefined"!=typeof s[1]&&(r=s[0]),s=r.split("Twitter"),"undefined"!=typeof s[1]&&(r=s[0]),this.apple={phone:q(b,r),ipod:q(c,r),tablet:!q(b,r)&&q(d,r),device:q(b,r)||q(c,r)||q(d,r)},this.amazon={phone:q(g,r),tablet:!q(g,r)&&q(h,r),device:q(g,r)||q(h,r)},this.android={phone:q(g,r)||q(e,r),tablet:!q(g,r)&&!q(e,r)&&(q(h,r)||q(f,r)),device:q(g,r)||q(h,r)||q(e,r)||q(f,r)},this.windows={phone:q(i,r),tablet:q(j,r),device:q(i,r)||q(j,r)},this.other={blackberry:q(k,r),blackberry10:q(l,r),opera:q(m,r),firefox:q(o,r),chrome:q(n,r),device:q(k,r)||q(l,r)||q(m,r)||q(o,r)||q(n,r)},this.seven_inch=q(p,r),this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch,this.phone=this.apple.phone||this.android.phone||this.windows.phone,this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet,"undefined"==typeof window?this:void 0},s=function(){var a=new r;return a.Class=r,a};"undefined"!=typeof module&&module.exports&&"undefined"==typeof window?module.exports=r:"undefined"!=typeof module&&module.exports&&"undefined"!=typeof window?module.exports=s():"function"==typeof define&&define.amd?define("isMobile",[],a.isMobile=s()):a.isMobile=s()}(this);
// My own arbitrary use of isMobile, as an example
(function () {
var MOBILE_SITE = 'mobile/index.html', // site to redirect to
NO_REDIRECT = 'noredirect'; // cookie to prevent redirect
// I only want to redirect iPhones, Android phones and a handful of 7" devices
if (isMobile.apple.phone || isMobile.android.phone || isMobile.seven_inch) {
// Only redirect if the user didn't previously choose
// to explicitly view the full site. This is validated
// by checking if a "noredirect" cookie exists
if ( document.cookie.indexOf(NO_REDIRECT) === -1 ) {
document.location += MOBILE_SITE;
}
}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
<title>Password Generator for pezy</title>
<link rel="stylesheet" href="css/primer.css">
<link rel="stylesheet" href="octicons/octicons.css">
<link rel="stylesheet" href="css/password.css">
<link rel="shortcut icon" href="favicon.ico" />
<script src="js/jquery-3.0.0.min.js"></script>
<script src="js/clipboard.min.js"></script>
<script src="js/sha.js"></script>
<script src="js/jquery.qrcode.min.js"></script>
<script>
$(document).ready(function(){
$('#showPassword').click(function() {
var info = new Object();
info.id = $('#ID').val().trim();
info.app = $('#APP').val().toLowerCase().trim();
var infoText = JSON.stringify(info);
var key = $('#KEY').val();
var hmacObj = new jsSHA('SHA-1', 'TEXT');
hmacObj.setHMACKey(key, 'TEXT');
hmacObj.update(infoText);
var password = hmacObj.getHMAC('B64').substring(0, 8);
$('#password').val(password).css("font-weight","Bold");
$('#qrcode').empty();
$('#qrcode').qrcode({
text: password,
width: 120,
height: 120
});
});
$("#KEY").keydown(function(event){
if(event.keyCode==32||event.keyCode==13||event.keyCode==188||event.keyCode==186){
$("#showPassword").click();
}
});
});
</script>
</head>
<body>
<div class="password-header">
<div class="header-logo">
<svg aria-hidden="true" class="octicon octicon-key" height="48" version="1.1" viewBox="0 0 16 16" width="48">
<path d="M12.83,2.17 C12.08,1.42 11.14,1.03 10,1 C8.87,1.03 7.92,1.42 7.17,2.17 C6.42,2.92 6.04,3.86 6.01,5 C6.01,5.3 6.04,5.59 6.1,5.89 L0,12 L0,13 L1,14 L3,14 L4,13 L4,12 L5,12 L5,11 L6,11 L6,10 L8,10 L9.09,8.89 C9.39,8.97 9.68,9 10,9 C11.14,8.97 12.08,8.58 12.83,7.83 C13.58,7.08 13.97,6.14 14,5 C13.97,3.86 13.58,2.92 12.83,2.17 L12.83,2.17 Z M11,5.38 C10.23,5.38 9.62,4.77 9.62,4 C9.62,3.23 10.23,2.62 11,2.62 C11.77,2.62 12.38,3.23 12.38,4 C12.38,4.77 11.77,5.38 11,5.38 L11,5.38 Z"></path>
</svg>
</div>
</div>
<div class="password-form">
<div class="password-form-header">
<h1>Password Generator</h1>
</div>
<div class="password-form-body">
<dl class="form-group">
<label>Username</label>
<input id="ID" class="form-control input-block" type="email" placeholder="username/email">
</dl>
<dl class="form-group">
<label>Website</label>
<input id="APP" class="form-control input-block" type="text" placeholder="website/app">
</dl>
<dl class="form-group">
<label>1Password</label>
<input id="KEY" class="form-control input-block" type="password" placeholder="1password">
</dl>
<dl class="form-group">
<div class="form-actions">
<button id="showPassword" type="button" class="btn btn-primary btn-block">Generate</button>
</div>
</dl>
<div class="input-group">
<input id="password" class="form-control" type="text" placeholder="password" readonly>
<span class="input-group-button">
<button id="copy" class="btn" data-clipboard-target="#password">
<span class="octicon octicon-clippy"></span>
</button>
</span>
<script>
var copyAction = document.getElementById('copy');
var clipboard = new Clipboard(copyAction);
clipboard.on('success', function(e) {
console.log(e);
});
</script>
</div>
<dl class="form-group">
<div id="qrcode"></div>
</dl>
</div>
</div>
</body>
<a href="https://github.com/pezy/password"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
</html>