summaryrefslogtreecommitdiff
path: root/share/www/script/jquery.resizer.js
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-06-02 21:57:35 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-06-02 21:57:35 +0000
commitefd28ccaa331fc983749dd6322fb4f4303c2e3b7 (patch)
tree69329772f2f0d17e31aa78fb8f08892036bb1542 /share/www/script/jquery.resizer.js
parent303230cb554aa07ce7ada5520b4d3dc0bb89ec51 (diff)
* The map/reduce function textareas in Futon are now horizontally resizable split-pane style
* The initial height of the view code textareas is adjusted to the number of lines in the map/reduce functions. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@662587 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/jquery.resizer.js')
-rw-r--r--share/www/script/jquery.resizer.js38
1 files changed, 27 insertions, 11 deletions
diff --git a/share/www/script/jquery.resizer.js b/share/www/script/jquery.resizer.js
index 081c7177..f020d3e2 100644
--- a/share/www/script/jquery.resizer.js
+++ b/share/www/script/jquery.resizer.js
@@ -12,10 +12,12 @@
(function($) {
- $.fn.resizable = function(options) {
+ $.fn.makeResizable = function(options) {
options = options || {};
options.always = options.always || false;
options.grippie = options.grippie || null;
+ options.minWidth = options.minWidth || 100;
+ options.maxWidth = options.maxWidth || null;
options.minHeight = options.minHeight || 32;
options.maxHeight = options.maxHeight || null;
@@ -28,19 +30,33 @@
grippie.addClass("grippie");
var elem = $(this);
grippie.mousedown(function(e) {
- var pos = e.screenY;
- var height = elem.height();
+ var pos = {x: e.screenX, y: e.screenY};
+ var dimensions = {width: elem.width(), height: elem.height()};
$(document)
.mousemove(function(e) {
- var offset = e.screenY - pos;
- if (offset) {
- var newHeight = height + offset;
- if (newHeight >= options.minHeight &&
- (!options.maxHeight || newHeight <= options.maxHeight)) {
- elem.height(newHeight);
- height = newHeight;
+ if (options.horizontal) {
+ var offset = e.screenX - pos.x;
+ if (offset) {
+ var newWidth = dimensions.width + offset;
+ if (newWidth >= options.minWidth &&
+ (!options.maxWidth || newWidth <= options.maxWidth)) {
+ elem.width(newWidth);
+ dimensions.width = newWidth;
+ }
+ pos.x = e.screenX;
+ }
+ }
+ if (options.vertical) {
+ var offset = e.screenY - pos.y;
+ if (offset) {
+ var newHeight = dimensions.height + offset;
+ if (newHeight >= options.minHeight &&
+ (!options.maxHeight || newHeight <= options.maxHeight)) {
+ elem.height(newHeight);
+ dimensions.height = newHeight;
+ }
+ pos.y = e.screenY;
}
- pos = e.screenY;
}
document.onselectstart = function() { return false }; // for IE
return false;