door_code 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -4
- data/door_code.gemspec +1 -1
- data/lib/index.html +79 -4
- metadata +2 -2
data/README.md
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
Install with Bundler:
|
6
6
|
|
7
|
-
gem 'door_code', '0.0.
|
7
|
+
gem 'door_code', '0.0.2'
|
8
8
|
|
9
9
|
In config.ru:
|
10
10
|
|
11
11
|
use DoorCode::RestrictedAccess, :code => '12345'
|
12
12
|
|
13
|
-
|
13
|
+
In application.rb (Rails3) or environment.rb (Rails2):
|
14
14
|
|
15
15
|
config.middleware.use DoorCode::RestrictedAccess, :code => '12345'
|
16
16
|
|
@@ -23,5 +23,3 @@ Or in application.rb (Rails3) or environment.rb (Rails2):
|
|
23
23
|
|
24
24
|
* Example app (heroku, sinatra)
|
25
25
|
* Allow specifying domains and paths to restrict access conditionally
|
26
|
-
* Add no-js/no-base64 version
|
27
|
-
* Add favicon?
|
data/door_code.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "door_code"
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.3'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Mike Fulcher", "Alex Neill"]
|
9
9
|
s.email = ["mike@plan9design.co.uk", "alex.neill@gmail.com"]
|
data/lib/index.html
CHANGED
@@ -216,6 +216,38 @@
|
|
216
216
|
}
|
217
217
|
|
218
218
|
.red #display img.error { display: inline; }
|
219
|
+
|
220
|
+
#helper {
|
221
|
+
height: 425px;
|
222
|
+
}
|
223
|
+
|
224
|
+
#helper p, #helper ul, #helper ol, #helper li {
|
225
|
+
margin: 0; padding: 0;
|
226
|
+
color: white;
|
227
|
+
font-family: Helvetica, Arial, sans-serif;
|
228
|
+
text-indent: 0;
|
229
|
+
font-size: 12px; line-height: 12px;
|
230
|
+
}
|
231
|
+
|
232
|
+
#helper ul, #helper ol {
|
233
|
+
padding: 0 0 0 20px;
|
234
|
+
}
|
235
|
+
|
236
|
+
#helper li { margin-bottom: 5px;}
|
237
|
+
|
238
|
+
#helper p {
|
239
|
+
font-size: 16px; line-height: 16px;
|
240
|
+
margin: 10px 0;
|
241
|
+
font-weight: bold;
|
242
|
+
}
|
243
|
+
|
244
|
+
#helper p.how { margin-top: 0; }
|
245
|
+
|
246
|
+
#helper p.close { text-align: center; }
|
247
|
+
|
248
|
+
#helper p.close a {
|
249
|
+
color: white;
|
250
|
+
}
|
219
251
|
</style>
|
220
252
|
|
221
253
|
<script type="text/javascript" charset="utf-8">
|
@@ -227,6 +259,9 @@
|
|
227
259
|
var form;
|
228
260
|
var display;
|
229
261
|
var displayLed;
|
262
|
+
|
263
|
+
var helperContainer;
|
264
|
+
var keypadContainer;
|
230
265
|
|
231
266
|
var validKeys = [ 48,49,50,51,52,53,54,55,56,57,
|
232
267
|
96,97,98,99,100,101,102,103,104,105 ];
|
@@ -279,15 +314,18 @@
|
|
279
314
|
keypad = $('#keypad');
|
280
315
|
display = $('#display');
|
281
316
|
displayLed = display.find('.led');
|
317
|
+
|
318
|
+
helperContainer = $('#helper');
|
319
|
+
keypadContainer = $('#display, #keys');
|
282
320
|
|
283
321
|
// Map clicking on the keys to showing the number in the display
|
284
|
-
$('a').click(function(e){
|
322
|
+
$('#keys a').click(function(e){
|
285
323
|
e.preventDefault();
|
286
324
|
if ($('.clone').length < codeLength) {
|
287
325
|
var num = $(this).attr('rel');
|
288
326
|
if (num === 'clear' || num === 'help') {
|
289
327
|
if (num === 'clear') { reset(); } else
|
290
|
-
if (num === 'help') {
|
328
|
+
if (num === 'help') { toggleHelp(); }
|
291
329
|
} else {
|
292
330
|
displayNum(num);
|
293
331
|
checkCode();
|
@@ -324,6 +362,11 @@
|
|
324
362
|
});
|
325
363
|
|
326
364
|
$(document).keyup(function(e){ $('#keys a').removeClass('active'); });
|
365
|
+
|
366
|
+
$('.close a').click(function(e) {
|
367
|
+
e.preventDefault();
|
368
|
+
toggleHelp();
|
369
|
+
});
|
327
370
|
|
328
371
|
});
|
329
372
|
|
@@ -382,8 +425,16 @@
|
|
382
425
|
keypad.removeClass(failureClass).removeClass(successClass).addClass(defaultClass);
|
383
426
|
}
|
384
427
|
|
385
|
-
function
|
386
|
-
|
428
|
+
function toggleHelp() {
|
429
|
+
if (helperContainer.is(':visible')) {
|
430
|
+
helperContainer.fadeOut(250, function(){
|
431
|
+
keypadContainer.fadeIn(250);
|
432
|
+
});
|
433
|
+
} else {
|
434
|
+
keypadContainer.fadeOut(250, function(){
|
435
|
+
helperContainer.fadeIn(250);
|
436
|
+
});
|
437
|
+
}
|
387
438
|
}
|
388
439
|
</script>
|
389
440
|
</head>
|
@@ -399,6 +450,30 @@
|
|
399
450
|
<div id="keypad" class="green" style="display:none;">
|
400
451
|
<div id="backlight">
|
401
452
|
<div id="frame">
|
453
|
+
<!-- #helper only shown when the HELP key is pressed -->
|
454
|
+
<div id="helper" style="display:none;">
|
455
|
+
<p class="how">
|
456
|
+
How to use this keypad:
|
457
|
+
</p>
|
458
|
+
<ol>
|
459
|
+
<li>Using the code provided to you, enter the digits using either your keyboard using the number keys, or your mouse by clicking the numbers on the keypad</li>
|
460
|
+
<li>When you have entered the correct number of digits, the keypad will confirm if you have entered the correct code</li>
|
461
|
+
<li>On entering the correct code, the keypad will flash blue with the message "SUCCESS" displayed on the keypad. You will then be redirected to the correct page of the website</li>
|
462
|
+
<li>On entering an incorrect code, the keypad will flash red with the message "ERROR" displayed on the keypad. The keypad will then reset, allowing you to re-enter the code</li>
|
463
|
+
</ol>
|
464
|
+
<p class="tips">
|
465
|
+
Tips:
|
466
|
+
</p>
|
467
|
+
<ul>
|
468
|
+
<li>The code will only be checked for validity once the correct number of digits have been entered</li>
|
469
|
+
<li>Use the backspace key on your keyboard to erase the last digit entered</li>
|
470
|
+
<li>Use the clear key on the keypad to clear the current code and reset the keypad</li>
|
471
|
+
</ul>
|
472
|
+
<p class="close">
|
473
|
+
<a href="#">Close</a>
|
474
|
+
</p>
|
475
|
+
</div>
|
476
|
+
|
402
477
|
<div id="display">
|
403
478
|
<div class="backlight">
|
404
479
|
<div class="led">
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: door_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mike Fulcher
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-02-
|
14
|
+
date: 2011-02-20 00:00:00 +00:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|