Commit 1597bdf4 by arjun810

Merge pull request #685 from MITx/kimth/fix-widow-js

Kimth/fix widow js
parents 3164af65 a40e8eae
......@@ -39,19 +39,22 @@
$(function(){
$(".ui-accordion-header a, .ui-accordion-content .subtitle").each(function() {
var wordArray = $(this).text().split(" ");
var elemText = $(this).text().replace(/^\s+|\s+$/g,''); // Strip leading and trailing whitespace
var wordArray = elemText.split(" ");
var finalTitle = "";
if ($.isEmptyObject(wordArray)) {
if (wordArray.length > 0) {
for (i=0;i<=wordArray.length-1;i++) {
finalTitle += wordArray[i];
if (i == (wordArray.length-2)) {
finalTitle += "&nbsp;";
} else if (i == (wordArray.length-1)) {
// Do nothing
} else {
finalTitle += " ";
}
}
$(this).html(finalTitle);
}
$(this).html(finalTitle);
});
});
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment