jquery-ui-rails 3.0.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jquery-ui-rails might be problematic. Click here for more details.

Files changed (61) hide show
  1. data/History.md +10 -0
  2. data/README.md +1 -1
  3. data/Rakefile +4 -5
  4. data/lib/jquery/ui/rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/jquery.ui.accordion.js +130 -290
  6. data/vendor/assets/javascripts/jquery.ui.autocomplete.js +30 -18
  7. data/vendor/assets/javascripts/jquery.ui.button.js +9 -8
  8. data/vendor/assets/javascripts/jquery.ui.core.js +19 -53
  9. data/vendor/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
  10. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
  11. data/vendor/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
  12. data/vendor/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
  13. data/vendor/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
  14. data/vendor/assets/javascripts/jquery.ui.datepicker.js +1076 -878
  15. data/vendor/assets/javascripts/jquery.ui.dialog.js +456 -547
  16. data/vendor/assets/javascripts/jquery.ui.draggable.js +317 -207
  17. data/vendor/assets/javascripts/jquery.ui.droppable.js +177 -100
  18. data/vendor/assets/javascripts/jquery.ui.effect-blind.js +2 -2
  19. data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +2 -2
  20. data/vendor/assets/javascripts/jquery.ui.effect-clip.js +2 -2
  21. data/vendor/assets/javascripts/jquery.ui.effect-drop.js +2 -2
  22. data/vendor/assets/javascripts/jquery.ui.effect-explode.js +2 -2
  23. data/vendor/assets/javascripts/jquery.ui.effect-fade.js +2 -2
  24. data/vendor/assets/javascripts/jquery.ui.effect-fold.js +2 -2
  25. data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +2 -2
  26. data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +2 -2
  27. data/vendor/assets/javascripts/jquery.ui.effect-scale.js +2 -2
  28. data/vendor/assets/javascripts/jquery.ui.effect-shake.js +2 -2
  29. data/vendor/assets/javascripts/jquery.ui.effect-slide.js +2 -2
  30. data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +3 -3
  31. data/vendor/assets/javascripts/jquery.ui.effect.js +91 -99
  32. data/vendor/assets/javascripts/jquery.ui.menu.js +20 -9
  33. data/vendor/assets/javascripts/jquery.ui.mouse.js +25 -25
  34. data/vendor/assets/javascripts/jquery.ui.position.js +39 -59
  35. data/vendor/assets/javascripts/jquery.ui.progressbar.js +73 -33
  36. data/vendor/assets/javascripts/jquery.ui.resizable.js +461 -294
  37. data/vendor/assets/javascripts/jquery.ui.selectable.js +67 -51
  38. data/vendor/assets/javascripts/jquery.ui.slider.js +100 -95
  39. data/vendor/assets/javascripts/jquery.ui.sortable.js +411 -257
  40. data/vendor/assets/javascripts/jquery.ui.spinner.js +19 -5
  41. data/vendor/assets/javascripts/jquery.ui.tabs.js +47 -567
  42. data/vendor/assets/javascripts/jquery.ui.tooltip.js +14 -10
  43. data/vendor/assets/javascripts/jquery.ui.widget.js +33 -40
  44. data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +30 -8
  45. data/vendor/assets/stylesheets/jquery.ui.all.css.erb +2 -2
  46. data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +2 -5
  47. data/vendor/assets/stylesheets/jquery.ui.base.css.erb +2 -2
  48. data/vendor/assets/stylesheets/jquery.ui.button.css.erb +100 -26
  49. data/vendor/assets/stylesheets/jquery.ui.core.css.erb +65 -12
  50. data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +166 -55
  51. data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +61 -14
  52. data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +61 -14
  53. data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +20 -4
  54. data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +70 -13
  55. data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +7 -3
  56. data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +63 -15
  57. data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +52 -10
  58. data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +44 -10
  59. data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +196 -38
  60. data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +4 -6
  61. metadata +8 -3
@@ -3,10 +3,10 @@
3
3
  //= require jquery.ui.button
4
4
 
