Sha256: 9ddae4798e6b1c4d9baef8f73d5009aa534668cc72521cf9bb3c7ab6b3e58c23

Contents?: true

Size: 1.61 KB

Versions: 7

Compression:

Stored size: 1.61 KB

Contents

// Olelo bootstrap
// Written by Daniel Mendler
$(function() {
    "use strict";

    $('html').removeClass('no-js').addClass('js');
    function pageLoaded() {
        $('#upload-path', this).each(function() {
            var elem = this;
            var old = elem.value;
            var base = elem.value;
            if (base.length === 0 || base.match(/\/$/)) {
                $('#upload-file').change(function() {
                    if (elem.value == old) {
                        elem.value = base + this.value;
                        old = elem.value;
                    }
                });
            }
        });
        $('label, #menu, .tabhead, .pagination, .button-bar', this).disableSelection();
	$('.date', this).timeAgo();
        $('.tabs', this).each(function() {
	    $('> li', this).tabWidget();
	});
        $('*[accesskey]', this).underlineAccessKey();
    }

    $('#content').pagination('.pagination a');
    $('#content').bind('pageLoaded', pageLoaded);
    pageLoaded.apply($(document));

    $('button[data-target]').live('click', function() {
	var button = $(this);
	var form = $(this.form);
	button.addClass('loading');
        $.ajax({
            type: form.attr('method') || 'get',
            url:  form.attr('action') || window.location.href,
            data: form.serialize() + '&' + button.attr('name') + '=' + button.attr('value') + '&no_layout=1',
            success: function(data) {
		$('#' + button.data('target')).html(data);
		button.removeClass('loading');
		if (window.MathJax)
		    MathJax.Hub.Queue(['Typeset',MathJax.Hub,button.data('target')]);
            }});
	return false;
    });
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
olelo-0.9.15 static/script/init.js
olelo-0.9.14 static/script/init.js
olelo-0.9.13 static/script/init.js
olelo-0.9.12 static/script/init.js
olelo-0.9.11 static/script/init.js
olelo-0.9.10 static/script/init.js
olelo-0.9.9 static/script/init.js