Sha256: 6652427a700240c50c48d10c28a553a4b6de9604d288d147f0af748d9f148277

Contents?: true

Size: 1.67 KB

Versions: 5

Compression:

Stored size: 1.67 KB

Contents

// Olelo bootstrap
// Written by Daniel Mendler
$(function() {
    $('html').removeClass('no-js').addClass('js');
    function pageLoaded(parent) {
        $('#upload-path', parent).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', parent).disableSelection();
        $('#history-table', parent).historyTable();
	$('.date', parent).timeAgo();
        $('.tabs', parent).each(function() {
	    $('> li', this).tabWidget();
	});
        $('*[accesskey]', parent).underlineAccessKey();
    }

    $('.pagination a').pagination('#content');
    $('#content').bind('pageLoaded', function() { pageLoaded(this); });
    pageLoaded();

    $('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

5 entries across 5 versions & 1 rubygems

Version Path
olelo-0.9.4 static/script/init.js
olelo-0.9.3 static/script/init.js
olelo-0.9.2 static/script/init.js
olelo-0.9.1 static/script/init.js
olelo-0.9.0 static/script/init.js