summaryrefslogtreecommitdiffstats
path: root/data/js/script.js
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-22 15:42:07 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-22 22:36:55 +0200
commitde02b8cb514a95c100d0ec11ab469acfc687ca00 (patch)
tree9c09a70f4ac2b582ae80dd6e065f700ef460ed11 /data/js/script.js
parent36f0185d8c950933099268c69081cabc084545c9 (diff)
switch design to bootstrap; minor fixes along the way
Initial-work-by: Oliver Mader <b52@reaktor42.de> Additional-work-by: Markus Cisler <mrkscslr@gmail.com> Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'data/js/script.js')
-rw-r--r--data/js/script.js60
1 files changed, 60 insertions, 0 deletions
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);
+
+ $('<div id="highlight_line" />').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);