5
5
  /*!
6
- * jQuery UI Spinner 1.9.2
6
+ * jQuery UI Spinner 1.10.0
7
7
  * http://jqueryui.com
8
8
  *
9
- * Copyright 2012 jQuery Foundation and other contributors
9
+ * Copyright 2013 jQuery Foundation and other contributors
10
10
  * Released under the MIT license.
11
11
  * http://jquery.org/license
12
12
  *
@@ -31,7 +31,7 @@ function modifier( fn ) {
31
31
  }
32
32
 
33
33
  $.widget( "ui.spinner", {
34
- version: "1.9.2",
34
+ version: "1.10.0",
35
35
  defaultElement: "<input>",
36
36
  widgetEventPrefix: "spin",
37
37
  options: {
@@ -372,6 +372,14 @@ $.widget( "ui.spinner", {
372
372
  value = this._parse( value );
373
373
  }
374
374
  }
375
+ if ( key === "icons" ) {
376
+ this.buttons.first().find( ".ui-icon" )
377
+ .removeClass( this.options.icons.up )
378
+ .addClass( value.up );
379
+ this.buttons.last().find( ".ui-icon" )
380
+ .removeClass( this.options.icons.down )
381
+ .addClass( value.down );
382
+ }
375
383
 
376
384
  this._super( key, value );
377
385
 
@@ -449,14 +457,20 @@ $.widget( "ui.spinner", {
449
457
  this._stepUp( steps );
450
458
  }),
451
459
  _stepUp: function( steps ) {
452
- this._spin( (steps || 1) * this.options.step );
460
+ if ( this._start() ) {
461
+ this._spin( (steps || 1) * this.options.step );
462
+ this._stop();
463
+ }
453
464
  },
454
465
 
455
466
  stepDown: modifier(function( steps ) {
456
467
  this._stepDown( steps );
457
468
  }),
458
469
  _stepDown: function( steps ) {
459
- this._spin( (steps || 1) * -this.options.step );
470
+ if ( this._start() ) {
471
+ this._spin( (steps || 1) * -this.options.step );
472
+ this._stop();
473
+ }
460
474
  },
461
475
 
462
476
  pageUp: modifier(function( pages ) {
@@ -2,10 +2,10 @@
2
2
  //= require jquery.ui.widget
3
3
 
4
4
  /*!
5
- * jQuery UI Tabs 1.9.2
5
+ * jQuery UI Tabs 1.10.0
6
6
  * http://jqueryui.com
7
7
  *
8
- * Copyright 2012 jQuery Foundation and other contributors
8
+ * Copyright 2013 jQuery Foundation and other contributors
9
9
  * Released under the MIT license.
10
10
  * http://jquery.org/license
11
11
  *
@@ -26,16 +26,12 @@ function getNextTabId() {
26
26
 
27
27
  function isLocal( anchor ) {
28
28
  return anchor.hash.length > 1 &&
29
- anchor.href.replace( rhash, "" ) ===
30
- location.href.replace( rhash, "" )
31
- // support: Safari 5.1
32
- // Safari 5.1 doesn't encode spaces in window.location
33
- // but it does encode spaces from anchors (#8777)
34
- .replace( /\s/g, "%20" );
29
+ decodeURIComponent( anchor.href.replace( rhash, "" ) ) ===
30
+ decodeURIComponent( location.href.replace( rhash, "" ) );
35
31
  }
36
32
 
37
33
  $.widget( "ui.tabs", {
38
- version: "1.9.2",
34
+ version: "1.10.0",
39
35
  delay: 300,
40
36
  options: {
41
37
  active: null,
@@ -54,9 +50,7 @@ $.widget( "ui.tabs", {
54
50
 
55
51
  _create: function() {
56
52
  var that = this,
57
- options = this.options,
58
- active = options.active,
59
- locationHash = location.hash.substring( 1 );
53
+ options = this.options;
60
54
 
61
55
  this.running = false;
62
56
 
@@ -82,6 +76,36 @@ $.widget( "ui.tabs", {
82
76
  });
83
77
 
84
78
  this._processTabs();
79
+ options.active = this._initialActive();
80
+
81
+ // Take disabling tabs via class attribute from HTML
82
+ // into account and update option properly.
83
+ if ( $.isArray( options.disabled ) ) {
84
+ options.disabled = $.unique( options.disabled.concat(
85
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
86
+ return that.tabs.index( li );
87
+ })
88
+ ) ).sort();
89
+ }
90
+
91
+ // check for length avoids error when initializing empty list
92
+ if ( this.options.active !== false && this.anchors.length ) {
93
+ this.active = this._findActive( options.active );
94
+ } else {
95
+ this.active = $();
96
+ }
97
+
98
+ this._refresh();
99
+
100
+ if ( this.active.length ) {
101
+ this.load( options.active );
102
+ }
103
+ },
104
+
105
+ _initialActive: function() {
106
+ var active = this.options.active,
107
+ collapsible = this.options.collapsible,
108
+ locationHash = location.hash.substring( 1 );
85
109
 
86
110
  if ( active === null ) {
87
111
  // check the fragment identifier in the URL
@@ -109,38 +133,16 @@ $.widget( "ui.tabs", {
109
133
  if ( active !== false ) {
110
134
  active = this.tabs.index( this.tabs.eq( active ) );
111
135
  if ( active === -1 ) {
112
- active = options.collapsible ? false : 0;
136
+ active = collapsible ? false : 0;
113
137
  }
114
138
  }
115
- options.active = active;
116
139
 
117
140
  // don't allow collapsible: false and active: false
118
- if ( !options.collapsible && options.active === false && this.anchors.length ) {
119
- options.active = 0;
141
+ if ( !collapsible && active === false && this.anchors.length ) {
142
+ active = 0;
120
143
  }
121
144
 
122
- // Take disabling tabs via class attribute from HTML
123
- // into account and update option properly.
124
- if ( $.isArray( options.disabled ) ) {
125
- options.disabled = $.unique( options.disabled.concat(
126
- $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
127
- return that.tabs.index( li );
128
- })
129
- ) ).sort();
130
- }
131
-
132
- // check for length avoids error when initializing empty list
133
- if ( this.options.active !== false && this.anchors.length ) {
134
- this.active = this._findActive( this.options.active );
135
- } else {
136
- this.active = $();
137
- }
138
-
139
- this._refresh();
140
-
141
- if ( this.active.length ) {
142
- this.load( options.active );
143
- }
145
+ return active;
144
146
  },
145
147
 
146
148
  _getCreateEventData: function() {
@@ -151,6 +153,7 @@ $.widget( "ui.tabs", {
151
153
  },
152
154
 
153
155
  _tabKeydown: function( event ) {
156
+ /*jshint maxcomplexity:15*/
154
157
  var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
