wtails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wtails/version.rb +1 -1
- data/public/css/images/animated-overlay.gif +0 -0
- data/public/css/images/ui-bg_flat_30_cccccc_40x100.png +0 -0
- data/public/css/images/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
- data/public/css/images/ui-bg_glass_20_555555_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_40_0078a3_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_40_ffc73d_1x400.png +0 -0
- data/public/css/images/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
- data/public/css/images/ui-bg_inset-soft_25_000000_1x100.png +0 -0
- data/public/css/images/ui-bg_inset-soft_30_f58400_1x100.png +0 -0
- data/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/public/css/images/ui-icons_4b8e0b_256x240.png +0 -0
- data/public/css/images/ui-icons_a83300_256x240.png +0 -0
- data/public/css/images/ui-icons_cccccc_256x240.png +0 -0
- data/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/css/jquery-ui-1.10.1.custom.min.css +5 -0
- data/public/css/style.css +16 -1
- data/public/js/jquery-ui-1.10.1.custom.js +4539 -0
- data/public/js/jquery-ui-1.10.1.custom.min.js +6 -0
- data/public/js/jquery.js +9597 -0
- data/views/_init.erb +43 -1
- data/views/dual.erb +1 -1
- data/views/single.erb +6 -6
- metadata +23 -4
data/lib/wtails/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*! jQuery UI - v1.10.1 - 2013-02-25
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.button.css, jquery.ui.dialog.css
|
4
|
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Segoe%20UI%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=333333&bgTextureHeader=gloss_wave&bgImgOpacityHeader=25&borderColorHeader=333333&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=000000&bgTextureContent=inset_soft&bgImgOpacityContent=25&borderColorContent=666666&fcContent=ffffff&iconColorContent=cccccc&bgColorDefault=555555&bgTextureDefault=glass&bgImgOpacityDefault=20&borderColorDefault=666666&fcDefault=eeeeee&iconColorDefault=cccccc&bgColorHover=0078a3&bgTextureHover=glass&bgImgOpacityHover=40&borderColorHover=59b4d4&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=f58400&bgTextureActive=inset_soft&bgImgOpacityActive=30&borderColorActive=ffaf0f&fcActive=ffffff&iconColorActive=222222&bgColorHighlight=eeeeee&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=80&borderColorHighlight=cccccc&fcHighlight=2e7db2&iconColorHighlight=4b8e0b&bgColorError=ffc73d&bgTextureError=glass&bgImgOpacityError=40&borderColorError=ffb73d&fcError=111111&iconColorError=a83300&bgColorOverlay=5c5c5c&bgTextureOverlay=flat&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=cccccc&bgTextureShadow=flat&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px
|
5
|
+
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:21px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-widget{font-family:Segoe UI,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Segoe UI,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #666;background:#000 url(images/ui-bg_inset-soft_25_000000_1x100.png) 50% bottom repeat-x;color:#fff}.ui-widget-content a{color:#fff}.ui-widget-header{border:1px solid #333;background:#333 url(images/ui-bg_gloss-wave_25_333333_500x100.png) 50% 50% repeat-x;color:#fff;font-weight:bold}.ui-widget-header a{color:#fff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #666;background:#555 url(images/ui-bg_glass_20_555555_1x400.png) 50% 50% repeat-x;font-weight:bold;color:#eee}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#eee;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #59b4d4;background:#0078a3 url(images/ui-bg_glass_40_0078a3_1x400.png) 50% 50% repeat-x;font-weight:bold;color:#fff}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#fff;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #ffaf0f;background:#f58400 url(images/ui-bg_inset-soft_30_f58400_1x100.png) 50% 50% repeat-x;font-weight:bold;color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #ccc;background:#eee url(images/ui-bg_highlight-soft_80_eeeeee_1x100.png) 50% top repeat-x;color:#2e7db2}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#2e7db2}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ffb73d;background:#ffc73d url(images/ui-bg_glass_40_ffc73d_1x400.png) 50% 50% repeat-x;color:#111}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#111}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#111}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px;background-position:16px 16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url(images/ui-icons_cccccc_256x240.png)}.ui-widget-header .ui-icon{background-image:url(images/ui-icons_ffffff_256x240.png)}.ui-state-default .ui-icon{background-image:url(images/ui-icons_cccccc_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(images/ui-icons_ffffff_256x240.png)}.ui-state-active .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(images/ui-icons_4b8e0b_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(images/ui-icons_a83300_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:6px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:6px}.ui-widget-overlay{background:#5c5c5c url(images/ui-bg_flat_50_5c5c5c_40x100.png) 50% 50% repeat-x;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-7px 0 0 -7px;padding:7px;background:#ccc url(images/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x;opacity:.6;filter:Alpha(Opacity=60);border-radius:8px}
|
data/public/css/style.css
CHANGED
@@ -164,11 +164,12 @@ pre {
|
|
164
164
|
margin: 0;
|
165
165
|
padding: 0;
|
166
166
|
font-family: "Monaco", "Consolas", monospace;
|
167
|
+
font-size: small;
|
167
168
|
|
168
169
|
word-wrap: break-word;
|
169
170
|
white-space: pre-wrap;
|
170
171
|
word-break: break-all;
|
171
|
-
border-bottom: thin dashed #
|
172
|
+
border-bottom: thin dashed #333;
|
172
173
|
}
|
173
174
|
|
174
175
|
.terminal hr {
|
@@ -179,3 +180,17 @@ pre {
|
|
179
180
|
background-image: -ms-linear-gradient(left, rgba(200,255,200,0), rgba(200,255,200,0.75), rgba(200,255,200,0));
|
180
181
|
background-image: -o-linear-gradient(left, rgba(200,255,200,0), rgba(200,255,200,0.75), rgba(200,255,200,0));
|
181
182
|
}
|
183
|
+
|
184
|
+
.dialog-content hr {
|
185
|
+
border: 0;
|
186
|
+
height: 1px;
|
187
|
+
background-image: -webkit-linear-gradient(left, rgba(200,255,200,0), rgba(200,255,200,0.75), rgba(200,255,200,0));
|
188
|
+
background-image: -moz-linear-gradient(left, rgba(200,255,200,0), rgba(200,255,200,0.75), rgba(200,255,200,0));
|
189
|
+
background-image: -ms-linear-gradient(left, rgba(200,255,200,0), rgba(200,255,200,0.75), rgba(200,255,200,0));
|
190
|
+
background-image: -o-linear-gradient(left, rgba(200,255,200,0), rgba(200,255,200,0.75), rgba(200,255,200,0));
|
191
|
+
}
|
192
|
+
|
193
|
+
div.ui-dialog-titlebar {
|
194
|
+
display: none;
|
195
|
+
}
|
196
|
+
|
@@ -0,0 +1,4539 @@
|
|
1
|
+
/*! jQuery UI - v1.10.1 - 2013-02-25
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.resizable.js, jquery.ui.button.js, jquery.ui.dialog.js
|
4
|
+
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */
|
5
|
+
|
6
|
+
(function( $, undefined ) {
|
7
|
+
|
8
|
+
var uuid = 0,
|
9
|
+
runiqueId = /^ui-id-\d+$/;
|
10
|
+
|
11
|
+
// prevent duplicate loading
|
12
|
+
// this is only a problem because we proxy existing functions
|
13
|
+
// and we don't want to double proxy them
|
14
|
+
$.ui = $.ui || {};
|
15
|
+
if ( $.ui.version ) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
19
|
+
$.extend( $.ui, {
|
20
|
+
version: "1.10.1",
|
21
|
+
|
22
|
+
keyCode: {
|
23
|
+
BACKSPACE: 8,
|
24
|
+
COMMA: 188,
|
25
|
+
DELETE: 46,
|
26
|
+
DOWN: 40,
|
27
|
+
END: 35,
|
28
|
+
ENTER: 13,
|
29
|
+
ESCAPE: 27,
|
30
|
+
HOME: 36,
|
31
|
+
LEFT: 37,
|
32
|
+
NUMPAD_ADD: 107,
|
33
|
+
NUMPAD_DECIMAL: 110,
|
34
|
+
NUMPAD_DIVIDE: 111,
|
35
|
+
NUMPAD_ENTER: 108,
|
36
|
+
NUMPAD_MULTIPLY: 106,
|
37
|
+
NUMPAD_SUBTRACT: 109,
|
38
|
+
PAGE_DOWN: 34,
|
39
|
+
PAGE_UP: 33,
|
40
|
+
PERIOD: 190,
|
41
|
+
RIGHT: 39,
|
42
|
+
SPACE: 32,
|
43
|
+
TAB: 9,
|
44
|
+
UP: 38
|
45
|
+
}
|
46
|
+
});
|
47
|
+
|
48
|
+
// plugins
|
49
|
+
$.fn.extend({
|
50
|
+
_focus: $.fn.focus,
|
51
|
+
focus: function( delay, fn ) {
|
52
|
+
return typeof delay === "number" ?
|
53
|
+
this.each(function() {
|
54
|
+
var elem = this;
|
55
|
+
setTimeout(function() {
|
56
|
+
$( elem ).focus();
|
57
|
+
if ( fn ) {
|
58
|
+
fn.call( elem );
|
59
|
+
}
|
60
|
+
}, delay );
|
61
|
+
}) :
|
62
|
+
this._focus.apply( this, arguments );
|
63
|
+
},
|
64
|
+
|
65
|
+
scrollParent: function() {
|
66
|
+
var scrollParent;
|
67
|
+
if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
|
68
|
+
scrollParent = this.parents().filter(function() {
|
69
|
+
return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
|
70
|
+
}).eq(0);
|
71
|
+
} else {
|
72
|
+
scrollParent = this.parents().filter(function() {
|
73
|
+
return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
|
74
|
+
}).eq(0);
|
75
|
+
}
|
76
|
+
|
77
|
+
return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
|
78
|
+
},
|
79
|
+
|
80
|
+
zIndex: function( zIndex ) {
|
81
|
+
if ( zIndex !== undefined ) {
|
82
|
+
return this.css( "zIndex", zIndex );
|
83
|
+
}
|
84
|
+
|
85
|
+
if ( this.length ) {
|
86
|
+
var elem = $( this[ 0 ] ), position, value;
|
87
|
+
while ( elem.length && elem[ 0 ] !== document ) {
|
88
|
+
// Ignore z-index if position is set to a value where z-index is ignored by the browser
|
89
|
+
// This makes behavior of this function consistent across browsers
|
90
|
+
// WebKit always returns auto if the element is positioned
|
91
|
+
position = elem.css( "position" );
|
92
|
+
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
|
93
|
+
// IE returns 0 when zIndex is not specified
|
94
|
+
// other browsers return a string
|
95
|
+
// we ignore the case of nested elements with an explicit value of 0
|
96
|
+
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
|
97
|
+
value = parseInt( elem.css( "zIndex" ), 10 );
|
98
|
+
if ( !isNaN( value ) && value !== 0 ) {
|
99
|
+
return value;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
elem = elem.parent();
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
return 0;
|
107
|
+
},
|
108
|
+
|
109
|
+
uniqueId: function() {
|
110
|
+
return this.each(function() {
|
111
|
+
if ( !this.id ) {
|
112
|
+
this.id = "ui-id-" + (++uuid);
|
113
|
+
}
|
114
|
+
});
|
115
|
+
},
|
116
|
+
|
117
|
+
removeUniqueId: function() {
|
118
|
+
return this.each(function() {
|
119
|
+
if ( runiqueId.test( this.id ) ) {
|
120
|
+
$( this ).removeAttr( "id" );
|
121
|
+
}
|
122
|
+
});
|
123
|
+
}
|
124
|
+
});
|
125
|
+
|
126
|
+
// selectors
|
127
|
+
function focusable( element, isTabIndexNotNaN ) {
|
128
|
+
var map, mapName, img,
|
129
|
+
nodeName = element.nodeName.toLowerCase();
|
130
|
+
if ( "area" === nodeName ) {
|
131
|
+
map = element.parentNode;
|
132
|
+
mapName = map.name;
|
133
|
+
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
|
134
|
+
return false;
|
135
|
+
}
|
136
|
+
img = $( "img[usemap=#" + mapName + "]" )[0];
|
137
|
+
return !!img && visible( img );
|
138
|
+
}
|
139
|
+
return ( /input|select|textarea|button|object/.test( nodeName ) ?
|
140
|
+
!element.disabled :
|
141
|
+
"a" === nodeName ?
|
142
|
+
element.href || isTabIndexNotNaN :
|
143
|
+
isTabIndexNotNaN) &&
|
144
|
+
// the element and all of its ancestors must be visible
|
145
|
+
visible( element );
|
146
|
+
}
|
147
|
+
|
148
|
+
function visible( element ) {
|
149
|
+
return $.expr.filters.visible( element ) &&
|
150
|
+
!$( element ).parents().addBack().filter(function() {
|
151
|
+
return $.css( this, "visibility" ) === "hidden";
|
152
|
+
}).length;
|
153
|
+
}
|
154
|
+
|
155
|
+
$.extend( $.expr[ ":" ], {
|
156
|
+
data: $.expr.createPseudo ?
|
157
|
+
$.expr.createPseudo(function( dataName ) {
|
158
|
+
return function( elem ) {
|
159
|
+
return !!$.data( elem, dataName );
|
160
|
+
};
|
161
|
+
}) :
|
162
|
+
// support: jQuery <1.8
|
163
|
+
function( elem, i, match ) {
|
164
|
+
return !!$.data( elem, match[ 3 ] );
|
165
|
+
},
|
166
|
+
|
167
|
+
focusable: function( element ) {
|
168
|
+
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
|
169
|
+
},
|
170
|
+
|
171
|
+
tabbable: function( element ) {
|
172
|
+
var tabIndex = $.attr( element, "tabindex" ),
|
173
|
+
isTabIndexNaN = isNaN( tabIndex );
|
174
|
+
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
|
175
|
+
}
|
176
|
+
});
|
177
|
+
|
178
|
+
// support: jQuery <1.8
|
179
|
+
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
|
180
|
+
$.each( [ "Width", "Height" ], function( i, name ) {
|
181
|
+
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
|
182
|
+
type = name.toLowerCase(),
|
183
|
+
orig = {
|
184
|
+
innerWidth: $.fn.innerWidth,
|
185
|
+
innerHeight: $.fn.innerHeight,
|
186
|
+
outerWidth: $.fn.outerWidth,
|
187
|
+
outerHeight: $.fn.outerHeight
|
188
|
+
};
|
189
|
+
|
190
|
+
function reduce( elem, size, border, margin ) {
|
191
|
+
$.each( side, function() {
|
192
|
+
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
|
193
|
+
if ( border ) {
|
194
|
+
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
|
195
|
+
}
|
196
|
+
if ( margin ) {
|
197
|
+
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
|
198
|
+
}
|
199
|
+
});
|
200
|
+
return size;
|
201
|
+
}
|
202
|
+
|
203
|
+
$.fn[ "inner" + name ] = function( size ) {
|
204
|
+
if ( size === undefined ) {
|
205
|
+
return orig[ "inner" + name ].call( this );
|
206
|
+
}
|
207
|
+
|
208
|
+
return this.each(function() {
|
209
|
+
$( this ).css( type, reduce( this, size ) + "px" );
|
210
|
+
});
|
211
|
+
};
|
212
|
+
|
213
|
+
$.fn[ "outer" + name] = function( size, margin ) {
|
214
|
+
if ( typeof size !== "number" ) {
|
215
|
+
return orig[ "outer" + name ].call( this, size );
|
216
|
+
}
|
217
|
+
|
218
|
+
return this.each(function() {
|
219
|
+
$( this).css( type, reduce( this, size, true, margin ) + "px" );
|
220
|
+
});
|
221
|
+
};
|
222
|
+
});
|
223
|
+
}
|
224
|
+
|
225
|
+
// support: jQuery <1.8
|
226
|
+
if ( !$.fn.addBack ) {
|
227
|
+
$.fn.addBack = function( selector ) {
|
228
|
+
return this.add( selector == null ?
|
229
|
+
this.prevObject : this.prevObject.filter( selector )
|
230
|
+
);
|
231
|
+
};
|
232
|
+
}
|
233
|
+
|
234
|
+
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
|
235
|
+
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
|
236
|
+
$.fn.removeData = (function( removeData ) {
|
237
|
+
return function( key ) {
|
238
|
+
if ( arguments.length ) {
|
239
|
+
return removeData.call( this, $.camelCase( key ) );
|
240
|
+
} else {
|
241
|
+
return removeData.call( this );
|
242
|
+
}
|
243
|
+
};
|
244
|
+
})( $.fn.removeData );
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
// deprecated
|
252
|
+
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
|
253
|
+
|
254
|
+
$.support.selectstart = "onselectstart" in document.createElement( "div" );
|
255
|
+
$.fn.extend({
|
256
|
+
disableSelection: function() {
|
257
|
+
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
|
258
|
+
".ui-disableSelection", function( event ) {
|
259
|
+
event.preventDefault();
|
260
|
+
});
|
261
|
+
},
|
262
|
+
|
263
|
+
enableSelection: function() {
|
264
|
+
return this.unbind( ".ui-disableSelection" );
|
265
|
+
}
|
266
|
+
});
|
267
|
+
|
268
|
+
$.extend( $.ui, {
|
269
|
+
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
270
|
+
plugin: {
|
271
|
+
add: function( module, option, set ) {
|
272
|
+
var i,
|
273
|
+
proto = $.ui[ module ].prototype;
|
274
|
+
for ( i in set ) {
|
275
|
+
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
276
|
+
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
277
|
+
}
|
278
|
+
},
|
279
|
+
call: function( instance, name, args ) {
|
280
|
+
var i,
|
281
|
+
set = instance.plugins[ name ];
|
282
|
+
if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
|
286
|
+
for ( i = 0; i < set.length; i++ ) {
|
287
|
+
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
288
|
+
set[ i ][ 1 ].apply( instance.element, args );
|
289
|
+
}
|
290
|
+
}
|
291
|
+
}
|
292
|
+
},
|
293
|
+
|
294
|
+
// only used by resizable
|
295
|
+
hasScroll: function( el, a ) {
|
296
|
+
|
297
|
+
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
298
|
+
if ( $( el ).css( "overflow" ) === "hidden") {
|
299
|
+
return false;
|
300
|
+
}
|
301
|
+
|
302
|
+
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
303
|
+
has = false;
|
304
|
+
|
305
|
+
if ( el[ scroll ] > 0 ) {
|
306
|
+
return true;
|
307
|
+
}
|
308
|
+
|
309
|
+
// TODO: determine which cases actually cause this to happen
|
310
|
+
// if the element doesn't have the scroll set, see if it's possible to
|
311
|
+
// set the scroll
|
312
|
+
el[ scroll ] = 1;
|
313
|
+
has = ( el[ scroll ] > 0 );
|
314
|
+
el[ scroll ] = 0;
|
315
|
+
return has;
|
316
|
+
}
|
317
|
+
});
|
318
|
+
|
319
|
+
})( jQuery );
|
320
|
+
(function( $, undefined ) {
|
321
|
+
|
322
|
+
var uuid = 0,
|
323
|
+
slice = Array.prototype.slice,
|
324
|
+
_cleanData = $.cleanData;
|
325
|
+
$.cleanData = function( elems ) {
|
326
|
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
327
|
+
try {
|
328
|
+
$( elem ).triggerHandler( "remove" );
|
329
|
+
// http://bugs.jquery.com/ticket/8235
|
330
|
+
} catch( e ) {}
|
331
|
+
}
|
332
|
+
_cleanData( elems );
|
333
|
+
};
|
334
|
+
|
335
|
+
$.widget = function( name, base, prototype ) {
|
336
|
+
var fullName, existingConstructor, constructor, basePrototype,
|
337
|
+
// proxiedPrototype allows the provided prototype to remain unmodified
|
338
|
+
// so that it can be used as a mixin for multiple widgets (#8876)
|
339
|
+
proxiedPrototype = {},
|
340
|
+
namespace = name.split( "." )[ 0 ];
|
341
|
+
|
342
|
+
name = name.split( "." )[ 1 ];
|
343
|
+
fullName = namespace + "-" + name;
|
344
|
+
|
345
|
+
if ( !prototype ) {
|
346
|
+
prototype = base;
|
347
|
+
base = $.Widget;
|
348
|
+
}
|
349
|
+
|
350
|
+
// create selector for plugin
|
351
|
+
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
352
|
+
return !!$.data( elem, fullName );
|
353
|
+
};
|
354
|
+
|
355
|
+
$[ namespace ] = $[ namespace ] || {};
|
356
|
+
existingConstructor = $[ namespace ][ name ];
|
357
|
+
constructor = $[ namespace ][ name ] = function( options, element ) {
|
358
|
+
// allow instantiation without "new" keyword
|
359
|
+
if ( !this._createWidget ) {
|
360
|
+
return new constructor( options, element );
|
361
|
+
}
|
362
|
+
|
363
|
+
// allow instantiation without initializing for simple inheritance
|
364
|
+
// must use "new" keyword (the code above always passes args)
|
365
|
+
if ( arguments.length ) {
|
366
|
+
this._createWidget( options, element );
|
367
|
+
}
|
368
|
+
};
|
369
|
+
// extend with the existing constructor to carry over any static properties
|
370
|
+
$.extend( constructor, existingConstructor, {
|
371
|
+
version: prototype.version,
|
372
|
+
// copy the object used to create the prototype in case we need to
|
373
|
+
// redefine the widget later
|
374
|
+
_proto: $.extend( {}, prototype ),
|
375
|
+
// track widgets that inherit from this widget in case this widget is
|
376
|
+
// redefined after a widget inherits from it
|
377
|
+
_childConstructors: []
|
378
|
+
});
|
379
|
+
|
380
|
+
basePrototype = new base();
|
381
|
+
// we need to make the options hash a property directly on the new instance
|
382
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
383
|
+
// inheriting from
|
384
|
+
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
385
|
+
$.each( prototype, function( prop, value ) {
|
386
|
+
if ( !$.isFunction( value ) ) {
|
387
|
+
proxiedPrototype[ prop ] = value;
|
388
|
+
return;
|
389
|
+
}
|
390
|
+
proxiedPrototype[ prop ] = (function() {
|
391
|
+
var _super = function() {
|
392
|
+
return base.prototype[ prop ].apply( this, arguments );
|
393
|
+
},
|
394
|
+
_superApply = function( args ) {
|
395
|
+
return base.prototype[ prop ].apply( this, args );
|
396
|
+
};
|
397
|
+
return function() {
|
398
|
+
var __super = this._super,
|
399
|
+
__superApply = this._superApply,
|
400
|
+
returnValue;
|
401
|
+
|
402
|
+
this._super = _super;
|
403
|
+
this._superApply = _superApply;
|
404
|
+
|
405
|
+
returnValue = value.apply( this, arguments );
|
406
|
+
|
407
|
+
this._super = __super;
|
408
|
+
this._superApply = __superApply;
|
409
|
+
|
410
|
+
return returnValue;
|
411
|
+
};
|
412
|
+
})();
|
413
|
+
});
|
414
|
+
constructor.prototype = $.widget.extend( basePrototype, {
|
415
|
+
// TODO: remove support for widgetEventPrefix
|
416
|
+
// always use the name + a colon as the prefix, e.g., draggable:start
|
417
|
+
// don't prefix for widgets that aren't DOM-based
|
418
|
+
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
|
419
|
+
}, proxiedPrototype, {
|
420
|
+
constructor: constructor,
|
421
|
+
namespace: namespace,
|
422
|
+
widgetName: name,
|
423
|
+
widgetFullName: fullName
|
424
|
+
});
|
425
|
+
|
426
|
+
// If this widget is being redefined then we need to find all widgets that
|
427
|
+
// are inheriting from it and redefine all of them so that they inherit from
|
428
|
+
// the new version of this widget. We're essentially trying to replace one
|
429
|
+
// level in the prototype chain.
|
430
|
+
if ( existingConstructor ) {
|
431
|
+
$.each( existingConstructor._childConstructors, function( i, child ) {
|
432
|
+
var childPrototype = child.prototype;
|
433
|
+
|
434
|
+
// redefine the child widget using the same prototype that was
|
435
|
+
// originally used, but inherit from the new version of the base
|
436
|
+
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
437
|
+
});
|
438
|
+
// remove the list of existing child constructors from the old constructor
|
439
|
+
// so the old child constructors can be garbage collected
|
440
|
+
delete existingConstructor._childConstructors;
|
441
|
+
} else {
|
442
|
+
base._childConstructors.push( constructor );
|
443
|
+
}
|
444
|
+
|
445
|
+
$.widget.bridge( name, constructor );
|
446
|
+
};
|
447
|
+
|
448
|
+
$.widget.extend = function( target ) {
|
449
|
+
var input = slice.call( arguments, 1 ),
|
450
|
+
inputIndex = 0,
|
451
|
+
inputLength = input.length,
|
452
|
+
key,
|
453
|
+
value;
|
454
|
+
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
455
|
+
for ( key in input[ inputIndex ] ) {
|
456
|
+
value = input[ inputIndex ][ key ];
|
457
|
+
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
458
|
+
// Clone objects
|
459
|
+
if ( $.isPlainObject( value ) ) {
|
460
|
+
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
461
|
+
$.widget.extend( {}, target[ key ], value ) :
|
462
|
+
// Don't extend strings, arrays, etc. with objects
|
463
|
+
$.widget.extend( {}, value );
|
464
|
+
// Copy everything else by reference
|
465
|
+
} else {
|
466
|
+
target[ key ] = value;
|
467
|
+
}
|
468
|
+
}
|
469
|
+
}
|
470
|
+
}
|
471
|
+
return target;
|
472
|
+
};
|
473
|
+
|
474
|
+
$.widget.bridge = function( name, object ) {
|
475
|
+
var fullName = object.prototype.widgetFullName || name;
|
476
|
+
$.fn[ name ] = function( options ) {
|
477
|
+
var isMethodCall = typeof options === "string",
|
478
|
+
args = slice.call( arguments, 1 ),
|
479
|
+
returnValue = this;
|
480
|
+
|
481
|
+
// allow multiple hashes to be passed on init
|
482
|
+
options = !isMethodCall && args.length ?
|
483
|
+
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
484
|
+
options;
|
485
|
+
|
486
|
+
if ( isMethodCall ) {
|
487
|
+
this.each(function() {
|
488
|
+
var methodValue,
|
489
|
+
instance = $.data( this, fullName );
|
490
|
+
if ( !instance ) {
|
491
|
+
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
492
|
+
"attempted to call method '" + options + "'" );
|
493
|
+
}
|
494
|
+
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
495
|
+
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
496
|
+
}
|
497
|
+
methodValue = instance[ options ].apply( instance, args );
|
498
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
499
|
+
returnValue = methodValue && methodValue.jquery ?
|
500
|
+
returnValue.pushStack( methodValue.get() ) :
|
501
|
+
methodValue;
|
502
|
+
return false;
|
503
|
+
}
|
504
|
+
});
|
505
|
+
} else {
|
506
|
+
this.each(function() {
|
507
|
+
var instance = $.data( this, fullName );
|
508
|
+
if ( instance ) {
|
509
|
+
instance.option( options || {} )._init();
|
510
|
+
} else {
|
511
|
+
$.data( this, fullName, new object( options, this ) );
|
512
|
+
}
|
513
|
+
});
|
514
|
+
}
|
515
|
+
|
516
|
+
return returnValue;
|
517
|
+
};
|
518
|
+
};
|
519
|
+
|
520
|
+
$.Widget = function( /* options, element */ ) {};
|
521
|
+
$.Widget._childConstructors = [];
|
522
|
+
|
523
|
+
$.Widget.prototype = {
|
524
|
+
widgetName: "widget",
|
525
|
+
widgetEventPrefix: "",
|
526
|
+
defaultElement: "<div>",
|
527
|
+
options: {
|
528
|
+
disabled: false,
|
529
|
+
|
530
|
+
// callbacks
|
531
|
+
create: null
|
532
|
+
},
|
533
|
+
_createWidget: function( options, element ) {
|
534
|
+
element = $( element || this.defaultElement || this )[ 0 ];
|
535
|
+
this.element = $( element );
|
536
|
+
this.uuid = uuid++;
|
537
|
+
this.eventNamespace = "." + this.widgetName + this.uuid;
|
538
|
+
this.options = $.widget.extend( {},
|
539
|
+
this.options,
|
540
|
+
this._getCreateOptions(),
|
541
|
+
options );
|
542
|
+
|
543
|
+
this.bindings = $();
|
544
|
+
this.hoverable = $();
|
545
|
+
this.focusable = $();
|
546
|
+
|
547
|
+
if ( element !== this ) {
|
548
|
+
$.data( element, this.widgetFullName, this );
|
549
|
+
this._on( true, this.element, {
|
550
|
+
remove: function( event ) {
|
551
|
+
if ( event.target === element ) {
|
552
|
+
this.destroy();
|
553
|
+
}
|
554
|
+
}
|
555
|
+
});
|
556
|
+
this.document = $( element.style ?
|
557
|
+
// element within the document
|
558
|
+
element.ownerDocument :
|
559
|
+
// element is window or document
|
560
|
+
element.document || element );
|
561
|
+
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
562
|
+
}
|
563
|
+
|
564
|
+
this._create();
|
565
|
+
this._trigger( "create", null, this._getCreateEventData() );
|
566
|
+
this._init();
|
567
|
+
},
|
568
|
+
_getCreateOptions: $.noop,
|
569
|
+
_getCreateEventData: $.noop,
|
570
|
+
_create: $.noop,
|
571
|
+
_init: $.noop,
|
572
|
+
|
573
|
+
destroy: function() {
|
574
|
+
this._destroy();
|
575
|
+
// we can probably remove the unbind calls in 2.0
|
576
|
+
// all event bindings should go through this._on()
|
577
|
+
this.element
|
578
|
+
.unbind( this.eventNamespace )
|
579
|
+
// 1.9 BC for #7810
|
580
|
+
// TODO remove dual storage
|
581
|
+
.removeData( this.widgetName )
|
582
|
+
.removeData( this.widgetFullName )
|
583
|
+
// support: jquery <1.6.3
|
584
|
+
// http://bugs.jquery.com/ticket/9413
|
585
|
+
.removeData( $.camelCase( this.widgetFullName ) );
|
586
|
+
this.widget()
|
587
|
+
.unbind( this.eventNamespace )
|
588
|
+
.removeAttr( "aria-disabled" )
|
589
|
+
.removeClass(
|
590
|
+
this.widgetFullName + "-disabled " +
|
591
|
+
"ui-state-disabled" );
|
592
|
+
|
593
|
+
// clean up events and states
|
594
|
+
this.bindings.unbind( this.eventNamespace );
|
595
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
596
|
+
this.focusable.removeClass( "ui-state-focus" );
|
597
|
+
},
|
598
|
+
_destroy: $.noop,
|
599
|
+
|
600
|
+
widget: function() {
|
601
|
+
return this.element;
|
602
|
+
},
|
603
|
+
|
604
|
+
option: function( key, value ) {
|
605
|
+
var options = key,
|
606
|
+
parts,
|
607
|
+
curOption,
|
608
|
+
i;
|
609
|
+
|
610
|
+
if ( arguments.length === 0 ) {
|
611
|
+
// don't return a reference to the internal hash
|
612
|
+
return $.widget.extend( {}, this.options );
|
613
|
+
}
|
614
|
+
|
615
|
+
if ( typeof key === "string" ) {
|
616
|
+
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
617
|
+
options = {};
|
618
|
+
parts = key.split( "." );
|
619
|
+
key = parts.shift();
|
620
|
+
if ( parts.length ) {
|
621
|
+
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
622
|
+
for ( i = 0; i < parts.length - 1; i++ ) {
|
623
|
+
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
624
|
+
curOption = curOption[ parts[ i ] ];
|
625
|
+
}
|
626
|
+
key = parts.pop();
|
627
|
+
if ( value === undefined ) {
|
628
|
+
return curOption[ key ] === undefined ? null : curOption[ key ];
|
629
|
+
}
|
630
|
+
curOption[ key ] = value;
|
631
|
+
} else {
|
632
|
+
if ( value === undefined ) {
|
633
|
+
return this.options[ key ] === undefined ? null : this.options[ key ];
|
634
|
+
}
|
635
|
+
options[ key ] = value;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
this._setOptions( options );
|
640
|
+
|
641
|
+
return this;
|
642
|
+
},
|
643
|
+
_setOptions: function( options ) {
|
644
|
+
var key;
|
645
|
+
|
646
|
+
for ( key in options ) {
|
647
|
+
this._setOption( key, options[ key ] );
|
648
|
+
}
|
649
|
+
|
650
|
+
return this;
|
651
|
+
},
|
652
|
+
_setOption: function( key, value ) {
|
653
|
+
this.options[ key ] = value;
|
654
|
+
|
655
|
+
if ( key === "disabled" ) {
|
656
|
+
this.widget()
|
657
|
+
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
|
658
|
+
.attr( "aria-disabled", value );
|
659
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
660
|
+
this.focusable.removeClass( "ui-state-focus" );
|
661
|
+
}
|
662
|
+
|
663
|
+
return this;
|
664
|
+
},
|
665
|
+
|
666
|
+
enable: function() {
|
667
|
+
return this._setOption( "disabled", false );
|
668
|
+
},
|
669
|
+
disable: function() {
|
670
|
+
return this._setOption( "disabled", true );
|
671
|
+
},
|
672
|
+
|
673
|
+
_on: function( suppressDisabledCheck, element, handlers ) {
|
674
|
+
var delegateElement,
|
675
|
+
instance = this;
|
676
|
+
|
677
|
+
// no suppressDisabledCheck flag, shuffle arguments
|
678
|
+
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
679
|
+
handlers = element;
|
680
|
+
element = suppressDisabledCheck;
|
681
|
+
suppressDisabledCheck = false;
|
682
|
+
}
|
683
|
+
|
684
|
+
// no element argument, shuffle and use this.element
|
685
|
+
if ( !handlers ) {
|
686
|
+
handlers = element;
|
687
|
+
element = this.element;
|
688
|
+
delegateElement = this.widget();
|
689
|
+
} else {
|
690
|
+
// accept selectors, DOM elements
|
691
|
+
element = delegateElement = $( element );
|
692
|
+
this.bindings = this.bindings.add( element );
|
693
|
+
}
|
694
|
+
|
695
|
+
$.each( handlers, function( event, handler ) {
|
696
|
+
function handlerProxy() {
|
697
|
+
// allow widgets to customize the disabled handling
|
698
|
+
// - disabled as an array instead of boolean
|
699
|
+
// - disabled class as method for disabling individual parts
|
700
|
+
if ( !suppressDisabledCheck &&
|
701
|
+
( instance.options.disabled === true ||
|
702
|
+
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
703
|
+
return;
|
704
|
+
}
|
705
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
706
|
+
.apply( instance, arguments );
|
707
|
+
}
|
708
|
+
|
709
|
+
// copy the guid so direct unbinding works
|
710
|
+
if ( typeof handler !== "string" ) {
|
711
|
+
handlerProxy.guid = handler.guid =
|
712
|
+
handler.guid || handlerProxy.guid || $.guid++;
|
713
|
+
}
|
714
|
+
|
715
|
+
var match = event.match( /^(\w+)\s*(.*)$/ ),
|
716
|
+
eventName = match[1] + instance.eventNamespace,
|
717
|
+
selector = match[2];
|
718
|
+
if ( selector ) {
|
719
|
+
delegateElement.delegate( selector, eventName, handlerProxy );
|
720
|
+
} else {
|
721
|
+
element.bind( eventName, handlerProxy );
|
722
|
+
}
|
723
|
+
});
|
724
|
+
},
|
725
|
+
|
726
|
+
_off: function( element, eventName ) {
|
727
|
+
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
728
|
+
element.unbind( eventName ).undelegate( eventName );
|
729
|
+
},
|
730
|
+
|
731
|
+
_delay: function( handler, delay ) {
|
732
|
+
function handlerProxy() {
|
733
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
734
|
+
.apply( instance, arguments );
|
735
|
+
}
|
736
|
+
var instance = this;
|
737
|
+
return setTimeout( handlerProxy, delay || 0 );
|
738
|
+
},
|
739
|
+
|
740
|
+
_hoverable: function( element ) {
|
741
|
+
this.hoverable = this.hoverable.add( element );
|
742
|
+
this._on( element, {
|
743
|
+
mouseenter: function( event ) {
|
744
|
+
$( event.currentTarget ).addClass( "ui-state-hover" );
|
745
|
+
},
|
746
|
+
mouseleave: function( event ) {
|
747
|
+
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
748
|
+
}
|
749
|
+
});
|
750
|
+
},
|
751
|
+
|
752
|
+
_focusable: function( element ) {
|
753
|
+
this.focusable = this.focusable.add( element );
|
754
|
+
this._on( element, {
|
755
|
+
focusin: function( event ) {
|
756
|
+
$( event.currentTarget ).addClass( "ui-state-focus" );
|
757
|
+
},
|
758
|
+
focusout: function( event ) {
|
759
|
+
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
760
|
+
}
|
761
|
+
});
|
762
|
+
},
|
763
|
+
|
764
|
+
_trigger: function( type, event, data ) {
|
765
|
+
var prop, orig,
|
766
|
+
callback = this.options[ type ];
|
767
|
+
|
768
|
+
data = data || {};
|
769
|
+
event = $.Event( event );
|
770
|
+
event.type = ( type === this.widgetEventPrefix ?
|
771
|
+
type :
|
772
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
773
|
+
// the original event may come from any element
|
774
|
+
// so we need to reset the target on the new event
|
775
|
+
event.target = this.element[ 0 ];
|
776
|
+
|
777
|
+
// copy original event properties over to the new event
|
778
|
+
orig = event.originalEvent;
|
779
|
+
if ( orig ) {
|
780
|
+
for ( prop in orig ) {
|
781
|
+
if ( !( prop in event ) ) {
|
782
|
+
event[ prop ] = orig[ prop ];
|
783
|
+
}
|
784
|
+
}
|
785
|
+
}
|
786
|
+
|
787
|
+
this.element.trigger( event, data );
|
788
|
+
return !( $.isFunction( callback ) &&
|
789
|
+
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
790
|
+
event.isDefaultPrevented() );
|
791
|
+
}
|
792
|
+
};
|
793
|
+
|
794
|
+
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
795
|
+
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
796
|
+
if ( typeof options === "string" ) {
|
797
|
+
options = { effect: options };
|
798
|
+
}
|
799
|
+
var hasOptions,
|
800
|
+
effectName = !options ?
|
801
|
+
method :
|
802
|
+
options === true || typeof options === "number" ?
|
803
|
+
defaultEffect :
|
804
|
+
options.effect || defaultEffect;
|
805
|
+
options = options || {};
|
806
|
+
if ( typeof options === "number" ) {
|
807
|
+
options = { duration: options };
|
808
|
+
}
|
809
|
+
hasOptions = !$.isEmptyObject( options );
|
810
|
+
options.complete = callback;
|
811
|
+
if ( options.delay ) {
|
812
|
+
element.delay( options.delay );
|
813
|
+
}
|
814
|
+
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
815
|
+
element[ method ]( options );
|
816
|
+
} else if ( effectName !== method && element[ effectName ] ) {
|
817
|
+
element[ effectName ]( options.duration, options.easing, callback );
|
818
|
+
} else {
|
819
|
+
element.queue(function( next ) {
|
820
|
+
$( this )[ method ]();
|
821
|
+
if ( callback ) {
|
822
|
+
callback.call( element[ 0 ] );
|
823
|
+
}
|
824
|
+
next();
|
825
|
+
});
|
826
|
+
}
|
827
|
+
};
|
828
|
+
});
|
829
|
+
|
830
|
+
})( jQuery );
|
831
|
+
(function( $, undefined ) {
|
832
|
+
|
833
|
+
var mouseHandled = false;
|
834
|
+
$( document ).mouseup( function() {
|
835
|
+
mouseHandled = false;
|
836
|
+
});
|
837
|
+
|
838
|
+
$.widget("ui.mouse", {
|
839
|
+
version: "1.10.1",
|
840
|
+
options: {
|
841
|
+
cancel: "input,textarea,button,select,option",
|
842
|
+
distance: 1,
|
843
|
+
delay: 0
|
844
|
+
},
|
845
|
+
_mouseInit: function() {
|
846
|
+
var that = this;
|
847
|
+
|
848
|
+
this.element
|
849
|
+
.bind("mousedown."+this.widgetName, function(event) {
|
850
|
+
return that._mouseDown(event);
|
851
|
+
})
|
852
|
+
.bind("click."+this.widgetName, function(event) {
|
853
|
+
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
|
854
|
+
$.removeData(event.target, that.widgetName + ".preventClickEvent");
|
855
|
+
event.stopImmediatePropagation();
|
856
|
+
return false;
|
857
|
+
}
|
858
|
+
});
|
859
|
+
|
860
|
+
this.started = false;
|
861
|
+
},
|
862
|
+
|
863
|
+
// TODO: make sure destroying one instance of mouse doesn't mess with
|
864
|
+
// other instances of mouse
|
865
|
+
_mouseDestroy: function() {
|
866
|
+
this.element.unbind("."+this.widgetName);
|
867
|
+
if ( this._mouseMoveDelegate ) {
|
868
|
+
$(document)
|
869
|
+
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
870
|
+
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
871
|
+
}
|
872
|
+
},
|
873
|
+
|
874
|
+
_mouseDown: function(event) {
|
875
|
+
// don't let more than one widget handle mouseStart
|
876
|
+
if( mouseHandled ) { return; }
|
877
|
+
|
878
|
+
// we may have missed mouseup (out of window)
|
879
|
+
(this._mouseStarted && this._mouseUp(event));
|
880
|
+
|
881
|
+
this._mouseDownEvent = event;
|
882
|
+
|
883
|
+
var that = this,
|
884
|
+
btnIsLeft = (event.which === 1),
|
885
|
+
// event.target.nodeName works around a bug in IE 8 with
|
886
|
+
// disabled inputs (#7620)
|
887
|
+
elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
|
888
|
+
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
889
|
+
return true;
|
890
|
+
}
|
891
|
+
|
892
|
+
this.mouseDelayMet = !this.options.delay;
|
893
|
+
if (!this.mouseDelayMet) {
|
894
|
+
this._mouseDelayTimer = setTimeout(function() {
|
895
|
+
that.mouseDelayMet = true;
|
896
|
+
}, this.options.delay);
|
897
|
+
}
|
898
|
+
|
899
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
900
|
+
this._mouseStarted = (this._mouseStart(event) !== false);
|
901
|
+
if (!this._mouseStarted) {
|
902
|
+
event.preventDefault();
|
903
|
+
return true;
|
904
|
+
}
|
905
|
+
}
|
906
|
+
|
907
|
+
// Click event may never have fired (Gecko & Opera)
|
908
|
+
if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
|
909
|
+
$.removeData(event.target, this.widgetName + ".preventClickEvent");
|
910
|
+
}
|
911
|
+
|
912
|
+
// these delegates are required to keep context
|
913
|
+
this._mouseMoveDelegate = function(event) {
|
914
|
+
return that._mouseMove(event);
|
915
|
+
};
|
916
|
+
this._mouseUpDelegate = function(event) {
|
917
|
+
return that._mouseUp(event);
|
918
|
+
};
|
919
|
+
$(document)
|
920
|
+
.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
921
|
+
.bind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
922
|
+
|
923
|
+
event.preventDefault();
|
924
|
+
|
925
|
+
mouseHandled = true;
|
926
|
+
return true;
|
927
|
+
},
|
928
|
+
|
929
|
+
_mouseMove: function(event) {
|
930
|
+
// IE mouseup check - mouseup happened when mouse was out of window
|
931
|
+
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
|
932
|
+
return this._mouseUp(event);
|
933
|
+
}
|
934
|
+
|
935
|
+
if (this._mouseStarted) {
|
936
|
+
this._mouseDrag(event);
|
937
|
+
return event.preventDefault();
|
938
|
+
}
|
939
|
+
|
940
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
941
|
+
this._mouseStarted =
|
942
|
+
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
943
|
+
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
944
|
+
}
|
945
|
+
|
946
|
+
return !this._mouseStarted;
|
947
|
+
},
|
948
|
+
|
949
|
+
_mouseUp: function(event) {
|
950
|
+
$(document)
|
951
|
+
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
|
952
|
+
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
|
953
|
+
|
954
|
+
if (this._mouseStarted) {
|
955
|
+
this._mouseStarted = false;
|
956
|
+
|
957
|
+
if (event.target === this._mouseDownEvent.target) {
|
958
|
+
$.data(event.target, this.widgetName + ".preventClickEvent", true);
|
959
|
+
}
|
960
|
+
|
961
|
+
this._mouseStop(event);
|
962
|
+
}
|
963
|
+
|
964
|
+
return false;
|
965
|
+
},
|
966
|
+
|
967
|
+
_mouseDistanceMet: function(event) {
|
968
|
+
return (Math.max(
|
969
|
+
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
970
|
+
Math.abs(this._mouseDownEvent.pageY - event.pageY)
|
971
|
+
) >= this.options.distance
|
972
|
+
);
|
973
|
+
},
|
974
|
+
|
975
|
+
_mouseDelayMet: function(/* event */) {
|
976
|
+
return this.mouseDelayMet;
|
977
|
+
},
|
978
|
+
|
979
|
+
// These are placeholder methods, to be overriden by extending plugin
|
980
|
+
_mouseStart: function(/* event */) {},
|
981
|
+
_mouseDrag: function(/* event */) {},
|
982
|
+
_mouseStop: function(/* event */) {},
|
983
|
+
_mouseCapture: function(/* event */) { return true; }
|
984
|
+
});
|
985
|
+
|
986
|
+
})(jQuery);
|
987
|
+
(function( $, undefined ) {
|
988
|
+
|
989
|
+
$.ui = $.ui || {};
|
990
|
+
|
991
|
+
var cachedScrollbarWidth,
|
992
|
+
max = Math.max,
|
993
|
+
abs = Math.abs,
|
994
|
+
round = Math.round,
|
995
|
+
rhorizontal = /left|center|right/,
|
996
|
+
rvertical = /top|center|bottom/,
|
997
|
+
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
|
998
|
+
rposition = /^\w+/,
|
999
|
+
rpercent = /%$/,
|
1000
|
+
_position = $.fn.position;
|
1001
|
+
|
1002
|
+
function getOffsets( offsets, width, height ) {
|
1003
|
+
return [
|
1004
|
+
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
|
1005
|
+
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
|
1006
|
+
];
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
function parseCss( element, property ) {
|
1010
|
+
return parseInt( $.css( element, property ), 10 ) || 0;
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
function getDimensions( elem ) {
|
1014
|
+
var raw = elem[0];
|
1015
|
+
if ( raw.nodeType === 9 ) {
|
1016
|
+
return {
|
1017
|
+
width: elem.width(),
|
1018
|
+
height: elem.height(),
|
1019
|
+
offset: { top: 0, left: 0 }
|
1020
|
+
};
|
1021
|
+
}
|
1022
|
+
if ( $.isWindow( raw ) ) {
|
1023
|
+
return {
|
1024
|
+
width: elem.width(),
|
1025
|
+
height: elem.height(),
|
1026
|
+
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
|
1027
|
+
};
|
1028
|
+
}
|
1029
|
+
if ( raw.preventDefault ) {
|
1030
|
+
return {
|
1031
|
+
width: 0,
|
1032
|
+
height: 0,
|
1033
|
+
offset: { top: raw.pageY, left: raw.pageX }
|
1034
|
+
};
|
1035
|
+
}
|
1036
|
+
return {
|
1037
|
+
width: elem.outerWidth(),
|
1038
|
+
height: elem.outerHeight(),
|
1039
|
+
offset: elem.offset()
|
1040
|
+
};
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
$.position = {
|
1044
|
+
scrollbarWidth: function() {
|
1045
|
+
if ( cachedScrollbarWidth !== undefined ) {
|
1046
|
+
return cachedScrollbarWidth;
|
1047
|
+
}
|
1048
|
+
var w1, w2,
|
1049
|
+
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
|
1050
|
+
innerDiv = div.children()[0];
|
1051
|
+
|
1052
|
+
$( "body" ).append( div );
|
1053
|
+
w1 = innerDiv.offsetWidth;
|
1054
|
+
div.css( "overflow", "scroll" );
|
1055
|
+
|
1056
|
+
w2 = innerDiv.offsetWidth;
|
1057
|
+
|
1058
|
+
if ( w1 === w2 ) {
|
1059
|
+
w2 = div[0].clientWidth;
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
div.remove();
|
1063
|
+
|
1064
|
+
return (cachedScrollbarWidth = w1 - w2);
|
1065
|
+
},
|
1066
|
+
getScrollInfo: function( within ) {
|
1067
|
+
var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
|
1068
|
+
overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
|
1069
|
+
hasOverflowX = overflowX === "scroll" ||
|
1070
|
+
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
|
1071
|
+
hasOverflowY = overflowY === "scroll" ||
|
1072
|
+
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
|
1073
|
+
return {
|
1074
|
+
width: hasOverflowX ? $.position.scrollbarWidth() : 0,
|
1075
|
+
height: hasOverflowY ? $.position.scrollbarWidth() : 0
|
1076
|
+
};
|
1077
|
+
},
|
1078
|
+
getWithinInfo: function( element ) {
|
1079
|
+
var withinElement = $( element || window ),
|
1080
|
+
isWindow = $.isWindow( withinElement[0] );
|
1081
|
+
return {
|
1082
|
+
element: withinElement,
|
1083
|
+
isWindow: isWindow,
|
1084
|
+
offset: withinElement.offset() || { left: 0, top: 0 },
|
1085
|
+
scrollLeft: withinElement.scrollLeft(),
|
1086
|
+
scrollTop: withinElement.scrollTop(),
|
1087
|
+
width: isWindow ? withinElement.width() : withinElement.outerWidth(),
|
1088
|
+
height: isWindow ? withinElement.height() : withinElement.outerHeight()
|
1089
|
+
};
|
1090
|
+
}
|
1091
|
+
};
|
1092
|
+
|
1093
|
+
$.fn.position = function( options ) {
|
1094
|
+
if ( !options || !options.of ) {
|
1095
|
+
return _position.apply( this, arguments );
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
// make a copy, we don't want to modify arguments
|
1099
|
+
options = $.extend( {}, options );
|
1100
|
+
|
1101
|
+
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
|
1102
|
+
target = $( options.of ),
|
1103
|
+
within = $.position.getWithinInfo( options.within ),
|
1104
|
+
scrollInfo = $.position.getScrollInfo( within ),
|
1105
|
+
collision = ( options.collision || "flip" ).split( " " ),
|
1106
|
+
offsets = {};
|
1107
|
+
|
1108
|
+
dimensions = getDimensions( target );
|
1109
|
+
if ( target[0].preventDefault ) {
|
1110
|
+
// force left top to allow flipping
|
1111
|
+
options.at = "left top";
|
1112
|
+
}
|
1113
|
+
targetWidth = dimensions.width;
|
1114
|
+
targetHeight = dimensions.height;
|
1115
|
+
targetOffset = dimensions.offset;
|
1116
|
+
// clone to reuse original targetOffset later
|
1117
|
+
basePosition = $.extend( {}, targetOffset );
|
1118
|
+
|
1119
|
+
// force my and at to have valid horizontal and vertical positions
|
1120
|
+
// if a value is missing or invalid, it will be converted to center
|
1121
|
+
$.each( [ "my", "at" ], function() {
|
1122
|
+
var pos = ( options[ this ] || "" ).split( " " ),
|
1123
|
+
horizontalOffset,
|
1124
|
+
verticalOffset;
|
1125
|
+
|
1126
|
+
if ( pos.length === 1) {
|
1127
|
+
pos = rhorizontal.test( pos[ 0 ] ) ?
|
1128
|
+
pos.concat( [ "center" ] ) :
|
1129
|
+
rvertical.test( pos[ 0 ] ) ?
|
1130
|
+
[ "center" ].concat( pos ) :
|
1131
|
+
[ "center", "center" ];
|
1132
|
+
}
|
1133
|
+
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
|
1134
|
+
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
|
1135
|
+
|
1136
|
+
// calculate offsets
|
1137
|
+
horizontalOffset = roffset.exec( pos[ 0 ] );
|
1138
|
+
verticalOffset = roffset.exec( pos[ 1 ] );
|
1139
|
+
offsets[ this ] = [
|
1140
|
+
horizontalOffset ? horizontalOffset[ 0 ] : 0,
|
1141
|
+
verticalOffset ? verticalOffset[ 0 ] : 0
|
1142
|
+
];
|
1143
|
+
|
1144
|
+
// reduce to just the positions without the offsets
|
1145
|
+
options[ this ] = [
|
1146
|
+
rposition.exec( pos[ 0 ] )[ 0 ],
|
1147
|
+
rposition.exec( pos[ 1 ] )[ 0 ]
|
1148
|
+
];
|
1149
|
+
});
|
1150
|
+
|
1151
|
+
// normalize collision option
|
1152
|
+
if ( collision.length === 1 ) {
|
1153
|
+
collision[ 1 ] = collision[ 0 ];
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
if ( options.at[ 0 ] === "right" ) {
|
1157
|
+
basePosition.left += targetWidth;
|
1158
|
+
} else if ( options.at[ 0 ] === "center" ) {
|
1159
|
+
basePosition.left += targetWidth / 2;
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
if ( options.at[ 1 ] === "bottom" ) {
|
1163
|
+
basePosition.top += targetHeight;
|
1164
|
+
} else if ( options.at[ 1 ] === "center" ) {
|
1165
|
+
basePosition.top += targetHeight / 2;
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
|
1169
|
+
basePosition.left += atOffset[ 0 ];
|
1170
|
+
basePosition.top += atOffset[ 1 ];
|
1171
|
+
|
1172
|
+
return this.each(function() {
|
1173
|
+
var collisionPosition, using,
|
1174
|
+
elem = $( this ),
|
1175
|
+
elemWidth = elem.outerWidth(),
|
1176
|
+
elemHeight = elem.outerHeight(),
|
1177
|
+
marginLeft = parseCss( this, "marginLeft" ),
|
1178
|
+
marginTop = parseCss( this, "marginTop" ),
|
1179
|
+
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
|
1180
|
+
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
|
1181
|
+
position = $.extend( {}, basePosition ),
|
1182
|
+
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
|
1183
|
+
|
1184
|
+
if ( options.my[ 0 ] === "right" ) {
|
1185
|
+
position.left -= elemWidth;
|
1186
|
+
} else if ( options.my[ 0 ] === "center" ) {
|
1187
|
+
position.left -= elemWidth / 2;
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
if ( options.my[ 1 ] === "bottom" ) {
|
1191
|
+
position.top -= elemHeight;
|
1192
|
+
} else if ( options.my[ 1 ] === "center" ) {
|
1193
|
+
position.top -= elemHeight / 2;
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
position.left += myOffset[ 0 ];
|
1197
|
+
position.top += myOffset[ 1 ];
|
1198
|
+
|
1199
|
+
// if the browser doesn't support fractions, then round for consistent results
|
1200
|
+
if ( !$.support.offsetFractions ) {
|
1201
|
+
position.left = round( position.left );
|
1202
|
+
position.top = round( position.top );
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
collisionPosition = {
|
1206
|
+
marginLeft: marginLeft,
|
1207
|
+
marginTop: marginTop
|
1208
|
+
};
|
1209
|
+
|
1210
|
+
$.each( [ "left", "top" ], function( i, dir ) {
|
1211
|
+
if ( $.ui.position[ collision[ i ] ] ) {
|
1212
|
+
$.ui.position[ collision[ i ] ][ dir ]( position, {
|
1213
|
+
targetWidth: targetWidth,
|
1214
|
+
targetHeight: targetHeight,
|
1215
|
+
elemWidth: elemWidth,
|
1216
|
+
elemHeight: elemHeight,
|
1217
|
+
collisionPosition: collisionPosition,
|
1218
|
+
collisionWidth: collisionWidth,
|
1219
|
+
collisionHeight: collisionHeight,
|
1220
|
+
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
|
1221
|
+
my: options.my,
|
1222
|
+
at: options.at,
|
1223
|
+
within: within,
|
1224
|
+
elem : elem
|
1225
|
+
});
|
1226
|
+
}
|
1227
|
+
});
|
1228
|
+
|
1229
|
+
if ( options.using ) {
|
1230
|
+
// adds feedback as second argument to using callback, if present
|
1231
|
+
using = function( props ) {
|
1232
|
+
var left = targetOffset.left - position.left,
|
1233
|
+
right = left + targetWidth - elemWidth,
|
1234
|
+
top = targetOffset.top - position.top,
|
1235
|
+
bottom = top + targetHeight - elemHeight,
|
1236
|
+
feedback = {
|
1237
|
+
target: {
|
1238
|
+
element: target,
|
1239
|
+
left: targetOffset.left,
|
1240
|
+
top: targetOffset.top,
|
1241
|
+
width: targetWidth,
|
1242
|
+
height: targetHeight
|
1243
|
+
},
|
1244
|
+
element: {
|
1245
|
+
element: elem,
|
1246
|
+
left: position.left,
|
1247
|
+
top: position.top,
|
1248
|
+
width: elemWidth,
|
1249
|
+
height: elemHeight
|
1250
|
+
},
|
1251
|
+
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
|
1252
|
+
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
|
1253
|
+
};
|
1254
|
+
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
|
1255
|
+
feedback.horizontal = "center";
|
1256
|
+
}
|
1257
|
+
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
|
1258
|
+
feedback.vertical = "middle";
|
1259
|
+
}
|
1260
|
+
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
|
1261
|
+
feedback.important = "horizontal";
|
1262
|
+
} else {
|
1263
|
+
feedback.important = "vertical";
|
1264
|
+
}
|
1265
|
+
options.using.call( this, props, feedback );
|
1266
|
+
};
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
elem.offset( $.extend( position, { using: using } ) );
|
1270
|
+
});
|
1271
|
+
};
|
1272
|
+
|
1273
|
+
$.ui.position = {
|
1274
|
+
fit: {
|
1275
|
+
left: function( position, data ) {
|
1276
|
+
var within = data.within,
|
1277
|
+
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
|
1278
|
+
outerWidth = within.width,
|
1279
|
+
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
|
1280
|
+
overLeft = withinOffset - collisionPosLeft,
|
1281
|
+
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
|
1282
|
+
newOverRight;
|
1283
|
+
|
1284
|
+
// element is wider than within
|
1285
|
+
if ( data.collisionWidth > outerWidth ) {
|
1286
|
+
// element is initially over the left side of within
|
1287
|
+
if ( overLeft > 0 && overRight <= 0 ) {
|
1288
|
+
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
|
1289
|
+
position.left += overLeft - newOverRight;
|
1290
|
+
// element is initially over right side of within
|
1291
|
+
} else if ( overRight > 0 && overLeft <= 0 ) {
|
1292
|
+
position.left = withinOffset;
|
1293
|
+
// element is initially over both left and right sides of within
|
1294
|
+
} else {
|
1295
|
+
if ( overLeft > overRight ) {
|
1296
|
+
position.left = withinOffset + outerWidth - data.collisionWidth;
|
1297
|
+
} else {
|
1298
|
+
position.left = withinOffset;
|
1299
|
+
}
|
1300
|
+
}
|
1301
|
+
// too far left -> align with left edge
|
1302
|
+
} else if ( overLeft > 0 ) {
|
1303
|
+
position.left += overLeft;
|
1304
|
+
// too far right -> align with right edge
|
1305
|
+
} else if ( overRight > 0 ) {
|
1306
|
+
position.left -= overRight;
|
1307
|
+
// adjust based on position and margin
|
1308
|
+
} else {
|
1309
|
+
position.left = max( position.left - collisionPosLeft, position.left );
|
1310
|
+
}
|
1311
|
+
},
|
1312
|
+
top: function( position, data ) {
|
1313
|
+
var within = data.within,
|
1314
|
+
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
|
1315
|
+
outerHeight = data.within.height,
|
1316
|
+
collisionPosTop = position.top - data.collisionPosition.marginTop,
|
1317
|
+
overTop = withinOffset - collisionPosTop,
|
1318
|
+
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
|
1319
|
+
newOverBottom;
|
1320
|
+
|
1321
|
+
// element is taller than within
|
1322
|
+
if ( data.collisionHeight > outerHeight ) {
|
1323
|
+
// element is initially over the top of within
|
1324
|
+
if ( overTop > 0 && overBottom <= 0 ) {
|
1325
|
+
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
|
1326
|
+
position.top += overTop - newOverBottom;
|
1327
|
+
// element is initially over bottom of within
|
1328
|
+
} else if ( overBottom > 0 && overTop <= 0 ) {
|
1329
|
+
position.top = withinOffset;
|
1330
|
+
// element is initially over both top and bottom of within
|
1331
|
+
} else {
|
1332
|
+
if ( overTop > overBottom ) {
|
1333
|
+
position.top = withinOffset + outerHeight - data.collisionHeight;
|
1334
|
+
} else {
|
1335
|
+
position.top = withinOffset;
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
// too far up -> align with top
|
1339
|
+
} else if ( overTop > 0 ) {
|
1340
|
+
position.top += overTop;
|
1341
|
+
// too far down -> align with bottom edge
|
1342
|
+
} else if ( overBottom > 0 ) {
|
1343
|
+
position.top -= overBottom;
|
1344
|
+
// adjust based on position and margin
|
1345
|
+
} else {
|
1346
|
+
position.top = max( position.top - collisionPosTop, position.top );
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
},
|
1350
|
+
flip: {
|
1351
|
+
left: function( position, data ) {
|
1352
|
+
var within = data.within,
|
1353
|
+
withinOffset = within.offset.left + within.scrollLeft,
|
1354
|
+
outerWidth = within.width,
|
1355
|
+
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
|
1356
|
+
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
|
1357
|
+
overLeft = collisionPosLeft - offsetLeft,
|
1358
|
+
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
|
1359
|
+
myOffset = data.my[ 0 ] === "left" ?
|
1360
|
+
-data.elemWidth :
|
1361
|
+
data.my[ 0 ] === "right" ?
|
1362
|
+
data.elemWidth :
|
1363
|
+
0,
|
1364
|
+
atOffset = data.at[ 0 ] === "left" ?
|
1365
|
+
data.targetWidth :
|
1366
|
+
data.at[ 0 ] === "right" ?
|
1367
|
+
-data.targetWidth :
|
1368
|
+
0,
|
1369
|
+
offset = -2 * data.offset[ 0 ],
|
1370
|
+
newOverRight,
|
1371
|
+
newOverLeft;
|
1372
|
+
|
1373
|
+
if ( overLeft < 0 ) {
|
1374
|
+
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
|
1375
|
+
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
|
1376
|
+
position.left += myOffset + atOffset + offset;
|
1377
|
+
}
|
1378
|
+
}
|
1379
|
+
else if ( overRight > 0 ) {
|
1380
|
+
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
|
1381
|
+
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
|
1382
|
+
position.left += myOffset + atOffset + offset;
|
1383
|
+
}
|
1384
|
+
}
|
1385
|
+
},
|
1386
|
+
top: function( position, data ) {
|
1387
|
+
var within = data.within,
|
1388
|
+
withinOffset = within.offset.top + within.scrollTop,
|
1389
|
+
outerHeight = within.height,
|
1390
|
+
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
|
1391
|
+
collisionPosTop = position.top - data.collisionPosition.marginTop,
|
1392
|
+
overTop = collisionPosTop - offsetTop,
|
1393
|
+
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
|
1394
|
+
top = data.my[ 1 ] === "top",
|
1395
|
+
myOffset = top ?
|
1396
|
+
-data.elemHeight :
|
1397
|
+
data.my[ 1 ] === "bottom" ?
|
1398
|
+
data.elemHeight :
|
1399
|
+
0,
|
1400
|
+
atOffset = data.at[ 1 ] === "top" ?
|
1401
|
+
data.targetHeight :
|
1402
|
+
data.at[ 1 ] === "bottom" ?
|
1403
|
+
-data.targetHeight :
|
1404
|
+
0,
|
1405
|
+
offset = -2 * data.offset[ 1 ],
|
1406
|
+
newOverTop,
|
1407
|
+
newOverBottom;
|
1408
|
+
if ( overTop < 0 ) {
|
1409
|
+
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
|
1410
|
+
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
|
1411
|
+
position.top += myOffset + atOffset + offset;
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
else if ( overBottom > 0 ) {
|
1415
|
+
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
|
1416
|
+
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
|
1417
|
+
position.top += myOffset + atOffset + offset;
|
1418
|
+
}
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
},
|
1422
|
+
flipfit: {
|
1423
|
+
left: function() {
|
1424
|
+
$.ui.position.flip.left.apply( this, arguments );
|
1425
|
+
$.ui.position.fit.left.apply( this, arguments );
|
1426
|
+
},
|
1427
|
+
top: function() {
|
1428
|
+
$.ui.position.flip.top.apply( this, arguments );
|
1429
|
+
$.ui.position.fit.top.apply( this, arguments );
|
1430
|
+
}
|
1431
|
+
}
|
1432
|
+
};
|
1433
|
+
|
1434
|
+
// fraction support test
|
1435
|
+
(function () {
|
1436
|
+
var testElement, testElementParent, testElementStyle, offsetLeft, i,
|
1437
|
+
body = document.getElementsByTagName( "body" )[ 0 ],
|
1438
|
+
div = document.createElement( "div" );
|
1439
|
+
|
1440
|
+
//Create a "fake body" for testing based on method used in jQuery.support
|
1441
|
+
testElement = document.createElement( body ? "div" : "body" );
|
1442
|
+
testElementStyle = {
|
1443
|
+
visibility: "hidden",
|
1444
|
+
width: 0,
|
1445
|
+
height: 0,
|
1446
|
+
border: 0,
|
1447
|
+
margin: 0,
|
1448
|
+
background: "none"
|
1449
|
+
};
|
1450
|
+
if ( body ) {
|
1451
|
+
$.extend( testElementStyle, {
|
1452
|
+
position: "absolute",
|
1453
|
+
left: "-1000px",
|
1454
|
+
top: "-1000px"
|
1455
|
+
});
|
1456
|
+
}
|
1457
|
+
for ( i in testElementStyle ) {
|
1458
|
+
testElement.style[ i ] = testElementStyle[ i ];
|
1459
|
+
}
|
1460
|
+
testElement.appendChild( div );
|
1461
|
+
testElementParent = body || document.documentElement;
|
1462
|
+
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
1463
|
+
|
1464
|
+
div.style.cssText = "position: absolute; left: 10.7432222px;";
|
1465
|
+
|
1466
|
+
offsetLeft = $( div ).offset().left;
|
1467
|
+
$.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
|
1468
|
+
|
1469
|
+
testElement.innerHTML = "";
|
1470
|
+
testElementParent.removeChild( testElement );
|
1471
|
+
})();
|
1472
|
+
|
1473
|
+
}( jQuery ) );
|
1474
|
+
(function( $, undefined ) {
|
1475
|
+
|
1476
|
+
$.widget("ui.draggable", $.ui.mouse, {
|
1477
|
+
version: "1.10.1",
|
1478
|
+
widgetEventPrefix: "drag",
|
1479
|
+
options: {
|
1480
|
+
addClasses: true,
|
1481
|
+
appendTo: "parent",
|
1482
|
+
axis: false,
|
1483
|
+
connectToSortable: false,
|
1484
|
+
containment: false,
|
1485
|
+
cursor: "auto",
|
1486
|
+
cursorAt: false,
|
1487
|
+
grid: false,
|
1488
|
+
handle: false,
|
1489
|
+
helper: "original",
|
1490
|
+
iframeFix: false,
|
1491
|
+
opacity: false,
|
1492
|
+
refreshPositions: false,
|
1493
|
+
revert: false,
|
1494
|
+
revertDuration: 500,
|
1495
|
+
scope: "default",
|
1496
|
+
scroll: true,
|
1497
|
+
scrollSensitivity: 20,
|
1498
|
+
scrollSpeed: 20,
|
1499
|
+
snap: false,
|
1500
|
+
snapMode: "both",
|
1501
|
+
snapTolerance: 20,
|
1502
|
+
stack: false,
|
1503
|
+
zIndex: false,
|
1504
|
+
|
1505
|
+
// callbacks
|
1506
|
+
drag: null,
|
1507
|
+
start: null,
|
1508
|
+
stop: null
|
1509
|
+
},
|
1510
|
+
_create: function() {
|
1511
|
+
|
1512
|
+
if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
|
1513
|
+
this.element[0].style.position = "relative";
|
1514
|
+
}
|
1515
|
+
if (this.options.addClasses){
|
1516
|
+
this.element.addClass("ui-draggable");
|
1517
|
+
}
|
1518
|
+
if (this.options.disabled){
|
1519
|
+
this.element.addClass("ui-draggable-disabled");
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
this._mouseInit();
|
1523
|
+
|
1524
|
+
},
|
1525
|
+
|
1526
|
+
_destroy: function() {
|
1527
|
+
this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
|
1528
|
+
this._mouseDestroy();
|
1529
|
+
},
|
1530
|
+
|
1531
|
+
_mouseCapture: function(event) {
|
1532
|
+
|
1533
|
+
var o = this.options;
|
1534
|
+
|
1535
|
+
// among others, prevent a drag on a resizable-handle
|
1536
|
+
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
|
1537
|
+
return false;
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
//Quit if we're not on a valid handle
|
1541
|
+
this.handle = this._getHandle(event);
|
1542
|
+
if (!this.handle) {
|
1543
|
+
return false;
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
|
1547
|
+
$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>")
|
1548
|
+
.css({
|
1549
|
+
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
|
1550
|
+
position: "absolute", opacity: "0.001", zIndex: 1000
|
1551
|
+
})
|
1552
|
+
.css($(this).offset())
|
1553
|
+
.appendTo("body");
|
1554
|
+
});
|
1555
|
+
|
1556
|
+
return true;
|
1557
|
+
|
1558
|
+
},
|
1559
|
+
|
1560
|
+
_mouseStart: function(event) {
|
1561
|
+
|
1562
|
+
var o = this.options;
|
1563
|
+
|
1564
|
+
//Create and append the visible helper
|
1565
|
+
this.helper = this._createHelper(event);
|
1566
|
+
|
1567
|
+
this.helper.addClass("ui-draggable-dragging");
|
1568
|
+
|
1569
|
+
//Cache the helper size
|
1570
|
+
this._cacheHelperProportions();
|
1571
|
+
|
1572
|
+
//If ddmanager is used for droppables, set the global draggable
|
1573
|
+
if($.ui.ddmanager) {
|
1574
|
+
$.ui.ddmanager.current = this;
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
/*
|
1578
|
+
* - Position generation -
|
1579
|
+
* This block generates everything position related - it's the core of draggables.
|
1580
|
+
*/
|
1581
|
+
|
1582
|
+
//Cache the margins of the original element
|
1583
|
+
this._cacheMargins();
|
1584
|
+
|
1585
|
+
//Store the helper's css position
|
1586
|
+
this.cssPosition = this.helper.css("position");
|
1587
|
+
this.scrollParent = this.helper.scrollParent();
|
1588
|
+
|
1589
|
+
//The element's absolute position on the page minus margins
|
1590
|
+
this.offset = this.positionAbs = this.element.offset();
|
1591
|
+
this.offset = {
|
1592
|
+
top: this.offset.top - this.margins.top,
|
1593
|
+
left: this.offset.left - this.margins.left
|
1594
|
+
};
|
1595
|
+
|
1596
|
+
$.extend(this.offset, {
|
1597
|
+
click: { //Where the click happened, relative to the element
|
1598
|
+
left: event.pageX - this.offset.left,
|
1599
|
+
top: event.pageY - this.offset.top
|
1600
|
+
},
|
1601
|
+
parent: this._getParentOffset(),
|
1602
|
+
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
|
1603
|
+
});
|
1604
|
+
|
1605
|
+
//Generate the original position
|
1606
|
+
this.originalPosition = this.position = this._generatePosition(event);
|
1607
|
+
this.originalPageX = event.pageX;
|
1608
|
+
this.originalPageY = event.pageY;
|
1609
|
+
|
1610
|
+
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
|
1611
|
+
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
|
1612
|
+
|
1613
|
+
//Set a containment if given in the options
|
1614
|
+
if(o.containment) {
|
1615
|
+
this._setContainment();
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
//Trigger event + callbacks
|
1619
|
+
if(this._trigger("start", event) === false) {
|
1620
|
+
this._clear();
|
1621
|
+
return false;
|
1622
|
+
}
|
1623
|
+
|
1624
|
+
//Recache the helper size
|
1625
|
+
this._cacheHelperProportions();
|
1626
|
+
|
1627
|
+
//Prepare the droppable offsets
|
1628
|
+
if ($.ui.ddmanager && !o.dropBehaviour) {
|
1629
|
+
$.ui.ddmanager.prepareOffsets(this, event);
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
|
1633
|
+
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
1634
|
+
|
1635
|
+
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
|
1636
|
+
if ( $.ui.ddmanager ) {
|
1637
|
+
$.ui.ddmanager.dragStart(this, event);
|
1638
|
+
}
|
1639
|
+
|
1640
|
+
return true;
|
1641
|
+
},
|
1642
|
+
|
1643
|
+
_mouseDrag: function(event, noPropagation) {
|
1644
|
+
|
1645
|
+
//Compute the helpers position
|
1646
|
+
this.position = this._generatePosition(event);
|
1647
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
1648
|
+
|
1649
|
+
//Call plugins and callbacks and use the resulting position if something is returned
|
1650
|
+
if (!noPropagation) {
|
1651
|
+
var ui = this._uiHash();
|
1652
|
+
if(this._trigger("drag", event, ui) === false) {
|
1653
|
+
this._mouseUp({});
|
1654
|
+
return false;
|
1655
|
+
}
|
1656
|
+
this.position = ui.position;
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
if(!this.options.axis || this.options.axis !== "y") {
|
1660
|
+
this.helper[0].style.left = this.position.left+"px";
|
1661
|
+
}
|
1662
|
+
if(!this.options.axis || this.options.axis !== "x") {
|
1663
|
+
this.helper[0].style.top = this.position.top+"px";
|
1664
|
+
}
|
1665
|
+
if($.ui.ddmanager) {
|
1666
|
+
$.ui.ddmanager.drag(this, event);
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
return false;
|
1670
|
+
},
|
1671
|
+
|
1672
|
+
_mouseStop: function(event) {
|
1673
|
+
|
1674
|
+
//If we are using droppables, inform the manager about the drop
|
1675
|
+
var element,
|
1676
|
+
that = this,
|
1677
|
+
elementInDom = false,
|
1678
|
+
dropped = false;
|
1679
|
+
if ($.ui.ddmanager && !this.options.dropBehaviour) {
|
1680
|
+
dropped = $.ui.ddmanager.drop(this, event);
|
1681
|
+
}
|
1682
|
+
|
1683
|
+
//if a drop comes from outside (a sortable)
|
1684
|
+
if(this.dropped) {
|
1685
|
+
dropped = this.dropped;
|
1686
|
+
this.dropped = false;
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
//if the original element is no longer in the DOM don't bother to continue (see #8269)
|
1690
|
+
element = this.element[0];
|
1691
|
+
while ( element && (element = element.parentNode) ) {
|
1692
|
+
if (element === document ) {
|
1693
|
+
elementInDom = true;
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
if ( !elementInDom && this.options.helper === "original" ) {
|
1697
|
+
return false;
|
1698
|
+
}
|
1699
|
+
|
1700
|
+
if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
|
1701
|
+
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
|
1702
|
+
if(that._trigger("stop", event) !== false) {
|
1703
|
+
that._clear();
|
1704
|
+
}
|
1705
|
+
});
|
1706
|
+
} else {
|
1707
|
+
if(this._trigger("stop", event) !== false) {
|
1708
|
+
this._clear();
|
1709
|
+
}
|
1710
|
+
}
|
1711
|
+
|
1712
|
+
return false;
|
1713
|
+
},
|
1714
|
+
|
1715
|
+
_mouseUp: function(event) {
|
1716
|
+
//Remove frame helpers
|
1717
|
+
$("div.ui-draggable-iframeFix").each(function() {
|
1718
|
+
this.parentNode.removeChild(this);
|
1719
|
+
});
|
1720
|
+
|
1721
|
+
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
|
1722
|
+
if( $.ui.ddmanager ) {
|
1723
|
+
$.ui.ddmanager.dragStop(this, event);
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
return $.ui.mouse.prototype._mouseUp.call(this, event);
|
1727
|
+
},
|
1728
|
+
|
1729
|
+
cancel: function() {
|
1730
|
+
|
1731
|
+
if(this.helper.is(".ui-draggable-dragging")) {
|
1732
|
+
this._mouseUp({});
|
1733
|
+
} else {
|
1734
|
+
this._clear();
|
1735
|
+
}
|
1736
|
+
|
1737
|
+
return this;
|
1738
|
+
|
1739
|
+
},
|
1740
|
+
|
1741
|
+
_getHandle: function(event) {
|
1742
|
+
|
1743
|
+
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
|
1744
|
+
$(this.options.handle, this.element)
|
1745
|
+
.find("*")
|
1746
|
+
.addBack()
|
1747
|
+
.each(function() {
|
1748
|
+
if(this === event.target) {
|
1749
|
+
handle = true;
|
1750
|
+
}
|
1751
|
+
});
|
1752
|
+
|
1753
|
+
return handle;
|
1754
|
+
|
1755
|
+
},
|
1756
|
+
|
1757
|
+
_createHelper: function(event) {
|
1758
|
+
|
1759
|
+
var o = this.options,
|
1760
|
+
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
|
1761
|
+
|
1762
|
+
if(!helper.parents("body").length) {
|
1763
|
+
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
|
1767
|
+
helper.css("position", "absolute");
|
1768
|
+
}
|
1769
|
+
|
1770
|
+
return helper;
|
1771
|
+
|
1772
|
+
},
|
1773
|
+
|
1774
|
+
_adjustOffsetFromHelper: function(obj) {
|
1775
|
+
if (typeof obj === "string") {
|
1776
|
+
obj = obj.split(" ");
|
1777
|
+
}
|
1778
|
+
if ($.isArray(obj)) {
|
1779
|
+
obj = {left: +obj[0], top: +obj[1] || 0};
|
1780
|
+
}
|
1781
|
+
if ("left" in obj) {
|
1782
|
+
this.offset.click.left = obj.left + this.margins.left;
|
1783
|
+
}
|
1784
|
+
if ("right" in obj) {
|
1785
|
+
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
1786
|
+
}
|
1787
|
+
if ("top" in obj) {
|
1788
|
+
this.offset.click.top = obj.top + this.margins.top;
|
1789
|
+
}
|
1790
|
+
if ("bottom" in obj) {
|
1791
|
+
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
1792
|
+
}
|
1793
|
+
},
|
1794
|
+
|
1795
|
+
_getParentOffset: function() {
|
1796
|
+
|
1797
|
+
//Get the offsetParent and cache its position
|
1798
|
+
this.offsetParent = this.helper.offsetParent();
|
1799
|
+
var po = this.offsetParent.offset();
|
1800
|
+
|
1801
|
+
// This is a special case where we need to modify a offset calculated on start, since the following happened:
|
1802
|
+
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
1803
|
+
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
1804
|
+
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
1805
|
+
if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
|
1806
|
+
po.left += this.scrollParent.scrollLeft();
|
1807
|
+
po.top += this.scrollParent.scrollTop();
|
1808
|
+
}
|
1809
|
+
|
1810
|
+
//This needs to be actually done for all browsers, since pageX/pageY includes this information
|
1811
|
+
//Ugly IE fix
|
1812
|
+
if((this.offsetParent[0] === document.body) ||
|
1813
|
+
(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
|
1814
|
+
po = { top: 0, left: 0 };
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
return {
|
1818
|
+
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
1819
|
+
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
1820
|
+
};
|
1821
|
+
|
1822
|
+
},
|
1823
|
+
|
1824
|
+
_getRelativeOffset: function() {
|
1825
|
+
|
1826
|
+
if(this.cssPosition === "relative") {
|
1827
|
+
var p = this.element.position();
|
1828
|
+
return {
|
1829
|
+
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
|
1830
|
+
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
|
1831
|
+
};
|
1832
|
+
} else {
|
1833
|
+
return { top: 0, left: 0 };
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
},
|
1837
|
+
|
1838
|
+
_cacheMargins: function() {
|
1839
|
+
this.margins = {
|
1840
|
+
left: (parseInt(this.element.css("marginLeft"),10) || 0),
|
1841
|
+
top: (parseInt(this.element.css("marginTop"),10) || 0),
|
1842
|
+
right: (parseInt(this.element.css("marginRight"),10) || 0),
|
1843
|
+
bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
|
1844
|
+
};
|
1845
|
+
},
|
1846
|
+
|
1847
|
+
_cacheHelperProportions: function() {
|
1848
|
+
this.helperProportions = {
|
1849
|
+
width: this.helper.outerWidth(),
|
1850
|
+
height: this.helper.outerHeight()
|
1851
|
+
};
|
1852
|
+
},
|
1853
|
+
|
1854
|
+
_setContainment: function() {
|
1855
|
+
|
1856
|
+
var over, c, ce,
|
1857
|
+
o = this.options;
|
1858
|
+
|
1859
|
+
if(o.containment === "parent") {
|
1860
|
+
o.containment = this.helper[0].parentNode;
|
1861
|
+
}
|
1862
|
+
if(o.containment === "document" || o.containment === "window") {
|
1863
|
+
this.containment = [
|
1864
|
+
o.containment === "document" ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
|
1865
|
+
o.containment === "document" ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
|
1866
|
+
(o.containment === "document" ? 0 : $(window).scrollLeft()) + $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
|
1867
|
+
(o.containment === "document" ? 0 : $(window).scrollTop()) + ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
|
1868
|
+
];
|
1869
|
+
}
|
1870
|
+
|
1871
|
+
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor !== Array) {
|
1872
|
+
c = $(o.containment);
|
1873
|
+
ce = c[0];
|
1874
|
+
|
1875
|
+
if(!ce) {
|
1876
|
+
return;
|
1877
|
+
}
|
1878
|
+
|
1879
|
+
over = ($(ce).css("overflow") !== "hidden");
|
1880
|
+
|
1881
|
+
this.containment = [
|
1882
|
+
(parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
|
1883
|
+
(parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
|
1884
|
+
(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
|
1885
|
+
(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
|
1886
|
+
];
|
1887
|
+
this.relative_container = c;
|
1888
|
+
|
1889
|
+
} else if(o.containment.constructor === Array) {
|
1890
|
+
this.containment = o.containment;
|
1891
|
+
}
|
1892
|
+
|
1893
|
+
},
|
1894
|
+
|
1895
|
+
_convertPositionTo: function(d, pos) {
|
1896
|
+
|
1897
|
+
if(!pos) {
|
1898
|
+
pos = this.position;
|
1899
|
+
}
|
1900
|
+
|
1901
|
+
var mod = d === "absolute" ? 1 : -1,
|
1902
|
+
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
1903
|
+
|
1904
|
+
return {
|
1905
|
+
top: (
|
1906
|
+
pos.top + // The absolute mouse position
|
1907
|
+
this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
1908
|
+
this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
|
1909
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
1910
|
+
),
|
1911
|
+
left: (
|
1912
|
+
pos.left + // The absolute mouse position
|
1913
|
+
this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
|
1914
|
+
this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
|
1915
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
1916
|
+
)
|
1917
|
+
};
|
1918
|
+
|
1919
|
+
},
|
1920
|
+
|
1921
|
+
_generatePosition: function(event) {
|
1922
|
+
|
1923
|
+
var containment, co, top, left,
|
1924
|
+
o = this.options,
|
1925
|
+
scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
|
1926
|
+
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName),
|
1927
|
+
pageX = event.pageX,
|
1928
|
+
pageY = event.pageY;
|
1929
|
+
|
1930
|
+
/*
|
1931
|
+
* - Position constraining -
|
1932
|
+
* Constrain the position to a mix of grid, containment.
|
1933
|
+
*/
|
1934
|
+
|
1935
|
+
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
|
1936
|
+
if(this.containment) {
|
1937
|
+
if (this.relative_container){
|
1938
|
+
co = this.relative_container.offset();
|
1939
|
+
containment = [ this.containment[0] + co.left,
|
1940
|
+
this.containment[1] + co.top,
|
1941
|
+
this.containment[2] + co.left,
|
1942
|
+
this.containment[3] + co.top ];
|
1943
|
+
}
|
1944
|
+
else {
|
1945
|
+
containment = this.containment;
|
1946
|
+
}
|
1947
|
+
|
1948
|
+
if(event.pageX - this.offset.click.left < containment[0]) {
|
1949
|
+
pageX = containment[0] + this.offset.click.left;
|
1950
|
+
}
|
1951
|
+
if(event.pageY - this.offset.click.top < containment[1]) {
|
1952
|
+
pageY = containment[1] + this.offset.click.top;
|
1953
|
+
}
|
1954
|
+
if(event.pageX - this.offset.click.left > containment[2]) {
|
1955
|
+
pageX = containment[2] + this.offset.click.left;
|
1956
|
+
}
|
1957
|
+
if(event.pageY - this.offset.click.top > containment[3]) {
|
1958
|
+
pageY = containment[3] + this.offset.click.top;
|
1959
|
+
}
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
if(o.grid) {
|
1963
|
+
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
|
1964
|
+
top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
|
1965
|
+
pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
1966
|
+
|
1967
|
+
left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
|
1968
|
+
pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
}
|
1972
|
+
|
1973
|
+
return {
|
1974
|
+
top: (
|
1975
|
+
pageY - // The absolute mouse position
|
1976
|
+
this.offset.click.top - // Click offset (relative to the element)
|
1977
|
+
this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
|
1978
|
+
this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
|
1979
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
|
1980
|
+
),
|
1981
|
+
left: (
|
1982
|
+
pageX - // The absolute mouse position
|
1983
|
+
this.offset.click.left - // Click offset (relative to the element)
|
1984
|
+
this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
|
1985
|
+
this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
|
1986
|
+
( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
|
1987
|
+
)
|
1988
|
+
};
|
1989
|
+
|
1990
|
+
},
|
1991
|
+
|
1992
|
+
_clear: function() {
|
1993
|
+
this.helper.removeClass("ui-draggable-dragging");
|
1994
|
+
if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
|
1995
|
+
this.helper.remove();
|
1996
|
+
}
|
1997
|
+
this.helper = null;
|
1998
|
+
this.cancelHelperRemoval = false;
|
1999
|
+
},
|
2000
|
+
|
2001
|
+
// From now on bulk stuff - mainly helpers
|
2002
|
+
|
2003
|
+
_trigger: function(type, event, ui) {
|
2004
|
+
ui = ui || this._uiHash();
|
2005
|
+
$.ui.plugin.call(this, type, [event, ui]);
|
2006
|
+
//The absolute position has to be recalculated after plugins
|
2007
|
+
if(type === "drag") {
|
2008
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
2009
|
+
}
|
2010
|
+
return $.Widget.prototype._trigger.call(this, type, event, ui);
|
2011
|
+
},
|
2012
|
+
|
2013
|
+
plugins: {},
|
2014
|
+
|
2015
|
+
_uiHash: function() {
|
2016
|
+
return {
|
2017
|
+
helper: this.helper,
|
2018
|
+
position: this.position,
|
2019
|
+
originalPosition: this.originalPosition,
|
2020
|
+
offset: this.positionAbs
|
2021
|
+
};
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
});
|
2025
|
+
|
2026
|
+
$.ui.plugin.add("draggable", "connectToSortable", {
|
2027
|
+
start: function(event, ui) {
|
2028
|
+
|
2029
|
+
var inst = $(this).data("ui-draggable"), o = inst.options,
|
2030
|
+
uiSortable = $.extend({}, ui, { item: inst.element });
|
2031
|
+
inst.sortables = [];
|
2032
|
+
$(o.connectToSortable).each(function() {
|
2033
|
+
var sortable = $.data(this, "ui-sortable");
|
2034
|
+
if (sortable && !sortable.options.disabled) {
|
2035
|
+
inst.sortables.push({
|
2036
|
+
instance: sortable,
|
2037
|
+
shouldRevert: sortable.options.revert
|
2038
|
+
});
|
2039
|
+
sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
|
2040
|
+
sortable._trigger("activate", event, uiSortable);
|
2041
|
+
}
|
2042
|
+
});
|
2043
|
+
|
2044
|
+
},
|
2045
|
+
stop: function(event, ui) {
|
2046
|
+
|
2047
|
+
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
|
2048
|
+
var inst = $(this).data("ui-draggable"),
|
2049
|
+
uiSortable = $.extend({}, ui, { item: inst.element });
|
2050
|
+
|
2051
|
+
$.each(inst.sortables, function() {
|
2052
|
+
if(this.instance.isOver) {
|
2053
|
+
|
2054
|
+
this.instance.isOver = 0;
|
2055
|
+
|
2056
|
+
inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
|
2057
|
+
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
|
2058
|
+
|
2059
|
+
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
|
2060
|
+
if(this.shouldRevert) {
|
2061
|
+
this.instance.options.revert = true;
|
2062
|
+
}
|
2063
|
+
|
2064
|
+
//Trigger the stop of the sortable
|
2065
|
+
this.instance._mouseStop(event);
|
2066
|
+
|
2067
|
+
this.instance.options.helper = this.instance.options._helper;
|
2068
|
+
|
2069
|
+
//If the helper has been the original item, restore properties in the sortable
|
2070
|
+
if(inst.options.helper === "original") {
|
2071
|
+
this.instance.currentItem.css({ top: "auto", left: "auto" });
|
2072
|
+
}
|
2073
|
+
|
2074
|
+
} else {
|
2075
|
+
this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
|
2076
|
+
this.instance._trigger("deactivate", event, uiSortable);
|
2077
|
+
}
|
2078
|
+
|
2079
|
+
});
|
2080
|
+
|
2081
|
+
},
|
2082
|
+
drag: function(event, ui) {
|
2083
|
+
|
2084
|
+
var inst = $(this).data("ui-draggable"), that = this;
|
2085
|
+
|
2086
|
+
$.each(inst.sortables, function() {
|
2087
|
+
|
2088
|
+
var innermostIntersecting = false,
|
2089
|
+
thisSortable = this;
|
2090
|
+
|
2091
|
+
//Copy over some variables to allow calling the sortable's native _intersectsWith
|
2092
|
+
this.instance.positionAbs = inst.positionAbs;
|
2093
|
+
this.instance.helperProportions = inst.helperProportions;
|
2094
|
+
this.instance.offset.click = inst.offset.click;
|
2095
|
+
|
2096
|
+
if(this.instance._intersectsWith(this.instance.containerCache)) {
|
2097
|
+
innermostIntersecting = true;
|
2098
|
+
$.each(inst.sortables, function () {
|
2099
|
+
this.instance.positionAbs = inst.positionAbs;
|
2100
|
+
this.instance.helperProportions = inst.helperProportions;
|
2101
|
+
this.instance.offset.click = inst.offset.click;
|
2102
|
+
if (this !== thisSortable &&
|
2103
|
+
this.instance._intersectsWith(this.instance.containerCache) &&
|
2104
|
+
$.contains(thisSortable.instance.element[0], this.instance.element[0])
|
2105
|
+
) {
|
2106
|
+
innermostIntersecting = false;
|
2107
|
+
}
|
2108
|
+
return innermostIntersecting;
|
2109
|
+
});
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
|
2113
|
+
if(innermostIntersecting) {
|
2114
|
+
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
|
2115
|
+
if(!this.instance.isOver) {
|
2116
|
+
|
2117
|
+
this.instance.isOver = 1;
|
2118
|
+
//Now we fake the start of dragging for the sortable instance,
|
2119
|
+
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
|
2120
|
+
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
|
2121
|
+
this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true);
|
2122
|
+
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
|
2123
|
+
this.instance.options.helper = function() { return ui.helper[0]; };
|
2124
|
+
|
2125
|
+
event.target = this.instance.currentItem[0];
|
2126
|
+
this.instance._mouseCapture(event, true);
|
2127
|
+
this.instance._mouseStart(event, true, true);
|
2128
|
+
|
2129
|
+
//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
|
2130
|
+
this.instance.offset.click.top = inst.offset.click.top;
|
2131
|
+
this.instance.offset.click.left = inst.offset.click.left;
|
2132
|
+
this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
|
2133
|
+
this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
|
2134
|
+
|
2135
|
+
inst._trigger("toSortable", event);
|
2136
|
+
inst.dropped = this.instance.element; //draggable revert needs that
|
2137
|
+
//hack so receive/update callbacks work (mostly)
|
2138
|
+
inst.currentItem = inst.element;
|
2139
|
+
this.instance.fromOutside = inst;
|
2140
|
+
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
|
2144
|
+
if(this.instance.currentItem) {
|
2145
|
+
this.instance._mouseDrag(event);
|
2146
|
+
}
|
2147
|
+
|
2148
|
+
} else {
|
2149
|
+
|
2150
|
+
//If it doesn't intersect with the sortable, and it intersected before,
|
2151
|
+
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
|
2152
|
+
if(this.instance.isOver) {
|
2153
|
+
|
2154
|
+
this.instance.isOver = 0;
|
2155
|
+
this.instance.cancelHelperRemoval = true;
|
2156
|
+
|
2157
|
+
//Prevent reverting on this forced stop
|
2158
|
+
this.instance.options.revert = false;
|
2159
|
+
|
2160
|
+
// The out event needs to be triggered independently
|
2161
|
+
this.instance._trigger("out", event, this.instance._uiHash(this.instance));
|
2162
|
+
|
2163
|
+
this.instance._mouseStop(event, true);
|
2164
|
+
this.instance.options.helper = this.instance.options._helper;
|
2165
|
+
|
2166
|
+
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
|
2167
|
+
this.instance.currentItem.remove();
|
2168
|
+
if(this.instance.placeholder) {
|
2169
|
+
this.instance.placeholder.remove();
|
2170
|
+
}
|
2171
|
+
|
2172
|
+
inst._trigger("fromSortable", event);
|
2173
|
+
inst.dropped = false; //draggable revert needs that
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
});
|
2179
|
+
|
2180
|
+
}
|
2181
|
+
});
|
2182
|
+
|
2183
|
+
$.ui.plugin.add("draggable", "cursor", {
|
2184
|
+
start: function() {
|
2185
|
+
var t = $("body"), o = $(this).data("ui-draggable").options;
|
2186
|
+
if (t.css("cursor")) {
|
2187
|
+
o._cursor = t.css("cursor");
|
2188
|
+
}
|
2189
|
+
t.css("cursor", o.cursor);
|
2190
|
+
},
|
2191
|
+
stop: function() {
|
2192
|
+
var o = $(this).data("ui-draggable").options;
|
2193
|
+
if (o._cursor) {
|
2194
|
+
$("body").css("cursor", o._cursor);
|
2195
|
+
}
|
2196
|
+
}
|
2197
|
+
});
|
2198
|
+
|
2199
|
+
$.ui.plugin.add("draggable", "opacity", {
|
2200
|
+
start: function(event, ui) {
|
2201
|
+
var t = $(ui.helper), o = $(this).data("ui-draggable").options;
|
2202
|
+
if(t.css("opacity")) {
|
2203
|
+
o._opacity = t.css("opacity");
|
2204
|
+
}
|
2205
|
+
t.css("opacity", o.opacity);
|
2206
|
+
},
|
2207
|
+
stop: function(event, ui) {
|
2208
|
+
var o = $(this).data("ui-draggable").options;
|
2209
|
+
if(o._opacity) {
|
2210
|
+
$(ui.helper).css("opacity", o._opacity);
|
2211
|
+
}
|
2212
|
+
}
|
2213
|
+
});
|
2214
|
+
|
2215
|
+
$.ui.plugin.add("draggable", "scroll", {
|
2216
|
+
start: function() {
|
2217
|
+
var i = $(this).data("ui-draggable");
|
2218
|
+
if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
|
2219
|
+
i.overflowOffset = i.scrollParent.offset();
|
2220
|
+
}
|
2221
|
+
},
|
2222
|
+
drag: function( event ) {
|
2223
|
+
|
2224
|
+
var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
|
2225
|
+
|
2226
|
+
if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
|
2227
|
+
|
2228
|
+
if(!o.axis || o.axis !== "x") {
|
2229
|
+
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
|
2230
|
+
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
|
2231
|
+
} else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
|
2232
|
+
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
|
2233
|
+
}
|
2234
|
+
}
|
2235
|
+
|
2236
|
+
if(!o.axis || o.axis !== "y") {
|
2237
|
+
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
|
2238
|
+
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
|
2239
|
+
} else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
|
2240
|
+
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
|
2241
|
+
}
|
2242
|
+
}
|
2243
|
+
|
2244
|
+
} else {
|
2245
|
+
|
2246
|
+
if(!o.axis || o.axis !== "x") {
|
2247
|
+
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
|
2248
|
+
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
2249
|
+
} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
|
2250
|
+
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
2251
|
+
}
|
2252
|
+
}
|
2253
|
+
|
2254
|
+
if(!o.axis || o.axis !== "y") {
|
2255
|
+
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
|
2256
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
2257
|
+
} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
|
2258
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
2259
|
+
}
|
2260
|
+
}
|
2261
|
+
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
|
2265
|
+
$.ui.ddmanager.prepareOffsets(i, event);
|
2266
|
+
}
|
2267
|
+
|
2268
|
+
}
|
2269
|
+
});
|
2270
|
+
|
2271
|
+
$.ui.plugin.add("draggable", "snap", {
|
2272
|
+
start: function() {
|
2273
|
+
|
2274
|
+
var i = $(this).data("ui-draggable"),
|
2275
|
+
o = i.options;
|
2276
|
+
|
2277
|
+
i.snapElements = [];
|
2278
|
+
|
2279
|
+
$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
|
2280
|
+
var $t = $(this),
|
2281
|
+
$o = $t.offset();
|
2282
|
+
if(this !== i.element[0]) {
|
2283
|
+
i.snapElements.push({
|
2284
|
+
item: this,
|
2285
|
+
width: $t.outerWidth(), height: $t.outerHeight(),
|
2286
|
+
top: $o.top, left: $o.left
|
2287
|
+
});
|
2288
|
+
}
|
2289
|
+
});
|
2290
|
+
|
2291
|
+
},
|
2292
|
+
drag: function(event, ui) {
|
2293
|
+
|
2294
|
+
var ts, bs, ls, rs, l, r, t, b, i, first,
|
2295
|
+
inst = $(this).data("ui-draggable"),
|
2296
|
+
o = inst.options,
|
2297
|
+
d = o.snapTolerance,
|
2298
|
+
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
|
2299
|
+
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
|
2300
|
+
|
2301
|
+
for (i = inst.snapElements.length - 1; i >= 0; i--){
|
2302
|
+
|
2303
|
+
l = inst.snapElements[i].left;
|
2304
|
+
r = l + inst.snapElements[i].width;
|
2305
|
+
t = inst.snapElements[i].top;
|
2306
|
+
b = t + inst.snapElements[i].height;
|
2307
|
+
|
2308
|
+
//Yes, I know, this is insane ;)
|
2309
|
+
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
|
2310
|
+
if(inst.snapElements[i].snapping) {
|
2311
|
+
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
2312
|
+
}
|
2313
|
+
inst.snapElements[i].snapping = false;
|
2314
|
+
continue;
|
2315
|
+
}
|
2316
|
+
|
2317
|
+
if(o.snapMode !== "inner") {
|
2318
|
+
ts = Math.abs(t - y2) <= d;
|
2319
|
+
bs = Math.abs(b - y1) <= d;
|
2320
|
+
ls = Math.abs(l - x2) <= d;
|
2321
|
+
rs = Math.abs(r - x1) <= d;
|
2322
|
+
if(ts) {
|
2323
|
+
ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
2324
|
+
}
|
2325
|
+
if(bs) {
|
2326
|
+
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
|
2327
|
+
}
|
2328
|
+
if(ls) {
|
2329
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
|
2330
|
+
}
|
2331
|
+
if(rs) {
|
2332
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
|
2333
|
+
}
|
2334
|
+
}
|
2335
|
+
|
2336
|
+
first = (ts || bs || ls || rs);
|
2337
|
+
|
2338
|
+
if(o.snapMode !== "outer") {
|
2339
|
+
ts = Math.abs(t - y1) <= d;
|
2340
|
+
bs = Math.abs(b - y2) <= d;
|
2341
|
+
ls = Math.abs(l - x1) <= d;
|
2342
|
+
rs = Math.abs(r - x2) <= d;
|
2343
|
+
if(ts) {
|
2344
|
+
ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
|
2345
|
+
}
|
2346
|
+
if(bs) {
|
2347
|
+
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
2348
|
+
}
|
2349
|
+
if(ls) {
|
2350
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
|
2351
|
+
}
|
2352
|
+
if(rs) {
|
2353
|
+
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
|
2354
|
+
}
|
2355
|
+
}
|
2356
|
+
|
2357
|
+
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
|
2358
|
+
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
2359
|
+
}
|
2360
|
+
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
|
2361
|
+
|
2362
|
+
}
|
2363
|
+
|
2364
|
+
}
|
2365
|
+
});
|
2366
|
+
|
2367
|
+
$.ui.plugin.add("draggable", "stack", {
|
2368
|
+
start: function() {
|
2369
|
+
var min,
|
2370
|
+
o = this.data("ui-draggable").options,
|
2371
|
+
group = $.makeArray($(o.stack)).sort(function(a,b) {
|
2372
|
+
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
|
2373
|
+
});
|
2374
|
+
|
2375
|
+
if (!group.length) { return; }
|
2376
|
+
|
2377
|
+
min = parseInt($(group[0]).css("zIndex"), 10) || 0;
|
2378
|
+
$(group).each(function(i) {
|
2379
|
+
$(this).css("zIndex", min + i);
|
2380
|
+
});
|
2381
|
+
this.css("zIndex", (min + group.length));
|
2382
|
+
}
|
2383
|
+
});
|
2384
|
+
|
2385
|
+
$.ui.plugin.add("draggable", "zIndex", {
|
2386
|
+
start: function(event, ui) {
|
2387
|
+
var t = $(ui.helper), o = $(this).data("ui-draggable").options;
|
2388
|
+
if(t.css("zIndex")) {
|
2389
|
+
o._zIndex = t.css("zIndex");
|
2390
|
+
}
|
2391
|
+
t.css("zIndex", o.zIndex);
|
2392
|
+
},
|
2393
|
+
stop: function(event, ui) {
|
2394
|
+
var o = $(this).data("ui-draggable").options;
|
2395
|
+
if(o._zIndex) {
|
2396
|
+
$(ui.helper).css("zIndex", o._zIndex);
|
2397
|
+
}
|
2398
|
+
}
|
2399
|
+
});
|
2400
|
+
|
2401
|
+
})(jQuery);
|
2402
|
+
(function( $, undefined ) {
|
2403
|
+
|
2404
|
+
function num(v) {
|
2405
|
+
return parseInt(v, 10) || 0;
|
2406
|
+
}
|
2407
|
+
|
2408
|
+
function isNumber(value) {
|
2409
|
+
return !isNaN(parseInt(value, 10));
|
2410
|
+
}
|
2411
|
+
|
2412
|
+
$.widget("ui.resizable", $.ui.mouse, {
|
2413
|
+
version: "1.10.1",
|
2414
|
+
widgetEventPrefix: "resize",
|
2415
|
+
options: {
|
2416
|
+
alsoResize: false,
|
2417
|
+
animate: false,
|
2418
|
+
animateDuration: "slow",
|
2419
|
+
animateEasing: "swing",
|
2420
|
+
aspectRatio: false,
|
2421
|
+
autoHide: false,
|
2422
|
+
containment: false,
|
2423
|
+
ghost: false,
|
2424
|
+
grid: false,
|
2425
|
+
handles: "e,s,se",
|
2426
|
+
helper: false,
|
2427
|
+
maxHeight: null,
|
2428
|
+
maxWidth: null,
|
2429
|
+
minHeight: 10,
|
2430
|
+
minWidth: 10,
|
2431
|
+
// See #7960
|
2432
|
+
zIndex: 90,
|
2433
|
+
|
2434
|
+
// callbacks
|
2435
|
+
resize: null,
|
2436
|
+
start: null,
|
2437
|
+
stop: null
|
2438
|
+
},
|
2439
|
+
_create: function() {
|
2440
|
+
|
2441
|
+
var n, i, handle, axis, hname,
|
2442
|
+
that = this,
|
2443
|
+
o = this.options;
|
2444
|
+
this.element.addClass("ui-resizable");
|
2445
|
+
|
2446
|
+
$.extend(this, {
|
2447
|
+
_aspectRatio: !!(o.aspectRatio),
|
2448
|
+
aspectRatio: o.aspectRatio,
|
2449
|
+
originalElement: this.element,
|
2450
|
+
_proportionallyResizeElements: [],
|
2451
|
+
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
|
2452
|
+
});
|
2453
|
+
|
2454
|
+
//Wrap the element if it cannot hold child nodes
|
2455
|
+
if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
|
2456
|
+
|
2457
|
+
//Create a wrapper element and set the wrapper to the new current internal element
|
2458
|
+
this.element.wrap(
|
2459
|
+
$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
|
2460
|
+
position: this.element.css("position"),
|
2461
|
+
width: this.element.outerWidth(),
|
2462
|
+
height: this.element.outerHeight(),
|
2463
|
+
top: this.element.css("top"),
|
2464
|
+
left: this.element.css("left")
|
2465
|
+
})
|
2466
|
+
);
|
2467
|
+
|
2468
|
+
//Overwrite the original this.element
|
2469
|
+
this.element = this.element.parent().data(
|
2470
|
+
"ui-resizable", this.element.data("ui-resizable")
|
2471
|
+
);
|
2472
|
+
|
2473
|
+
this.elementIsWrapper = true;
|
2474
|
+
|
2475
|
+
//Move margins to the wrapper
|
2476
|
+
this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
|
2477
|
+
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
2478
|
+
|
2479
|
+
//Prevent Safari textarea resize
|
2480
|
+
this.originalResizeStyle = this.originalElement.css("resize");
|
2481
|
+
this.originalElement.css("resize", "none");
|
2482
|
+
|
2483
|
+
//Push the actual element to our proportionallyResize internal array
|
2484
|
+
this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
|
2485
|
+
|
2486
|
+
// avoid IE jump (hard set the margin)
|
2487
|
+
this.originalElement.css({ margin: this.originalElement.css("margin") });
|
2488
|
+
|
2489
|
+
// fix handlers offset
|
2490
|
+
this._proportionallyResize();
|
2491
|
+
|
2492
|
+
}
|
2493
|
+
|
2494
|
+
this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
|
2495
|
+
if(this.handles.constructor === String) {
|
2496
|
+
|
2497
|
+
if ( this.handles === "all") {
|
2498
|
+
this.handles = "n,e,s,w,se,sw,ne,nw";
|
2499
|
+
}
|
2500
|
+
|
2501
|
+
n = this.handles.split(",");
|
2502
|
+
this.handles = {};
|
2503
|
+
|
2504
|
+
for(i = 0; i < n.length; i++) {
|
2505
|
+
|
2506
|
+
handle = $.trim(n[i]);
|
2507
|
+
hname = "ui-resizable-"+handle;
|
2508
|
+
axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
|
2509
|
+
|
2510
|
+
// Apply zIndex to all handles - see #7960
|
2511
|
+
axis.css({ zIndex: o.zIndex });
|
2512
|
+
|
2513
|
+
//TODO : What's going on here?
|
2514
|
+
if ("se" === handle) {
|
2515
|
+
axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
|
2516
|
+
}
|
2517
|
+
|
2518
|
+
//Insert into internal handles object and append to element
|
2519
|
+
this.handles[handle] = ".ui-resizable-"+handle;
|
2520
|
+
this.element.append(axis);
|
2521
|
+
}
|
2522
|
+
|
2523
|
+
}
|
2524
|
+
|
2525
|
+
this._renderAxis = function(target) {
|
2526
|
+
|
2527
|
+
var i, axis, padPos, padWrapper;
|
2528
|
+
|
2529
|
+
target = target || this.element;
|
2530
|
+
|
2531
|
+
for(i in this.handles) {
|
2532
|
+
|
2533
|
+
if(this.handles[i].constructor === String) {
|
2534
|
+
this.handles[i] = $(this.handles[i], this.element).show();
|
2535
|
+
}
|
2536
|
+
|
2537
|
+
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
|
2538
|
+
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
|
2539
|
+
|
2540
|
+
axis = $(this.handles[i], this.element);
|
2541
|
+
|
2542
|
+
//Checking the correct pad and border
|
2543
|
+
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
2544
|
+
|
2545
|
+
//The padding type i have to apply...
|
2546
|
+
padPos = [ "padding",
|
2547
|
+
/ne|nw|n/.test(i) ? "Top" :
|
2548
|
+
/se|sw|s/.test(i) ? "Bottom" :
|
2549
|
+
/^e$/.test(i) ? "Right" : "Left" ].join("");
|
2550
|
+
|
2551
|
+
target.css(padPos, padWrapper);
|
2552
|
+
|
2553
|
+
this._proportionallyResize();
|
2554
|
+
|
2555
|
+
}
|
2556
|
+
|
2557
|
+
//TODO: What's that good for? There's not anything to be executed left
|
2558
|
+
if(!$(this.handles[i]).length) {
|
2559
|
+
continue;
|
2560
|
+
}
|
2561
|
+
}
|
2562
|
+
};
|
2563
|
+
|
2564
|
+
//TODO: make renderAxis a prototype function
|
2565
|
+
this._renderAxis(this.element);
|
2566
|
+
|
2567
|
+
this._handles = $(".ui-resizable-handle", this.element)
|
2568
|
+
.disableSelection();
|
2569
|
+
|
2570
|
+
//Matching axis name
|
2571
|
+
this._handles.mouseover(function() {
|
2572
|
+
if (!that.resizing) {
|
2573
|
+
if (this.className) {
|
2574
|
+
axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
2575
|
+
}
|
2576
|
+
//Axis, default = se
|
2577
|
+
that.axis = axis && axis[1] ? axis[1] : "se";
|
2578
|
+
}
|
2579
|
+
});
|
2580
|
+
|
2581
|
+
//If we want to auto hide the elements
|
2582
|
+
if (o.autoHide) {
|
2583
|
+
this._handles.hide();
|
2584
|
+
$(this.element)
|
2585
|
+
.addClass("ui-resizable-autohide")
|
2586
|
+
.mouseenter(function() {
|
2587
|
+
if (o.disabled) {
|
2588
|
+
return;
|
2589
|
+
}
|
2590
|
+
$(this).removeClass("ui-resizable-autohide");
|
2591
|
+
that._handles.show();
|
2592
|
+
})
|
2593
|
+
.mouseleave(function(){
|
2594
|
+
if (o.disabled) {
|
2595
|
+
return;
|
2596
|
+
}
|
2597
|
+
if (!that.resizing) {
|
2598
|
+
$(this).addClass("ui-resizable-autohide");
|
2599
|
+
that._handles.hide();
|
2600
|
+
}
|
2601
|
+
});
|
2602
|
+
}
|
2603
|
+
|
2604
|
+
//Initialize the mouse interaction
|
2605
|
+
this._mouseInit();
|
2606
|
+
|
2607
|
+
},
|
2608
|
+
|
2609
|
+
_destroy: function() {
|
2610
|
+
|
2611
|
+
this._mouseDestroy();
|
2612
|
+
|
2613
|
+
var wrapper,
|
2614
|
+
_destroy = function(exp) {
|
2615
|
+
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
|
2616
|
+
.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
|
2617
|
+
};
|
2618
|
+
|
2619
|
+
//TODO: Unwrap at same DOM position
|
2620
|
+
if (this.elementIsWrapper) {
|
2621
|
+
_destroy(this.element);
|
2622
|
+
wrapper = this.element;
|
2623
|
+
this.originalElement.css({
|
2624
|
+
position: wrapper.css("position"),
|
2625
|
+
width: wrapper.outerWidth(),
|
2626
|
+
height: wrapper.outerHeight(),
|
2627
|
+
top: wrapper.css("top"),
|
2628
|
+
left: wrapper.css("left")
|
2629
|
+
}).insertAfter( wrapper );
|
2630
|
+
wrapper.remove();
|
2631
|
+
}
|
2632
|
+
|
2633
|
+
this.originalElement.css("resize", this.originalResizeStyle);
|
2634
|
+
_destroy(this.originalElement);
|
2635
|
+
|
2636
|
+
return this;
|
2637
|
+
},
|
2638
|
+
|
2639
|
+
_mouseCapture: function(event) {
|
2640
|
+
var i, handle,
|
2641
|
+
capture = false;
|
2642
|
+
|
2643
|
+
for (i in this.handles) {
|
2644
|
+
handle = $(this.handles[i])[0];
|
2645
|
+
if (handle === event.target || $.contains(handle, event.target)) {
|
2646
|
+
capture = true;
|
2647
|
+
}
|
2648
|
+
}
|
2649
|
+
|
2650
|
+
return !this.options.disabled && capture;
|
2651
|
+
},
|
2652
|
+
|
2653
|
+
_mouseStart: function(event) {
|
2654
|
+
|
2655
|
+
var curleft, curtop, cursor,
|
2656
|
+
o = this.options,
|
2657
|
+
iniPos = this.element.position(),
|
2658
|
+
el = this.element;
|
2659
|
+
|
2660
|
+
this.resizing = true;
|
2661
|
+
|
2662
|
+
// bugfix for http://dev.jquery.com/ticket/1749
|
2663
|
+
if ( (/absolute/).test( el.css("position") ) ) {
|
2664
|
+
el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
|
2665
|
+
} else if (el.is(".ui-draggable")) {
|
2666
|
+
el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
|
2667
|
+
}
|
2668
|
+
|
2669
|
+
this._renderProxy();
|
2670
|
+
|
2671
|
+
curleft = num(this.helper.css("left"));
|
2672
|
+
curtop = num(this.helper.css("top"));
|
2673
|
+
|
2674
|
+
if (o.containment) {
|
2675
|
+
curleft += $(o.containment).scrollLeft() || 0;
|
2676
|
+
curtop += $(o.containment).scrollTop() || 0;
|
2677
|
+
}
|
2678
|
+
|
2679
|
+
//Store needed variables
|
2680
|
+
this.offset = this.helper.offset();
|
2681
|
+
this.position = { left: curleft, top: curtop };
|
2682
|
+
this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
|
2683
|
+
this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
|
2684
|
+
this.originalPosition = { left: curleft, top: curtop };
|
2685
|
+
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
|
2686
|
+
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
2687
|
+
|
2688
|
+
//Aspect Ratio
|
2689
|
+
this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
|
2690
|
+
|
2691
|
+
cursor = $(".ui-resizable-" + this.axis).css("cursor");
|
2692
|
+
$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
|
2693
|
+
|
2694
|
+
el.addClass("ui-resizable-resizing");
|
2695
|
+
this._propagate("start", event);
|
2696
|
+
return true;
|
2697
|
+
},
|
2698
|
+
|
2699
|
+
_mouseDrag: function(event) {
|
2700
|
+
|
2701
|
+
//Increase performance, avoid regex
|
2702
|
+
var data,
|
2703
|
+
el = this.helper, props = {},
|
2704
|
+
smp = this.originalMousePosition,
|
2705
|
+
a = this.axis,
|
2706
|
+
prevTop = this.position.top,
|
2707
|
+
prevLeft = this.position.left,
|
2708
|
+
prevWidth = this.size.width,
|
2709
|
+
prevHeight = this.size.height,
|
2710
|
+
dx = (event.pageX-smp.left)||0,
|
2711
|
+
dy = (event.pageY-smp.top)||0,
|
2712
|
+
trigger = this._change[a];
|
2713
|
+
|
2714
|
+
if (!trigger) {
|
2715
|
+
return false;
|
2716
|
+
}
|
2717
|
+
|
2718
|
+
// Calculate the attrs that will be change
|
2719
|
+
data = trigger.apply(this, [event, dx, dy]);
|
2720
|
+
|
2721
|
+
// Put this in the mouseDrag handler since the user can start pressing shift while resizing
|
2722
|
+
this._updateVirtualBoundaries(event.shiftKey);
|
2723
|
+
if (this._aspectRatio || event.shiftKey) {
|
2724
|
+
data = this._updateRatio(data, event);
|
2725
|
+
}
|
2726
|
+
|
2727
|
+
data = this._respectSize(data, event);
|
2728
|
+
|
2729
|
+
this._updateCache(data);
|
2730
|
+
|
2731
|
+
// plugins callbacks need to be called first
|
2732
|
+
this._propagate("resize", event);
|
2733
|
+
|
2734
|
+
if (this.position.top !== prevTop) {
|
2735
|
+
props.top = this.position.top + "px";
|
2736
|
+
}
|
2737
|
+
if (this.position.left !== prevLeft) {
|
2738
|
+
props.left = this.position.left + "px";
|
2739
|
+
}
|
2740
|
+
if (this.size.width !== prevWidth) {
|
2741
|
+
props.width = this.size.width + "px";
|
2742
|
+
}
|
2743
|
+
if (this.size.height !== prevHeight) {
|
2744
|
+
props.height = this.size.height + "px";
|
2745
|
+
}
|
2746
|
+
el.css(props);
|
2747
|
+
|
2748
|
+
if (!this._helper && this._proportionallyResizeElements.length) {
|
2749
|
+
this._proportionallyResize();
|
2750
|
+
}
|
2751
|
+
|
2752
|
+
// Call the user callback if the element was resized
|
2753
|
+
if ( ! $.isEmptyObject(props) ) {
|
2754
|
+
this._trigger("resize", event, this.ui());
|
2755
|
+
}
|
2756
|
+
|
2757
|
+
return false;
|
2758
|
+
},
|
2759
|
+
|
2760
|
+
_mouseStop: function(event) {
|
2761
|
+
|
2762
|
+
this.resizing = false;
|
2763
|
+
var pr, ista, soffseth, soffsetw, s, left, top,
|
2764
|
+
o = this.options, that = this;
|
2765
|
+
|
2766
|
+
if(this._helper) {
|
2767
|
+
|
2768
|
+
pr = this._proportionallyResizeElements;
|
2769
|
+
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
|
2770
|
+
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
|
2771
|
+
soffsetw = ista ? 0 : that.sizeDiff.width;
|
2772
|
+
|
2773
|
+
s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
|
2774
|
+
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
|
2775
|
+
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
|
2776
|
+
|
2777
|
+
if (!o.animate) {
|
2778
|
+
this.element.css($.extend(s, { top: top, left: left }));
|
2779
|
+
}
|
2780
|
+
|
2781
|
+
that.helper.height(that.size.height);
|
2782
|
+
that.helper.width(that.size.width);
|
2783
|
+
|
2784
|
+
if (this._helper && !o.animate) {
|
2785
|
+
this._proportionallyResize();
|
2786
|
+
}
|
2787
|
+
}
|
2788
|
+
|
2789
|
+
$("body").css("cursor", "auto");
|
2790
|
+
|
2791
|
+
this.element.removeClass("ui-resizable-resizing");
|
2792
|
+
|
2793
|
+
this._propagate("stop", event);
|
2794
|
+
|
2795
|
+
if (this._helper) {
|
2796
|
+
this.helper.remove();
|
2797
|
+
}
|
2798
|
+
|
2799
|
+
return false;
|
2800
|
+
|
2801
|
+
},
|
2802
|
+
|
2803
|
+
_updateVirtualBoundaries: function(forceAspectRatio) {
|
2804
|
+
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
|
2805
|
+
o = this.options;
|
2806
|
+
|
2807
|
+
b = {
|
2808
|
+
minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
|
2809
|
+
maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
|
2810
|
+
minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
|
2811
|
+
maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
|
2812
|
+
};
|
2813
|
+
|
2814
|
+
if(this._aspectRatio || forceAspectRatio) {
|
2815
|
+
// We want to create an enclosing box whose aspect ration is the requested one
|
2816
|
+
// First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
|
2817
|
+
pMinWidth = b.minHeight * this.aspectRatio;
|
2818
|
+
pMinHeight = b.minWidth / this.aspectRatio;
|
2819
|
+
pMaxWidth = b.maxHeight * this.aspectRatio;
|
2820
|
+
pMaxHeight = b.maxWidth / this.aspectRatio;
|
2821
|
+
|
2822
|
+
if(pMinWidth > b.minWidth) {
|
2823
|
+
b.minWidth = pMinWidth;
|
2824
|
+
}
|
2825
|
+
if(pMinHeight > b.minHeight) {
|
2826
|
+
b.minHeight = pMinHeight;
|
2827
|
+
}
|
2828
|
+
if(pMaxWidth < b.maxWidth) {
|
2829
|
+
b.maxWidth = pMaxWidth;
|
2830
|
+
}
|
2831
|
+
if(pMaxHeight < b.maxHeight) {
|
2832
|
+
b.maxHeight = pMaxHeight;
|
2833
|
+
}
|
2834
|
+
}
|
2835
|
+
this._vBoundaries = b;
|
2836
|
+
},
|
2837
|
+
|
2838
|
+
_updateCache: function(data) {
|
2839
|
+
this.offset = this.helper.offset();
|
2840
|
+
if (isNumber(data.left)) {
|
2841
|
+
this.position.left = data.left;
|
2842
|
+
}
|
2843
|
+
if (isNumber(data.top)) {
|
2844
|
+
this.position.top = data.top;
|
2845
|
+
}
|
2846
|
+
if (isNumber(data.height)) {
|
2847
|
+
this.size.height = data.height;
|
2848
|
+
}
|
2849
|
+
if (isNumber(data.width)) {
|
2850
|
+
this.size.width = data.width;
|
2851
|
+
}
|
2852
|
+
},
|
2853
|
+
|
2854
|
+
_updateRatio: function( data ) {
|
2855
|
+
|
2856
|
+
var cpos = this.position,
|
2857
|
+
csize = this.size,
|
2858
|
+
a = this.axis;
|
2859
|
+
|
2860
|
+
if (isNumber(data.height)) {
|
2861
|
+
data.width = (data.height * this.aspectRatio);
|
2862
|
+
} else if (isNumber(data.width)) {
|
2863
|
+
data.height = (data.width / this.aspectRatio);
|
2864
|
+
}
|
2865
|
+
|
2866
|
+
if (a === "sw") {
|
2867
|
+
data.left = cpos.left + (csize.width - data.width);
|
2868
|
+
data.top = null;
|
2869
|
+
}
|
2870
|
+
if (a === "nw") {
|
2871
|
+
data.top = cpos.top + (csize.height - data.height);
|
2872
|
+
data.left = cpos.left + (csize.width - data.width);
|
2873
|
+
}
|
2874
|
+
|
2875
|
+
return data;
|
2876
|
+
},
|
2877
|
+
|
2878
|
+
_respectSize: function( data ) {
|
2879
|
+
|
2880
|
+
var o = this._vBoundaries,
|
2881
|
+
a = this.axis,
|
2882
|
+
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
|
2883
|
+
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
|
2884
|
+
dw = this.originalPosition.left + this.originalSize.width,
|
2885
|
+
dh = this.position.top + this.size.height,
|
2886
|
+
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
|
2887
|
+
if (isminw) {
|
2888
|
+
data.width = o.minWidth;
|
2889
|
+
}
|
2890
|
+
if (isminh) {
|
2891
|
+
data.height = o.minHeight;
|
2892
|
+
}
|
2893
|
+
if (ismaxw) {
|
2894
|
+
data.width = o.maxWidth;
|
2895
|
+
}
|
2896
|
+
if (ismaxh) {
|
2897
|
+
data.height = o.maxHeight;
|
2898
|
+
}
|
2899
|
+
|
2900
|
+
if (isminw && cw) {
|
2901
|
+
data.left = dw - o.minWidth;
|
2902
|
+
}
|
2903
|
+
if (ismaxw && cw) {
|
2904
|
+
data.left = dw - o.maxWidth;
|
2905
|
+
}
|
2906
|
+
if (isminh && ch) {
|
2907
|
+
data.top = dh - o.minHeight;
|
2908
|
+
}
|
2909
|
+
if (ismaxh && ch) {
|
2910
|
+
data.top = dh - o.maxHeight;
|
2911
|
+
}
|
2912
|
+
|
2913
|
+
// fixing jump error on top/left - bug #2330
|
2914
|
+
if (!data.width && !data.height && !data.left && data.top) {
|
2915
|
+
data.top = null;
|
2916
|
+
} else if (!data.width && !data.height && !data.top && data.left) {
|
2917
|
+
data.left = null;
|
2918
|
+
}
|
2919
|
+
|
2920
|
+
return data;
|
2921
|
+
},
|
2922
|
+
|
2923
|
+
_proportionallyResize: function() {
|
2924
|
+
|
2925
|
+
if (!this._proportionallyResizeElements.length) {
|
2926
|
+
return;
|
2927
|
+
}
|
2928
|
+
|
2929
|
+
var i, j, borders, paddings, prel,
|
2930
|
+
element = this.helper || this.element;
|
2931
|
+
|
2932
|
+
for ( i=0; i < this._proportionallyResizeElements.length; i++) {
|
2933
|
+
|
2934
|
+
prel = this._proportionallyResizeElements[i];
|
2935
|
+
|
2936
|
+
if (!this.borderDif) {
|
2937
|
+
this.borderDif = [];
|
2938
|
+
borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
|
2939
|
+
paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
|
2940
|
+
|
2941
|
+
for ( j = 0; j < borders.length; j++ ) {
|
2942
|
+
this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
|
2943
|
+
}
|
2944
|
+
}
|
2945
|
+
|
2946
|
+
prel.css({
|
2947
|
+
height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
|
2948
|
+
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
|
2949
|
+
});
|
2950
|
+
|
2951
|
+
}
|
2952
|
+
|
2953
|
+
},
|
2954
|
+
|
2955
|
+
_renderProxy: function() {
|
2956
|
+
|
2957
|
+
var el = this.element, o = this.options;
|
2958
|
+
this.elementOffset = el.offset();
|
2959
|
+
|
2960
|
+
if(this._helper) {
|
2961
|
+
|
2962
|
+
this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
|
2963
|
+
|
2964
|
+
this.helper.addClass(this._helper).css({
|
2965
|
+
width: this.element.outerWidth() - 1,
|
2966
|
+
height: this.element.outerHeight() - 1,
|
2967
|
+
position: "absolute",
|
2968
|
+
left: this.elementOffset.left +"px",
|
2969
|
+
top: this.elementOffset.top +"px",
|
2970
|
+
zIndex: ++o.zIndex //TODO: Don't modify option
|
2971
|
+
});
|
2972
|
+
|
2973
|
+
this.helper
|
2974
|
+
.appendTo("body")
|
2975
|
+
.disableSelection();
|
2976
|
+
|
2977
|
+
} else {
|
2978
|
+
this.helper = this.element;
|
2979
|
+
}
|
2980
|
+
|
2981
|
+
},
|
2982
|
+
|
2983
|
+
_change: {
|
2984
|
+
e: function(event, dx) {
|
2985
|
+
return { width: this.originalSize.width + dx };
|
2986
|
+
},
|
2987
|
+
w: function(event, dx) {
|
2988
|
+
var cs = this.originalSize, sp = this.originalPosition;
|
2989
|
+
return { left: sp.left + dx, width: cs.width - dx };
|
2990
|
+
},
|
2991
|
+
n: function(event, dx, dy) {
|
2992
|
+
var cs = this.originalSize, sp = this.originalPosition;
|
2993
|
+
return { top: sp.top + dy, height: cs.height - dy };
|
2994
|
+
},
|
2995
|
+
s: function(event, dx, dy) {
|
2996
|
+
return { height: this.originalSize.height + dy };
|
2997
|
+
},
|
2998
|
+
se: function(event, dx, dy) {
|
2999
|
+
return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
|
3000
|
+
},
|
3001
|
+
sw: function(event, dx, dy) {
|
3002
|
+
return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
|
3003
|
+
},
|
3004
|
+
ne: function(event, dx, dy) {
|
3005
|
+
return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
|
3006
|
+
},
|
3007
|
+
nw: function(event, dx, dy) {
|
3008
|
+
return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
|
3009
|
+
}
|
3010
|
+
},
|
3011
|
+
|
3012
|
+
_propagate: function(n, event) {
|
3013
|
+
$.ui.plugin.call(this, n, [event, this.ui()]);
|
3014
|
+
(n !== "resize" && this._trigger(n, event, this.ui()));
|
3015
|
+
},
|
3016
|
+
|
3017
|
+
plugins: {},
|
3018
|
+
|
3019
|
+
ui: function() {
|
3020
|
+
return {
|
3021
|
+
originalElement: this.originalElement,
|
3022
|
+
element: this.element,
|
3023
|
+
helper: this.helper,
|
3024
|
+
position: this.position,
|
3025
|
+
size: this.size,
|
3026
|
+
originalSize: this.originalSize,
|
3027
|
+
originalPosition: this.originalPosition
|
3028
|
+
};
|
3029
|
+
}
|
3030
|
+
|
3031
|
+
});
|
3032
|
+
|
3033
|
+
/*
|
3034
|
+
* Resizable Extensions
|
3035
|
+
*/
|
3036
|
+
|
3037
|
+
$.ui.plugin.add("resizable", "animate", {
|
3038
|
+
|
3039
|
+
stop: function( event ) {
|
3040
|
+
var that = $(this).data("ui-resizable"),
|
3041
|
+
o = that.options,
|
3042
|
+
pr = that._proportionallyResizeElements,
|
3043
|
+
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
3044
|
+
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
|
3045
|
+
soffsetw = ista ? 0 : that.sizeDiff.width,
|
3046
|
+
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
|
3047
|
+
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
|
3048
|
+
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
|
3049
|
+
|
3050
|
+
that.element.animate(
|
3051
|
+
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
3052
|
+
duration: o.animateDuration,
|
3053
|
+
easing: o.animateEasing,
|
3054
|
+
step: function() {
|
3055
|
+
|
3056
|
+
var data = {
|
3057
|
+
width: parseInt(that.element.css("width"), 10),
|
3058
|
+
height: parseInt(that.element.css("height"), 10),
|
3059
|
+
top: parseInt(that.element.css("top"), 10),
|
3060
|
+
left: parseInt(that.element.css("left"), 10)
|
3061
|
+
};
|
3062
|
+
|
3063
|
+
if (pr && pr.length) {
|
3064
|
+
$(pr[0]).css({ width: data.width, height: data.height });
|
3065
|
+
}
|
3066
|
+
|
3067
|
+
// propagating resize, and updating values for each animation step
|
3068
|
+
that._updateCache(data);
|
3069
|
+
that._propagate("resize", event);
|
3070
|
+
|
3071
|
+
}
|
3072
|
+
}
|
3073
|
+
);
|
3074
|
+
}
|
3075
|
+
|
3076
|
+
});
|
3077
|
+
|
3078
|
+
$.ui.plugin.add("resizable", "containment", {
|
3079
|
+
|
3080
|
+
start: function() {
|
3081
|
+
var element, p, co, ch, cw, width, height,
|
3082
|
+
that = $(this).data("ui-resizable"),
|
3083
|
+
o = that.options,
|
3084
|
+
el = that.element,
|
3085
|
+
oc = o.containment,
|
3086
|
+
ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
|
3087
|
+
|
3088
|
+
if (!ce) {
|
3089
|
+
return;
|
3090
|
+
}
|
3091
|
+
|
3092
|
+
that.containerElement = $(ce);
|
3093
|
+
|
3094
|
+
if (/document/.test(oc) || oc === document) {
|
3095
|
+
that.containerOffset = { left: 0, top: 0 };
|
3096
|
+
that.containerPosition = { left: 0, top: 0 };
|
3097
|
+
|
3098
|
+
that.parentData = {
|
3099
|
+
element: $(document), left: 0, top: 0,
|
3100
|
+
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
|
3101
|
+
};
|
3102
|
+
}
|
3103
|
+
|
3104
|
+
// i'm a node, so compute top, left, right, bottom
|
3105
|
+
else {
|
3106
|
+
element = $(ce);
|
3107
|
+
p = [];
|
3108
|
+
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
|
3109
|
+
|
3110
|
+
that.containerOffset = element.offset();
|
3111
|
+
that.containerPosition = element.position();
|
3112
|
+
that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
|
3113
|
+
|
3114
|
+
co = that.containerOffset;
|
3115
|
+
ch = that.containerSize.height;
|
3116
|
+
cw = that.containerSize.width;
|
3117
|
+
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
|
3118
|
+
height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
|
3119
|
+
|
3120
|
+
that.parentData = {
|
3121
|
+
element: ce, left: co.left, top: co.top, width: width, height: height
|
3122
|
+
};
|
3123
|
+
}
|
3124
|
+
},
|
3125
|
+
|
3126
|
+
resize: function( event ) {
|
3127
|
+
var woset, hoset, isParent, isOffsetRelative,
|
3128
|
+
that = $(this).data("ui-resizable"),
|
3129
|
+
o = that.options,
|
3130
|
+
co = that.containerOffset, cp = that.position,
|
3131
|
+
pRatio = that._aspectRatio || event.shiftKey,
|
3132
|
+
cop = { top:0, left:0 }, ce = that.containerElement;
|
3133
|
+
|
3134
|
+
if (ce[0] !== document && (/static/).test(ce.css("position"))) {
|
3135
|
+
cop = co;
|
3136
|
+
}
|
3137
|
+
|
3138
|
+
if (cp.left < (that._helper ? co.left : 0)) {
|
3139
|
+
that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
|
3140
|
+
if (pRatio) {
|
3141
|
+
that.size.height = that.size.width / that.aspectRatio;
|
3142
|
+
}
|
3143
|
+
that.position.left = o.helper ? co.left : 0;
|
3144
|
+
}
|
3145
|
+
|
3146
|
+
if (cp.top < (that._helper ? co.top : 0)) {
|
3147
|
+
that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
|
3148
|
+
if (pRatio) {
|
3149
|
+
that.size.width = that.size.height * that.aspectRatio;
|
3150
|
+
}
|
3151
|
+
that.position.top = that._helper ? co.top : 0;
|
3152
|
+
}
|
3153
|
+
|
3154
|
+
that.offset.left = that.parentData.left+that.position.left;
|
3155
|
+
that.offset.top = that.parentData.top+that.position.top;
|
3156
|
+
|
3157
|
+
woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );
|
3158
|
+
hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
|
3159
|
+
|
3160
|
+
isParent = that.containerElement.get(0) === that.element.parent().get(0);
|
3161
|
+
isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
|
3162
|
+
|
3163
|
+
if(isParent && isOffsetRelative) {
|
3164
|
+
woset -= that.parentData.left;
|
3165
|
+
}
|
3166
|
+
|
3167
|
+
if (woset + that.size.width >= that.parentData.width) {
|
3168
|
+
that.size.width = that.parentData.width - woset;
|
3169
|
+
if (pRatio) {
|
3170
|
+
that.size.height = that.size.width / that.aspectRatio;
|
3171
|
+
}
|
3172
|
+
}
|
3173
|
+
|
3174
|
+
if (hoset + that.size.height >= that.parentData.height) {
|
3175
|
+
that.size.height = that.parentData.height - hoset;
|
3176
|
+
if (pRatio) {
|
3177
|
+
that.size.width = that.size.height * that.aspectRatio;
|
3178
|
+
}
|
3179
|
+
}
|
3180
|
+
},
|
3181
|
+
|
3182
|
+
stop: function(){
|
3183
|
+
var that = $(this).data("ui-resizable"),
|
3184
|
+
o = that.options,
|
3185
|
+
co = that.containerOffset,
|
3186
|
+
cop = that.containerPosition,
|
3187
|
+
ce = that.containerElement,
|
3188
|
+
helper = $(that.helper),
|
3189
|
+
ho = helper.offset(),
|
3190
|
+
w = helper.outerWidth() - that.sizeDiff.width,
|
3191
|
+
h = helper.outerHeight() - that.sizeDiff.height;
|
3192
|
+
|
3193
|
+
if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
|
3194
|
+
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
3195
|
+
}
|
3196
|
+
|
3197
|
+
if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
|
3198
|
+
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
3199
|
+
}
|
3200
|
+
|
3201
|
+
}
|
3202
|
+
});
|
3203
|
+
|
3204
|
+
$.ui.plugin.add("resizable", "alsoResize", {
|
3205
|
+
|
3206
|
+
start: function () {
|
3207
|
+
var that = $(this).data("ui-resizable"),
|
3208
|
+
o = that.options,
|
3209
|
+
_store = function (exp) {
|
3210
|
+
$(exp).each(function() {
|
3211
|
+
var el = $(this);
|
3212
|
+
el.data("ui-resizable-alsoresize", {
|
3213
|
+
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
3214
|
+
left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
|
3215
|
+
});
|
3216
|
+
});
|
3217
|
+
};
|
3218
|
+
|
3219
|
+
if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
|
3220
|
+
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
3221
|
+
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
3222
|
+
}else{
|
3223
|
+
_store(o.alsoResize);
|
3224
|
+
}
|
3225
|
+
},
|
3226
|
+
|
3227
|
+
resize: function (event, ui) {
|
3228
|
+
var that = $(this).data("ui-resizable"),
|
3229
|
+
o = that.options,
|
3230
|
+
os = that.originalSize,
|
3231
|
+
op = that.originalPosition,
|
3232
|
+
delta = {
|
3233
|
+
height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
|
3234
|
+
top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
|
3235
|
+
},
|
3236
|
+
|
3237
|
+
_alsoResize = function (exp, c) {
|
3238
|
+
$(exp).each(function() {
|
3239
|
+
var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
|
3240
|
+
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
|
3241
|
+
|
3242
|
+
$.each(css, function (i, prop) {
|
3243
|
+
var sum = (start[prop]||0) + (delta[prop]||0);
|
3244
|
+
if (sum && sum >= 0) {
|
3245
|
+
style[prop] = sum || null;
|
3246
|
+
}
|
3247
|
+
});
|
3248
|
+
|
3249
|
+
el.css(style);
|
3250
|
+
});
|
3251
|
+
};
|
3252
|
+
|
3253
|
+
if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
|
3254
|
+
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
3255
|
+
}else{
|
3256
|
+
_alsoResize(o.alsoResize);
|
3257
|
+
}
|
3258
|
+
},
|
3259
|
+
|
3260
|
+
stop: function () {
|
3261
|
+
$(this).removeData("resizable-alsoresize");
|
3262
|
+
}
|
3263
|
+
});
|
3264
|
+
|
3265
|
+
$.ui.plugin.add("resizable", "ghost", {
|
3266
|
+
|
3267
|
+
start: function() {
|
3268
|
+
|
3269
|
+
var that = $(this).data("ui-resizable"), o = that.options, cs = that.size;
|
3270
|
+
|
3271
|
+
that.ghost = that.originalElement.clone();
|
3272
|
+
that.ghost
|
3273
|
+
.css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
|
3274
|
+
.addClass("ui-resizable-ghost")
|
3275
|
+
.addClass(typeof o.ghost === "string" ? o.ghost : "");
|
3276
|
+
|
3277
|
+
that.ghost.appendTo(that.helper);
|
3278
|
+
|
3279
|
+
},
|
3280
|
+
|
3281
|
+
resize: function(){
|
3282
|
+
var that = $(this).data("ui-resizable");
|
3283
|
+
if (that.ghost) {
|
3284
|
+
that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
|
3285
|
+
}
|
3286
|
+
},
|
3287
|
+
|
3288
|
+
stop: function() {
|
3289
|
+
var that = $(this).data("ui-resizable");
|
3290
|
+
if (that.ghost && that.helper) {
|
3291
|
+
that.helper.get(0).removeChild(that.ghost.get(0));
|
3292
|
+
}
|
3293
|
+
}
|
3294
|
+
|
3295
|
+
});
|
3296
|
+
|
3297
|
+
$.ui.plugin.add("resizable", "grid", {
|
3298
|
+
|
3299
|
+
resize: function() {
|
3300
|
+
var that = $(this).data("ui-resizable"),
|
3301
|
+
o = that.options,
|
3302
|
+
cs = that.size,
|
3303
|
+
os = that.originalSize,
|
3304
|
+
op = that.originalPosition,
|
3305
|
+
a = that.axis,
|
3306
|
+
grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
|
3307
|
+
gridX = (grid[0]||1),
|
3308
|
+
gridY = (grid[1]||1),
|
3309
|
+
ox = Math.round((cs.width - os.width) / gridX) * gridX,
|
3310
|
+
oy = Math.round((cs.height - os.height) / gridY) * gridY,
|
3311
|
+
newWidth = os.width + ox,
|
3312
|
+
newHeight = os.height + oy,
|
3313
|
+
isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
|
3314
|
+
isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
|
3315
|
+
isMinWidth = o.minWidth && (o.minWidth > newWidth),
|
3316
|
+
isMinHeight = o.minHeight && (o.minHeight > newHeight);
|
3317
|
+
|
3318
|
+
o.grid = grid;
|
3319
|
+
|
3320
|
+
if (isMinWidth) {
|
3321
|
+
newWidth = newWidth + gridX;
|
3322
|
+
}
|
3323
|
+
if (isMinHeight) {
|
3324
|
+
newHeight = newHeight + gridY;
|
3325
|
+
}
|
3326
|
+
if (isMaxWidth) {
|
3327
|
+
newWidth = newWidth - gridX;
|
3328
|
+
}
|
3329
|
+
if (isMaxHeight) {
|
3330
|
+
newHeight = newHeight - gridY;
|
3331
|
+
}
|
3332
|
+
|
3333
|
+
if (/^(se|s|e)$/.test(a)) {
|
3334
|
+
that.size.width = newWidth;
|
3335
|
+
that.size.height = newHeight;
|
3336
|
+
} else if (/^(ne)$/.test(a)) {
|
3337
|
+
that.size.width = newWidth;
|
3338
|
+
that.size.height = newHeight;
|
3339
|
+
that.position.top = op.top - oy;
|
3340
|
+
} else if (/^(sw)$/.test(a)) {
|
3341
|
+
that.size.width = newWidth;
|
3342
|
+
that.size.height = newHeight;
|
3343
|
+
that.position.left = op.left - ox;
|
3344
|
+
} else {
|
3345
|
+
that.size.width = newWidth;
|
3346
|
+
that.size.height = newHeight;
|
3347
|
+
that.position.top = op.top - oy;
|
3348
|
+
that.position.left = op.left - ox;
|
3349
|
+
}
|
3350
|
+
}
|
3351
|
+
|
3352
|
+
});
|
3353
|
+
|
3354
|
+
})(jQuery);
|
3355
|
+
(function( $, undefined ) {
|
3356
|
+
|
3357
|
+
var lastActive, startXPos, startYPos, clickDragged,
|
3358
|
+
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
|
3359
|
+
stateClasses = "ui-state-hover ui-state-active ",
|
3360
|
+
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
|
3361
|
+
formResetHandler = function() {
|
3362
|
+
var buttons = $( this ).find( ":ui-button" );
|
3363
|
+
setTimeout(function() {
|
3364
|
+
buttons.button( "refresh" );
|
3365
|
+
}, 1 );
|
3366
|
+
},
|
3367
|
+
radioGroup = function( radio ) {
|
3368
|
+
var name = radio.name,
|
3369
|
+
form = radio.form,
|
3370
|
+
radios = $( [] );
|
3371
|
+
if ( name ) {
|
3372
|
+
name = name.replace( /'/g, "\\'" );
|
3373
|
+
if ( form ) {
|
3374
|
+
radios = $( form ).find( "[name='" + name + "']" );
|
3375
|
+
} else {
|
3376
|
+
radios = $( "[name='" + name + "']", radio.ownerDocument )
|
3377
|
+
.filter(function() {
|
3378
|
+
return !this.form;
|
3379
|
+
});
|
3380
|
+
}
|
3381
|
+
}
|
3382
|
+
return radios;
|
3383
|
+
};
|
3384
|
+
|
3385
|
+
$.widget( "ui.button", {
|
3386
|
+
version: "1.10.1",
|
3387
|
+
defaultElement: "<button>",
|
3388
|
+
options: {
|
3389
|
+
disabled: null,
|
3390
|
+
text: true,
|
3391
|
+
label: null,
|
3392
|
+
icons: {
|
3393
|
+
primary: null,
|
3394
|
+
secondary: null
|
3395
|
+
}
|
3396
|
+
},
|
3397
|
+
_create: function() {
|
3398
|
+
this.element.closest( "form" )
|
3399
|
+
.unbind( "reset" + this.eventNamespace )
|
3400
|
+
.bind( "reset" + this.eventNamespace, formResetHandler );
|
3401
|
+
|
3402
|
+
if ( typeof this.options.disabled !== "boolean" ) {
|
3403
|
+
this.options.disabled = !!this.element.prop( "disabled" );
|
3404
|
+
} else {
|
3405
|
+
this.element.prop( "disabled", this.options.disabled );
|
3406
|
+
}
|
3407
|
+
|
3408
|
+
this._determineButtonType();
|
3409
|
+
this.hasTitle = !!this.buttonElement.attr( "title" );
|
3410
|
+
|
3411
|
+
var that = this,
|
3412
|
+
options = this.options,
|
3413
|
+
toggleButton = this.type === "checkbox" || this.type === "radio",
|
3414
|
+
activeClass = !toggleButton ? "ui-state-active" : "",
|
3415
|
+
focusClass = "ui-state-focus";
|
3416
|
+
|
3417
|
+
if ( options.label === null ) {
|
3418
|
+
options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
|
3419
|
+
}
|
3420
|
+
|
3421
|
+
this._hoverable( this.buttonElement );
|
3422
|
+
|
3423
|
+
this.buttonElement
|
3424
|
+
.addClass( baseClasses )
|
3425
|
+
.attr( "role", "button" )
|
3426
|
+
.bind( "mouseenter" + this.eventNamespace, function() {
|
3427
|
+
if ( options.disabled ) {
|
3428
|
+
return;
|
3429
|
+
}
|
3430
|
+
if ( this === lastActive ) {
|
3431
|
+
$( this ).addClass( "ui-state-active" );
|
3432
|
+
}
|
3433
|
+
})
|
3434
|
+
.bind( "mouseleave" + this.eventNamespace, function() {
|
3435
|
+
if ( options.disabled ) {
|
3436
|
+
return;
|
3437
|
+
}
|
3438
|
+
$( this ).removeClass( activeClass );
|
3439
|
+
})
|
3440
|
+
.bind( "click" + this.eventNamespace, function( event ) {
|
3441
|
+
if ( options.disabled ) {
|
3442
|
+
event.preventDefault();
|
3443
|
+
event.stopImmediatePropagation();
|
3444
|
+
}
|
3445
|
+
});
|
3446
|
+
|
3447
|
+
this.element
|
3448
|
+
.bind( "focus" + this.eventNamespace, function() {
|
3449
|
+
// no need to check disabled, focus won't be triggered anyway
|
3450
|
+
that.buttonElement.addClass( focusClass );
|
3451
|
+
})
|
3452
|
+
.bind( "blur" + this.eventNamespace, function() {
|
3453
|
+
that.buttonElement.removeClass( focusClass );
|
3454
|
+
});
|
3455
|
+
|
3456
|
+
if ( toggleButton ) {
|
3457
|
+
this.element.bind( "change" + this.eventNamespace, function() {
|
3458
|
+
if ( clickDragged ) {
|
3459
|
+
return;
|
3460
|
+
}
|
3461
|
+
that.refresh();
|
3462
|
+
});
|
3463
|
+
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
|
3464
|
+
// prevents issue where button state changes but checkbox/radio checked state
|
3465
|
+
// does not in Firefox (see ticket #6970)
|
3466
|
+
this.buttonElement
|
3467
|
+
.bind( "mousedown" + this.eventNamespace, function( event ) {
|
3468
|
+
if ( options.disabled ) {
|
3469
|
+
return;
|
3470
|
+
}
|
3471
|
+
clickDragged = false;
|
3472
|
+
startXPos = event.pageX;
|
3473
|
+
startYPos = event.pageY;
|
3474
|
+
})
|
3475
|
+
.bind( "mouseup" + this.eventNamespace, function( event ) {
|
3476
|
+
if ( options.disabled ) {
|
3477
|
+
return;
|
3478
|
+
}
|
3479
|
+
if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
|
3480
|
+
clickDragged = true;
|
3481
|
+
}
|
3482
|
+
});
|
3483
|
+
}
|
3484
|
+
|
3485
|
+
if ( this.type === "checkbox" ) {
|
3486
|
+
this.buttonElement.bind( "click" + this.eventNamespace, function() {
|
3487
|
+
if ( options.disabled || clickDragged ) {
|
3488
|
+
return false;
|
3489
|
+
}
|
3490
|
+
});
|
3491
|
+
} else if ( this.type === "radio" ) {
|
3492
|
+
this.buttonElement.bind( "click" + this.eventNamespace, function() {
|
3493
|
+
if ( options.disabled || clickDragged ) {
|
3494
|
+
return false;
|
3495
|
+
}
|
3496
|
+
$( this ).addClass( "ui-state-active" );
|
3497
|
+
that.buttonElement.attr( "aria-pressed", "true" );
|
3498
|
+
|
3499
|
+
var radio = that.element[ 0 ];
|
3500
|
+
radioGroup( radio )
|
3501
|
+
.not( radio )
|
3502
|
+
.map(function() {
|
3503
|
+
return $( this ).button( "widget" )[ 0 ];
|
3504
|
+
})
|
3505
|
+
.removeClass( "ui-state-active" )
|
3506
|
+
.attr( "aria-pressed", "false" );
|
3507
|
+
});
|
3508
|
+
} else {
|
3509
|
+
this.buttonElement
|
3510
|
+
.bind( "mousedown" + this.eventNamespace, function() {
|
3511
|
+
if ( options.disabled ) {
|
3512
|
+
return false;
|
3513
|
+
}
|
3514
|
+
$( this ).addClass( "ui-state-active" );
|
3515
|
+
lastActive = this;
|
3516
|
+
that.document.one( "mouseup", function() {
|
3517
|
+
lastActive = null;
|
3518
|
+
});
|
3519
|
+
})
|
3520
|
+
.bind( "mouseup" + this.eventNamespace, function() {
|
3521
|
+
if ( options.disabled ) {
|
3522
|
+
return false;
|
3523
|
+
}
|
3524
|
+
$( this ).removeClass( "ui-state-active" );
|
3525
|
+
})
|
3526
|
+
.bind( "keydown" + this.eventNamespace, function(event) {
|
3527
|
+
if ( options.disabled ) {
|
3528
|
+
return false;
|
3529
|
+
}
|
3530
|
+
if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
|
3531
|
+
$( this ).addClass( "ui-state-active" );
|
3532
|
+
}
|
3533
|
+
})
|
3534
|
+
// see #8559, we bind to blur here in case the button element loses
|
3535
|
+
// focus between keydown and keyup, it would be left in an "active" state
|
3536
|
+
.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
|
3537
|
+
$( this ).removeClass( "ui-state-active" );
|
3538
|
+
});
|
3539
|
+
|
3540
|
+
if ( this.buttonElement.is("a") ) {
|
3541
|
+
this.buttonElement.keyup(function(event) {
|
3542
|
+
if ( event.keyCode === $.ui.keyCode.SPACE ) {
|
3543
|
+
// TODO pass through original event correctly (just as 2nd argument doesn't work)
|
3544
|
+
$( this ).click();
|
3545
|
+
}
|
3546
|
+
});
|
3547
|
+
}
|
3548
|
+
}
|
3549
|
+
|
3550
|
+
// TODO: pull out $.Widget's handling for the disabled option into
|
3551
|
+
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
|
3552
|
+
// be overridden by individual plugins
|
3553
|
+
this._setOption( "disabled", options.disabled );
|
3554
|
+
this._resetButton();
|
3555
|
+
},
|
3556
|
+
|
3557
|
+
_determineButtonType: function() {
|
3558
|
+
var ancestor, labelSelector, checked;
|
3559
|
+
|
3560
|
+
if ( this.element.is("[type=checkbox]") ) {
|
3561
|
+
this.type = "checkbox";
|
3562
|
+
} else if ( this.element.is("[type=radio]") ) {
|
3563
|
+
this.type = "radio";
|
3564
|
+
} else if ( this.element.is("input") ) {
|
3565
|
+
this.type = "input";
|
3566
|
+
} else {
|
3567
|
+
this.type = "button";
|
3568
|
+
}
|
3569
|
+
|
3570
|
+
if ( this.type === "checkbox" || this.type === "radio" ) {
|
3571
|
+
// we don't search against the document in case the element
|
3572
|
+
// is disconnected from the DOM
|
3573
|
+
ancestor = this.element.parents().last();
|
3574
|
+
labelSelector = "label[for='" + this.element.attr("id") + "']";
|
3575
|
+
this.buttonElement = ancestor.find( labelSelector );
|
3576
|
+
if ( !this.buttonElement.length ) {
|
3577
|
+
ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
|
3578
|
+
this.buttonElement = ancestor.filter( labelSelector );
|
3579
|
+
if ( !this.buttonElement.length ) {
|
3580
|
+
this.buttonElement = ancestor.find( labelSelector );
|
3581
|
+
}
|
3582
|
+
}
|
3583
|
+
this.element.addClass( "ui-helper-hidden-accessible" );
|
3584
|
+
|
3585
|
+
checked = this.element.is( ":checked" );
|
3586
|
+
if ( checked ) {
|
3587
|
+
this.buttonElement.addClass( "ui-state-active" );
|
3588
|
+
}
|
3589
|
+
this.buttonElement.prop( "aria-pressed", checked );
|
3590
|
+
} else {
|
3591
|
+
this.buttonElement = this.element;
|
3592
|
+
}
|
3593
|
+
},
|
3594
|
+
|
3595
|
+
widget: function() {
|
3596
|
+
return this.buttonElement;
|
3597
|
+
},
|
3598
|
+
|
3599
|
+
_destroy: function() {
|
3600
|
+
this.element
|
3601
|
+
.removeClass( "ui-helper-hidden-accessible" );
|
3602
|
+
this.buttonElement
|
3603
|
+
.removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
|
3604
|
+
.removeAttr( "role" )
|
3605
|
+
.removeAttr( "aria-pressed" )
|
3606
|
+
.html( this.buttonElement.find(".ui-button-text").html() );
|
3607
|
+
|
3608
|
+
if ( !this.hasTitle ) {
|
3609
|
+
this.buttonElement.removeAttr( "title" );
|
3610
|
+
}
|
3611
|
+
},
|
3612
|
+
|
3613
|
+
_setOption: function( key, value ) {
|
3614
|
+
this._super( key, value );
|
3615
|
+
if ( key === "disabled" ) {
|
3616
|
+
if ( value ) {
|
3617
|
+
this.element.prop( "disabled", true );
|
3618
|
+
} else {
|
3619
|
+
this.element.prop( "disabled", false );
|
3620
|
+
}
|
3621
|
+
return;
|
3622
|
+
}
|
3623
|
+
this._resetButton();
|
3624
|
+
},
|
3625
|
+
|
3626
|
+
refresh: function() {
|
3627
|
+
//See #8237 & #8828
|
3628
|
+
var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
|
3629
|
+
|
3630
|
+
if ( isDisabled !== this.options.disabled ) {
|
3631
|
+
this._setOption( "disabled", isDisabled );
|
3632
|
+
}
|
3633
|
+
if ( this.type === "radio" ) {
|
3634
|
+
radioGroup( this.element[0] ).each(function() {
|
3635
|
+
if ( $( this ).is( ":checked" ) ) {
|
3636
|
+
$( this ).button( "widget" )
|
3637
|
+
.addClass( "ui-state-active" )
|
3638
|
+
.attr( "aria-pressed", "true" );
|
3639
|
+
} else {
|
3640
|
+
$( this ).button( "widget" )
|
3641
|
+
.removeClass( "ui-state-active" )
|
3642
|
+
.attr( "aria-pressed", "false" );
|
3643
|
+
}
|
3644
|
+
});
|
3645
|
+
} else if ( this.type === "checkbox" ) {
|
3646
|
+
if ( this.element.is( ":checked" ) ) {
|
3647
|
+
this.buttonElement
|
3648
|
+
.addClass( "ui-state-active" )
|
3649
|
+
.attr( "aria-pressed", "true" );
|
3650
|
+
} else {
|
3651
|
+
this.buttonElement
|
3652
|
+
.removeClass( "ui-state-active" )
|
3653
|
+
.attr( "aria-pressed", "false" );
|
3654
|
+
}
|
3655
|
+
}
|
3656
|
+
},
|
3657
|
+
|
3658
|
+
_resetButton: function() {
|
3659
|
+
if ( this.type === "input" ) {
|
3660
|
+
if ( this.options.label ) {
|
3661
|
+
this.element.val( this.options.label );
|
3662
|
+
}
|
3663
|
+
return;
|
3664
|
+
}
|
3665
|
+
var buttonElement = this.buttonElement.removeClass( typeClasses ),
|
3666
|
+
buttonText = $( "<span></span>", this.document[0] )
|
3667
|
+
.addClass( "ui-button-text" )
|
3668
|
+
.html( this.options.label )
|
3669
|
+
.appendTo( buttonElement.empty() )
|
3670
|
+
.text(),
|
3671
|
+
icons = this.options.icons,
|
3672
|
+
multipleIcons = icons.primary && icons.secondary,
|
3673
|
+
buttonClasses = [];
|
3674
|
+
|
3675
|
+
if ( icons.primary || icons.secondary ) {
|
3676
|
+
if ( this.options.text ) {
|
3677
|
+
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
|
3678
|
+
}
|
3679
|
+
|
3680
|
+
if ( icons.primary ) {
|
3681
|
+
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
|
3682
|
+
}
|
3683
|
+
|
3684
|
+
if ( icons.secondary ) {
|
3685
|
+
buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
|
3686
|
+
}
|
3687
|
+
|
3688
|
+
if ( !this.options.text ) {
|
3689
|
+
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
|
3690
|
+
|
3691
|
+
if ( !this.hasTitle ) {
|
3692
|
+
buttonElement.attr( "title", $.trim( buttonText ) );
|
3693
|
+
}
|
3694
|
+
}
|
3695
|
+
} else {
|
3696
|
+
buttonClasses.push( "ui-button-text-only" );
|
3697
|
+
}
|
3698
|
+
buttonElement.addClass( buttonClasses.join( " " ) );
|
3699
|
+
}
|
3700
|
+
});
|
3701
|
+
|
3702
|
+
$.widget( "ui.buttonset", {
|
3703
|
+
version: "1.10.1",
|
3704
|
+
options: {
|
3705
|
+
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
|
3706
|
+
},
|
3707
|
+
|
3708
|
+
_create: function() {
|
3709
|
+
this.element.addClass( "ui-buttonset" );
|
3710
|
+
},
|
3711
|
+
|
3712
|
+
_init: function() {
|
3713
|
+
this.refresh();
|
3714
|
+
},
|
3715
|
+
|
3716
|
+
_setOption: function( key, value ) {
|
3717
|
+
if ( key === "disabled" ) {
|
3718
|
+
this.buttons.button( "option", key, value );
|
3719
|
+
}
|
3720
|
+
|
3721
|
+
this._super( key, value );
|
3722
|
+
},
|
3723
|
+
|
3724
|
+
refresh: function() {
|
3725
|
+
var rtl = this.element.css( "direction" ) === "rtl";
|
3726
|
+
|
3727
|
+
this.buttons = this.element.find( this.options.items )
|
3728
|
+
.filter( ":ui-button" )
|
3729
|
+
.button( "refresh" )
|
3730
|
+
.end()
|
3731
|
+
.not( ":ui-button" )
|
3732
|
+
.button()
|
3733
|
+
.end()
|
3734
|
+
.map(function() {
|
3735
|
+
return $( this ).button( "widget" )[ 0 ];
|
3736
|
+
})
|
3737
|
+
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
|
3738
|
+
.filter( ":first" )
|
3739
|
+
.addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
|
3740
|
+
.end()
|
3741
|
+
.filter( ":last" )
|
3742
|
+
.addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
|
3743
|
+
.end()
|
3744
|
+
.end();
|
3745
|
+
},
|
3746
|
+
|
3747
|
+
_destroy: function() {
|
3748
|
+
this.element.removeClass( "ui-buttonset" );
|
3749
|
+
this.buttons
|
3750
|
+
.map(function() {
|
3751
|
+
return $( this ).button( "widget" )[ 0 ];
|
3752
|
+
})
|
3753
|
+
.removeClass( "ui-corner-left ui-corner-right" )
|
3754
|
+
.end()
|
3755
|
+
.button( "destroy" );
|
3756
|
+
}
|
3757
|
+
});
|
3758
|
+
|
3759
|
+
}( jQuery ) );
|
3760
|
+
(function( $, undefined ) {
|
3761
|
+
|
3762
|
+
var sizeRelatedOptions = {
|
3763
|
+
buttons: true,
|
3764
|
+
height: true,
|
3765
|
+
maxHeight: true,
|
3766
|
+
maxWidth: true,
|
3767
|
+
minHeight: true,
|
3768
|
+
minWidth: true,
|
3769
|
+
width: true
|
3770
|
+
},
|
3771
|
+
resizableRelatedOptions = {
|
3772
|
+
maxHeight: true,
|
3773
|
+
maxWidth: true,
|
3774
|
+
minHeight: true,
|
3775
|
+
minWidth: true
|
3776
|
+
};
|
3777
|
+
|
3778
|
+
$.widget( "ui.dialog", {
|
3779
|
+
version: "1.10.1",
|
3780
|
+
options: {
|
3781
|
+
appendTo: "body",
|
3782
|
+
autoOpen: true,
|
3783
|
+
buttons: [],
|
3784
|
+
closeOnEscape: true,
|
3785
|
+
closeText: "close",
|
3786
|
+
dialogClass: "",
|
3787
|
+
draggable: true,
|
3788
|
+
hide: null,
|
3789
|
+
height: "auto",
|
3790
|
+
maxHeight: null,
|
3791
|
+
maxWidth: null,
|
3792
|
+
minHeight: 150,
|
3793
|
+
minWidth: 150,
|
3794
|
+
modal: false,
|
3795
|
+
position: {
|
3796
|
+
my: "center",
|
3797
|
+
at: "center",
|
3798
|
+
of: window,
|
3799
|
+
collision: "fit",
|
3800
|
+
// Ensure the titlebar is always visible
|
3801
|
+
using: function( pos ) {
|
3802
|
+
var topOffset = $( this ).css( pos ).offset().top;
|
3803
|
+
if ( topOffset < 0 ) {
|
3804
|
+
$( this ).css( "top", pos.top - topOffset );
|
3805
|
+
}
|
3806
|
+
}
|
3807
|
+
},
|
3808
|
+
resizable: true,
|
3809
|
+
show: null,
|
3810
|
+
title: null,
|
3811
|
+
width: 300,
|
3812
|
+
|
3813
|
+
// callbacks
|
3814
|
+
beforeClose: null,
|
3815
|
+
close: null,
|
3816
|
+
drag: null,
|
3817
|
+
dragStart: null,
|
3818
|
+
dragStop: null,
|
3819
|
+
focus: null,
|
3820
|
+
open: null,
|
3821
|
+
resize: null,
|
3822
|
+
resizeStart: null,
|
3823
|
+
resizeStop: null
|
3824
|
+
},
|
3825
|
+
|
3826
|
+
_create: function() {
|
3827
|
+
this.originalCss = {
|
3828
|
+
display: this.element[0].style.display,
|
3829
|
+
width: this.element[0].style.width,
|
3830
|
+
minHeight: this.element[0].style.minHeight,
|
3831
|
+
maxHeight: this.element[0].style.maxHeight,
|
3832
|
+
height: this.element[0].style.height
|
3833
|
+
};
|
3834
|
+
this.originalPosition = {
|
3835
|
+
parent: this.element.parent(),
|
3836
|
+
index: this.element.parent().children().index( this.element )
|
3837
|
+
};
|
3838
|
+
this.originalTitle = this.element.attr("title");
|
3839
|
+
this.options.title = this.options.title || this.originalTitle;
|
3840
|
+
|
3841
|
+
this._createWrapper();
|
3842
|
+
|
3843
|
+
this.element
|
3844
|
+
.show()
|
3845
|
+
.removeAttr("title")
|
3846
|
+
.addClass("ui-dialog-content ui-widget-content")
|
3847
|
+
.appendTo( this.uiDialog );
|
3848
|
+
|
3849
|
+
this._createTitlebar();
|
3850
|
+
this._createButtonPane();
|
3851
|
+
|
3852
|
+
if ( this.options.draggable && $.fn.draggable ) {
|
3853
|
+
this._makeDraggable();
|
3854
|
+
}
|
3855
|
+
if ( this.options.resizable && $.fn.resizable ) {
|
3856
|
+
this._makeResizable();
|
3857
|
+
}
|
3858
|
+
|
3859
|
+
this._isOpen = false;
|
3860
|
+
},
|
3861
|
+
|
3862
|
+
_init: function() {
|
3863
|
+
if ( this.options.autoOpen ) {
|
3864
|
+
this.open();
|
3865
|
+
}
|
3866
|
+
},
|
3867
|
+
|
3868
|
+
_appendTo: function() {
|
3869
|
+
var element = this.options.appendTo;
|
3870
|
+
if ( element && (element.jquery || element.nodeType) ) {
|
3871
|
+
return $( element );
|
3872
|
+
}
|
3873
|
+
return this.document.find( element || "body" ).eq( 0 );
|
3874
|
+
},
|
3875
|
+
|
3876
|
+
_destroy: function() {
|
3877
|
+
var next,
|
3878
|
+
originalPosition = this.originalPosition;
|
3879
|
+
|
3880
|
+
this._destroyOverlay();
|
3881
|
+
|
3882
|
+
this.element
|
3883
|
+
.removeUniqueId()
|
3884
|
+
.removeClass("ui-dialog-content ui-widget-content")
|
3885
|
+
.css( this.originalCss )
|
3886
|
+
// Without detaching first, the following becomes really slow
|
3887
|
+
.detach();
|
3888
|
+
|
3889
|
+
this.uiDialog.stop( true, true ).remove();
|
3890
|
+
|
3891
|
+
if ( this.originalTitle ) {
|
3892
|
+
this.element.attr( "title", this.originalTitle );
|
3893
|
+
}
|
3894
|
+
|
3895
|
+
next = originalPosition.parent.children().eq( originalPosition.index );
|
3896
|
+
// Don't try to place the dialog next to itself (#8613)
|
3897
|
+
if ( next.length && next[0] !== this.element[0] ) {
|
3898
|
+
next.before( this.element );
|
3899
|
+
} else {
|
3900
|
+
originalPosition.parent.append( this.element );
|
3901
|
+
}
|
3902
|
+
},
|
3903
|
+
|
3904
|
+
widget: function() {
|
3905
|
+
return this.uiDialog;
|
3906
|
+
},
|
3907
|
+
|
3908
|
+
disable: $.noop,
|
3909
|
+
enable: $.noop,
|
3910
|
+
|
3911
|
+
close: function( event ) {
|
3912
|
+
var that = this;
|
3913
|
+
|
3914
|
+
if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
|
3915
|
+
return;
|
3916
|
+
}
|
3917
|
+
|
3918
|
+
this._isOpen = false;
|
3919
|
+
this._destroyOverlay();
|
3920
|
+
|
3921
|
+
if ( !this.opener.filter(":focusable").focus().length ) {
|
3922
|
+
// Hiding a focused element doesn't trigger blur in WebKit
|
3923
|
+
// so in case we have nothing to focus on, explicitly blur the active element
|
3924
|
+
// https://bugs.webkit.org/show_bug.cgi?id=47182
|
3925
|
+
$( this.document[0].activeElement ).blur();
|
3926
|
+
}
|
3927
|
+
|
3928
|
+
this._hide( this.uiDialog, this.options.hide, function() {
|
3929
|
+
that._trigger( "close", event );
|
3930
|
+
});
|
3931
|
+
},
|
3932
|
+
|
3933
|
+
isOpen: function() {
|
3934
|
+
return this._isOpen;
|
3935
|
+
},
|
3936
|
+
|
3937
|
+
moveToTop: function() {
|
3938
|
+
this._moveToTop();
|
3939
|
+
},
|
3940
|
+
|
3941
|
+
_moveToTop: function( event, silent ) {
|
3942
|
+
var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length;
|
3943
|
+
if ( moved && !silent ) {
|
3944
|
+
this._trigger( "focus", event );
|
3945
|
+
}
|
3946
|
+
return moved;
|
3947
|
+
},
|
3948
|
+
|
3949
|
+
open: function() {
|
3950
|
+
var that = this;
|
3951
|
+
if ( this._isOpen ) {
|
3952
|
+
if ( this._moveToTop() ) {
|
3953
|
+
this._focusTabbable();
|
3954
|
+
}
|
3955
|
+
return;
|
3956
|
+
}
|
3957
|
+
|
3958
|
+
this._isOpen = true;
|
3959
|
+
this.opener = $( this.document[0].activeElement );
|
3960
|
+
|
3961
|
+
this._size();
|
3962
|
+
this._position();
|
3963
|
+
this._createOverlay();
|
3964
|
+
this._moveToTop( null, true );
|
3965
|
+
this._show( this.uiDialog, this.options.show, function() {
|
3966
|
+
that._focusTabbable();
|
3967
|
+
that._trigger("focus");
|
3968
|
+
});
|
3969
|
+
|
3970
|
+
this._trigger("open");
|
3971
|
+
},
|
3972
|
+
|
3973
|
+
_focusTabbable: function() {
|
3974
|
+
// Set focus to the first match:
|
3975
|
+
// 1. First element inside the dialog matching [autofocus]
|
3976
|
+
// 2. Tabbable element inside the content element
|
3977
|
+
// 3. Tabbable element inside the buttonpane
|
3978
|
+
// 4. The close button
|
3979
|
+
// 5. The dialog itself
|
3980
|
+
var hasFocus = this.element.find("[autofocus]");
|
3981
|
+
if ( !hasFocus.length ) {
|
3982
|
+
hasFocus = this.element.find(":tabbable");
|
3983
|
+
}
|
3984
|
+
if ( !hasFocus.length ) {
|
3985
|
+
hasFocus = this.uiDialogButtonPane.find(":tabbable");
|
3986
|
+
}
|
3987
|
+
if ( !hasFocus.length ) {
|
3988
|
+
hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
|
3989
|
+
}
|
3990
|
+
if ( !hasFocus.length ) {
|
3991
|
+
hasFocus = this.uiDialog;
|
3992
|
+
}
|
3993
|
+
hasFocus.eq( 0 ).focus();
|
3994
|
+
},
|
3995
|
+
|
3996
|
+
_keepFocus: function( event ) {
|
3997
|
+
function checkFocus() {
|
3998
|
+
var activeElement = this.document[0].activeElement,
|
3999
|
+
isActive = this.uiDialog[0] === activeElement ||
|
4000
|
+
$.contains( this.uiDialog[0], activeElement );
|
4001
|
+
if ( !isActive ) {
|
4002
|
+
this._focusTabbable();
|
4003
|
+
}
|
4004
|
+
}
|
4005
|
+
event.preventDefault();
|
4006
|
+
checkFocus.call( this );
|
4007
|
+
// support: IE
|
4008
|
+
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
|
4009
|
+
// so we check again later
|
4010
|
+
this._delay( checkFocus );
|
4011
|
+
},
|
4012
|
+
|
4013
|
+
_createWrapper: function() {
|
4014
|
+
this.uiDialog = $("<div>")
|
4015
|
+
.addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
|
4016
|
+
this.options.dialogClass )
|
4017
|
+
.hide()
|
4018
|
+
.attr({
|
4019
|
+
// Setting tabIndex makes the div focusable
|
4020
|
+
tabIndex: -1,
|
4021
|
+
role: "dialog"
|
4022
|
+
})
|
4023
|
+
.appendTo( this._appendTo() );
|
4024
|
+
|
4025
|
+
this._on( this.uiDialog, {
|
4026
|
+
keydown: function( event ) {
|
4027
|
+
if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
|
4028
|
+
event.keyCode === $.ui.keyCode.ESCAPE ) {
|
4029
|
+
event.preventDefault();
|
4030
|
+
this.close( event );
|
4031
|
+
return;
|
4032
|
+
}
|
4033
|
+
|
4034
|
+
// prevent tabbing out of dialogs
|
4035
|
+
if ( event.keyCode !== $.ui.keyCode.TAB ) {
|
4036
|
+
return;
|
4037
|
+
}
|
4038
|
+
var tabbables = this.uiDialog.find(":tabbable"),
|
4039
|
+
first = tabbables.filter(":first"),
|
4040
|
+
last = tabbables.filter(":last");
|
4041
|
+
|
4042
|
+
if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
|
4043
|
+
first.focus( 1 );
|
4044
|
+
event.preventDefault();
|
4045
|
+
} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
|
4046
|
+
last.focus( 1 );
|
4047
|
+
event.preventDefault();
|
4048
|
+
}
|
4049
|
+
},
|
4050
|
+
mousedown: function( event ) {
|
4051
|
+
if ( this._moveToTop( event ) ) {
|
4052
|
+
this._focusTabbable();
|
4053
|
+
}
|
4054
|
+
}
|
4055
|
+
});
|
4056
|
+
|
4057
|
+
// We assume that any existing aria-describedby attribute means
|
4058
|
+
// that the dialog content is marked up properly
|
4059
|
+
// otherwise we brute force the content as the description
|
4060
|
+
if ( !this.element.find("[aria-describedby]").length ) {
|
4061
|
+
this.uiDialog.attr({
|
4062
|
+
"aria-describedby": this.element.uniqueId().attr("id")
|
4063
|
+
});
|
4064
|
+
}
|
4065
|
+
},
|
4066
|
+
|
4067
|
+
_createTitlebar: function() {
|
4068
|
+
var uiDialogTitle;
|
4069
|
+
|
4070
|
+
this.uiDialogTitlebar = $("<div>")
|
4071
|
+
.addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix")
|
4072
|
+
.prependTo( this.uiDialog );
|
4073
|
+
this._on( this.uiDialogTitlebar, {
|
4074
|
+
mousedown: function( event ) {
|
4075
|
+
// Don't prevent click on close button (#8838)
|
4076
|
+
// Focusing a dialog that is partially scrolled out of view
|
4077
|
+
// causes the browser to scroll it into view, preventing the click event
|
4078
|
+
if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) {
|
4079
|
+
// Dialog isn't getting focus when dragging (#8063)
|
4080
|
+
this.uiDialog.focus();
|
4081
|
+
}
|
4082
|
+
}
|
4083
|
+
});
|
4084
|
+
|
4085
|
+
this.uiDialogTitlebarClose = $("<button></button>")
|
4086
|
+
.button({
|
4087
|
+
label: this.options.closeText,
|
4088
|
+
icons: {
|
4089
|
+
primary: "ui-icon-closethick"
|
4090
|
+
},
|
4091
|
+
text: false
|
4092
|
+
})
|
4093
|
+
.addClass("ui-dialog-titlebar-close")
|
4094
|
+
.appendTo( this.uiDialogTitlebar );
|
4095
|
+
this._on( this.uiDialogTitlebarClose, {
|
4096
|
+
click: function( event ) {
|
4097
|
+
event.preventDefault();
|
4098
|
+
this.close( event );
|
4099
|
+
}
|
4100
|
+
});
|
4101
|
+
|
4102
|
+
uiDialogTitle = $("<span>")
|
4103
|
+
.uniqueId()
|
4104
|
+
.addClass("ui-dialog-title")
|
4105
|
+
.prependTo( this.uiDialogTitlebar );
|
4106
|
+
this._title( uiDialogTitle );
|
4107
|
+
|
4108
|
+
this.uiDialog.attr({
|
4109
|
+
"aria-labelledby": uiDialogTitle.attr("id")
|
4110
|
+
});
|
4111
|
+
},
|
4112
|
+
|
4113
|
+
_title: function( title ) {
|
4114
|
+
if ( !this.options.title ) {
|
4115
|
+
title.html(" ");
|
4116
|
+
}
|
4117
|
+
title.text( this.options.title );
|
4118
|
+
},
|
4119
|
+
|
4120
|
+
_createButtonPane: function() {
|
4121
|
+
this.uiDialogButtonPane = $("<div>")
|
4122
|
+
.addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
|
4123
|
+
|
4124
|
+
this.uiButtonSet = $("<div>")
|
4125
|
+
.addClass("ui-dialog-buttonset")
|
4126
|
+
.appendTo( this.uiDialogButtonPane );
|
4127
|
+
|
4128
|
+
this._createButtons();
|
4129
|
+
},
|
4130
|
+
|
4131
|
+
_createButtons: function() {
|
4132
|
+
var that = this,
|
4133
|
+
buttons = this.options.buttons;
|
4134
|
+
|
4135
|
+
// if we already have a button pane, remove it
|
4136
|
+
this.uiDialogButtonPane.remove();
|
4137
|
+
this.uiButtonSet.empty();
|
4138
|
+
|
4139
|
+
if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
|
4140
|
+
this.uiDialog.removeClass("ui-dialog-buttons");
|
4141
|
+
return;
|
4142
|
+
}
|
4143
|
+
|
4144
|
+
$.each( buttons, function( name, props ) {
|
4145
|
+
var click, buttonOptions;
|
4146
|
+
props = $.isFunction( props ) ?
|
4147
|
+
{ click: props, text: name } :
|
4148
|
+
props;
|
4149
|
+
// Default to a non-submitting button
|
4150
|
+
props = $.extend( { type: "button" }, props );
|
4151
|
+
// Change the context for the click callback to be the main element
|
4152
|
+
click = props.click;
|
4153
|
+
props.click = function() {
|
4154
|
+
click.apply( that.element[0], arguments );
|
4155
|
+
};
|
4156
|
+
buttonOptions = {
|
4157
|
+
icons: props.icons,
|
4158
|
+
text: props.showText
|
4159
|
+
};
|
4160
|
+
delete props.icons;
|
4161
|
+
delete props.showText;
|
4162
|
+
$( "<button></button>", props )
|
4163
|
+
.button( buttonOptions )
|
4164
|
+
.appendTo( that.uiButtonSet );
|
4165
|
+
});
|
4166
|
+
this.uiDialog.addClass("ui-dialog-buttons");
|
4167
|
+
this.uiDialogButtonPane.appendTo( this.uiDialog );
|
4168
|
+
},
|
4169
|
+
|
4170
|
+
_makeDraggable: function() {
|
4171
|
+
var that = this,
|
4172
|
+
options = this.options;
|
4173
|
+
|
4174
|
+
function filteredUi( ui ) {
|
4175
|
+
return {
|
4176
|
+
position: ui.position,
|
4177
|
+
offset: ui.offset
|
4178
|
+
};
|
4179
|
+
}
|
4180
|
+
|
4181
|
+
this.uiDialog.draggable({
|
4182
|
+
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
|
4183
|
+
handle: ".ui-dialog-titlebar",
|
4184
|
+
containment: "document",
|
4185
|
+
start: function( event, ui ) {
|
4186
|
+
$( this ).addClass("ui-dialog-dragging");
|
4187
|
+
that._blockFrames();
|
4188
|
+
that._trigger( "dragStart", event, filteredUi( ui ) );
|
4189
|
+
},
|
4190
|
+
drag: function( event, ui ) {
|
4191
|
+
that._trigger( "drag", event, filteredUi( ui ) );
|
4192
|
+
},
|
4193
|
+
stop: function( event, ui ) {
|
4194
|
+
options.position = [
|
4195
|
+
ui.position.left - that.document.scrollLeft(),
|
4196
|
+
ui.position.top - that.document.scrollTop()
|
4197
|
+
];
|
4198
|
+
$( this ).removeClass("ui-dialog-dragging");
|
4199
|
+
that._unblockFrames();
|
4200
|
+
that._trigger( "dragStop", event, filteredUi( ui ) );
|
4201
|
+
}
|
4202
|
+
});
|
4203
|
+
},
|
4204
|
+
|
4205
|
+
_makeResizable: function() {
|
4206
|
+
var that = this,
|
4207
|
+
options = this.options,
|
4208
|
+
handles = options.resizable,
|
4209
|
+
// .ui-resizable has position: relative defined in the stylesheet
|
4210
|
+
// but dialogs have to use absolute or fixed positioning
|
4211
|
+
position = this.uiDialog.css("position"),
|
4212
|
+
resizeHandles = typeof handles === "string" ?
|
4213
|
+
handles :
|
4214
|
+
"n,e,s,w,se,sw,ne,nw";
|
4215
|
+
|
4216
|
+
function filteredUi( ui ) {
|
4217
|
+
return {
|
4218
|
+
originalPosition: ui.originalPosition,
|
4219
|
+
originalSize: ui.originalSize,
|
4220
|
+
position: ui.position,
|
4221
|
+
size: ui.size
|
4222
|
+
};
|
4223
|
+
}
|
4224
|
+
|
4225
|
+
this.uiDialog.resizable({
|
4226
|
+
cancel: ".ui-dialog-content",
|
4227
|
+
containment: "document",
|
4228
|
+
alsoResize: this.element,
|
4229
|
+
maxWidth: options.maxWidth,
|
4230
|
+
maxHeight: options.maxHeight,
|
4231
|
+
minWidth: options.minWidth,
|
4232
|
+
minHeight: this._minHeight(),
|
4233
|
+
handles: resizeHandles,
|
4234
|
+
start: function( event, ui ) {
|
4235
|
+
$( this ).addClass("ui-dialog-resizing");
|
4236
|
+
that._blockFrames();
|
4237
|
+
that._trigger( "resizeStart", event, filteredUi( ui ) );
|
4238
|
+
},
|
4239
|
+
resize: function( event, ui ) {
|
4240
|
+
that._trigger( "resize", event, filteredUi( ui ) );
|
4241
|
+
},
|
4242
|
+
stop: function( event, ui ) {
|
4243
|
+
options.height = $( this ).height();
|
4244
|
+
options.width = $( this ).width();
|
4245
|
+
$( this ).removeClass("ui-dialog-resizing");
|
4246
|
+
that._unblockFrames();
|
4247
|
+
that._trigger( "resizeStop", event, filteredUi( ui ) );
|
4248
|
+
}
|
4249
|
+
})
|
4250
|
+
.css( "position", position );
|
4251
|
+
},
|
4252
|
+
|
4253
|
+
_minHeight: function() {
|
4254
|
+
var options = this.options;
|
4255
|
+
|
4256
|
+
return options.height === "auto" ?
|
4257
|
+
options.minHeight :
|
4258
|
+
Math.min( options.minHeight, options.height );
|
4259
|
+
},
|
4260
|
+
|
4261
|
+
_position: function() {
|
4262
|
+
// Need to show the dialog to get the actual offset in the position plugin
|
4263
|
+
var isVisible = this.uiDialog.is(":visible");
|
4264
|
+
if ( !isVisible ) {
|
4265
|
+
this.uiDialog.show();
|
4266
|
+
}
|
4267
|
+
this.uiDialog.position( this.options.position );
|
4268
|
+
if ( !isVisible ) {
|
4269
|
+
this.uiDialog.hide();
|
4270
|
+
}
|
4271
|
+
},
|
4272
|
+
|
4273
|
+
_setOptions: function( options ) {
|
4274
|
+
var that = this,
|
4275
|
+
resize = false,
|
4276
|
+
resizableOptions = {};
|
4277
|
+
|
4278
|
+
$.each( options, function( key, value ) {
|
4279
|
+
that._setOption( key, value );
|
4280
|
+
|
4281
|
+
if ( key in sizeRelatedOptions ) {
|
4282
|
+
resize = true;
|
4283
|
+
}
|
4284
|
+
if ( key in resizableRelatedOptions ) {
|
4285
|
+
resizableOptions[ key ] = value;
|
4286
|
+
}
|
4287
|
+
});
|
4288
|
+
|
4289
|
+
if ( resize ) {
|
4290
|
+
this._size();
|
4291
|
+
this._position();
|
4292
|
+
}
|
4293
|
+
if ( this.uiDialog.is(":data(ui-resizable)") ) {
|
4294
|
+
this.uiDialog.resizable( "option", resizableOptions );
|
4295
|
+
}
|
4296
|
+
},
|
4297
|
+
|
4298
|
+
_setOption: function( key, value ) {
|
4299
|
+
/*jshint maxcomplexity:15*/
|
4300
|
+
var isDraggable, isResizable,
|
4301
|
+
uiDialog = this.uiDialog;
|
4302
|
+
|
4303
|
+
if ( key === "dialogClass" ) {
|
4304
|
+
uiDialog
|
4305
|
+
.removeClass( this.options.dialogClass )
|
4306
|
+
.addClass( value );
|
4307
|
+
}
|
4308
|
+
|
4309
|
+
if ( key === "disabled" ) {
|
4310
|
+
return;
|
4311
|
+
}
|
4312
|
+
|
4313
|
+
this._super( key, value );
|
4314
|
+
|
4315
|
+
if ( key === "appendTo" ) {
|
4316
|
+
this.uiDialog.appendTo( this._appendTo() );
|
4317
|
+
}
|
4318
|
+
|
4319
|
+
if ( key === "buttons" ) {
|
4320
|
+
this._createButtons();
|
4321
|
+
}
|
4322
|
+
|
4323
|
+
if ( key === "closeText" ) {
|
4324
|
+
this.uiDialogTitlebarClose.button({
|
4325
|
+
// Ensure that we always pass a string
|
4326
|
+
label: "" + value
|
4327
|
+
});
|
4328
|
+
}
|
4329
|
+
|
4330
|
+
if ( key === "draggable" ) {
|
4331
|
+
isDraggable = uiDialog.is(":data(ui-draggable)");
|
4332
|
+
if ( isDraggable && !value ) {
|
4333
|
+
uiDialog.draggable("destroy");
|
4334
|
+
}
|
4335
|
+
|
4336
|
+
if ( !isDraggable && value ) {
|
4337
|
+
this._makeDraggable();
|
4338
|
+
}
|
4339
|
+
}
|
4340
|
+
|
4341
|
+
if ( key === "position" ) {
|
4342
|
+
this._position();
|
4343
|
+
}
|
4344
|
+
|
4345
|
+
if ( key === "resizable" ) {
|
4346
|
+
// currently resizable, becoming non-resizable
|
4347
|
+
isResizable = uiDialog.is(":data(ui-resizable)");
|
4348
|
+
if ( isResizable && !value ) {
|
4349
|
+
uiDialog.resizable("destroy");
|
4350
|
+
}
|
4351
|
+
|
4352
|
+
// currently resizable, changing handles
|
4353
|
+
if ( isResizable && typeof value === "string" ) {
|
4354
|
+
uiDialog.resizable( "option", "handles", value );
|
4355
|
+
}
|
4356
|
+
|
4357
|
+
// currently non-resizable, becoming resizable
|
4358
|
+
if ( !isResizable && value !== false ) {
|
4359
|
+
this._makeResizable();
|
4360
|
+
}
|
4361
|
+
}
|
4362
|
+
|
4363
|
+
if ( key === "title" ) {
|
4364
|
+
this._title( this.uiDialogTitlebar.find(".ui-dialog-title") );
|
4365
|
+
}
|
4366
|
+
},
|
4367
|
+
|
4368
|
+
_size: function() {
|
4369
|
+
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
|
4370
|
+
// divs will both have width and height set, so we need to reset them
|
4371
|
+
var nonContentHeight, minContentHeight, maxContentHeight,
|
4372
|
+
options = this.options;
|
4373
|
+
|
4374
|
+
// Reset content sizing
|
4375
|
+
this.element.show().css({
|
4376
|
+
width: "auto",
|
4377
|
+
minHeight: 0,
|
4378
|
+
maxHeight: "none",
|
4379
|
+
height: 0
|
4380
|
+
});
|
4381
|
+
|
4382
|
+
if ( options.minWidth > options.width ) {
|
4383
|
+
options.width = options.minWidth;
|
4384
|
+
}
|
4385
|
+
|
4386
|
+
// reset wrapper sizing
|
4387
|
+
// determine the height of all the non-content elements
|
4388
|
+
nonContentHeight = this.uiDialog.css({
|
4389
|
+
height: "auto",
|
4390
|
+
width: options.width
|
4391
|
+
})
|
4392
|
+
.outerHeight();
|
4393
|
+
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
|
4394
|
+
maxContentHeight = typeof options.maxHeight === "number" ?
|
4395
|
+
Math.max( 0, options.maxHeight - nonContentHeight ) :
|
4396
|
+
"none";
|
4397
|
+
|
4398
|
+
if ( options.height === "auto" ) {
|
4399
|
+
this.element.css({
|
4400
|
+
minHeight: minContentHeight,
|
4401
|
+
maxHeight: maxContentHeight,
|
4402
|
+
height: "auto"
|
4403
|
+
});
|
4404
|
+
} else {
|
4405
|
+
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
|
4406
|
+
}
|
4407
|
+
|
4408
|
+
if (this.uiDialog.is(":data(ui-resizable)") ) {
|
4409
|
+
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
|
4410
|
+
}
|
4411
|
+
},
|
4412
|
+
|
4413
|
+
_blockFrames: function() {
|
4414
|
+
this.iframeBlocks = this.document.find( "iframe" ).map(function() {
|
4415
|
+
var iframe = $( this );
|
4416
|
+
|
4417
|
+
return $( "<div>" )
|
4418
|
+
.css({
|
4419
|
+
position: "absolute",
|
4420
|
+
width: iframe.outerWidth(),
|
4421
|
+
height: iframe.outerHeight()
|
4422
|
+
})
|
4423
|
+
.appendTo( iframe.parent() )
|
4424
|
+
.offset( iframe.offset() )[0];
|
4425
|
+
});
|
4426
|
+
},
|
4427
|
+
|
4428
|
+
_unblockFrames: function() {
|
4429
|
+
if ( this.iframeBlocks ) {
|
4430
|
+
this.iframeBlocks.remove();
|
4431
|
+
delete this.iframeBlocks;
|
4432
|
+
}
|
4433
|
+
},
|
4434
|
+
|
4435
|
+
_createOverlay: function() {
|
4436
|
+
if ( !this.options.modal ) {
|
4437
|
+
return;
|
4438
|
+
}
|
4439
|
+
|
4440
|
+
if ( !$.ui.dialog.overlayInstances ) {
|
4441
|
+
// Prevent use of anchors and inputs.
|
4442
|
+
// We use a delay in case the overlay is created from an
|
4443
|
+
// event that we're going to be cancelling. (#2804)
|
4444
|
+
this._delay(function() {
|
4445
|
+
// Handle .dialog().dialog("close") (#4065)
|
4446
|
+
if ( $.ui.dialog.overlayInstances ) {
|
4447
|
+
this.document.bind( "focusin.dialog", function( event ) {
|
4448
|
+
if ( !$( event.target ).closest(".ui-dialog").length &&
|
4449
|
+
// TODO: Remove hack when datepicker implements
|
4450
|
+
// the .ui-front logic (#8989)
|
4451
|
+
!$( event.target ).closest(".ui-datepicker").length ) {
|
4452
|
+
event.preventDefault();
|
4453
|
+
$(".ui-dialog:visible:last .ui-dialog-content")
|
4454
|
+
.data("ui-dialog")._focusTabbable();
|
4455
|
+
}
|
4456
|
+
});
|
4457
|
+
}
|
4458
|
+
});
|
4459
|
+
}
|
4460
|
+
|
4461
|
+
this.overlay = $("<div>")
|
4462
|
+
.addClass("ui-widget-overlay ui-front")
|
4463
|
+
.appendTo( this._appendTo() );
|
4464
|
+
this._on( this.overlay, {
|
4465
|
+
mousedown: "_keepFocus"
|
4466
|
+
});
|
4467
|
+
$.ui.dialog.overlayInstances++;
|
4468
|
+
},
|
4469
|
+
|
4470
|
+
_destroyOverlay: function() {
|
4471
|
+
if ( !this.options.modal ) {
|
4472
|
+
return;
|
4473
|
+
}
|
4474
|
+
|
4475
|
+
if ( this.overlay ) {
|
4476
|
+
$.ui.dialog.overlayInstances--;
|
4477
|
+
|
4478
|
+
if ( !$.ui.dialog.overlayInstances ) {
|
4479
|
+
this.document.unbind( "focusin.dialog" );
|
4480
|
+
}
|
4481
|
+
this.overlay.remove();
|
4482
|
+
this.overlay = null;
|
4483
|
+
}
|
4484
|
+
}
|
4485
|
+
});
|
4486
|
+
|
4487
|
+
$.ui.dialog.overlayInstances = 0;
|
4488
|
+
|
4489
|
+
// DEPRECATED
|
4490
|
+
if ( $.uiBackCompat !== false ) {
|
4491
|
+
// position option with array notation
|
4492
|
+
// just override with old implementation
|
4493
|
+
$.widget( "ui.dialog", $.ui.dialog, {
|
4494
|
+
_position: function() {
|
4495
|
+
var position = this.options.position,
|
4496
|
+
myAt = [],
|
4497
|
+
offset = [ 0, 0 ],
|
4498
|
+
isVisible;
|
4499
|
+
|
4500
|
+
if ( position ) {
|
4501
|
+
if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
|
4502
|
+
myAt = position.split ? position.split(" ") : [ position[0], position[1] ];
|
4503
|
+
if ( myAt.length === 1 ) {
|
4504
|
+
myAt[1] = myAt[0];
|
4505
|
+
}
|
4506
|
+
|
4507
|
+
$.each( [ "left", "top" ], function( i, offsetPosition ) {
|
4508
|
+
if ( +myAt[ i ] === myAt[ i ] ) {
|
4509
|
+
offset[ i ] = myAt[ i ];
|
4510
|
+
myAt[ i ] = offsetPosition;
|
4511
|
+
}
|
4512
|
+
});
|
4513
|
+
|
4514
|
+
position = {
|
4515
|
+
my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
|
4516
|
+
myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
|
4517
|
+
at: myAt.join(" ")
|
4518
|
+
};
|
4519
|
+
}
|
4520
|
+
|
4521
|
+
position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
|
4522
|
+
} else {
|
4523
|
+
position = $.ui.dialog.prototype.options.position;
|
4524
|
+
}
|
4525
|
+
|
4526
|
+
// need to show the dialog to get the actual offset in the position plugin
|
4527
|
+
isVisible = this.uiDialog.is(":visible");
|
4528
|
+
if ( !isVisible ) {
|
4529
|
+
this.uiDialog.show();
|
4530
|
+
}
|
4531
|
+
this.uiDialog.position( position );
|
4532
|
+
if ( !isVisible ) {
|
4533
|
+
this.uiDialog.hide();
|
4534
|
+
}
|
4535
|
+
}
|
4536
|
+
});
|
4537
|
+
}
|
4538
|
+
|
4539
|
+
}( jQuery ) );
|