Skip to content

Instantly share code, notes, and snippets.

@julio-saito-linx
Created April 24, 2012 18:51
Show Gist options
  • Save julio-saito-linx/2482658 to your computer and use it in GitHub Desktop.
Save julio-saito-linx/2482658 to your computer and use it in GitHub Desktop.
jQuery template sample + Ctrl + Alt + Shift + "d"
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript"></script>
<script id="tarefasTemplate" type="text/x-jquery-tmpl">
<li>
${horaDecimal}, ${valorHora}
</li>
</script>
<div id="debug">
<div>
<input type="button" value="stringify" id="buttonStringify"></input>
</div>
<pre id="preDebug"></pre>
<ul class="itemDebug" id="tarefaList">
</ul>
</div>
<script>
$().ready(function() {
$("#tarefasTemplate").tmpl(d.tarefas).appendTo("#tarefaList");
});
// Ctrl + Alt + Shift + "d"
var isShift = false;
var isCtrl = false;
var isAlt = false;
document.onkeyup = function (e) {
if (e.which == 16) {
isShift = false;
}
if (e.which == 17) {
isCtrl = false;
}
if (e.which == 18) {
isAlt = false;
}
};
document.onkeydown = function (e) {
if (e.which == 16) {
isShift = true;
}
if (e.which == 17) {
isCtrl = true;
}
if (e.which == 18) {
isAlt = true;
}
if (e.which == 68 && isShift == true && isCtrl == true && isAlt == true) {
$("#debug").toggle();
return false;
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment