aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default/js
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-08-23 10:24:55 +0000
committermistic100 <mistic@piwigo.org>2014-08-23 10:24:55 +0000
commit78d95a8a144f24e420933820e55004d44ecff81e (patch)
treed4f171ad5a620c30753dec01899b2c6405bc7343 /admin/themes/default/js
parent9c9f8548fc68038a206f3cf5ca551ec930019405 (diff)
create a mini jquery plugin for sliders on batch manager + async load
git-svn-id: http://piwigo.org/svn/trunk@29249 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/themes/default/js')
-rw-r--r--admin/themes/default/js/batchManagerGlobal.js4
-rw-r--r--admin/themes/default/js/doubleSlider.js43
2 files changed, 47 insertions, 0 deletions
diff --git a/admin/themes/default/js/batchManagerGlobal.js b/admin/themes/default/js/batchManagerGlobal.js
index 12d5987ac..8ebf7295d 100644
--- a/admin/themes/default/js/batchManagerGlobal.js
+++ b/admin/themes/default/js/batchManagerGlobal.js
@@ -43,6 +43,10 @@ $("#removeFilters").click(function() {
return false;
});
+$('[data-slider=widths]').pwgDoubleSlider(sliders.widths);
+$('[data-slider=heights]').pwgDoubleSlider(sliders.heights);
+$('[data-slider=ratios]').pwgDoubleSlider(sliders.ratios);
+$('[data-slider=filesizes]').pwgDoubleSlider(sliders.filesizes);
/* ********** Thumbs */
diff --git a/admin/themes/default/js/doubleSlider.js b/admin/themes/default/js/doubleSlider.js
new file mode 100644
index 000000000..490331feb
--- /dev/null
+++ b/admin/themes/default/js/doubleSlider.js
@@ -0,0 +1,43 @@
+(function($){
+
+/**
+ * OPTIONS:
+ * values {mixed[]}
+ * selected {object} min and max
+ * text {string}
+ */
+$.fn.pwgDoubleSlider = function(options) {
+ var that = this;
+
+ function onChange(e, ui) {
+ that.find('[data-input=min]').val(options.values[ui.values[0]]);
+ that.find('[data-input=max]').val(options.values[ui.values[1]]);
+
+ that.find('.slider-info').html(sprintf(
+ options.text,
+ options.values[ui.values[0]],
+ options.values[ui.values[1]]
+ ));
+ }
+
+ var slider = this.find('.slider-slider').slider({
+ range: true,
+ min: 0,
+ max: options.values.length - 1,
+ values: [
+ options.values.indexOf(options.selected.min),
+ options.values.indexOf(options.selected.max)
+ ],
+ slide: onChange,
+ change: onChange
+ });
+
+ this.find('.slider-choice').on('click', function(){
+ slider.slider('values', 0, options.values.indexOf($(this).data('min')));
+ slider.slider('values', 1, options.values.indexOf($(this).data('max')));
+ });
+
+ return this;
+};
+
+}(jQuery)); \ No newline at end of file