Created
August 5, 2013 21:21
-
-
Save hanford/6159719 to your computer and use it in GitHub Desktop.
Companies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var hideAllPopovers = function() { | |
$('.shift-bar').each(function() { | |
$(this).popover('hide'); | |
}); | |
}; | |
$('.shift-bar') .each(function() { | |
$(this).popover({ | |
content: $('.shift-options', this).html(), | |
html: true, | |
placement: 'bottom' | |
}).on('click', function(e){ | |
// don't close the popover when we click to open it | |
e.stopPropagation(); | |
}); | |
}) | |
// open the timeclock | |
$(document).on('click', '.clock-in, .clock-out', function(e) { | |
$('.timeclock', $(this).parent().parent()).show(); | |
}); | |
// don't close the popover when we click the timeclock or the buttons | |
$(document).on('click','.timeclock, .shift-buttons', function(e) { | |
e.stopPropagation(); | |
}); | |
// close the popover with the esc key | |
$(document).keydown(function(e){ | |
if (e.keyCode === 27) | |
hideAllPopovers(); | |
}); | |
// close the popover when you click somewhere else | |
$(document).on('click', function(e) { | |
hideAllPopovers(); | |
}) | |
}); | |
function addCode(key){ | |
var code = document.forms[0].code; | |
if(code.value.length < 4) { | |
code.value = code.value + key; | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment