-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.min.js
1 lines (1 loc) · 3.36 KB
/
script.min.js
1
!function(e){e(document).on("lazyloaded",function(t){e(t.target).hasClass("media-background")&&e(t.target).mediaBackground()})}(jQuery),function(){var a,D,e=/^-?[£$¤]?[\d,.]+%?$/,n=/^\s+|\s+$/g,i=["click"];"ontouchstart"in document.documentElement&&i.push("touchstart"),a=function(t,e,n){return null!=t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},(D={init:function(t){var e,n,r,o,a;for(null==(t=null==t?{}:t).selector&&(t.selector="table[data-sortable]"),r=[],e=0,n=(a=document.querySelectorAll(t.selector)).length;e<n;e++)o=a[e],r.push(D.initTable(o));return r},initTable:function(t){var e,n,r,o,a,i;if(1===(null!=(r=t.tHead)?r.rows.length:void 0)&&"true"!==t.getAttribute("data-sortable-initialized")){for(t.setAttribute("data-sortable-initialized","true"),o=e=0,n=(i=t.querySelectorAll("th")).length;e<n;o=++e)"false"!==(a=i[o]).getAttribute("data-sortable")&&D.setupClickableTH(t,a,o);return t}},setupClickableTH:function(T,S,w){for(var t,E=D.getColumnType(T,w),e=function(t){var n,e,r,o,a,i,u,l,s,d,c,f,p,h,g,m,b,v,y,A,C;if(!0===t.handled)return!1;for(t.handled=!0,t="true"===this.getAttribute("data-sorted"),v=this.getAttribute("data-sorted-direction"),v=t?"ascending"===v?"descending":"ascending":E.defaultSortDirection,e=0,i=(A=this.parentNode.querySelectorAll("th")).length;e<i;e++)(S=A[e]).setAttribute("data-sorted","false"),S.removeAttribute("data-sorted-direction");if(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",v),y=T.tBodies[0],b=[],t){for(a=0,s=(p=y.rows).length;a<s;a++)h=p[a],b.push(h);for(b.reverse(),c=0,d=b.length;c<d;c++)y.appendChild(m=b[c])}else{for(n=null!=E.compare?E.compare:function(t,e){return e-t},v=function(t,e){return t[0]===e[0]?t[2]-e[2]:E.reverse?n(e[0],t[0]):n(t[0],e[0])},g=r=0,u=(f=y.rows).length;r<u;g=++r)m=f[g],C=D.getNodeValue(m.cells[w]),null!=E.comparator&&(C=E.comparator(C)),b.push([C,m,g]);for(b.sort(v),o=0,l=b.length;o<l;o++)y.appendChild((m=b[o])[1])}return"function"==typeof window.CustomEvent&&"function"==typeof T.dispatchEvent?T.dispatchEvent(new CustomEvent("Sortable.sorted",{bubbles:!0})):void 0},n=[],r=0,o=i.length;r<o;r++)t=i[r],n.push(a(S,t,e));return n},getColumnType:function(t,e){var n,r,o,a,i,u,l,s,d,c=null!=(c=t.querySelectorAll("th")[e])?c.getAttribute("data-sortable-type"):void 0;if(null!=c)return D.typesObject[c];for(o=(i=t.tBodies[n=0].rows).length;n<o;n++)for(l=i[n],s=D.getNodeValue(l.cells[e]),r=0,a=(u=D.types).length;r<a;r++)if((d=u[r]).match(s))return d;return D.typesObject.alpha},getNodeValue:function(t){var e;return t?null!==(e=t.getAttribute("data-value"))?e:(void 0!==t.innerText?t.innerText:t.textContent).replace(n,""):""},setupTypes:function(t){var e,n,r,o;for(D.types=t,D.typesObject={},r=[],e=0,n=t.length;e<n;e++)o=t[e],r.push(D.typesObject[o.name]=o);return r}}).setupTypes([{name:"numeric",defaultSortDirection:"descending",match:function(t){return t.match(e)},comparator:function(t){return parseFloat(t.replace(/[^0-9.-]/g,""),10)||0}},{name:"date",defaultSortDirection:"ascending",reverse:!0,match:function(t){return!isNaN(Date.parse(t))},comparator:function(t){return Date.parse(t)||0}},{name:"alpha",defaultSortDirection:"ascending",match:function(){return!0},compare:function(t,e){return t.localeCompare(e)}}]),setTimeout(D.init,0),"function"==typeof define&&define.amd?define(function(){return D}):"undefined"!=typeof exports?module.exports=D:window.Sortable=D}.call(this);