';
@@ -179,6 +180,15 @@
fn.withdraw($div);
return false;
});
+ // handle reset
+ $form.find('.'+cls+'reset').on('click', function () {
+ var sliders = $form.find('div.'+tiny);
+ sliders.each(function () {
+ var reset = $(this).data('reset');
+ reset();
+ });
+ // TODO: update indicator
+ });
// handle cancel
$form.find('.'+cls+'cancel').on('click', function () {
fn.withdraw($div);
@@ -186,7 +196,6 @@
// show div
$div.fadeIn();
// fix non-HTML5 slider
- var tiny = cssPrefix + 'tinyslider';
var $range = $form.find('input.'+tiny+'range');
var HTML5 = $range.prop('type') === 'range';
if (!HTML5) {
@@ -208,7 +217,7 @@
var cssPrefix = data.settings.cssPrefix;
var cls = cssPrefix + 'tinyslider';
var html = '\
-
\
+
\
'+opts.label+'\
\
\
@@ -216,17 +225,15 @@
var $slider = $(html);
var $range = $slider.find('input.'+cls+'range');
var $text = $slider.find('input.'+cls+'text');
- $slider.data({'$text' : $text, '$range' : $range});
- // connect slider and input
- $range.on('change', function () {
+ var rangeChange = function () {
// crop floating point imprecision
var val = parseFloat($range.val()).toFixed(4);
$text.val(parseFloat(val));
if ($.isFunction(onChange)) {
onChange($slider, val);
}
- });
- $text.on('change', function () {
+ };
+ var textChange = function () {
var val = $text.val();
$range.val(val);
// val doesn't change the slider handle position in Tinyrange
@@ -238,6 +245,18 @@
if ($.isFunction(onChange)) {
onChange($slider, val);
}
+ };
+ var reset = function () {
+ $text.val(param);
+ textChange();
+ };
+ // connect slider and input
+ $range.on('change', rangeChange);
+ $text.on('change', textChange);
+ $slider.data({
+ '$text' : $text,
+ '$range' : $range,
+ 'reset' : reset
});
return $slider;
};
@@ -265,15 +284,21 @@
var html = '\
\
\
-
\
- \
-
\
-
\
- \
+
\
+
\
+
\
+
\
+
\
+
\
+
\
+
\
+
\
+
\
+
\
\
';
var $div = $(html);
- var $table = $div.find('table');
+ var $table = $div.find('table.'+cls);
var onChange = function () {
// show effects of color brightness/contrast on a grey scale
var input = $table.data();
@@ -290,9 +315,9 @@
var b = Math.min(Math.max(Math.round(Math.pow(2, bm) * val + ba), 0), 255);
$(this).css('background-color', 'rgb('+r+','+g+','+b+')');
};
- $div.find('div.'+cls+'indicator span').each(setRGBValue);
+ $div.find('table.'+cls+'indicator td').each(setRGBValue);
};
- var setupTableRow = function(index, value) {
+ var insertTableRow = function(index, value) {
var color = rgb[value];
// start values are set in "handleSetup"
var $tr = $('