Docs: select2 note & make newest version styling more prominent

This commit is contained in:
Mottie 2015-01-17 08:10:17 -06:00
parent 5eeb103f98
commit bbaf9083c8
3 changed files with 11 additions and 5 deletions

View File

@ -61,8 +61,8 @@ p.small {padding-left: 25px;}
.xsmall {font-size:11px;}
p.tip em, div.tip em,.label-info {padding: 2px; background-color: #5bc0de; color: #fff; border-radius: .25em;}
.label { padding: 0.1em 0.6em 0.1em; font-size: 75%; color: #fff; border-radius: .25em; }
span.tip em, .label-success { background-color: #5cb85c; }
.updated .label-success { background-color: #8eCe8e; }
span.tip em, .label-success, .version .label-success { background-color: #2b7e7e; } /*5cb85c*/
.older .label-success { background-color: #8eCe8e; }
span.tip.old em, .label-default { background-color: #999; }
span.warning { background-color: #f0ad4e; } /* orange */
span.warn em, .label.alert { background-color: #d9534f; } /* red */

View File

@ -90,6 +90,7 @@
<h3><a href="#">Notes</a></h3>
<div>
<ul>
<li>Updated in <span class="version updated">v2.18.5</span> to properly escape regexp characters. See <a href="https://github.com/Mottie/tablesorter/issues/796">issue #796</a> for details.</li>
<li>Updated in <span class="version updated">v2.16.3</span> to allow adding an initial value to the select2 plugin.</li>
<li>This is a demo of the select2 filter formatter code.</li>
<li>It requires jQuery 1.7.2+, tablesorter <span class="version">2.16</span>+, the filter widget 2.16+ and <a href="http://ivaynberg.github.io/select2/">Select2</a> v3.4.6+ (not tested on older select2 versions)</li>

View File

@ -80,17 +80,22 @@
$t.html($.tablesorter.version);
}
// add high visibility tags for newest versions (just grab the major revision number 2.10.0 -> 10
// add high visibility tags for newest versions
t = $.tablesorter.version.replace(/(v|version|\+)/g, '').split('.');
v = [ parseInt(t[0], 10) || 1, parseInt(t[1], 10) || 0 ];
v = [ parseInt(t[0], 10) || 1, parseInt(t[1], 10) || 0, parseInt(t[2], 10) || 0 ];
$('.version').each(function(){
var i;
$t = $(this);
i = $t.text().replace(/(v|version|\+)/g, '').split('.');
t = [ parseInt(i[0], 10) || 1, parseInt(i[1], 10) || 0 ];
t = [ parseInt(i[0], 10) || 1, parseInt(i[1], 10) || 0, parseInt(i[2], 10) || 0 ];
if (t[0] === v[0] && t[1] >= v[1] - 1 ) {
$t.prepend('<span class="label ' + ( t[0] === v[0] && t[1] < v[1] ? ' label-default' : ' label-success' ) +
'">'+ ($t.hasClass('updated') ? 'Updated' : 'New') + '</span> ');
// updates for current version are brighter
if (t[2] <= v[2] - 1) {
// new labels for revisions > 1 back are lighter
$t.addClass('older');
}
}
});