No regular expressions were active.
|
|
1 |
|
/*
|
|
|
2 |
|
* 'this'
-> origina
l element
|
|
|
3 |
|
* 1. argu
ment: brow
ser event
|
|
|
4 |
|
* 2.argum
ent: ui ob
ject
|
|
|
5 |
|
*/
|
|
|
6 |
|
|
|
|
7 |
|
(function(
$) {
|
|
|
8 |
|
|
|
|
9 |
|
$.ui.p
lugin.add(
"sortable"
, "cursor"
, {
|
|
|
10 |
|
st
art: funct
ion(e,ui)
{
|
|
|
11 |
|
var t =
$('body');
|
|
|
12 |
|
if (t.cs
s("cursor"
)) ui.opti
ons._curso
r = t.css(
"cursor");
|
|
|
13 |
|
t.css("c
ursor", ui
.options.c
ursor);
|
|
|
14 |
|
},
|
|
|
15 |
|
st
op: functi
on(e,ui) {
|
|
|
16 |
|
if (ui.o
ptions._cu
rsor) $('b
ody').css(
"cursor",
ui.options
._cursor);
|
|
|
17 |
|
}
|
|
|
18 |
|
});
|
|
|
19 |
|
|
|
|
20 |
|
$.ui.p
lugin.add(
"sortable"
, "zIndex"
, {
|
|
|
21 |
|
st
art: funct
ion(e,ui)
{
|
|
|
22 |
|
var t =
ui.helper;
|
|
|
23 |
|
if(t.css
("zIndex")
) ui.optio
ns._zIndex
= t.css("
zIndex");
|
|
|
24 |
|
t.css('z
Index', ui
.options.z
Index);
|
|
|
25 |
|
},
|
|
|
26 |
|
st
op: functi
on(e,ui) {
|
|
|
27 |
|
if(ui.op
tions._zIn
dex) $(ui.
helper).cs
s('zIndex'
, ui.optio
ns._zIndex
);
|
|
|
28 |
|
}
|
|
|
29 |
|
});
|
|
|
30 |
|
|
|
|
31 |
|
$.ui.p
lugin.add(
"sortable"
, "opacity
", {
|
|
|
32 |
|
st
art: funct
ion(e,ui)
{
|
|
|
33 |
|
var t =
ui.helper;
|
|
|
34 |
|
if(t.css
("opacity"
)) ui.opti
ons._opaci
ty = t.css
("opacity"
);
|
|
|
35 |
|
t.css('o
pacity', u
i.options.
opacity);
|
|
|
36 |
|
},
|
|
|
37 |
|
st
op: functi
on(e,ui) {
|
|
|
38 |
|
if(ui.op
tions._opa
city) $(ui
.helper).c
ss('opacit
y', ui.opt
ions._opac
ity);
|
|
|
39 |
|
}
|
|
|
40 |
|
});
|
|
|
41 |
|
|
|
|
42 |
|
|
|
|
43 |
|
$.ui.p
lugin.add(
"sortable"
, "revert"
, {
|
|
|
44 |
|
st
op: functi
on(e,ui) {
|
|
|
45 |
|
var self
= ui.inst
ance;
|
|
|
46 |
|
self.can
celHelperR
emoval = t
rue;
|
|
|
47 |
|
var cur
= self.cur
rentItem.o
ffset();
|
|
|
48 |
|
if(ui.in
stance.opt
ions.zInde
x) ui.help
er.css('zI
ndex', ui.
instance.o
ptions.zIn
dex); //Do
the zInde
x again be
cause it a
lready was
resetted
by the plu
gin above
on stop
|
|
|
49 |
|
|
|
|
50 |
|
//Also a
nimate the
placehold
er if we h
ave one
|
|
|
51 |
|
if(ui.in
stance.pla
ceholder)
ui.instanc
e.placehol
der.animat
e({ opacit
y: 'hide'
}, parseIn
t(ui.optio
ns.revert,
10) || 50
0);
|
|
|
52 |
|
|
|
|
53 |
|
ui.helpe
r.animate(
{
|
|
|
54 |
|
left
: cur.left
- self.of
fsetParent
Offset.lef
t - (parse
Int(self.c
urrentItem
.css('marg
inLeft'),1
0) || 0),
|
|
|
55 |
|
top:
cur.top -
self.offs
etParentOf
fset.top -
(parseInt
(self.curr
entItem.cs
s('marginT
op'),10) |
| 0)
|
|
|
56 |
|
}, parse
Int(ui.opt
ions.rever
t, 10) ||
500, funct
ion() {
|
|
|
57 |
|
self
.currentIt
em.css('vi
sibility',
'visible'
);
|
|
|
58 |
|
wind
ow.setTime
out(functi
on() {
|
|
|
59 |
|
if(self.pl
aceholder)
self.plac
eholder.re
move();
|
|
|
60 |
|
self.helpe
r.remove()
;
|
|
|
61 |
|
if(ui.opti
ons._zInde
x) ui.help
er.css('zI
ndex', ui.
options._z
Index);
|
|
|
62 |
|
}, 5
0);
|
|
|
63 |
|
});
|
|
|
64 |
|
}
|
|
|
65 |
|
});
|
|
|
66 |
|
|
|
|
67 |
|
|
|
|
68 |
|
$.ui.p
lugin.add(
"sortable"
, "contain
ment", {
|
|
|
69 |
|
st
art: funct
ion(e,ui)
{
|
|
|
70 |
|
|
|
|
71 |
|
var o =
ui.options
;
|
|
|
72 |
|
if((o.co
ntainment.
left != un
defined ||
o.contain
ment.const
ructor ==
Array) &&
!o._contai
nment) ret
urn;
|
|
|
73 |
|
if(!o._c
ontainment
) o._conta
inment = o
.containme
nt;
|
|
|
74 |
|
|
|
|
75 |
|
if(o._co
ntainment
== 'parent
') o._cont
ainment =
this[0].pa
rentNode;
|
|
|
76 |
|
if(o._co
ntainment
== 'docume
nt') {
|
|
|
77 |
|
o.co
ntainment
= [
|
|
|
78 |
|
0,
|
|
|
79 |
|
0,
|
|
|
80 |
|
$(document
).width(),
|
|
|
81 |
|
($(documen
t).height(
) || docum
ent.body.p
arentNode.
scrollHeig
ht)
|
|
|
82 |
|
];
|
|
|
83 |
|
} else {
//I'm a n
ode, so co
mpute top/
left/right
/bottom
|
|
|
84 |
|
|
|
|
85 |
|
var
ce = $(o._
containmen
t)[0];
|
|
|
86 |
|
var
co = $(o._
containmen
t).offset(
);
|
|
|
87 |
|
|
|
|
88 |
|
o.co
ntainment
= [
|
|
|
89 |
|
co.left,
|
|
|
90 |
|
co.top,
|
|
|
91 |
|
co.left+(c
e.offsetWi
dth || ce.
scrollWidt
h),
|
|
|
92 |
|
co.top+(ce
.offsetHei
ght || ce.
scrollHeig
ht)
|
|
|
93 |
|
];
|
|
|
94 |
|
}
|
|
|
95 |
|
|
|
|
96 |
|
},
|
|
|
97 |
|
so
rt: functi
on(e,ui) {
|
|
|
98 |
|
|
|
|
99 |
|
var o =
ui.options
;
|
|
|
100 |
|
var h =
ui.helper;
|
|
|
101 |
|
var c =
o.containm
ent;
|
|
|
102 |
|
var self
= ui.inst
ance;
|
|
|
103 |
|
|
|
|
104 |
|
if(c.con
structor =
= Array) {
|
|
|
105 |
|
if((
ui.absolut
ePosition.
left < c[0
])) self.p
osition.le
ft = c[0]
- (self.of
fset.left
- self.cli
ckOffset.l
eft);
|
|
|
106 |
|
if((
ui.absolut
ePosition.
top < c[1]
)) self.po
sition.top
= c[1] -
(self.offs
et.top - s
elf.clickO
ffset.top)
;
|
|
|
107 |
|
if(u
i.absolute
Position.l
eft - c[2]
+ self.he
lperPropor
tions.widt
h >= 0) se
lf.positio
n.left = c
[2] - (sel
f.offset.l
eft - self
.clickOffs
et.left) -
self.help
erProporti
ons.width;
|
|
|
108 |
|
if(u
i.absolute
Position.t
op - c[3]
+ self.hel
perProport
ions.heigh
t >= 0) se
lf.positio
n.top = c[
3] - (self
.offset.to
p - self.c
lickOffset
.top) - se
lf.helperP
roportions
.height;
|
|
|
109 |
|
} else {
|
|
|
110 |
|
if((
ui.positio
n.left < c
.left)) se
lf.positio
n.left = c
.left;
|
|
|
111 |
|
if((
ui.positio
n.top < c.
top)) self
.position.
top = c.to
p;
|
|
|
112 |
|
if(u
i.position
.left - se
lf.offsetP
arent.inne
rWidth() +
self.help
erProporti
ons.width
+ c.right
+ (parseIn
t(self.off
setParent.
css("borde
rLeftWidth
"), 10) ||
0) + (par
seInt(self
.offsetPar
ent.css("b
orderRight
Width"), 1
0) || 0) >
= 0) self.
position.l
eft = self
.offsetPar
ent.innerW
idth() - s
elf.helper
Proportion
s.width -
c.right -
(parseInt(
self.offse
tParent.cs
s("borderL
eftWidth")
, 10) || 0
) - (parse
Int(self.o
ffsetParen
t.css("bor
derRightWi
dth"), 10)
|| 0);
|
|
|
113 |
|
if(u
i.position
.top - sel
f.offsetPa
rent.inner
Height() +
self.help
erProporti
ons.height
+ c.botto
m + (parse
Int(self.o
ffsetParen
t.css("bor
derTopWidt
h"), 10) |
| 0) + (pa
rseInt(sel
f.offsetPa
rent.css("
borderBott
omWidth"),
10) || 0)
>= 0) sel
f.position
.top = sel
f.offsetPa
rent.inner
Height() -
self.help
erProporti
ons.height
- c.botto
m - (parse
Int(self.o
ffsetParen
t.css("bor
derTopWidt
h"), 10) |
| 0) - (pa
rseInt(sel
f.offsetPa
rent.css("
borderBott
omWidth"),
10) || 0)
;
|
|
|
114 |
|
}
|
|
|
115 |
|
|
|
|
116 |
|
}
|
|
|
117 |
|
});
|
|
|
118 |
|
|
|
|
119 |
|
$.ui.p
lugin.add(
"sortable"
, "axis",
{
|
|
|
120 |
|
so
rt: functi
on(e,ui) {
|
|
|
121 |
|
var o =
ui.options
;
|
|
|
122 |
|
if(o.con
straint) o
.axis = o.
constraint
; //Legacy
check
|
|
|
123 |
|
o.axis =
= 'x' ? ui
.instance.
position.t
op = ui.in
stance.ori
ginalPosit
ion.top :
ui.instanc
e.position
.left = ui
.instance.
originalPo
sition.lef
t;
|
|
|
124 |
|
}
|
|
|
125 |
|
});
|
|
|
126 |
|
|
|
|
127 |
|
$.ui.p
lugin.add(
"sortable"
, "scroll"
, {
|
|
|
128 |
|
st
art: funct
ion(e,ui)
{
|
|
|
129 |
|
var o =
ui.options
;
|
|
|
130 |
|
o.scroll
Sensitivit
y = o.scro
llSensitiv
ity || 20;
|
|
|
131 |
|
o.scroll
Speed
= o.scro
llSpeed ||
20;
|
|
|
132 |
|
|
|
|
133 |
|
ui.insta
nce.overfl
owY = func
tion(el) {
|
|
|
134 |
|
do {
if((/auto
|scroll/).
test(el.cs
s('overflo
w')) || (/
auto|scrol
l/).test(e
l.css('ove
rflow-y'))
) return e
l; el = el
.parent();
} while (
el[0].pare
ntNode);
|
|
|
135 |
|
retu
rn $(docum
ent);
|
|
|
136 |
|
}(this);
|
|
|
137 |
|
ui.insta
nce.overfl
owX = func
tion(el) {
|
|
|
138 |
|
do {
if((/auto
|scroll/).
test(el.cs
s('overflo
w')) || (/
auto|scrol
l/).test(e
l.css('ove
rflow-x'))
) return e
l; el = el
.parent();
} while (
el[0].pare
ntNode);
|
|
|
139 |
|
retu
rn $(docum
ent);
|
|
|
140 |
|
}(this);
|
|
|
141 |
|
},
|
|
|
142 |
|
so
rt: functi
on(e,ui) {
|
|
|
143 |
|
|
|
|
144 |
|
var o =
ui.options
;
|
|
|
145 |
|
var i =
ui.instanc
e;
|
|
|
146 |
|
|
|
|
147 |
|
if(i.ove
rflowY[0]
!= documen
t && i.ove
rflowY[0].
tagName !=
'HTML') {
|
|
|
148 |
|
if(i
.overflowY
[0].offset
Height - (
ui.positio
n.top - i.
overflowY[
0].scrollT
op + i.cli
ckOffset.t
op) < o.sc
rollSensit
ivity)
|
|
|
149 |
|
i.overflow
Y[0].scrol
lTop = i.o
verflowY[0
].scrollTo
p + o.scro
llSpeed;
|
|
|
150 |
|
if((
ui.positio
n.top - i.
overflowY[
0].scrollT
op + i.cli
ckOffset.t
op) < o.sc
rollSensit
ivity)
|
|
|
151 |
|
i.overflow
Y[0].scrol
lTop = i.o
verflowY[0
].scrollTo
p - o.scro
llSpeed;
|
|
|
152 |
|
} else {
|
|
|
153 |
|
//$(
document.b
ody).appen
d('<p>'+(e
.pageY - $
(document)
.scrollTop
())+'</p>'
);
|
|
|
154 |
|
if(e
.pageY - $
(document)
.scrollTop
() < o.scr
ollSensiti
vity)
|
|
|
155 |
|
$(document
).scrollTo
p($(docume
nt).scroll
Top() - o.
scrollSpee
d);
|
|
|
156 |
|
if($
(window).h
eight() -
(e.pageY -
$(documen
t).scrollT
op()) < o.
scrollSens
itivity)
|
|
|
157 |
|
$(document
).scrollTo
p($(docume
nt).scroll
Top() + o.
scrollSpee
d);
|
|
|
158 |
|
}
|
|
|
159 |
|
|
|
|
160 |
|
if(i.ove
rflowX[0]
!= documen
t && i.ove
rflowX[0].
tagName !=
'HTML') {
|
|
|
161 |
|
if(i
.overflowX
[0].offset
Width - (u
i.position
.left - i.
overflowX[
0].scrollL
eft + i.cl
ickOffset.
left) < o.
scrollSens
itivity)
|
|
|
162 |
|
i.overflow
X[0].scrol
lLeft = i.
overflowX[
0].scrollL
eft + o.sc
rollSpeed;
|
|
|
163 |
|
if((
ui.positio
n.top - i.
overflowX[
0].scrollL
eft + i.cl
ickOffset.
left) < o.
scrollSens
itivity)
|
|
|
164 |
|
i.overflow
X[0].scrol
lLeft = i.
overflowX[
0].scrollL
eft - o.sc
rollSpeed;
|
|
|
165 |
|
} else {
|
|
|
166 |
|
if(e
.pageX - $
(document)
.scrollLef
t() < o.sc
rollSensit
ivity)
|
|
|
167 |
|
$(document
).scrollLe
ft($(docum
ent).scrol
lLeft() -
o.scrollSp
eed);
|
|
|
168 |
|
if($
(window).w
idth() - (
e.pageX -
$(document
).scrollLe
ft()) < o.
scrollSens
itivity)
|
|
|
169 |
|
$(document
).scrollLe
ft($(docum
ent).scrol
lLeft() +
o.scrollSp
eed);
|
|
|
170 |
|
}
|
|
|
171 |
|
|
|
|
172 |
|
ui.insta
nce.recall
Offset(e);
|
|
|
173 |
|
|
|
|
174 |
|
}
|
|
|
175 |
|
});
|
|
|
176 |
|
|
|
|
177 |
|
})(jQuery)
;
|
|
|
178 |
|
|