Ignore:
Timestamp:
Sep 12, 2014, 1:35:32 PM (10 years ago)
Author:
mistic100
Message:

add URL filter input for dimension and filesize + batch_manager_url_filter trigger + fixes in doubleSlider.js

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/js/doubleSlider.js

    r29249 r29505  
    2121  }
    2222
     23  function findClosest(array, value) {
     24    var closest = null, index = -1;
     25    $.each(array, function(i, v){
     26      if (closest == null || Math.abs(v - value) < Math.abs(closest - value)) {
     27        closest = v;
     28        index = i;
     29      }
     30    });
     31    return index;
     32  }
     33
     34  var values = [
     35    options.values.indexOf(options.selected.min),
     36    options.values.indexOf(options.selected.max)
     37  ];
     38  if (values[0] == -1) {
     39    values[0] = findClosest(options.values, options.selected.min);
     40  }
     41  if (values[1] == -1) {
     42    values[1] = findClosest(options.values, options.selected.max);
     43  }
     44
    2345  var slider = this.find('.slider-slider').slider({
    2446    range: true,
    2547    min: 0,
    2648    max: options.values.length - 1,
    27     values: [
    28       options.values.indexOf(options.selected.min),
    29       options.values.indexOf(options.selected.max)
    30     ],
     49    values: values,
    3150    slide: onChange,
    3251    change: onChange
Note: See TracChangeset for help on using the changeset viewer.