2
* Bash One-Liners JavaScript Library v0.1
3
* http://bashoneliners.com/
5
* Copyright 2012, Janos Gyerik
6
* http://bashoneliners.com/LICENSE
8
* Date: Sat Oct 8 06:38:28 CEST 2011
11
function popup_error() {
12
alert('Oops! Whatever you were trying to do, it\'s not working now... Please try again later!\n\nIf the problem doesn\'t go away soon, send an email to info@bashoneliners.com');
15
function bind_help_markdown() {
16
$('.help-markdown').click(function() {
18
var dialog = $('<div class="loading"></div>').appendTo('body');
20
close: function(event, ui) { dialog.remove(); },
23
title: 'Markdown Syntax Quick Reference'
28
function(responseText, textStatus, XMLHttpRequest) {
29
dialog.removeClass('loading');
36
function bind_question_answered() {
37
$('.question-answered').click(function(e) {
39
var question = $('.' + $(this).attr('data-parent'));
40
var remove_buttons = function() {
41
question.find('.question-answered').remove();
44
url: $(this).attr('href'),
45
success: remove_buttons,
51
function bind_preview_markdown() {
52
$('.preview-markdown').click(function(e) {
54
var source = $('#' + $(this).attr('data-source'));
55
var preview = $('#' + $(this).attr('data-source') + '-preview');
56
var update_preview = function(html) {
58
preview.addClass('well');
61
url: $(this).attr('href'),
63
data: { text: source.val() },
64
success: update_preview,
70
function bind_comments_toggle() {
71
$('.comments-toggle').click(function(e) {
72
$(this).toggleClass('expanded').next().toggle(0);
76
function footer_fix() {
77
if ($('body').height() < $(window).height()) {
78
$('.footer').addClass('fixed-bottom');
79
$('body').css('padding-bottom', '50px');
83
$(document).ready(function() {
85
bind_question_answered();
86
bind_preview_markdown();
87
bind_comments_toggle();