diff --git a/external/jsdiff/jsdiff.js b/external/jsdiff/jsdiff.js new file mode 100644 index 000000000..31c3a273e --- /dev/null +++ b/external/jsdiff/jsdiff.js @@ -0,0 +1,159 @@ +/* + * Javascript Diff Algorithm + * By John Resig (http://ejohn.org/) + * Modified by Chu Alan "sprite" + * + * More Info: + * http://ejohn.org/projects/javascript-diff-algorithm/ + */ + +function escape(s) { + var n = s; + n = n.replace(/&/g, "&"); + n = n.replace(//g, ">"); + n = n.replace(/"/g, """); + + return n; +} + +function diffString( o, n ) { + o = o.replace(/\s+$/, ''); + n = n.replace(/\s+$/, ''); + + var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/) ); + var str = ""; + + var oSpace = o.match(/\s+/g); + if (oSpace == null) { + oSpace = ["\n"]; + } else { + oSpace.push("\n"); + } + var nSpace = n.match(/\s+/g); + if (nSpace == null) { + nSpace = ["\n"]; + } else { + nSpace.push("\n"); + } + + if (out.n.length == 0) { + for (var i = 0; i < out.o.length; i++) { + str += '' + escape(out.o[i]) + oSpace[i] + ""; + } + } else { + if (out.n[0].text == null) { + for (n = 0; n < out.o.length && out.o[n].text == null; n++) { + str += '' + escape(out.o[n]) + oSpace[n] + ""; + } + } + + for ( var i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += '' + escape(out.n[i]) + nSpace[i] + ""; + } else { + var pre = ""; + + for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += '' + escape(out.o[n]) + oSpace[n] + ""; + } + str += " " + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; +} + +function randomColor() { + return "rgb(" + (Math.random() * 100) + "%, " + + (Math.random() * 100) + "%, " + + (Math.random() * 100) + "%)"; +} +function diffString2( o, n ) { + o = o.replace(/\s+$/, ''); + n = n.replace(/\s+$/, ''); + + var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/) ); + + var oSpace = o.match(/\s+/g); + if (oSpace == null) { + oSpace = ["\n"]; + } else { + oSpace.push("\n"); + } + var nSpace = n.match(/\s+/g); + if (nSpace == null) { + nSpace = ["\n"]; + } else { + nSpace.push("\n"); + } + + var os = ""; + var colors = new Array(); + for (var i = 0; i < out.o.length; i++) { + colors[i] = randomColor(); + + if (out.o[i].text != null) { + os += '' + + escape(out.o[i].text) + oSpace[i] + ""; + } else { + os += "" + escape(out.o[i]) + oSpace[i] + ""; + } + } + + var ns = ""; + for (var i = 0; i < out.n.length; i++) { + if (out.n[i].text != null) { + ns += '' + + escape(out.n[i].text) + nSpace[i] + ""; + } else { + ns += "" + escape(out.n[i]) + nSpace[i] + ""; + } + } + + return { o : os , n : ns }; +} + +function diff( o, n ) { + var ns = new Object(); + var os = new Object(); + + for ( var i = 0; i < n.length; i++ ) { + if ( ns[ n[i] ] == null ) + ns[ n[i] ] = { rows: new Array(), o: null }; + ns[ n[i] ].rows.push( i ); + } + + for ( var i = 0; i < o.length; i++ ) { + if ( os[ o[i] ] == null ) + os[ o[i] ] = { rows: new Array(), n: null }; + os[ o[i] ].rows.push( i ); + } + + for ( var i in ns ) { + if ( ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1 ) { + n[ ns[i].rows[0] ] = { text: n[ ns[i].rows[0] ], row: os[i].rows[0] }; + o[ os[i].rows[0] ] = { text: o[ os[i].rows[0] ], row: ns[i].rows[0] }; + } + } + + for ( var i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[i+1].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && + n[i+1] == o[ n[i].row + 1 ] ) { + n[i+1] = { text: n[i+1], row: n[i].row + 1 }; + o[n[i].row+1] = { text: o[n[i].row+1], row: i + 1 }; + } + } + + for ( var i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[i-1].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && + n[i-1] == o[ n[i].row - 1 ] ) { + n[i-1] = { text: n[i-1], row: n[i].row - 1 }; + o[n[i].row-1] = { text: o[n[i].row-1], row: i - 1 }; + } + } + + return { o: o, n: n }; +} + diff --git a/tests/index.html b/tests/index.html index 2c2968408..da3700d93 100644 --- a/tests/index.html +++ b/tests/index.html @@ -4,16 +4,10 @@ jQuery UI Tests - - - + + + - @@ -22,75 +16,37 @@ + + + - - - - - + + + + + + + + - - - - - - + + + + + +
Interaction Static VisualStaticVisualDiff
Draggable
Droppable
Resizable
Selectable
Sortable
Draggable
Droppable
Resizable
Sortable
Widget Static VisualStaticVisualDiff
Accordion
Datepicker
Dialog
Progressbar
slider
Tabs
Accordion
Datepicker
Dialog
Progressbar
slider
Tabs
-
- -
- - - diff --git a/tests/slider.html b/tests/slider.html new file mode 100644 index 000000000..78d86d95c --- /dev/null +++ b/tests/slider.html @@ -0,0 +1,63 @@ + + + + jQuery UI Tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Default Slider TestsStaticVisualStaticVisualDiff
Default
Vertical
Horizontal Slider TestsStaticVisualStaticVisualDiff
Horizontal
Horizontal range
Horizontal range max
Horizontal range min
Vertical Slider TestsStaticVisualStaticVisualDiff
Vertical
Vertical range
Vertical range max
Vertical range min
+ + + diff --git a/tests/static/draggable/default.html b/tests/static/draggable/default.html index 3bf844b18..d5d92ef25 100644 --- a/tests/static/draggable/default.html +++ b/tests/static/draggable/default.html @@ -10,11 +10,7 @@ -
-

- Draggable -

-
+

Draggable

diff --git a/tests/static/droppable/default.html b/tests/static/droppable/default.html index c010ab767..61504bc18 100644 --- a/tests/static/droppable/default.html +++ b/tests/static/droppable/default.html @@ -10,9 +10,7 @@ -
- Droppable -
+

Droppable

diff --git a/tests/static/slider/default.html b/tests/static/slider/default.html index 2bda5f322..fba92d9eb 100644 --- a/tests/static/slider/default.html +++ b/tests/static/slider/default.html @@ -10,9 +10,7 @@ -
- -
+
diff --git a/tests/static/slider/default_vertical.html b/tests/static/slider/default_vertical.html index b47dc4bbb..208c3c77c 100644 --- a/tests/static/slider/default_vertical.html +++ b/tests/static/slider/default_vertical.html @@ -10,9 +10,7 @@ -
- -
+
diff --git a/tests/static/slider/slider_horizontal.html b/tests/static/slider/slider_horizontal.html index c4275d608..de510a835 100644 --- a/tests/static/slider/slider_horizontal.html +++ b/tests/static/slider/slider_horizontal.html @@ -10,9 +10,7 @@ -
- -
+
diff --git a/tests/static/slider/slider_horizontal_range.html b/tests/static/slider/slider_horizontal_range.html index 7ab6e6cd7..d19babde8 100644 --- a/tests/static/slider/slider_horizontal_range.html +++ b/tests/static/slider/slider_horizontal_range.html @@ -10,11 +10,7 @@ -
-
- - -
+
diff --git a/tests/static/slider/slider_horizontal_range_max.html b/tests/static/slider/slider_horizontal_range_max.html index 03466e3f8..e0f3d0080 100644 --- a/tests/static/slider/slider_horizontal_range_max.html +++ b/tests/static/slider/slider_horizontal_range_max.html @@ -10,10 +10,7 @@ -
-
- -
+
diff --git a/tests/static/slider/slider_horizontal_range_min.html b/tests/static/slider/slider_horizontal_range_min.html index 72741b0dc..7c553668d 100644 --- a/tests/static/slider/slider_horizontal_range_min.html +++ b/tests/static/slider/slider_horizontal_range_min.html @@ -10,10 +10,7 @@ -
-
- -
+
diff --git a/tests/static/slider/slider_vertical.html b/tests/static/slider/slider_vertical.html index 75579caea..dc729cf40 100644 --- a/tests/static/slider/slider_vertical.html +++ b/tests/static/slider/slider_vertical.html @@ -10,9 +10,7 @@ -
- -
+
diff --git a/tests/static/slider/slider_vertical_range.html b/tests/static/slider/slider_vertical_range.html index deb839c0b..f0a772b13 100644 --- a/tests/static/slider/slider_vertical_range.html +++ b/tests/static/slider/slider_vertical_range.html @@ -10,11 +10,7 @@ -
-
- - -
+
diff --git a/tests/static/slider/slider_vertical_range_max.html b/tests/static/slider/slider_vertical_range_max.html index e7bac01a1..d35e1e455 100644 --- a/tests/static/slider/slider_vertical_range_max.html +++ b/tests/static/slider/slider_vertical_range_max.html @@ -10,10 +10,7 @@ -
-
- -
+
diff --git a/tests/static/slider/slider_vertical_range_min.html b/tests/static/slider/slider_vertical_range_min.html index 6494688ee..946428f2d 100644 --- a/tests/static/slider/slider_vertical_range_min.html +++ b/tests/static/slider/slider_vertical_range_min.html @@ -10,10 +10,7 @@ -
-
- -
+
diff --git a/tests/static/sortable/default.html b/tests/static/sortable/default.html index 88d150aa5..bd70859f6 100644 --- a/tests/static/sortable/default.html +++ b/tests/static/sortable/default.html @@ -10,11 +10,7 @@ -
-
Sortable 1
-
Sortable 2
-
Sortable 3
-
+
Sortable 1
Sortable 2
Sortable 3
diff --git a/tests/static/tabs/default.html b/tests/static/tabs/default.html index 66dd06da9..d99e8b75c 100644 --- a/tests/static/tabs/default.html +++ b/tests/static/tabs/default.html @@ -1,15 +1,15 @@ - jQuery UI Tabs Static Markup Test Page + Tabs Static Test : Default + - + -