Sha256: a6c450d6394ef22ad672414f354b889f247d5a8819dd271b2d59124bd179869d

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

(function($) {
    $.fn.historyTable = function() {
	$('thead tr', this).prepend('<th class="compare"><button>&#177;</button></th>');
	$('tbody tr', this).each(function() {
	    var version = $(this).attr('id').substr(8);
	    $(this).prepend('<td class="compare"><input type="checkbox" name="' + version + '"/></td>');
	});
	var versions = $.storage.get('historyTable');
	if (versions) {
	    for (var i = 0; i < versions.length; ++i)
		$('input[name=' + versions[i] + ']').attr('checked', 'checked');
	}

	var checkboxes = $('tbody input', this);
	function getSelectedVersions() {
	    var versions = [];
	    checkboxes.each(function() {
		if (this.checked) {
		    versions.push(this.name);
		}
	    });
	    return versions;
	}

	var button = $('th button', this);
	button.click(function() {
	    var versions = getSelectedVersions();
	    $.storage.set('historyTable', versions);
            location.href = location.pathname.replace('/history', '/compare/' + versions[versions.length-1] + '...' + versions[0]);
	});

	$('td input', this).change(function() {
	    var versions = getSelectedVersions();
	    if (versions.length > 1)
		button.removeAttr('disabled');
	    else
		button.attr('disabled', 'disabled');
	}).change();
    };
})(jQuery);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
olelo-0.9.6 static/script/12-olelo.historytable.js
olelo-0.9.5 static/script/12-olelo.historytable.js
olelo-0.9.4 static/script/10-olelo.historytable.js