Interpret null wordSeparator as empty string
This commit is contained in:
parent
7a05219f6e
commit
bd42f80c17
3 changed files with 22 additions and 1 deletions
|
@ -86,7 +86,16 @@
|
||||||
years < 1.5 && substitute($l.year, 1) ||
|
years < 1.5 && substitute($l.year, 1) ||
|
||||||
substitute($l.years, Math.round(years));
|
substitute($l.years, Math.round(years));
|
||||||
|
|
||||||
var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator;
|
switch ($l.wordSeparator) {
|
||||||
|
case undefined:
|
||||||
|
var separator = " ";
|
||||||
|
break;
|
||||||
|
case null:
|
||||||
|
var separator = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
var separator = $l.wordSeparator;
|
||||||
|
}
|
||||||
return $.trim([prefix, words, suffix].join(separator));
|
return $.trim([prefix, words, suffix].join(separator));
|
||||||
},
|
},
|
||||||
parse: function(iso8601) {
|
parse: function(iso8601) {
|
||||||
|
|
|
@ -139,6 +139,7 @@
|
||||||
<li><abbr id="testYoungOldSettings2" class="toyoungold" title="2018304000"></abbr> [23360 days]</li>
|
<li><abbr id="testYoungOldSettings2" class="toyoungold" title="2018304000"></abbr> [23360 days]</li>
|
||||||
|
|
||||||
<li><abbr id="testNoSpaces1" class="nospaces" title="120"></abbr> [120 sec]</li>
|
<li><abbr id="testNoSpaces1" class="nospaces" title="120"></abbr> [120 sec]</li>
|
||||||
|
<li><abbr id="testNullSpaces1" class="nullspaces" title="120"></abbr> [120 sec]</li>
|
||||||
|
|
||||||
<li><abbr id="testLatinSettings1" class="tolatin" title="-7200"></abbr> [-120 min]</li>
|
<li><abbr id="testLatinSettings1" class="tolatin" title="-7200"></abbr> [-120 min]</li>
|
||||||
<li><abbr id="testLatinSettings2" class="tolatin" title="-60"></abbr> [-60 sec]</li>
|
<li><abbr id="testLatinSettings2" class="tolatin" title="-60"></abbr> [-60 sec]</li>
|
||||||
|
@ -243,6 +244,9 @@
|
||||||
loadNoSpaces();
|
loadNoSpaces();
|
||||||
$("abbr.nospaces").each(toWords);
|
$("abbr.nospaces").each(toWords);
|
||||||
|
|
||||||
|
loadNullSpaces();
|
||||||
|
$("abbr.nullspaces").each(toWords);
|
||||||
|
|
||||||
loadPigLatin();
|
loadPigLatin();
|
||||||
$("abbr.tolatin").each(toWords);
|
$("abbr.tolatin").each(toWords);
|
||||||
|
|
||||||
|
@ -562,6 +566,7 @@
|
||||||
|
|
||||||
test("wordSeparator", function () {
|
test("wordSeparator", function () {
|
||||||
ok($("#testNoSpaces1").html().match(/^2minutesago$/), "Settings correctly applied");
|
ok($("#testNoSpaces1").html().match(/^2minutesago$/), "Settings correctly applied");
|
||||||
|
ok($("#testNullSpaces1").html().match(/^2minutesago$/), "Settings correctly applied");
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
//]]>
|
//]]>
|
||||||
|
|
|
@ -102,6 +102,13 @@ function loadNoSpaces() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadNullSpaces() {
|
||||||
|
jQuery.extend(jQuery.timeago.settings.strings, {
|
||||||
|
minutes: "%dminutes",
|
||||||
|
wordSeparator: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function loadYoungOldYears() {
|
function loadYoungOldYears() {
|
||||||
jQuery.extend(jQuery.timeago.settings.strings, {
|
jQuery.extend(jQuery.timeago.settings.strings, {
|
||||||
years: function(value) { return (value < 21) ? "%d young years" : "%d old years"; }
|
years: function(value) { return (value < 21) ? "%d young years" : "%d old years"; }
|
||||||
|
|
Reference in a new issue