You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
2.8 KiB
JavaScript
2 lines
2.8 KiB
JavaScript
/*! © SpryMedia Ltd - datatables.net/license */
|
|
!function(a){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return a(t,window,document)}):"object"==typeof exports?module.exports=function(t,e){return t=t||window,(e=e||("undefined"!=typeof window?require("jquery"):require("jquery")(t))).fn.dataTable||require("datatables.net")(t,e),a(e,0,t.document)}:a(jQuery,window,document)}(function(o,t,e,r){"use strict";var i=o.fn.dataTable;function c(t,e,a){e.empty(),e.append("Search: ");var t=t.column(a.column).data(),n=function(t,e){for(var a,n={},r=0,i=t.length;r<i;r++)n[a=e.caseSensitive?t[r].toString().replace(/<.*?>/g,"").charAt(0):t[r].toString().replace(/<.*?>/g,"").charAt(0).toUpperCase()]?n[a]++:n[a]=1;return n}(t,a);if(o('<span class="clear active"/>').data("letter","").data("match-count",t.length).html("None").appendTo(e),a.numbers)for(var r=0;r<10;r++){var i=String.fromCharCode(48+r);o("<span/>").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(e)}for(r=0;r<26;r++){i=String.fromCharCode(65+r);o("<span/>").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(e)}if(a.caseSensitive)for(r=0;r<26;r++){i=String.fromCharCode(97+r);o("<span/>").data("letter",i).data("match-count",n[i]||0).addClass(n[i]?"":"empty").html(i).appendTo(e)}o('<div class="alphabetInfo"></div>').appendTo(e)}return i.Api.register("alphabetSearch()",function(e){return this.iterator("table",function(t){t.alphabetSearch=e}),this}),i.Api.register("alphabetSearch.recalc()",function(){return this.iterator("table",function(t){c(new i.Api(t),t._alphabet,t._alphabetOptions)}),this}),i.Api.register("alphabetSearch.node()",function(){return this._context.length?this._context._alphabet:null}),i.ext.search.push(function(t,e){if(!t.alphabetSearch)return!0;var a=0,n=!1;if(t.oInit.alphabet!==r&&(a=t.oInit.alphabet.column!==r?t.oInit.alphabet.column:0,n=t.oInit.alphabet.caseSensitive!==r&&t.oInit.alphabet.caseSensitive),n){if(e[a].charAt(0)===t.alphabetSearch)return!0}else if(e[a].charAt(0).toUpperCase()===t.alphabetSearch)return!0;return!1}),i.AlphabetSearch=function(t){var e=new i.Api(t),a=o('<div class="alphabet"/>'),n=o.extend({column:0,caseSensitive:!1,numbers:!1},e.init().alphabet);c(e,a,n),t._alphabet=a,t._alphabetOptions=n,a.on("click","span",function(){a.find(".active").removeClass("active"),o(this).addClass("active"),e.alphabetSearch(o(this).data("letter")).draw()}),a.on("mouseenter","span",function(){a.find("div.alphabetInfo").css({opacity:1,left:o(this).position().left,width:o(this).width()}).html(o(this).data("match-count"))}).on("mouseleave","span",function(){a.find("div.alphabetInfo").css("opacity",0)})},i.ext.feature.push({fnInit:function(t){return new i.AlphabetSearch(t).node()},cFeature:"A"}),i}); |