Sha256: d40910f27b9b3a6155f81e1e56ac21eab04a265dece41455031847b3c0cbc6ed

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

// Olelo bootstrap
// Written by Daniel Mendler
$(function() {
    $('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();
        $('#history-table', this).historyTable();
	$('.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

2 entries across 2 versions & 1 rubygems

Version Path
olelo-0.9.6 static/script/init.js
olelo-0.9.5 static/script/init.js