mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-12-05 05:04:20 +00:00
2 lines
2.0 KiB
JavaScript
2 lines
2.0 KiB
JavaScript
/*! Widget: headerTitles - updated 11/10/2015 (v2.24.4) */
|
|
!function(e){"use strict";var t=e.tablesorter;t.addWidget({id:"headerTitles",options:{headerTitle_useAria:!1,headerTitle_tooltip:"",headerTitle_cur_text:[" sort: A - Z"," sort: Z - A","ly unsorted"],headerTitle_cur_numeric:[" sort: 0 - 9"," sort: 9 - 0","ly unsorted"],headerTitle_nxt_text:[" sort: A - Z"," sort: Z - A","remove sort"],headerTitle_nxt_numeric:[" sort: 0 - 9"," sort: 9 - 0","remove sort"],headerTitle_output_sorted:"current{current}; activate to {next}",headerTitle_output_unsorted:"current{current}; activate to {next} ",headerTitle_output_nosort:"No sort available",headerTitle_type:[],headerTitle_callback:null},init:function(t,r,a,o){a.$table.on("refreshHeaderTitle",function(){r.format(t,a,o)}),e.isArray(o.headerTitle_tooltip)?a.$headers.each(function(){e(this).addClass(o.headerTitle_tooltip[this.column]||"")}):""!==o.headerTitle_tooltip&&a.$headers.addClass(o.headerTitle_tooltip)},format:function(r,a,o){var s;a.$headers.each(function(){var r=e(this),i=parseInt(r.attr("data-column"),10),l=o.headerTitle_type[i]||a.parsers[i].type||"text",d=r.hasClass(t.css.sortAsc)?0:r.hasClass(t.css.sortDesc)?1:2,n=a.sortVars[i].order[(a.sortVars[i].count+1)%(a.sortReset?3:2)];o.headerTitle_useAria?s=r.attr("aria-label")||o.headerTitle_output_nosort||"":(s=(o.headerTitle_prefix||"")+(r.hasClass("sorter-false")?o.headerTitle_output_nosort:t.isValueInArray(i,a.sortList)>=0?o.headerTitle_output_sorted:o.headerTitle_output_unsorted),s=s.replace(/\{(current|next|name)\}/gi,function(e){return{"{name}":r.text(),"{current}":o["headerTitle_cur_"+l][d]||"","{next}":o["headerTitle_nxt_"+l][n]||""}[e.toLowerCase()]})),r.attr("title",e.isFunction(o.headerTitle_callback)?o.headerTitle_callback(r,s):s)})},remove:function(t,r,a){r.$headers.attr("title",""),r.$table.off("refreshHeaderTitle"),e.isArray(a.headerTitle_tooltip)?r.$headers.each(function(){e(this).removeClass(a.headerTitle_tooltip[this.column]||"")}):""!==a.headerTitle_tooltip&&r.$headers.removeClass(a.headerTitle_tooltip)}})}(jQuery); |