helpcenter/helpcenter.r7-office.ru/Web/js/help/sitemap.sort.js

23 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

$(document).ready(function() {
$("#abcindexed").find(".lable_tip").each(function(e) {
$(this).remove()
});
var e = {
letters: []
};
$("#abcindexed").children("li").each(function() {
var t = $(this).find("a").text().substring(0, 1).toUpperCase();
if ("¿" == t || "." == t) var t = $(this).find("a").text().substring(1, 2).toUpperCase();
t in e || (e[t] = [], e.letters.push(t)), e[t].push($(this))
}), e.letters.sort(), $(".div_for_index").empty(), $.each(e.letters, function(t, a) {
e[a].sort(function(e, t) {
return $(e).text().toUpperCase().trim().localeCompare($(t).text().toUpperCase().trim())
});
var i = $("<ul/>");
$.each(e[a], function(e, t) {
i.append(t)
});
var s = '<p class="gloss_capital" id="gcID' + a.toUpperCase() + '">' + a.toUpperCase() + "</p>";
$("div.div_for_index").append($("<div/>").attr("class", "gloss_content").attr("id", "gloss_" + a.toLowerCase() + "_block").append(s).append(i))
})
});