155
158
  selectedIndex = this.tabs.index( focusedTab ),
156
159
  goingForward = true;
@@ -495,19 +498,13 @@ $.widget( "ui.tabs", {
495
498
  },
496
499
 
497
500
  _setupHeightStyle: function( heightStyle ) {
498
- var maxHeight, overflow,
501
+ var maxHeight,
499
502
  parent = this.element.parent();
500
503
 
501
504
  if ( heightStyle === "fill" ) {
502
- // IE 6 treats height like minHeight, so we need to turn off overflow
503
- // in order to get a reliable height
504
- // we use the minHeight support test because we assume that only
505
- // browsers that don't support minHeight will treat height as minHeight
506
- if ( !$.support.minHeight ) {
507
- overflow = parent.css( "overflow" );
508
- parent.css( "overflow", "hidden");
509
- }
510
505
  maxHeight = parent.height();
506
+ maxHeight -= this.element.outerHeight() - this.element.height();
507
+
511
508
  this.element.siblings( ":visible" ).each(function() {
512
509
  var elem = $( this ),
513
510
  position = elem.css( "position" );
@@ -517,9 +514,6 @@ $.widget( "ui.tabs", {
517
514
  }
518
515
  maxHeight -= elem.outerHeight( true );
519
516
  });
520
- if ( overflow ) {
521
- parent.css( "overflow", overflow );
522
- }
523
517
 
524
518
  this.element.children().not( this.panels ).each(function() {
525
519
  maxHeight -= $( this ).outerHeight( true );
@@ -698,8 +692,6 @@ $.widget( "ui.tabs", {
698
692
  .removeClass( "ui-tabs-anchor" )
699
693
  .removeAttr( "role" )
700
694
  .removeAttr( "tabIndex" )
701
- .removeData( "href.tabs" )
702
- .removeData( "load.tabs" )
703
695
  .removeUniqueId();
704
696
 
705
697
  this.tabs.add( this.panels ).each(function() {
@@ -724,7 +716,9 @@ $.widget( "ui.tabs", {
724
716
  var li = $( this ),
725
717
  prev = li.data( "ui-tabs-aria-controls" );
726
718
  if ( prev ) {
727
- li.attr( "aria-controls", prev );
719
+ li
720
+ .attr( "aria-controls", prev )
721
+ .removeData( "ui-tabs-aria-controls" );
728
722
  } else {
729
723
  li.removeAttr( "aria-controls" );
730
724
  }
@@ -835,7 +829,6 @@ $.widget( "ui.tabs", {
835
829
  }
836
830
  },
837
831
 
838
- // TODO: Remove this function in 1.10 when ajaxOptions is removed
839
832
  _ajaxSettings: function( anchor, event, eventData ) {
840
833
  var that = this;
841
834
  return {
@@ -853,517 +846,4 @@ $.widget( "ui.tabs", {
853
846
  }
854
847
  });
855
848
 
856
- // DEPRECATED
857
- if ( $.uiBackCompat !== false ) {
858
-
859
- // helper method for a lot of the back compat extensions
860
- $.ui.tabs.prototype._ui = function( tab, panel ) {
861
- return {
862
- tab: tab,
863
- panel: panel,
864
- index: this.anchors.index( tab )
865
- };
866
- };
867
-
868
- // url method
869
- $.widget( "ui.tabs", $.ui.tabs, {
870
- url: function( index, url ) {
871
- this.anchors.eq( index ).attr( "href", url );
872
- }
873
- });
874
-
875
- // TODO: Remove _ajaxSettings() method when removing this extension
876
- // ajaxOptions and cache options
877
- $.widget( "ui.tabs", $.ui.tabs, {
878
- options: {
879
- ajaxOptions: null,
880
- cache: false
881
- },
882
-
883
- _create: function() {
884
- this._super();
885
-
886
- var that = this;
887
-
888
- this._on({ tabsbeforeload: function( event, ui ) {
889
- // tab is already cached
890
- if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
891
- event.preventDefault();
892
- return;
893
- }
894
-
895
- ui.jqXHR.success(function() {
896
- if ( that.options.cache ) {
897
- $.data( ui.tab[ 0 ], "cache.tabs", true );
898
- }
899
- });
900
- }});
901
- },
902
-
903
- _ajaxSettings: function( anchor, event, ui ) {
904
- var ajaxOptions = this.options.ajaxOptions;
905
- return $.extend( {}, ajaxOptions, {
906
- error: function( xhr, status ) {
907
- try {
908
- // Passing index avoid a race condition when this method is
909
- // called after the user has selected another tab.
910
- // Pass the anchor that initiated this request allows
911
- // loadError to manipulate the tab content panel via $(a.hash)
912
- ajaxOptions.error(
913
- xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
914
- }
915
- catch ( error ) {}
916
- }
917
- }, this._superApply( arguments ) );
918
- },
919
-
920
- _setOption: function( key, value ) {
921
- // reset cache if switching from cached to not cached
922
- if ( key === "cache" && value === false ) {
923
- this.anchors.removeData( "cache.tabs" );
924
- }
925
- this._super( key, value );
926
- },
927
-
928
- _destroy: function() {
929
- this.anchors.removeData( "cache.tabs" );
930
- this._super();
931
- },
932
-
933
- url: function( index ){
934
- this.anchors.eq( index ).removeData( "cache.tabs" );
935
- this._superApply( arguments );
936
- }
937
- });
938
-
939
- // abort method
940
- $.widget( "ui.tabs", $.ui.tabs, {
941
- abort: function() {
942
- if ( this.xhr ) {
943
- this.xhr.abort();
944
- }
945
- }
946
- });
947
-
948
- // spinner
949
- $.widget( "ui.tabs", $.ui.tabs, {
950
- options: {
951
- spinner: "<em>Loading&#8230;</em>"
952
- },
953
- _create: function() {
954
- this._super();
955
- this._on({
956
- tabsbeforeload: function( event, ui ) {
957
- // Don't react to nested tabs or tabs that don't use a spinner
958
- if ( event.target !== this.element[ 0 ] ||
959
- !this.options.spinner ) {
960
- return;
961
- }
962
-
963
- var span = ui.tab.find( "span" ),
964
- html = span.html();
965
- span.html( this.options.spinner );
966
- ui.jqXHR.complete(function() {
967
- span.html( html );
968
- });
969
- }
970
- });
971
- }
972
- });
973
-
974
- // enable/disable events
975
- $.widget( "ui.tabs", $.ui.tabs, {
976
- options: {
977
- enable: null,
978
- disable: null
979
- },
980
-
981
- enable: function( index ) {
982
- var options = this.options,
983
- trigger;
984
-
985
- if ( index && options.disabled === true ||
986
- ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
987
- trigger = true;
988
- }
989
-
990
- this._superApply( arguments );
991
-
992
- if ( trigger ) {
993
- this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
994
- }
995
- },
996
-
997
- disable: function( index ) {
998
- var options = this.options,
999
- trigger;
1000
-
1001
- if ( index && options.disabled === false ||
1002
- ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
1003
- trigger = true;
1004
- }
1005
-
1006
- this._superApply( arguments );
1007
-
1008
- if ( trigger ) {
1009
- this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
1010
- }
1011
- }
1012
- });
1013
-
1014
- // add/remove methods and events
1015
- $.widget( "ui.tabs", $.ui.tabs, {
1016
- options: {
1017
- add: null,
1018
- remove: null,
1019
- tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
1020
- },
1021
-
1022
- add: function( url, label, index ) {
1023
- if ( index === undefined ) {
1024
- index = this.anchors.length;
1025
- }
1026
-
1027
- var doInsertAfter, panel,
1028
- options = this.options,
1029
- li = $( options.tabTemplate
1030
- .replace( /#\{href\}/g, url )
1031
- .replace( /#\{label\}/g, label ) ),
1032
- id = !url.indexOf( "#" ) ?
1033
- url.replace( "#", "" ) :
1034
- this._tabId( li );
1035
-
1036
- li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
1037
- li.attr( "aria-controls", id );
1038
-
1039
- doInsertAfter = index >= this.tabs.length;
1040
-
1041
- // try to find an existing element before creating a new one
1042
- panel = this.element.find( "#" + id );
1043
- if ( !panel.length ) {
1044
- panel = this._createPanel( id );
1045
- if ( doInsertAfter ) {
1046
- if ( index > 0 ) {
1047
- panel.insertAfter( this.panels.eq( -1 ) );
1048
- } else {
1049
- panel.appendTo( this.element );
1050
- }
1051
- } else {
1052
- panel.insertBefore( this.panels[ index ] );
1053
- }
1054
- }
1055
- panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
1056
-
1057
- if ( doInsertAfter ) {
1058
- li.appendTo( this.tablist );
1059
- } else {
1060
- li.insertBefore( this.tabs[ index ] );
1061
- }
1062
-
1063
- options.disabled = $.map( options.disabled, function( n ) {
1064
- return n >= index ? ++n : n;
1065
- });
1066
-
1067
- this.refresh();
1068
- if ( this.tabs.length === 1 && options.active === false ) {
1069
- this.option( "active", 0 );
1070
- }
1071
-
1072
- this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
1073
- return this;
1074
- },
1075
-
1076
- remove: function( index ) {
1077
- index = this._getIndex( index );
1078
- var options = this.options,
1079
- tab = this.tabs.eq( index ).remove(),
1080
- panel = this._getPanelForTab( tab ).remove();
1081
-
1082
- // If selected tab was removed focus tab to the right or
1083
- // in case the last tab was removed the tab to the left.
1084
- // We check for more than 2 tabs, because if there are only 2,
1085
- // then when we remove this tab, there will only be one tab left
1086
- // so we don't need to detect which tab to activate.
1087
- if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
1088
- this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
1089
- }
1090
-
1091
- options.disabled = $.map(
1092
- $.grep( options.disabled, function( n ) {
1093
- return n !== index;
1094
- }),
1095
- function( n ) {
1096
- return n >= index ? --n : n;
1097
- });
1098
-
1099
- this.refresh();
1100
-
1101
- this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) );
1102
- return this;
1103
- }
1104
- });
1105
-
1106
- // length method
1107
- $.widget( "ui.tabs", $.ui.tabs, {
1108
- length: function() {
1109
- return this.anchors.length;
1110
- }
1111
- });
1112
-
1113
- // panel ids (idPrefix option + title attribute)
1114
- $.widget( "ui.tabs", $.ui.tabs, {
1115
- options: {
1116
- idPrefix: "ui-tabs-"
1117
- },
1118
-
1119
- _tabId: function( tab ) {
1120
- var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab;
1121
- a = a[0];
1122
- return $( a ).closest( "li" ).attr( "aria-controls" ) ||
1123
- a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) ||
1124
- this.options.idPrefix + getNextTabId();
1125
- }
1126
- });
1127
-
1128
- // _createPanel method
1129
- $.widget( "ui.tabs", $.ui.tabs, {
1130
- options: {
1131
- panelTemplate: "<div></div>"
1132
- },
1133
-
1134
- _createPanel: function( id ) {
1135
- return $( this.options.panelTemplate )
1136
- .attr( "id", id )
1137
- .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
1138
- .data( "ui-tabs-destroy", true );
1139
- }
1140
- });
1141
-
1142
- // selected option
1143
- $.widget( "ui.tabs", $.ui.tabs, {
1144
- _create: function() {
1145
- var options = this.options;
1146
- if ( options.active === null && options.selected !== undefined ) {
1147
- options.active = options.selected === -1 ? false : options.selected;
1148
- }
1149
- this._super();
1150
- options.selected = options.active;
1151
- if ( options.selected === false ) {
1152
- options.selected = -1;
1153
- }
1154
- },
1155
-
1156
- _setOption: function( key, value ) {
1157
- if ( key !== "selected" ) {
1158
- return this._super( key, value );
1159
- }
1160
-
1161
- var options = this.options;
1162
- this._super( "active", value === -1 ? false : value );
1163
- options.selected = options.active;
1164
- if ( options.selected === false ) {
1165
- options.selected = -1;
1166
- }
1167
- },
1168
-
1169
- _eventHandler: function() {
1170
- this._superApply( arguments );
1171
- this.options.selected = this.options.active;
1172
- if ( this.options.selected === false ) {
1173
- this.options.selected = -1;
1174
- }
1175
- }
1176
- });
1177
-
1178
- // show and select event
1179
- $.widget( "ui.tabs", $.ui.tabs, {
1180
- options: {
1181
- show: null,
1182
- select: null
1183
- },
1184
- _create: function() {
1185
- this._super();
1186
- if ( this.options.active !== false ) {
1187
- this._trigger( "show", null, this._ui(
1188
- this.active.find( ".ui-tabs-anchor" )[ 0 ],
1189
- this._getPanelForTab( this.active )[ 0 ] ) );
1190
- }
1191
- },
1192
- _trigger: function( type, event, data ) {
1193
- var tab, panel,
1194
- ret = this._superApply( arguments );
1195
-
1196
- if ( !ret ) {
1197
- return false;
1198
- }
1199
-
1200
- if ( type === "beforeActivate" ) {
1201
- tab = data.newTab.length ? data.newTab : data.oldTab;
1202
- panel = data.newPanel.length ? data.newPanel : data.oldPanel;
1203
- ret = this._super( "select", event, {
1204
- tab: tab.find( ".ui-tabs-anchor" )[ 0],
1205
- panel: panel[ 0 ],
1206
- index: tab.closest( "li" ).index()
1207
- });
1208
- } else if ( type === "activate" && data.newTab.length ) {
1209
- ret = this._super( "show", event, {
1210
- tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
1211
- panel: data.newPanel[ 0 ],
1212
- index: data.newTab.closest( "li" ).index()
1213
- });
1214
- }
1215
- return ret;
1216
- }
1217
- });
1218
-
1219
- // select method
1220
- $.widget( "ui.tabs", $.ui.tabs, {
1221
- select: function( index ) {
1222
- index = this._getIndex( index );
1223
- if ( index === -1 ) {
1224
- if ( this.options.collapsible && this.options.selected !== -1 ) {
1225
- index = this.options.selected;
1226
- } else {
1227
- return;
1228
- }
1229
- }
1230
- this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace );
1231
- }
1232
- });
1233
-
1234
- // cookie option
1235
- (function() {
1236
-
1237
- var listId = 0;
1238
-
1239
- $.widget( "ui.tabs", $.ui.tabs, {
1240
- options: {
1241
- cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
1242
- },
1243
- _create: function() {
1244
- var options = this.options,
1245
- active;
1246
- if ( options.active == null && options.cookie ) {
1247
- active = parseInt( this._cookie(), 10 );
1248
- if ( active === -1 ) {
1249
- active = false;
1250
- }
1251
- options.active = active;
1252
- }
1253
- this._super();
1254
- },
1255
- _cookie: function( active ) {
1256
- var cookie = [ this.cookie ||
1257
- ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
1258
- if ( arguments.length ) {
1259
- cookie.push( active === false ? -1 : active );
1260
- cookie.push( this.options.cookie );
1261
- }
1262
- return $.cookie.apply( null, cookie );
1263
- },
1264
- _refresh: function() {
1265
- this._super();
1266
- if ( this.options.cookie ) {
1267
- this._cookie( this.options.active, this.options.cookie );
1268
- }
1269
- },
1270
- _eventHandler: function() {
1271
- this._superApply( arguments );
1272
- if ( this.options.cookie ) {
1273
- this._cookie( this.options.active, this.options.cookie );
1274
- }
1275
- },
1276
- _destroy: function() {
1277
- this._super();
1278
- if ( this.options.cookie ) {
1279
- this._cookie( null, this.options.cookie );
1280
- }
1281
- }
1282
- });
1283
-
1284
- })();
1285
-
1286
- // load event
1287
- $.widget( "ui.tabs", $.ui.tabs, {
1288
- _trigger: function( type, event, data ) {
1289
- var _data = $.extend( {}, data );
1290
- if ( type === "load" ) {
1291
- _data.panel = _data.panel[ 0 ];
1292
- _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
1293
- }
1294
- return this._super( type, event, _data );
1295
- }
1296
- });
1297
-
1298
- // fx option
1299
- // The new animation options (show, hide) conflict with the old show callback.
1300
- // The old fx option wins over show/hide anyway (always favor back-compat).
1301
- // If a user wants to use the new animation API, they must give up the old API.
1302
- $.widget( "ui.tabs", $.ui.tabs, {
1303
- options: {
1304
- fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
1305
- },
1306
-
1307
- _getFx: function() {
1308
- var hide, show,
1309
- fx = this.options.fx;
1310
-
1311
- if ( fx ) {
1312
- if ( $.isArray( fx ) ) {
1313
- hide = fx[ 0 ];
1314
- show = fx[ 1 ];
1315
- } else {
1316
- hide = show = fx;
1317
- }
1318
- }
1319
-
1320
- return fx ? { show: show, hide: hide } : null;
1321
- },
1322
-
1323
- _toggle: function( event, eventData ) {
1324
- var that = this,
1325
- toShow = eventData.newPanel,
1326
- toHide = eventData.oldPanel,
1327
- fx = this._getFx();
1328
-
1329
- if ( !fx ) {
1330
- return this._super( event, eventData );
1331
- }
1332
-
1333
- that.running = true;
1334
-
1335
- function complete() {
1336
- that.running = false;
1337
- that._trigger( "activate", event, eventData );
1338
- }
1339
-
1340
- function show() {
1341
- eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
1342
-
1343
- if ( toShow.length && fx.show ) {
1344
- toShow
1345
- .animate( fx.show, fx.show.duration, function() {
1346
- complete();
1347
- });
1348
- } else {
1349
- toShow.show();
1350
- complete();
1351
- }
1352
- }
1353
-
1354
- // start out by hiding, then showing, then completing
1355
- if ( toHide.length && fx.hide ) {
1356
- toHide.animate( fx.hide, fx.hide.duration, function() {
1357
- eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
1358
- show();
1359
- });
1360
- } else {
1361
- eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
1362
- toHide.hide();
1363
- show();
1364
- }
1365
- }
1366
- });
1367
- }
1368
-
1369
849
  })( jQuery );