Sha256: 3f68a354a2113fb3a5886863a2c44cb49ba8d4ab2c0f193e6b4ee70bbb11551c
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
(function($) { $.fn.historyTable = function() { $('thead tr', this).prepend('<th class="compare"><button>±</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 = jStorage.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(); jStorage.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
4 entries across 4 versions & 1 rubygems