Changing source preview to use new syntax highlighter

fixing issue with QR OTP on user page
This commit is contained in:
Nathan Adams
2014-03-11 21:01:25 -05:00
parent 22de793422
commit 822e107958
5 changed files with 105 additions and 65 deletions

View File

@@ -133,6 +133,28 @@ $(document).ready(function(){
return result
};
function gotoline()
{
if ($('.number' + window.location.hash.substring(1)).first().offset() == null)
{
window.setTimeout(gotoline, 100);
return;
}
$('html, body').animate({
scrollTop: ($('.number' + window.location.hash.substring(1)).first().offset().top)
},500);
changegutter();
}
function changegutter()
{
if ($('.gutter > [class*=number]').first().offset() == null)
{
window.setTimeout(changegutter, 100);
return;
}
$(".gutter > [class*=number]").each(function(){ $(this).html('<a href="https://' + window.location.hostname + window.location.pathname + '#' + $(this).html() +'">' + $(this).html() + '</a>'); });
}
$(function() {
@@ -164,7 +186,17 @@ $(function() {
));
SyntaxHighlighter.all();
if(window.location.hash)
{
window.setTimeout(gotoline, 100);
} else {
window.setTimeout(changegutter, 100);
}
});
{/literal}
</script>
</body>

View File

@@ -194,7 +194,7 @@ $(document).ready(function() {
for(var i = 0; i < 32; i++)
key += chars[Math.floor(Math.random() * 32)];
$("#id_otpkey").val(key);
var url = "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=otpauth%3A%2F%2Ftotp%srchub:" + user + "?secret=" + $("#id_otpkey").val().toUpperCase() + "%26issuer=srchub&choe=UTF-8";
var url = "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=otpauth%3A%2F%2Ftotp%2Fsrchub:" + user + "?secret=" + $("#id_otpkey").val().toUpperCase() + "%26issuer=srchub&choe=UTF-8";
$("#QRcode").html('<img src="' + url + '" />')
return false;
});