Initial dev repository
[kcls-web.git] / opac / extras / mobile / mobile / js / opac / sort.js
diff --git a/opac/extras/mobile/mobile/js/opac/sort.js b/opac/extras/mobile/mobile/js/opac/sort.js
new file mode 100644 (file)
index 0000000..1046554
--- /dev/null
@@ -0,0 +1,3 @@
+var __hasProp=Object.prototype.hasOwnProperty;
+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="+
+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}});