0byt3m1n1
Path:
/
var
/
www
/
clients
/
client38
/
web37
/
web
/
wp-content
/
themes
/
Impreza
/
common
/
js
/
elements
/
[
Home
]
File: grid-order.min.js
(function($,undefined){"use strict";$us.WGridOrder=function(container){this.init(container)};$.extend($us.WGridOrder.prototype,$us.mixins.Events,{init:function(container){this.$container=$(container);this.$select=$('select',this.$container);this.$grid=$('.w-grid[data-filterable="true"]:first',$us.$canvas.find('.l-main'));this.name=this.$select.attr('name')||'order';this.$container.on('change','select',this._events.changeSelect.bind(this));this.$grid.addClass('used_by_grid_order')},_events:{changeSelect:function(){var value=this.$select.val()||'',matches=(location.href.match(/page(=|\/)(\d+)(\/?)/)||[]),page=parseInt(matches[2]||1);this.URLSearchValue(value);this.triggerGrid('us_grid.updateOrderBy',[value,page,this])}},triggerGrid:function(eventType,extraParameters){$us.debounce(function(){$us.$body.trigger(eventType,extraParameters)},10)()},URLSearchValue:function(value){var orderby_search='',url=location.origin+location.pathname+(location.pathname.slice(-1)!='/'?'/':''),search=location.search.replace(new RegExp('[?&]'+this.name+'=[^&#]*(#.*)?$'),'$1').replace(new RegExp('([?&])'+this.name+'=[^&]*&'),'$1');if(search&&search.substr(0,1)==='?'){search=search.slice(1)} if(value){orderby_search+=this.name+'='+value} if(orderby_search&&search){orderby_search+='&'} orderby_search+=search;history.replaceState(document.title,document.title,url+(orderby_search?'?'+orderby_search:''))}});$.fn.wGridOrder=function(options){return this.each(function(){$(this).data('wGridOrder',new $us.WGridOrder(this))})};$(function(){$('.w-order',$us.$canvas).wGridOrder()})})(jQuery)