Index: trunk/phase3/resources/jquery.ui/jquery.ui.dialog.js |
— | — | @@ -10,12 +10,11 @@ |
11 | 11 | * Depends: |
12 | 12 | * jquery.ui.core.js |
13 | 13 | * jquery.ui.widget.js |
14 | | - * jquery.ui.button.js |
| 14 | + * jquery.ui.button.js |
15 | 15 | * jquery.ui.draggable.js |
16 | 16 | * jquery.ui.mouse.js |
17 | 17 | * jquery.ui.position.js |
18 | 18 | * jquery.ui.resizable.js |
19 | | - * jquery.ui.droppable.js |
20 | 19 | */ |
21 | 20 | (function( $, undefined ) { |
22 | 21 | |
— | — | @@ -855,274 +854,4 @@ |
856 | 855 | } |
857 | 856 | }); |
858 | 857 | |
859 | | -/* jquery.ui.droppable.js */ |
860 | | - |
861 | | -$.widget("ui.droppable", { |
862 | | - widgetEventPrefix: "drop", |
863 | | - options: { |
864 | | - accept: '*', |
865 | | - activeClass: false, |
866 | | - addClasses: true, |
867 | | - greedy: false, |
868 | | - hoverClass: false, |
869 | | - scope: 'default', |
870 | | - tolerance: 'intersect' |
871 | | - }, |
872 | | - _create: function() { |
873 | | - |
874 | | - var o = this.options, accept = o.accept; |
875 | | - this.isover = 0; this.isout = 1; |
876 | | - |
877 | | - this.accept = $.isFunction(accept) ? accept : function(d) { |
878 | | - return d.is(accept); |
879 | | - }; |
880 | | - |
881 | | - //Store the droppable's proportions |
882 | | - this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; |
883 | | - |
884 | | - // Add the reference and positions to the manager |
885 | | - $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; |
886 | | - $.ui.ddmanager.droppables[o.scope].push(this); |
887 | | - |
888 | | - (o.addClasses && this.element.addClass("ui-droppable")); |
889 | | - |
890 | | - }, |
891 | | - |
892 | | - destroy: function() { |
893 | | - var drop = $.ui.ddmanager.droppables[this.options.scope]; |
894 | | - for ( var i = 0; i < drop.length; i++ ) |
895 | | - if ( drop[i] == this ) |
896 | | - drop.splice(i, 1); |
897 | | - |
898 | | - this.element |
899 | | - .removeClass("ui-droppable ui-droppable-disabled") |
900 | | - .removeData("droppable") |
901 | | - .unbind(".droppable"); |
902 | | - |
903 | | - return this; |
904 | | - }, |
905 | | - |
906 | | - _setOption: function(key, value) { |
907 | | - |
908 | | - if(key == 'accept') { |
909 | | - this.accept = $.isFunction(value) ? value : function(d) { |
910 | | - return d.is(value); |
911 | | - }; |
912 | | - } |
913 | | - $.Widget.prototype._setOption.apply(this, arguments); |
914 | | - }, |
915 | | - |
916 | | - _activate: function(event) { |
917 | | - var draggable = $.ui.ddmanager.current; |
918 | | - if(this.options.activeClass) this.element.addClass(this.options.activeClass); |
919 | | - (draggable && this._trigger('activate', event, this.ui(draggable))); |
920 | | - }, |
921 | | - |
922 | | - _deactivate: function(event) { |
923 | | - var draggable = $.ui.ddmanager.current; |
924 | | - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); |
925 | | - (draggable && this._trigger('deactivate', event, this.ui(draggable))); |
926 | | - }, |
927 | | - |
928 | | - _over: function(event) { |
929 | | - |
930 | | - var draggable = $.ui.ddmanager.current; |
931 | | - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element |
932 | | - |
933 | | - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { |
934 | | - if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); |
935 | | - this._trigger('over', event, this.ui(draggable)); |
936 | | - } |
937 | | - |
938 | | - }, |
939 | | - |
940 | | - _out: function(event) { |
941 | | - |
942 | | - var draggable = $.ui.ddmanager.current; |
943 | | - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element |
944 | | - |
945 | | - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { |
946 | | - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); |
947 | | - this._trigger('out', event, this.ui(draggable)); |
948 | | - } |
949 | | - |
950 | | - }, |
951 | | - |
952 | | - _drop: function(event,custom) { |
953 | | - |
954 | | - var draggable = custom || $.ui.ddmanager.current; |
955 | | - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element |
956 | | - |
957 | | - var childrenIntersection = false; |
958 | | - this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { |
959 | | - var inst = $.data(this, 'droppable'); |
960 | | - if( |
961 | | - inst.options.greedy |
962 | | - && !inst.options.disabled |
963 | | - && inst.options.scope == draggable.options.scope |
964 | | - && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) |
965 | | - && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) |
966 | | - ) { childrenIntersection = true; return false; } |
967 | | - }); |
968 | | - if(childrenIntersection) return false; |
969 | | - |
970 | | - if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { |
971 | | - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); |
972 | | - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); |
973 | | - this._trigger('drop', event, this.ui(draggable)); |
974 | | - return this.element; |
975 | | - } |
976 | | - |
977 | | - return false; |
978 | | - |
979 | | - }, |
980 | | - |
981 | | - ui: function(c) { |
982 | | - return { |
983 | | - draggable: (c.currentItem || c.element), |
984 | | - helper: c.helper, |
985 | | - position: c.position, |
986 | | - offset: c.positionAbs |
987 | | - }; |
988 | | - } |
989 | | - |
990 | | -}); |
991 | | - |
992 | | -$.extend($.ui.droppable, { |
993 | | - version: "1.8.11" |
994 | | -}); |
995 | | - |
996 | | -$.ui.intersect = function(draggable, droppable, toleranceMode) { |
997 | | - |
998 | | - if (!droppable.offset) return false; |
999 | | - |
1000 | | - var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, |
1001 | | - y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; |
1002 | | - var l = droppable.offset.left, r = l + droppable.proportions.width, |
1003 | | - t = droppable.offset.top, b = t + droppable.proportions.height; |
1004 | | - |
1005 | | - switch (toleranceMode) { |
1006 | | - case 'fit': |
1007 | | - return (l <= x1 && x2 <= r |
1008 | | - && t <= y1 && y2 <= b); |
1009 | | - break; |
1010 | | - case 'intersect': |
1011 | | - return (l < x1 + (draggable.helperProportions.width / 2) // Right Half |
1012 | | - && x2 - (draggable.helperProportions.width / 2) < r // Left Half |
1013 | | - && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half |
1014 | | - && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half |
1015 | | - break; |
1016 | | - case 'pointer': |
1017 | | - var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), |
1018 | | - draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), |
1019 | | - isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); |
1020 | | - return isOver; |
1021 | | - break; |
1022 | | - case 'touch': |
1023 | | - return ( |
1024 | | - (y1 >= t && y1 <= b) || // Top edge touching |
1025 | | - (y2 >= t && y2 <= b) || // Bottom edge touching |
1026 | | - (y1 < t && y2 > b) // Surrounded vertically |
1027 | | - ) && ( |
1028 | | - (x1 >= l && x1 <= r) || // Left edge touching |
1029 | | - (x2 >= l && x2 <= r) || // Right edge touching |
1030 | | - (x1 < l && x2 > r) // Surrounded horizontally |
1031 | | - ); |
1032 | | - break; |
1033 | | - default: |
1034 | | - return false; |
1035 | | - break; |
1036 | | - } |
1037 | | - |
1038 | | -}; |
1039 | | - |
1040 | | -/* |
1041 | | - This manager tracks offsets of draggables and droppables |
1042 | | -*/ |
1043 | | -$.ui.ddmanager = { |
1044 | | - current: null, |
1045 | | - droppables: { 'default': [] }, |
1046 | | - prepareOffsets: function(t, event) { |
1047 | | - |
1048 | | - var m = $.ui.ddmanager.droppables[t.options.scope] || []; |
1049 | | - var type = event ? event.type : null; // workaround for #2317 |
1050 | | - var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); |
1051 | | - |
1052 | | - droppablesLoop: for (var i = 0; i < m.length; i++) { |
1053 | | - |
1054 | | - if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted |
1055 | | - for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item |
1056 | | - m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue |
1057 | | - |
1058 | | - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables |
1059 | | - |
1060 | | - m[i].offset = m[i].element.offset(); |
1061 | | - m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; |
1062 | | - |
1063 | | - } |
1064 | | - |
1065 | | - }, |
1066 | | - drop: function(draggable, event) { |
1067 | | - |
1068 | | - var dropped = false; |
1069 | | - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { |
1070 | | - |
1071 | | - if(!this.options) return; |
1072 | | - if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) |
1073 | | - dropped = dropped || this._drop.call(this, event); |
1074 | | - |
1075 | | - if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { |
1076 | | - this.isout = 1; this.isover = 0; |
1077 | | - this._deactivate.call(this, event); |
1078 | | - } |
1079 | | - |
1080 | | - }); |
1081 | | - return dropped; |
1082 | | - |
1083 | | - }, |
1084 | | - drag: function(draggable, event) { |
1085 | | - |
1086 | | - //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. |
1087 | | - if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); |
1088 | | - |
1089 | | - //Run through all droppables and check their positions based on specific tolerance options |
1090 | | - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { |
1091 | | - |
1092 | | - if(this.options.disabled || this.greedyChild || !this.visible) return; |
1093 | | - var intersects = $.ui.intersect(draggable, this, this.options.tolerance); |
1094 | | - |
1095 | | - var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); |
1096 | | - if(!c) return; |
1097 | | - |
1098 | | - var parentInstance; |
1099 | | - if (this.options.greedy) { |
1100 | | - var parent = this.element.parents(':data(droppable):eq(0)'); |
1101 | | - if (parent.length) { |
1102 | | - parentInstance = $.data(parent[0], 'droppable'); |
1103 | | - parentInstance.greedyChild = (c == 'isover' ? 1 : 0); |
1104 | | - } |
1105 | | - } |
1106 | | - |
1107 | | - // we just moved into a greedy child |
1108 | | - if (parentInstance && c == 'isover') { |
1109 | | - parentInstance['isover'] = 0; |
1110 | | - parentInstance['isout'] = 1; |
1111 | | - parentInstance._out.call(parentInstance, event); |
1112 | | - } |
1113 | | - |
1114 | | - this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; |
1115 | | - this[c == "isover" ? "_over" : "_out"].call(this, event); |
1116 | | - |
1117 | | - // we just moved out of a greedy child |
1118 | | - if (parentInstance && c == 'isout') { |
1119 | | - parentInstance['isout'] = 0; |
1120 | | - parentInstance['isover'] = 1; |
1121 | | - parentInstance._over.call(parentInstance, event); |
1122 | | - } |
1123 | | - }); |
1124 | | - |
1125 | | - } |
1126 | | -}; |
1127 | | - |
1128 | | - |
1129 | 858 | }(jQuery)); |