From de02b8cb514a95c100d0ec11ab469acfc687ca00 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 22 Oct 2012 15:42:07 +0200 Subject: switch design to bootstrap; minor fixes along the way Initial-work-by: Oliver Mader Additional-work-by: Markus Cisler Signed-off-by: Florian Pritz --- data/js/script.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 data/js/script.js (limited to 'data/js/script.js') diff --git a/data/js/script.js b/data/js/script.js new file mode 100644 index 000000000..e49733b97 --- /dev/null +++ b/data/js/script.js @@ -0,0 +1,60 @@ +(function($) { + + $(function() { + + $(window).bind('hashchange', function(e) { + var hash = window.location.hash; + + $('#highlight_line').remove(); + + if (hash.match(/^#n\d+$/) === null) { + return; + } + + var link = $(hash); + + $('
').prependTo('.highlight').css({ + top: link.get(0).offsetTop - 10 + parseInt(link.css("padding-top")) + 'px' + }); + }); + + $(window).trigger('hashchange'); + + var lexer_source = []; + for (var key in window.lexers) { + lexer_source.push({ label: window.lexers[key], value: key }); + } + + $('#language').autocomplete({ + source: lexer_source, + select: function(event, ui) { + window.location = window.paste_base + '/' + ui.item.value; + } + }); + + $('#language-toggle').click(function() { + setTimeout(function() { + $('#language').focus(); + }, 0); + }); + + $('[rel="tooltip"]').tooltip({ + placement: 'bottom' + }); + + $('#history-all').bind('change', function() { + $('.delete-history').prop('checked', $(this).is(':checked')); + }); + + $('.modal').on('shown', function(e) { + var modal = $(this); + + modal.css('margin-top', (modal.outerHeight() / 2) * -1) + .css('margin-left', (modal.outerWidth() / 2) * -1); + + return this; + }); + + }); + +})(jQuery); -- cgit v1.2.3-24-g4f1b