Initial dev repository
[kcls-web.git] / opac / extras / mobile / mobile / js / opac / sort.js
1 var __hasProp=Object.prototype.hasOwnProperty;
2 module("opac.sort",imports("plugin"),function(){var h;h={sort:{pubdate:"Sort by publication date",title:"Sort by title",author:"Sort by author","":"Sort by relevance"},sort_dir:{desc:"c, b, a / 3, 2, 1",asc:"a, b, c / 1, 2, 3"}};$.fn.build_selectors=function(b){var d,f,i,a,c,e,g;for(c in b)__hasProp.call(b,c)&&this.append($("<select name="+c+" />"));f=this.find("select");d=0;for(i=f.length;d<i;d++){g=f[d];if(a=b[$(g).attr("name")]){a=a;for(e in a)if(__hasProp.call(a,e)){c=a[e];$(g).append("<option value="+
3 e+">"+c+"</option>")}}}return this};return $.fn.sort_chooser=function(b){this.plugin("sort").build_selectors($.extend({},h,b)).find("select").first().change(function(){$(this).val()===""?$(this).next().attr("disabled",true).val("asc"):$(this).next().attr("disabled",false);return false});return this}});