WordPress Social Tools, Related Posts, Monetization – Shareaholic - Version 7.0.2.0

Version Description

  • This is a big update based on a lot of user feedback!
  • For Facebook, sharers are now taken directly to Facebook
  • Fixed how Twitter and Facebook sharing work on mobile devices
  • Now access Share Button and Related Content settings without a (free) account, although it is highly encouraged
  • Bugfix: Unresponsive "Edit Button" and "General Website Settings" button
Download this release

Release Info

Developer shareaholic
Plugin Icon 128x128 WordPress Social Tools, Related Posts, Monetization – Shareaholic
Version 7.0.2.0
Comparing to
See all releases

Code changes from version 7.0.1.0 to 7.0.2.0

admin.php CHANGED
@@ -149,14 +149,14 @@ class ShareaholicAdmin {
149
  array_push($csss, ShareaholicUtilities::asset_url('application.css'));
150
  array_push($csss, plugins_url('assets/css/bootstrap.min.css', __FILE__));
151
  array_push($csss, plugins_url('assets/css/main.css', __FILE__));
152
- array_push($csss, 'http://fonts.googleapis.com/css?family=Open+Sans:400,300,700');
153
 
154
  $javascripts = array();
155
- array_push($javascripts, '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
156
- array_push($javascripts, ShareaholicUtilities::asset_url('application.js'));
157
  array_push($javascripts, ShareaholicUtilities::asset_url('pub/shareaholic.js'));
158
- // array_push($javascripts, ShareaholicUtilities::asset_url('pub/utilities.js'));
159
  array_push($javascripts, plugins_url('assets/js/bootstrap.min.js', __FILE__));
 
 
 
160
  array_push($javascripts, plugins_url('assets/js/main.js', __FILE__));
161
 
162
  foreach ($csss as $css) {
@@ -352,4 +352,4 @@ class ShareaholicAdmin {
352
  }
353
  }
354
  }
355
- ?>
149
  array_push($csss, ShareaholicUtilities::asset_url('application.css'));
150
  array_push($csss, plugins_url('assets/css/bootstrap.min.css', __FILE__));
151
  array_push($csss, plugins_url('assets/css/main.css', __FILE__));
152
+ array_push($csss, '//fonts.googleapis.com/css?family=Open+Sans:400,300,700');
153
 
154
  $javascripts = array();
 
 
155
  array_push($javascripts, ShareaholicUtilities::asset_url('pub/shareaholic.js'));
 
156
  array_push($javascripts, plugins_url('assets/js/bootstrap.min.js', __FILE__));
157
+ array_push($javascripts, plugins_url('assets/js/jquery_custom.js', __FILE__));
158
+ array_push($javascripts, plugins_url('assets/js/jquery_ui_custom.js', __FILE__));
159
+ array_push($javascripts, plugins_url('assets/js/jquery.reveal.modified.js', __FILE__));
160
  array_push($javascripts, plugins_url('assets/js/main.js', __FILE__));
161
 
162
  foreach ($csss as $css) {
352
  }
353
  }
354
  }
355
+ ?>
assets/css/main.css CHANGED
@@ -2,6 +2,10 @@ body {
2
  background: transparent;
3
  }
4
 
 
 
 
 
5
  fieldset {
6
  border: 1px solid #d8d8d8;
7
  margin: 5px;
@@ -12,6 +16,14 @@ fieldset {
12
  float:left;
13
  }
14
 
 
 
 
 
 
 
 
 
15
  legend {
16
  border: none;
17
  width: auto;
2
  background: transparent;
3
  }
4
 
5
+ #app_settings{
6
+ padding-top:20px;
7
+ }
8
+
9
  fieldset {
10
  border: 1px solid #d8d8d8;
11
  margin: 5px;
16
  float:left;
17
  }
18
 
19
+ .app {
20
+ width:100%;
21
+ }
22
+
23
+ .app h2 {
24
+ font-size: 20px;
25
+ }
26
+
27
  legend {
28
  border: none;
29
  width: auto;
assets/js/jquery.reveal.modified.js ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Reveal Plugin 1.0
3
+ * Copyright 2010, ZURB
4
+ * Free to use under the MIT license.
5
+ * http://www.opensource.org/licenses/mit-license.php
6
+ *
7
+ * Modified : Dan Horan
8
+ *
9
+ * Added functionality to mention scrollheight in the config
10
+ *
11
+ */
12
+
13
+ (function($) {
14
+
15
+ /*---------------------------
16
+ Defaults for Reveal
17
+ ----------------------------*/
18
+
19
+ /*---------------------------
20
+ Listener for data-reveal-id attributes
21
+ ----------------------------*/
22
+
23
+ $('a[data-reveal-id]').live('click', function(e) {
24
+ e.preventDefault();
25
+ var modalLocation = $(this).attr('data-reveal-id');
26
+ $('#'+modalLocation).reveal($(this).data());
27
+ });
28
+
29
+ /*---------------------------
30
+ Extend and Execute
31
+ ----------------------------*/
32
+
33
+ $.widget("ui.reveal", {
34
+ options: {
35
+ animation: 'fadeAndPop' //fade, fadeAndPop, none
36
+ , animationspeed: 300 //how fast animtions are
37
+ , closeonbackgroundclick: true //if you click background will modal close?
38
+ , closeonesc: true //if you hit the ESC key will modal close?
39
+ , dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
40
+ , backdrop: true //Show the modal by default or not
41
+ , autoshow: true //Show the modal by default or not
42
+ , showevent: 'show' // event to listen on the modal container to trigger show
43
+ , shownevent: 'shown' // event to listen on the modal container after the modal box is shown
44
+ , hideevent: 'hide' // event to listen on the modal container to trigger hide
45
+ , hiddenevent: 'hidden' // event to listen on the modal container after the modal is hidden
46
+ , draggable: false
47
+ , draghandle: null
48
+ , fixed: true
49
+ , topPosition: 150
50
+ //scrollHeight: <integer> This attribute if not passed will be calculated at the runtime and used
51
+ },
52
+ _create : function() {
53
+ var self = this, options = self.options;
54
+ /*---------------------------
55
+ Global Variables
56
+ ----------------------------*/
57
+ var modal = ( self.modal = self.element.addClass('reveal-modal') ),
58
+ topMeasure = ( self._topMeasure = parseInt(modal.css('top')) ),
59
+ topOffset = ( self._topOffset = modal.height() + topMeasure ),
60
+ locked = ( self._locked = false ),
61
+ modalBG = ( self.modalBG = $('.reveal-modal-bg') );
62
+
63
+ if(!modal.attr('id')){
64
+ modal.attr('id', (new Date).getTime() + Math.floor((Math.random()*100)+1))
65
+ }
66
+
67
+ self._isOpen = false;
68
+
69
+ if(options.draggable){
70
+ var drag_opts = { handle : options.draghandle };
71
+ modal.draggable(drag_opts);
72
+ }
73
+
74
+ /*---------------------------
75
+ Create Modal BG
76
+ ----------------------------*/
77
+
78
+ if(modalBG.length == 0) {
79
+ modalBG = ( self.modalBG = $('<div class="reveal-modal-bg" />').insertAfter(modal) );
80
+ }
81
+
82
+ /*---------------------------
83
+ Add Closing Listeners
84
+ ----------------------------*/
85
+
86
+ //Close Modal Listeners
87
+ var closeButton = $('.' + options.dismissmodalclass).off('click.reveal').on('click.reveal', function () {
88
+ self.close();
89
+ });
90
+
91
+ if(options.closeonbackgroundclick) {
92
+ self.modalBG.css({"cursor":"pointer"})
93
+ self.modalBG.off('click.reveal').on('click.reveal', function () {
94
+ self.close();
95
+ });
96
+ }
97
+
98
+ },
99
+
100
+ _init : function(){
101
+ var self = this, options = self.options;
102
+
103
+ //Entrance Animations
104
+ self.modal.on('reveal:open ' + options.showevent, function () {
105
+ if(!self._isOpen){ self.open(); }
106
+ });
107
+
108
+ //Closing Animation
109
+ self.modal.on('reveal:close ' + options.hideevent, function () {
110
+ if(self._isOpen){ self.close(); }
111
+ });
112
+
113
+ //Open Modal Immediately
114
+ options.autoshow && self.modal.trigger('reveal:open');
115
+
116
+
117
+ },
118
+
119
+ open : function(){
120
+ var self = this, options = self.options;
121
+ $('.' + options.dismissmodalclass).off('click.modalEvent');
122
+ if(!self._locked) {
123
+ self.lockModal();
124
+ self.modal.css({left: '50%'}); // reset the left position in the event it was dragged over.
125
+ if(options.animation == "fadeAndPop") {
126
+ var h = typeof options.scrollheight !== "undefined" ? options.scrollheight : $(document).scrollTop();
127
+ self.modal.css({'top': options.fixed ? 0 : h -self._topOffset, 'opacity' : 0, 'visibility' : 'visible'});
128
+ options.backdrop && self.modalBG.fadeIn(options.animationspeed/2);
129
+ self.modal.show().delay(options.animationspeed/2).animate({
130
+ "top": options.fixed ? options.topPosition : h+self._topMeasure + 'px',
131
+ "opacity" : 1
132
+ }, options.animationspeed,self.shown());
133
+ }
134
+ if(options.animation == "fade") {
135
+ self.modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+self._topMeasure});
136
+ self.modalBG.fadeIn(options.animationspeed/2);
137
+ self.modal.show().delay(options.animationspeed/2).animate({
138
+ "opacity" : 1
139
+ }, options.animationspeed,self.shown());
140
+ }
141
+ if(options.animation == "none") {
142
+ self.modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+self._topMeasure});
143
+ self.modalBG.show();
144
+ self.shown()
145
+ }
146
+ }
147
+ if(options.closeonesc){
148
+ $('body').on('keyup.reveal_' + self.modal.attr('id'), function(e) {
149
+ if(e.which===27){ self.close(); } // 27 is the keycode for the Escape key
150
+ });
151
+ }
152
+ self.modal.unbind('reveal:open');
153
+ },
154
+
155
+ close : function(event){
156
+ var self = this, options = self.options;
157
+ if(!self._locked) {
158
+ self.lockModal();
159
+ if(options.animation == "fadeAndPop") {
160
+ var h = typeof options.scrollheight !== "undefined" ? options.scrollheight : $(document).scrollTop();
161
+ options.backdrop && self.modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
162
+ self.modal.animate({
163
+ "top": options.fixed ? 0 : h - self._topOffset + 'px',
164
+ "opacity" : 0
165
+ }, options.animationspeed/2, function() {
166
+ self.modal.css({'top':self._topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
167
+ self.hidden(event);
168
+ });
169
+ }
170
+ if(options.animation == "fade") {
171
+ self.modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
172
+ self.modal.animate({
173
+ "opacity" : 0
174
+ }, options.animationspeed, function() {
175
+ self.modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : self._topMeasure});
176
+ self.hidden(event);
177
+ });
178
+ }
179
+ if(options.animation == "none") {
180
+ self.modal.css({'visibility' : 'hidden', 'top' : self._topMeasure});
181
+ self.modalBG.hide();
182
+ self.hidden(event);
183
+ }
184
+ }
185
+ $('body').off('keyup.reveal_' + self.modal.attr('id'));
186
+ self.modal.unbind('reveal:close');
187
+ },
188
+
189
+ shown : function() {
190
+ var self = this, options = self.options;
191
+ self.modal.trigger(options.shownevent);
192
+ self._isOpen = true;
193
+ self.unlockModal();
194
+ },
195
+
196
+ hidden : function(event) {
197
+ var self = this, options = self.options;
198
+ self.modal.trigger(options.hiddenevent);
199
+ self._trigger( "close", event );
200
+ self._isOpen = false;
201
+ self.unlockModal();
202
+ },
203
+
204
+ /*---------------------------
205
+ Animations Locks
206
+ ----------------------------*/
207
+ unlockModal: function() {
208
+ self._locked = false;
209
+ },
210
+
211
+ lockModal : function() {
212
+ self._locked = true;
213
+ }
214
+
215
+ });//Widget definition
216
+
217
+ })(sQuery);
assets/js/jquery_custom.js ADDED
@@ -0,0 +1,9227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.8.0
3
+ * http://jquery.com/
4
+ *
5
+ * Includes Sizzle.js
6
+ * http://sizzlejs.com/
7
+ *
8
+ * Copyright 2012 jQuery Foundation and other contributors
9
+ * Released under the MIT license
10
+ * http://jquery.org/license
11
+ *
12
+ * Date: Thu Aug 09 2012 16:24:48 GMT-0400 (Eastern Daylight Time)
13
+ */
14
+ (function( window, undefined ) {
15
+ var
16
+ // A central reference to the root jQuery(document)
17
+ rootjQuery,
18
+
19
+ // The deferred used on DOM ready
20
+ readyList,
21
+
22
+ // Use the correct document accordingly with window argument (sandbox)
23
+ document = window.document,
24
+ location = window.location,
25
+ navigator = window.navigator,
26
+
27
+ // Map over jQuery in case of overwrite
28
+ _jQuery = window.sQuery,
29
+
30
+ // Map over the $ in case of overwrite
31
+ _$ = window.$,
32
+
33
+ // Save a reference to some core methods
34
+ core_push = Array.prototype.push,
35
+ core_slice = Array.prototype.slice,
36
+ core_indexOf = Array.prototype.indexOf,
37
+ core_toString = Object.prototype.toString,
38
+ core_hasOwn = Object.prototype.hasOwnProperty,
39
+ core_trim = String.prototype.trim,
40
+
41
+ // Define a local copy of jQuery
42
+ jQuery = function( selector, context ) {
43
+ // The jQuery object is actually just the init constructor 'enhanced'
44
+ return new jQuery.fn.init( selector, context, rootjQuery );
45
+ },
46
+
47
+ // Used for matching numbers
48
+ core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
49
+
50
+ // Used for detecting and trimming whitespace
51
+ core_rnotwhite = /\S/,
52
+ core_rspace = /\s+/,
53
+
54
+ // IE doesn't match non-breaking spaces with \s
55
+ rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,
56
+
57
+ // A simple way to check for HTML strings
58
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
59
+ rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
60
+
61
+ // Match a standalone tag
62
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
63
+
64
+ // JSON RegExp
65
+ rvalidchars = /^[\],:{}\s]*$/,
66
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
67
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
68
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
69
+
70
+ // Matches dashed string for camelizing
71
+ rmsPrefix = /^-ms-/,
72
+ rdashAlpha = /-([\da-z])/gi,
73
+
74
+ // Used by jQuery.camelCase as callback to replace()
75
+ fcamelCase = function( all, letter ) {
76
+ return ( letter + "" ).toUpperCase();
77
+ },
78
+
79
+ // The ready event handler and self cleanup method
80
+ DOMContentLoaded = function() {
81
+ if ( document.addEventListener ) {
82
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
83
+ jQuery.ready();
84
+ } else if ( document.readyState === "complete" ) {
85
+ // we're here because readyState === "complete" in oldIE
86
+ // which is good enough for us to call the dom ready!
87
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
88
+ jQuery.ready();
89
+ }
90
+ },
91
+
92
+ // [[Class]] -> type pairs
93
+ class2type = {};
94
+
95
+ jQuery.fn = jQuery.prototype = {
96
+ constructor: jQuery,
97
+ init: function( selector, context, rootjQuery ) {
98
+ var match, elem, ret, doc;
99
+
100
+ // Handle $(""), $(null), $(undefined), $(false)
101
+ if ( !selector ) {
102
+ return this;
103
+ }
104
+
105
+ // Handle $(DOMElement)
106
+ if ( selector.nodeType ) {
107
+ this.context = this[0] = selector;
108
+ this.length = 1;
109
+ return this;
110
+ }
111
+
112
+ // Handle HTML strings
113
+ if ( typeof selector === "string" ) {
114
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
115
+ // Assume that strings that start and end with <> are HTML and skip the regex check
116
+ match = [ null, selector, null ];
117
+
118
+ } else {
119
+ match = rquickExpr.exec( selector );
120
+ }
121
+
122
+ // Match html or make sure no context is specified for #id
123
+ if ( match && (match[1] || !context) ) {
124
+
125
+ // HANDLE: $(html) -> $(array)
126
+ if ( match[1] ) {
127
+ context = context instanceof jQuery ? context[0] : context;
128
+ doc = ( context && context.nodeType ? context.ownerDocument || context : document );
129
+
130
+ // scripts is true for back-compat
131
+ selector = jQuery.parseHTML( match[1], doc, true );
132
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
133
+ this.attr.call( selector, context, true );
134
+ }
135
+
136
+ return jQuery.merge( this, selector );
137
+
138
+ // HANDLE: $(#id)
139
+ } else {
140
+ elem = document.getElementById( match[2] );
141
+
142
+ // Check parentNode to catch when Blackberry 4.6 returns
143
+ // nodes that are no longer in the document #6963
144
+ if ( elem && elem.parentNode ) {
145
+ // Handle the case where IE and Opera return items
146
+ // by name instead of ID
147
+ if ( elem.id !== match[2] ) {
148
+ return rootjQuery.find( selector );
149
+ }
150
+
151
+ // Otherwise, we inject the element directly into the jQuery object
152
+ this.length = 1;
153
+ this[0] = elem;
154
+ }
155
+
156
+ this.context = document;
157
+ this.selector = selector;
158
+ return this;
159
+ }
160
+
161
+ // HANDLE: $(expr, $(...))
162
+ } else if ( !context || context.jquery ) {
163
+ return ( context || rootjQuery ).find( selector );
164
+
165
+ // HANDLE: $(expr, context)
166
+ // (which is just equivalent to: $(context).find(expr)
167
+ } else {
168
+ return this.constructor( context ).find( selector );
169
+ }
170
+
171
+ // HANDLE: $(function)
172
+ // Shortcut for document ready
173
+ } else if ( jQuery.isFunction( selector ) ) {
174
+ return rootjQuery.ready( selector );
175
+ }
176
+
177
+ if ( selector.selector !== undefined ) {
178
+ this.selector = selector.selector;
179
+ this.context = selector.context;
180
+ }
181
+
182
+ return jQuery.makeArray( selector, this );
183
+ },
184
+
185
+ // Start with an empty selector
186
+ selector: "",
187
+
188
+ // The current version of jQuery being used
189
+ jquery: "1.8.0",
190
+
191
+ // The default length of a jQuery object is 0
192
+ length: 0,
193
+
194
+ // The number of elements contained in the matched element set
195
+ size: function() {
196
+ return this.length;
197
+ },
198
+
199
+ toArray: function() {
200
+ return core_slice.call( this );
201
+ },
202
+
203
+ // Get the Nth element in the matched element set OR
204
+ // Get the whole matched element set as a clean array
205
+ get: function( num ) {
206
+ return num == null ?
207
+
208
+ // Return a 'clean' array
209
+ this.toArray() :
210
+
211
+ // Return just the object
212
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
213
+ },
214
+
215
+ // Take an array of elements and push it onto the stack
216
+ // (returning the new matched element set)
217
+ pushStack: function( elems, name, selector ) {
218
+
219
+ // Build a new jQuery matched element set
220
+ var ret = jQuery.merge( this.constructor(), elems );
221
+
222
+ // Add the old object onto the stack (as a reference)
223
+ ret.prevObject = this;
224
+
225
+ ret.context = this.context;
226
+
227
+ if ( name === "find" ) {
228
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
229
+ } else if ( name ) {
230
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
231
+ }
232
+
233
+ // Return the newly-formed element set
234
+ return ret;
235
+ },
236
+
237
+ // Execute a callback for every element in the matched set.
238
+ // (You can seed the arguments with an array of args, but this is
239
+ // only used internally.)
240
+ each: function( callback, args ) {
241
+ return jQuery.each( this, callback, args );
242
+ },
243
+
244
+ ready: function( fn ) {
245
+ // Add the callback
246
+ jQuery.ready.promise().done( fn );
247
+
248
+ return this;
249
+ },
250
+
251
+ eq: function( i ) {
252
+ i = +i;
253
+ return i === -1 ?
254
+ this.slice( i ) :
255
+ this.slice( i, i + 1 );
256
+ },
257
+
258
+ first: function() {
259
+ return this.eq( 0 );
260
+ },
261
+
262
+ last: function() {
263
+ return this.eq( -1 );
264
+ },
265
+
266
+ slice: function() {
267
+ return this.pushStack( core_slice.apply( this, arguments ),
268
+ "slice", core_slice.call(arguments).join(",") );
269
+ },
270
+
271
+ map: function( callback ) {
272
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
273
+ return callback.call( elem, i, elem );
274
+ }));
275
+ },
276
+
277
+ end: function() {
278
+ return this.prevObject || this.constructor(null);
279
+ },
280
+
281
+ // For internal use only.
282
+ // Behaves like an Array's method, not like a jQuery method.
283
+ push: core_push,
284
+ sort: [].sort,
285
+ splice: [].splice
286
+ };
287
+
288
+ // Give the init function the jQuery prototype for later instantiation
289
+ jQuery.fn.init.prototype = jQuery.fn;
290
+
291
+ jQuery.extend = jQuery.fn.extend = function() {
292
+ var options, name, src, copy, copyIsArray, clone,
293
+ target = arguments[0] || {},
294
+ i = 1,
295
+ length = arguments.length,
296
+ deep = false;
297
+
298
+ // Handle a deep copy situation
299
+ if ( typeof target === "boolean" ) {
300
+ deep = target;
301
+ target = arguments[1] || {};
302
+ // skip the boolean and the target
303
+ i = 2;
304
+ }
305
+
306
+ // Handle case when target is a string or something (possible in deep copy)
307
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
308
+ target = {};
309
+ }
310
+
311
+ // extend jQuery itself if only one argument is passed
312
+ if ( length === i ) {
313
+ target = this;
314
+ --i;
315
+ }
316
+
317
+ for ( ; i < length; i++ ) {
318
+ // Only deal with non-null/undefined values
319
+ if ( (options = arguments[ i ]) != null ) {
320
+ // Extend the base object
321
+ for ( name in options ) {
322
+ src = target[ name ];
323
+ copy = options[ name ];
324
+
325
+ // Prevent never-ending loop
326
+ if ( target === copy ) {
327
+ continue;
328
+ }
329
+
330
+ // Recurse if we're merging plain objects or arrays
331
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
332
+ if ( copyIsArray ) {
333
+ copyIsArray = false;
334
+ clone = src && jQuery.isArray(src) ? src : [];
335
+
336
+ } else {
337
+ clone = src && jQuery.isPlainObject(src) ? src : {};
338
+ }
339
+
340
+ // Never move original objects, clone them
341
+ target[ name ] = jQuery.extend( deep, clone, copy );
342
+
343
+ // Don't bring in undefined values
344
+ } else if ( copy !== undefined ) {
345
+ target[ name ] = copy;
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ // Return the modified object
352
+ return target;
353
+ };
354
+
355
+ jQuery.extend({
356
+ noConflict: function( deep ) {
357
+ if ( window.$ === jQuery ) {
358
+ window.$ = _$;
359
+ }
360
+
361
+ if ( deep && window.sQuery === jQuery ) {
362
+ window.sQuery = _jQuery;
363
+ }
364
+
365
+ return jQuery;
366
+ },
367
+
368
+ // Is the DOM ready to be used? Set to true once it occurs.
369
+ isReady: false,
370
+
371
+ // A counter to track how many items to wait for before
372
+ // the ready event fires. See #6781
373
+ readyWait: 1,
374
+
375
+ // Hold (or release) the ready event
376
+ holdReady: function( hold ) {
377
+ if ( hold ) {
378
+ jQuery.readyWait++;
379
+ } else {
380
+ jQuery.ready( true );
381
+ }
382
+ },
383
+
384
+ // Handle when the DOM is ready
385
+ ready: function( wait ) {
386
+
387
+ // Abort if there are pending holds or we're already ready
388
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
389
+ return;
390
+ }
391
+
392
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
393
+ if ( !document.body ) {
394
+ return setTimeout( jQuery.ready, 1 );
395
+ }
396
+
397
+ // Remember that the DOM is ready
398
+ jQuery.isReady = true;
399
+
400
+ // If a normal DOM Ready event fired, decrement, and wait if need be
401
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
402
+ return;
403
+ }
404
+
405
+ // If there are functions bound, to execute
406
+ readyList.resolveWith( document, [ jQuery ] );
407
+
408
+ // Trigger any bound ready events
409
+ if ( jQuery.fn.trigger ) {
410
+ jQuery( document ).trigger("ready").off("ready");
411
+ }
412
+ },
413
+
414
+ // See test/unit/core.js for details concerning isFunction.
415
+ // Since version 1.3, DOM methods and functions like alert
416
+ // aren't supported. They return false on IE (#2968).
417
+ isFunction: function( obj ) {
418
+ return jQuery.type(obj) === "function";
419
+ },
420
+
421
+ isArray: Array.isArray || function( obj ) {
422
+ return jQuery.type(obj) === "array";
423
+ },
424
+
425
+ isWindow: function( obj ) {
426
+ return obj != null && obj == obj.window;
427
+ },
428
+
429
+ isNumeric: function( obj ) {
430
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
431
+ },
432
+
433
+ type: function( obj ) {
434
+ return obj == null ?
435
+ String( obj ) :
436
+ class2type[ core_toString.call(obj) ] || "object";
437
+ },
438
+
439
+ isPlainObject: function( obj ) {
440
+ // Must be an Object.
441
+ // Because of IE, we also have to check the presence of the constructor property.
442
+ // Make sure that DOM nodes and window objects don't pass through, as well
443
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
444
+ return false;
445
+ }
446
+
447
+ try {
448
+ // Not own constructor property must be Object
449
+ if ( obj.constructor &&
450
+ !core_hasOwn.call(obj, "constructor") &&
451
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
452
+ return false;
453
+ }
454
+ } catch ( e ) {
455
+ // IE8,9 Will throw exceptions on certain host objects #9897
456
+ return false;
457
+ }
458
+
459
+ // Own properties are enumerated firstly, so to speed up,
460
+ // if last one is own, then all properties are own.
461
+
462
+ var key;
463
+ for ( key in obj ) {}
464
+
465
+ return key === undefined || core_hasOwn.call( obj, key );
466
+ },
467
+
468
+ isEmptyObject: function( obj ) {
469
+ var name;
470
+ for ( name in obj ) {
471
+ return false;
472
+ }
473
+ return true;
474
+ },
475
+
476
+ error: function( msg ) {
477
+ throw new Error( msg );
478
+ },
479
+
480
+ // data: string of html
481
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
482
+ // scripts (optional): If true, will include scripts passed in the html string
483
+ parseHTML: function( data, context, scripts ) {
484
+ var parsed;
485
+ if ( !data || typeof data !== "string" ) {
486
+ return null;
487
+ }
488
+ if ( typeof context === "boolean" ) {
489
+ scripts = context;
490
+ context = 0;
491
+ }
492
+ context = context || document;
493
+
494
+ // Single tag
495
+ if ( (parsed = rsingleTag.exec( data )) ) {
496
+ return [ context.createElement( parsed[1] ) ];
497
+ }
498
+
499
+ parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
500
+ return jQuery.merge( [],
501
+ (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
502
+ },
503
+
504
+ parseJSON: function( data ) {
505
+ if ( !data || typeof data !== "string") {
506
+ return null;
507
+ }
508
+
509
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
510
+ data = jQuery.trim( data );
511
+
512
+ // Attempt to parse using the native JSON parser first
513
+ if ( window.JSON && window.JSON.parse ) {
514
+ return window.JSON.parse( data );
515
+ }
516
+
517
+ // Make sure the incoming data is actual JSON
518
+ // Logic borrowed from http://json.org/json2.js
519
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
520
+ .replace( rvalidtokens, "]" )
521
+ .replace( rvalidbraces, "")) ) {
522
+
523
+ return ( new Function( "return " + data ) )();
524
+
525
+ }
526
+ jQuery.error( "Invalid JSON: " + data );
527
+ },
528
+
529
+ // Cross-browser xml parsing
530
+ parseXML: function( data ) {
531
+ var xml, tmp;
532
+ if ( !data || typeof data !== "string" ) {
533
+ return null;
534
+ }
535
+ try {
536
+ if ( window.DOMParser ) { // Standard
537
+ tmp = new DOMParser();
538
+ xml = tmp.parseFromString( data , "text/xml" );
539
+ } else { // IE
540
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
541
+ xml.async = "false";
542
+ xml.loadXML( data );
543
+ }
544
+ } catch( e ) {
545
+ xml = undefined;
546
+ }
547
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
548
+ jQuery.error( "Invalid XML: " + data );
549
+ }
550
+ return xml;
551
+ },
552
+
553
+ noop: function() {},
554
+
555
+ // Evaluates a script in a global context
556
+ // Workarounds based on findings by Jim Driscoll
557
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
558
+ globalEval: function( data ) {
559
+ if ( data && core_rnotwhite.test( data ) ) {
560
+ // We use execScript on Internet Explorer
561
+ // We use an anonymous function so that context is window
562
+ // rather than jQuery in Firefox
563
+ ( window.execScript || function( data ) {
564
+ window[ "eval" ].call( window, data );
565
+ } )( data );
566
+ }
567
+ },
568
+
569
+ // Convert dashed to camelCase; used by the css and data modules
570
+ // Microsoft forgot to hump their vendor prefix (#9572)
571
+ camelCase: function( string ) {
572
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
573
+ },
574
+
575
+ nodeName: function( elem, name ) {
576
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
577
+ },
578
+
579
+ // args is for internal usage only
580
+ each: function( obj, callback, args ) {
581
+ var name,
582
+ i = 0,
583
+ length = obj.length,
584
+ isObj = length === undefined || jQuery.isFunction( obj );
585
+
586
+ if ( args ) {
587
+ if ( isObj ) {
588
+ for ( name in obj ) {
589
+ if ( callback.apply( obj[ name ], args ) === false ) {
590
+ break;
591
+ }
592
+ }
593
+ } else {
594
+ for ( ; i < length; ) {
595
+ if ( callback.apply( obj[ i++ ], args ) === false ) {
596
+ break;
597
+ }
598
+ }
599
+ }
600
+
601
+ // A special, fast, case for the most common use of each
602
+ } else {
603
+ if ( isObj ) {
604
+ for ( name in obj ) {
605
+ if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
606
+ break;
607
+ }
608
+ }
609
+ } else {
610
+ for ( ; i < length; ) {
611
+ if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
612
+ break;
613
+ }
614
+ }
615
+ }
616
+ }
617
+
618
+ return obj;
619
+ },
620
+
621
+ // Use native String.trim function wherever possible
622
+ trim: core_trim ?
623
+ function( text ) {
624
+ return text == null ?
625
+ "" :
626
+ core_trim.call( text );
627
+ } :
628
+
629
+ // Otherwise use our own trimming functionality
630
+ function( text ) {
631
+ return text == null ?
632
+ "" :
633
+ text.toString().replace( rtrim, "" );
634
+ },
635
+
636
+ // results is for internal usage only
637
+ makeArray: function( arr, results ) {
638
+ var type,
639
+ ret = results || [];
640
+
641
+ if ( arr != null ) {
642
+ // The window, strings (and functions) also have 'length'
643
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
644
+ type = jQuery.type( arr );
645
+
646
+ if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
647
+ core_push.call( ret, arr );
648
+ } else {
649
+ jQuery.merge( ret, arr );
650
+ }
651
+ }
652
+
653
+ return ret;
654
+ },
655
+
656
+ inArray: function( elem, arr, i ) {
657
+ var len;
658
+
659
+ if ( arr ) {
660
+ if ( core_indexOf ) {
661
+ return core_indexOf.call( arr, elem, i );
662
+ }
663
+
664
+ len = arr.length;
665
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
666
+
667
+ for ( ; i < len; i++ ) {
668
+ // Skip accessing in sparse arrays
669
+ if ( i in arr && arr[ i ] === elem ) {
670
+ return i;
671
+ }
672
+ }
673
+ }
674
+
675
+ return -1;
676
+ },
677
+
678
+ merge: function( first, second ) {
679
+ var l = second.length,
680
+ i = first.length,
681
+ j = 0;
682
+
683
+ if ( typeof l === "number" ) {
684
+ for ( ; j < l; j++ ) {
685
+ first[ i++ ] = second[ j ];
686
+ }
687
+
688
+ } else {
689
+ while ( second[j] !== undefined ) {
690
+ first[ i++ ] = second[ j++ ];
691
+ }
692
+ }
693
+
694
+ first.length = i;
695
+
696
+ return first;
697
+ },
698
+
699
+ grep: function( elems, callback, inv ) {
700
+ var retVal,
701
+ ret = [],
702
+ i = 0,
703
+ length = elems.length;
704
+ inv = !!inv;
705
+
706
+ // Go through the array, only saving the items
707
+ // that pass the validator function
708
+ for ( ; i < length; i++ ) {
709
+ retVal = !!callback( elems[ i ], i );
710
+ if ( inv !== retVal ) {
711
+ ret.push( elems[ i ] );
712
+ }
713
+ }
714
+
715
+ return ret;
716
+ },
717
+
718
+ // arg is for internal usage only
719
+ map: function( elems, callback, arg ) {
720
+ var value, key,
721
+ ret = [],
722
+ i = 0,
723
+ length = elems.length,
724
+ // jquery objects are treated as arrays
725
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
726
+
727
+ // Go through the array, translating each of the items to their
728
+ if ( isArray ) {
729
+ for ( ; i < length; i++ ) {
730
+ value = callback( elems[ i ], i, arg );
731
+
732
+ if ( value != null ) {
733
+ ret[ ret.length ] = value;
734
+ }
735
+ }
736
+
737
+ // Go through every key on the object,
738
+ } else {
739
+ for ( key in elems ) {
740
+ value = callback( elems[ key ], key, arg );
741
+
742
+ if ( value != null ) {
743
+ ret[ ret.length ] = value;
744
+ }
745
+ }
746
+ }
747
+
748
+ // Flatten any nested arrays
749
+ return ret.concat.apply( [], ret );
750
+ },
751
+
752
+ // A global GUID counter for objects
753
+ guid: 1,
754
+
755
+ // Bind a function to a context, optionally partially applying any
756
+ // arguments.
757
+ proxy: function( fn, context ) {
758
+ var tmp, args, proxy;
759
+
760
+ if ( typeof context === "string" ) {
761
+ tmp = fn[ context ];
762
+ context = fn;
763
+ fn = tmp;
764
+ }
765
+
766
+ // Quick check to determine if target is callable, in the spec
767
+ // this throws a TypeError, but we will just return undefined.
768
+ if ( !jQuery.isFunction( fn ) ) {
769
+ return undefined;
770
+ }
771
+
772
+ // Simulated bind
773
+ args = core_slice.call( arguments, 2 );
774
+ proxy = function() {
775
+ return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
776
+ };
777
+
778
+ // Set the guid of unique handler to the same of original handler, so it can be removed
779
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
780
+
781
+ return proxy;
782
+ },
783
+
784
+ // Multifunctional method to get and set values of a collection
785
+ // The value/s can optionally be executed if it's a function
786
+ access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
787
+ var exec,
788
+ bulk = key == null,
789
+ i = 0,
790
+ length = elems.length;
791
+
792
+ // Sets many values
793
+ if ( key && typeof key === "object" ) {
794
+ for ( i in key ) {
795
+ jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
796
+ }
797
+ chainable = 1;
798
+
799
+ // Sets one value
800
+ } else if ( value !== undefined ) {
801
+ // Optionally, function values get executed if exec is true
802
+ exec = pass === undefined && jQuery.isFunction( value );
803
+
804
+ if ( bulk ) {
805
+ // Bulk operations only iterate when executing function values
806
+ if ( exec ) {
807
+ exec = fn;
808
+ fn = function( elem, key, value ) {
809
+ return exec.call( jQuery( elem ), value );
810
+ };
811
+
812
+ // Otherwise they run against the entire set
813
+ } else {
814
+ fn.call( elems, value );
815
+ fn = null;
816
+ }
817
+ }
818
+
819
+ if ( fn ) {
820
+ for (; i < length; i++ ) {
821
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
822
+ }
823
+ }
824
+
825
+ chainable = 1;
826
+ }
827
+
828
+ return chainable ?
829
+ elems :
830
+
831
+ // Gets
832
+ bulk ?
833
+ fn.call( elems ) :
834
+ length ? fn( elems[0], key ) : emptyGet;
835
+ },
836
+
837
+ now: function() {
838
+ return ( new Date() ).getTime();
839
+ }
840
+ });
841
+
842
+ jQuery.ready.promise = function( obj ) {
843
+ if ( !readyList ) {
844
+
845
+ readyList = jQuery.Deferred();
846
+
847
+ // Catch cases where $(document).ready() is called after the
848
+ // browser event has already occurred.
849
+ if ( document.readyState === "complete" || ( document.readyState !== "loading" && document.addEventListener ) ) {
850
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
851
+ setTimeout( jQuery.ready, 1 );
852
+
853
+ // Standards-based browsers support DOMContentLoaded
854
+ } else if ( document.addEventListener ) {
855
+ // Use the handy event callback
856
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
857
+
858
+ // A fallback to window.onload, that will always work
859
+ window.addEventListener( "load", jQuery.ready, false );
860
+
861
+ // If IE event model is used
862
+ } else {
863
+ // Ensure firing before onload, maybe late but safe also for iframes
864
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
865
+
866
+ // A fallback to window.onload, that will always work
867
+ window.attachEvent( "onload", jQuery.ready );
868
+
869
+ // If IE and not a frame
870
+ // continually check to see if the document is ready
871
+ var top = false;
872
+
873
+ try {
874
+ top = window.frameElement == null && document.documentElement;
875
+ } catch(e) {}
876
+
877
+ if ( top && top.doScroll ) {
878
+ (function doScrollCheck() {
879
+ if ( !jQuery.isReady ) {
880
+
881
+ try {
882
+ // Use the trick by Diego Perini
883
+ // http://javascript.nwbox.com/IEContentLoaded/
884
+ top.doScroll("left");
885
+ } catch(e) {
886
+ return setTimeout( doScrollCheck, 50 );
887
+ }
888
+
889
+ // and execute any waiting functions
890
+ jQuery.ready();
891
+ }
892
+ })();
893
+ }
894
+ }
895
+ }
896
+ return readyList.promise( obj );
897
+ };
898
+
899
+ // Populate the class2type map
900
+ jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
901
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
902
+ });
903
+
904
+ // All jQuery objects should point back to these
905
+ rootjQuery = jQuery(document);
906
+ // String to Object options format cache
907
+ var optionsCache = {};
908
+
909
+ // Convert String-formatted options into Object-formatted ones and store in cache
910
+ function createOptions( options ) {
911
+ var object = optionsCache[ options ] = {};
912
+ jQuery.each( options.split( core_rspace ), function( _, flag ) {
913
+ object[ flag ] = true;
914
+ });
915
+ return object;
916
+ }
917
+
918
+ /*
919
+ * Create a callback list using the following parameters:
920
+ *
921
+ * options: an optional list of space-separated options that will change how
922
+ * the callback list behaves or a more traditional option object
923
+ *
924
+ * By default a callback list will act like an event callback list and can be
925
+ * "fired" multiple times.
926
+ *
927
+ * Possible options:
928
+ *
929
+ * once: will ensure the callback list can only be fired once (like a Deferred)
930
+ *
931
+ * memory: will keep track of previous values and will call any callback added
932
+ * after the list has been fired right away with the latest "memorized"
933
+ * values (like a Deferred)
934
+ *
935
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
936
+ *
937
+ * stopOnFalse: interrupt callings when a callback returns false
938
+ *
939
+ */
940
+ jQuery.Callbacks = function( options ) {
941
+
942
+ // Convert options from String-formatted to Object-formatted if needed
943
+ // (we check in cache first)
944
+ options = typeof options === "string" ?
945
+ ( optionsCache[ options ] || createOptions( options ) ) :
946
+ jQuery.extend( {}, options );
947
+
948
+ var // Last fire value (for non-forgettable lists)
949
+ memory,
950
+ // Flag to know if list was already fired
951
+ fired,
952
+ // Flag to know if list is currently firing
953
+ firing,
954
+ // First callback to fire (used internally by add and fireWith)
955
+ firingStart,
956
+ // End of the loop when firing
957
+ firingLength,
958
+ // Index of currently firing callback (modified by remove if needed)
959
+ firingIndex,
960
+ // Actual callback list
961
+ list = [],
962
+ // Stack of fire calls for repeatable lists
963
+ stack = !options.once && [],
964
+ // Fire callbacks
965
+ fire = function( data ) {
966
+ memory = options.memory && data;
967
+ fired = true;
968
+ firingIndex = firingStart || 0;
969
+ firingStart = 0;
970
+ firingLength = list.length;
971
+ firing = true;
972
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
973
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
974
+ memory = false; // To prevent further calls using add
975
+ break;
976
+ }
977
+ }
978
+ firing = false;
979
+ if ( list ) {
980
+ if ( stack ) {
981
+ if ( stack.length ) {
982
+ fire( stack.shift() );
983
+ }
984
+ } else if ( memory ) {
985
+ list = [];
986
+ } else {
987
+ self.disable();
988
+ }
989
+ }
990
+ },
991
+ // Actual Callbacks object
992
+ self = {
993
+ // Add a callback or a collection of callbacks to the list
994
+ add: function() {
995
+ if ( list ) {
996
+ // First, we save the current length
997
+ var start = list.length;
998
+ (function add( args ) {
999
+ jQuery.each( args, function( _, arg ) {
1000
+ if ( jQuery.isFunction( arg ) && ( !options.unique || !self.has( arg ) ) ) {
1001
+ list.push( arg );
1002
+ } else if ( arg && arg.length ) {
1003
+ // Inspect recursively
1004
+ add( arg );
1005
+ }
1006
+ });
1007
+ })( arguments );
1008
+ // Do we need to add the callbacks to the
1009
+ // current firing batch?
1010
+ if ( firing ) {
1011
+ firingLength = list.length;
1012
+ // With memory, if we're not firing then
1013
+ // we should call right away
1014
+ } else if ( memory ) {
1015
+ firingStart = start;
1016
+ fire( memory );
1017
+ }
1018
+ }
1019
+ return this;
1020
+ },
1021
+ // Remove a callback from the list
1022
+ remove: function() {
1023
+ if ( list ) {
1024
+ jQuery.each( arguments, function( _, arg ) {
1025
+ var index;
1026
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
1027
+ list.splice( index, 1 );
1028
+ // Handle firing indexes
1029
+ if ( firing ) {
1030
+ if ( index <= firingLength ) {
1031
+ firingLength--;
1032
+ }
1033
+ if ( index <= firingIndex ) {
1034
+ firingIndex--;
1035
+ }
1036
+ }
1037
+ }
1038
+ });
1039
+ }
1040
+ return this;
1041
+ },
1042
+ // Control if a given callback is in the list
1043
+ has: function( fn ) {
1044
+ return jQuery.inArray( fn, list ) > -1;
1045
+ },
1046
+ // Remove all callbacks from the list
1047
+ empty: function() {
1048
+ list = [];
1049
+ return this;
1050
+ },
1051
+ // Have the list do nothing anymore
1052
+ disable: function() {
1053
+ list = stack = memory = undefined;
1054
+ return this;
1055
+ },
1056
+ // Is it disabled?
1057
+ disabled: function() {
1058
+ return !list;
1059
+ },
1060
+ // Lock the list in its current state
1061
+ lock: function() {
1062
+ stack = undefined;
1063
+ if ( !memory ) {
1064
+ self.disable();
1065
+ }
1066
+ return this;
1067
+ },
1068
+ // Is it locked?
1069
+ locked: function() {
1070
+ return !stack;
1071
+ },
1072
+ // Call all callbacks with the given context and arguments
1073
+ fireWith: function( context, args ) {
1074
+ args = args || [];
1075
+ args = [ context, args.slice ? args.slice() : args ];
1076
+ if ( list && ( !fired || stack ) ) {
1077
+ if ( firing ) {
1078
+ stack.push( args );
1079
+ } else {
1080
+ fire( args );
1081
+ }
1082
+ }
1083
+ return this;
1084
+ },
1085
+ // Call all the callbacks with the given arguments
1086
+ fire: function() {
1087
+ self.fireWith( this, arguments );
1088
+ return this;
1089
+ },
1090
+ // To know if the callbacks have already been called at least once
1091
+ fired: function() {
1092
+ return !!fired;
1093
+ }
1094
+ };
1095
+
1096
+ return self;
1097
+ };
1098
+ jQuery.extend({
1099
+
1100
+ Deferred: function( func ) {
1101
+ var tuples = [
1102
+ // action, add listener, listener list, final state
1103
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
1104
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
1105
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
1106
+ ],
1107
+ state = "pending",
1108
+ promise = {
1109
+ state: function() {
1110
+ return state;
1111
+ },
1112
+ always: function() {
1113
+ deferred.done( arguments ).fail( arguments );
1114
+ return this;
1115
+ },
1116
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
1117
+ var fns = arguments;
1118
+ return jQuery.Deferred(function( newDefer ) {
1119
+ jQuery.each( tuples, function( i, tuple ) {
1120
+ var action = tuple[ 0 ],
1121
+ fn = fns[ i ];
1122
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
1123
+ deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
1124
+ function() {
1125
+ var returned = fn.apply( this, arguments );
1126
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
1127
+ returned.promise()
1128
+ .done( newDefer.resolve )
1129
+ .fail( newDefer.reject )
1130
+ .progress( newDefer.notify );
1131
+ } else {
1132
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
1133
+ }
1134
+ } :
1135
+ newDefer[ action ]
1136
+ );
1137
+ });
1138
+ fns = null;
1139
+ }).promise();
1140
+ },
1141
+ // Get a promise for this deferred
1142
+ // If obj is provided, the promise aspect is added to the object
1143
+ promise: function( obj ) {
1144
+ return typeof obj === "object" ? jQuery.extend( obj, promise ) : promise;
1145
+ }
1146
+ },
1147
+ deferred = {};
1148
+
1149
+ // Keep pipe for back-compat
1150
+ promise.pipe = promise.then;
1151
+
1152
+ // Add list-specific methods
1153
+ jQuery.each( tuples, function( i, tuple ) {
1154
+ var list = tuple[ 2 ],
1155
+ stateString = tuple[ 3 ];
1156
+
1157
+ // promise[ done | fail | progress ] = list.add
1158
+ promise[ tuple[1] ] = list.add;
1159
+
1160
+ // Handle state
1161
+ if ( stateString ) {
1162
+ list.add(function() {
1163
+ // state = [ resolved | rejected ]
1164
+ state = stateString;
1165
+
1166
+ // [ reject_list | resolve_list ].disable; progress_list.lock
1167
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
1168
+ }
1169
+
1170
+ // deferred[ resolve | reject | notify ] = list.fire
1171
+ deferred[ tuple[0] ] = list.fire;
1172
+ deferred[ tuple[0] + "With" ] = list.fireWith;
1173
+ });
1174
+
1175
+ // Make the deferred a promise
1176
+ promise.promise( deferred );
1177
+
1178
+ // Call given func if any
1179
+ if ( func ) {
1180
+ func.call( deferred, deferred );
1181
+ }
1182
+
1183
+ // All done!
1184
+ return deferred;
1185
+ },
1186
+
1187
+ // Deferred helper
1188
+ when: function( subordinate /* , ..., subordinateN */ ) {
1189
+ var i = 0,
1190
+ resolveValues = core_slice.call( arguments ),
1191
+ length = resolveValues.length,
1192
+
1193
+ // the count of uncompleted subordinates
1194
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
1195
+
1196
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
1197
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
1198
+
1199
+ // Update function for both resolve and progress values
1200
+ updateFunc = function( i, contexts, values ) {
1201
+ return function( value ) {
1202
+ contexts[ i ] = this;
1203
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
1204
+ if( values === progressValues ) {
1205
+ deferred.notifyWith( contexts, values );
1206
+ } else if ( !( --remaining ) ) {
1207
+ deferred.resolveWith( contexts, values );
1208
+ }
1209
+ };
1210
+ },
1211
+
1212
+ progressValues, progressContexts, resolveContexts;
1213
+
1214
+ // add listeners to Deferred subordinates; treat others as resolved
1215
+ if ( length > 1 ) {
1216
+ progressValues = new Array( length );
1217
+ progressContexts = new Array( length );
1218
+ resolveContexts = new Array( length );
1219
+ for ( ; i < length; i++ ) {
1220
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
1221
+ resolveValues[ i ].promise()
1222
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
1223
+ .fail( deferred.reject )
1224
+ .progress( updateFunc( i, progressContexts, progressValues ) );
1225
+ } else {
1226
+ --remaining;
1227
+ }
1228
+ }
1229
+ }
1230
+
1231
+ // if we're not waiting on anything, resolve the master
1232
+ if ( !remaining ) {
1233
+ deferred.resolveWith( resolveContexts, resolveValues );
1234
+ }
1235
+
1236
+ return deferred.promise();
1237
+ }
1238
+ });
1239
+ jQuery.support = (function() {
1240
+
1241
+ var support,
1242
+ all,
1243
+ a,
1244
+ select,
1245
+ opt,
1246
+ input,
1247
+ fragment,
1248
+ eventName,
1249
+ i,
1250
+ isSupported,
1251
+ clickFn,
1252
+ div = document.createElement("div");
1253
+
1254
+ // Preliminary tests
1255
+ div.setAttribute( "className", "t" );
1256
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
1257
+
1258
+ all = div.getElementsByTagName("*");
1259
+ a = div.getElementsByTagName("a")[ 0 ];
1260
+ a.style.cssText = "top:1px;float:left;opacity:.5";
1261
+
1262
+ // Can't get basic test support
1263
+ if ( !all || !all.length || !a ) {
1264
+ return {};
1265
+ }
1266
+
1267
+ // First batch of supports tests
1268
+ select = document.createElement("select");
1269
+ opt = select.appendChild( document.createElement("option") );
1270
+ input = div.getElementsByTagName("input")[ 0 ];
1271
+
1272
+ support = {
1273
+ // IE strips leading whitespace when .innerHTML is used
1274
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
1275
+
1276
+ // Make sure that tbody elements aren't automatically inserted
1277
+ // IE will insert them into empty tables
1278
+ tbody: !div.getElementsByTagName("tbody").length,
1279
+
1280
+ // Make sure that link elements get serialized correctly by innerHTML
1281
+ // This requires a wrapper element in IE
1282
+ htmlSerialize: !!div.getElementsByTagName("link").length,
1283
+
1284
+ // Get the style information from getAttribute
1285
+ // (IE uses .cssText instead)
1286
+ style: /top/.test( a.getAttribute("style") ),
1287
+
1288
+ // Make sure that URLs aren't manipulated
1289
+ // (IE normalizes it by default)
1290
+ hrefNormalized: ( a.getAttribute("href") === "/a" ),
1291
+
1292
+ // Make sure that element opacity exists
1293
+ // (IE uses filter instead)
1294
+ // Use a regex to work around a WebKit issue. See #5145
1295
+ opacity: /^0.5/.test( a.style.opacity ),
1296
+
1297
+ // Verify style float existence
1298
+ // (IE uses styleFloat instead of cssFloat)
1299
+ cssFloat: !!a.style.cssFloat,
1300
+
1301
+ // Make sure that if no value is specified for a checkbox
1302
+ // that it defaults to "on".
1303
+ // (WebKit defaults to "" instead)
1304
+ checkOn: ( input.value === "on" ),
1305
+
1306
+ // Make sure that a selected-by-default option has a working selected property.
1307
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1308
+ optSelected: opt.selected,
1309
+
1310
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1311
+ getSetAttribute: div.className !== "t",
1312
+
1313
+ // Tests for enctype support on a form(#6743)
1314
+ enctype: !!document.createElement("form").enctype,
1315
+
1316
+ // Makes sure cloning an html5 element does not cause problems
1317
+ // Where outerHTML is undefined, this still works
1318
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
1319
+
1320
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
1321
+ boxModel: ( document.compatMode === "CSS1Compat" ),
1322
+
1323
+ // Will be defined later
1324
+ submitBubbles: true,
1325
+ changeBubbles: true,
1326
+ focusinBubbles: false,
1327
+ deleteExpando: true,
1328
+ noCloneEvent: true,
1329
+ inlineBlockNeedsLayout: false,
1330
+ shrinkWrapBlocks: false,
1331
+ reliableMarginRight: true,
1332
+ boxSizingReliable: true,
1333
+ pixelPosition: false
1334
+ };
1335
+
1336
+ // Make sure checked status is properly cloned
1337
+ input.checked = true;
1338
+ support.noCloneChecked = input.cloneNode( true ).checked;
1339
+
1340
+ // Make sure that the options inside disabled selects aren't marked as disabled
1341
+ // (WebKit marks them as disabled)
1342
+ select.disabled = true;
1343
+ support.optDisabled = !opt.disabled;
1344
+
1345
+ // Test to see if it's possible to delete an expando from an element
1346
+ // Fails in Internet Explorer
1347
+ try {
1348
+ delete div.test;
1349
+ } catch( e ) {
1350
+ support.deleteExpando = false;
1351
+ }
1352
+
1353
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1354
+ div.attachEvent( "onclick", clickFn = function() {
1355
+ // Cloning a node shouldn't copy over any
1356
+ // bound event handlers (IE does this)
1357
+ support.noCloneEvent = false;
1358
+ });
1359
+ div.cloneNode( true ).fireEvent("onclick");
1360
+ div.detachEvent( "onclick", clickFn );
1361
+ }
1362
+
1363
+ // Check if a radio maintains its value
1364
+ // after being appended to the DOM
1365
+ input = document.createElement("input");
1366
+ input.value = "t";
1367
+ input.setAttribute( "type", "radio" );
1368
+ support.radioValue = input.value === "t";
1369
+
1370
+ input.setAttribute( "checked", "checked" );
1371
+
1372
+ // #11217 - WebKit loses check when the name is after the checked attribute
1373
+ input.setAttribute( "name", "t" );
1374
+
1375
+ div.appendChild( input );
1376
+ fragment = document.createDocumentFragment();
1377
+ fragment.appendChild( div.lastChild );
1378
+
1379
+ // WebKit doesn't clone checked state correctly in fragments
1380
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1381
+
1382
+ // Check if a disconnected checkbox will retain its checked
1383
+ // value of true after appended to the DOM (IE6/7)
1384
+ support.appendChecked = input.checked;
1385
+
1386
+ fragment.removeChild( input );
1387
+ fragment.appendChild( div );
1388
+
1389
+ // Technique from Juriy Zaytsev
1390
+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
1391
+ // We only care about the case where non-standard event systems
1392
+ // are used, namely in IE. Short-circuiting here helps us to
1393
+ // avoid an eval call (in setAttribute) which can cause CSP
1394
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1395
+ if ( div.attachEvent ) {
1396
+ for ( i in {
1397
+ submit: true,
1398
+ change: true,
1399
+ focusin: true
1400
+ }) {
1401
+ eventName = "on" + i;
1402
+ isSupported = ( eventName in div );
1403
+ if ( !isSupported ) {
1404
+ div.setAttribute( eventName, "return;" );
1405
+ isSupported = ( typeof div[ eventName ] === "function" );
1406
+ }
1407
+ support[ i + "Bubbles" ] = isSupported;
1408
+ }
1409
+ }
1410
+
1411
+ // Run tests that need a body at doc ready
1412
+ jQuery(function() {
1413
+ var container, div, tds, marginDiv,
1414
+ divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
1415
+ body = document.getElementsByTagName("body")[0];
1416
+
1417
+ if ( !body ) {
1418
+ // Return for frameset docs that don't have a body
1419
+ return;
1420
+ }
1421
+
1422
+ container = document.createElement("div");
1423
+ container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
1424
+ body.insertBefore( container, body.firstChild );
1425
+
1426
+ // Construct the test element
1427
+ div = document.createElement("div");
1428
+ container.appendChild( div );
1429
+
1430
+ // Check if table cells still have offsetWidth/Height when they are set
1431
+ // to display:none and there are still other visible table cells in a
1432
+ // table row; if so, offsetWidth/Height are not reliable for use when
1433
+ // determining if an element has been hidden directly using
1434
+ // display:none (it is still safe to use offsets if a parent element is
1435
+ // hidden; don safety goggles and see bug #4512 for more information).
1436
+ // (only IE 8 fails this test)
1437
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
1438
+ tds = div.getElementsByTagName("td");
1439
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
1440
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
1441
+
1442
+ tds[ 0 ].style.display = "";
1443
+ tds[ 1 ].style.display = "none";
1444
+
1445
+ // Check if empty table cells still have offsetWidth/Height
1446
+ // (IE <= 8 fail this test)
1447
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1448
+
1449
+ // Check box-sizing and margin behavior
1450
+ div.innerHTML = "";
1451
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
1452
+ support.boxSizing = ( div.offsetWidth === 4 );
1453
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
1454
+
1455
+ // NOTE: To any future maintainer, window.getComputedStyle was used here
1456
+ // instead of getComputedStyle because it gave a better gzip size.
1457
+ // The difference between window.getComputedStyle and getComputedStyle is
1458
+ // 7 bytes
1459
+ if ( window.getComputedStyle ) {
1460
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
1461
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
1462
+
1463
+ // Check if div with explicit width and no margin-right incorrectly
1464
+ // gets computed margin-right based on width of container. For more
1465
+ // info see bug #3333
1466
+ // Fails in WebKit before Feb 2011 nightlies
1467
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1468
+ marginDiv = document.createElement("div");
1469
+ marginDiv.style.cssText = div.style.cssText = divReset;
1470
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
1471
+ div.style.width = "1px";
1472
+ div.appendChild( marginDiv );
1473
+ support.reliableMarginRight =
1474
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
1475
+ }
1476
+
1477
+ if ( typeof div.style.zoom !== "undefined" ) {
1478
+ // Check if natively block-level elements act like inline-block
1479
+ // elements when setting their display to 'inline' and giving
1480
+ // them layout
1481
+ // (IE < 8 does this)
1482
+ div.innerHTML = "";
1483
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
1484
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
1485
+
1486
+ // Check if elements with layout shrink-wrap their children
1487
+ // (IE 6 does this)
1488
+ div.style.display = "block";
1489
+ div.style.overflow = "visible";
1490
+ div.innerHTML = "<div></div>";
1491
+ div.firstChild.style.width = "5px";
1492
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
1493
+
1494
+ container.style.zoom = 1;
1495
+ }
1496
+
1497
+ // Null elements to avoid leaks in IE
1498
+ body.removeChild( container );
1499
+ container = div = tds = marginDiv = null;
1500
+ });
1501
+
1502
+ // Null elements to avoid leaks in IE
1503
+ fragment.removeChild( div );
1504
+ all = a = select = opt = input = fragment = div = null;
1505
+
1506
+ return support;
1507
+ })();
1508
+ var rbrace = /^(?:\{.*\}|\[.*\])$/,
1509
+ rmultiDash = /([A-Z])/g;
1510
+
1511
+ jQuery.extend({
1512
+ cache: {},
1513
+
1514
+ deletedIds: [],
1515
+
1516
+ // Please use with caution
1517
+ uuid: 0,
1518
+
1519
+ // Unique for each copy of jQuery on the page
1520
+ // Non-digits removed to match rinlinejQuery
1521
+ expando: "sQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
1522
+
1523
+ // The following elements throw uncatchable exceptions if you
1524
+ // attempt to add expando properties to them.
1525
+ noData: {
1526
+ "embed": true,
1527
+ // Ban all objects except for Flash (which handle expandos)
1528
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1529
+ "applet": true
1530
+ },
1531
+
1532
+ hasData: function( elem ) {
1533
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1534
+ return !!elem && !isEmptyDataObject( elem );
1535
+ },
1536
+
1537
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
1538
+ if ( !jQuery.acceptData( elem ) ) {
1539
+ return;
1540
+ }
1541
+
1542
+ var thisCache, ret,
1543
+ internalKey = jQuery.expando,
1544
+ getByName = typeof name === "string",
1545
+
1546
+ // We have to handle DOM nodes and JS objects differently because IE6-7
1547
+ // can't GC object references properly across the DOM-JS boundary
1548
+ isNode = elem.nodeType,
1549
+
1550
+ // Only DOM nodes need the global jQuery cache; JS object data is
1551
+ // attached directly to the object so GC can occur automatically
1552
+ cache = isNode ? jQuery.cache : elem,
1553
+
1554
+ // Only defining an ID for JS objects if its cache already exists allows
1555
+ // the code to shortcut on the same path as a DOM node with no cache
1556
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
1557
+
1558
+ // Avoid doing any more work than we need to when trying to get data on an
1559
+ // object that has no data at all
1560
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
1561
+ return;
1562
+ }
1563
+
1564
+ if ( !id ) {
1565
+ // Only DOM nodes need a new unique ID for each element since their data
1566
+ // ends up in the global cache
1567
+ if ( isNode ) {
1568
+ elem[ internalKey ] = id = jQuery.deletedIds.pop() || ++jQuery.uuid;
1569
+ } else {
1570
+ id = internalKey;
1571
+ }
1572
+ }
1573
+
1574
+ if ( !cache[ id ] ) {
1575
+ cache[ id ] = {};
1576
+
1577
+ // Avoids exposing jQuery metadata on plain JS objects when the object
1578
+ // is serialized using JSON.stringify
1579
+ if ( !isNode ) {
1580
+ cache[ id ].toJSON = jQuery.noop;
1581
+ }
1582
+ }
1583
+
1584
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
1585
+ // shallow copied over onto the existing cache
1586
+ if ( typeof name === "object" || typeof name === "function" ) {
1587
+ if ( pvt ) {
1588
+ cache[ id ] = jQuery.extend( cache[ id ], name );
1589
+ } else {
1590
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
1591
+ }
1592
+ }
1593
+
1594
+ thisCache = cache[ id ];
1595
+
1596
+ // jQuery data() is stored in a separate object inside the object's internal data
1597
+ // cache in order to avoid key collisions between internal data and user-defined
1598
+ // data.
1599
+ if ( !pvt ) {
1600
+ if ( !thisCache.data ) {
1601
+ thisCache.data = {};
1602
+ }
1603
+
1604
+ thisCache = thisCache.data;
1605
+ }
1606
+
1607
+ if ( data !== undefined ) {
1608
+ thisCache[ jQuery.camelCase( name ) ] = data;
1609
+ }
1610
+
1611
+ // Check for both converted-to-camel and non-converted data property names
1612
+ // If a data property was specified
1613
+ if ( getByName ) {
1614
+
1615
+ // First Try to find as-is property data
1616
+ ret = thisCache[ name ];
1617
+
1618
+ // Test for null|undefined property data
1619
+ if ( ret == null ) {
1620
+
1621
+ // Try to find the camelCased property
1622
+ ret = thisCache[ jQuery.camelCase( name ) ];
1623
+ }
1624
+ } else {
1625
+ ret = thisCache;
1626
+ }
1627
+
1628
+ return ret;
1629
+ },
1630
+
1631
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
1632
+ if ( !jQuery.acceptData( elem ) ) {
1633
+ return;
1634
+ }
1635
+
1636
+ var thisCache, i, l,
1637
+
1638
+ isNode = elem.nodeType,
1639
+
1640
+ // See jQuery.data for more information
1641
+ cache = isNode ? jQuery.cache : elem,
1642
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
1643
+
1644
+ // If there is already no cache entry for this object, there is no
1645
+ // purpose in continuing
1646
+ if ( !cache[ id ] ) {
1647
+ return;
1648
+ }
1649
+
1650
+ if ( name ) {
1651
+
1652
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
1653
+
1654
+ if ( thisCache ) {
1655
+
1656
+ // Support array or space separated string names for data keys
1657
+ if ( !jQuery.isArray( name ) ) {
1658
+
1659
+ // try the string as a key before any manipulation
1660
+ if ( name in thisCache ) {
1661
+ name = [ name ];
1662
+ } else {
1663
+
1664
+ // split the camel cased version by spaces unless a key with the spaces exists
1665
+ name = jQuery.camelCase( name );
1666
+ if ( name in thisCache ) {
1667
+ name = [ name ];
1668
+ } else {
1669
+ name = name.split(" ");
1670
+ }
1671
+ }
1672
+ }
1673
+
1674
+ for ( i = 0, l = name.length; i < l; i++ ) {
1675
+ delete thisCache[ name[i] ];
1676
+ }
1677
+
1678
+ // If there is no data left in the cache, we want to continue
1679
+ // and let the cache object itself get destroyed
1680
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
1681
+ return;
1682
+ }
1683
+ }
1684
+ }
1685
+
1686
+ // See jQuery.data for more information
1687
+ if ( !pvt ) {
1688
+ delete cache[ id ].data;
1689
+
1690
+ // Don't destroy the parent cache unless the internal data object
1691
+ // had been the only thing left in it
1692
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
1693
+ return;
1694
+ }
1695
+ }
1696
+
1697
+ // Destroy the cache
1698
+ if ( isNode ) {
1699
+ jQuery.cleanData( [ elem ], true );
1700
+
1701
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
1702
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
1703
+ delete cache[ id ];
1704
+
1705
+ // When all else fails, null
1706
+ } else {
1707
+ cache[ id ] = null;
1708
+ }
1709
+ },
1710
+
1711
+ // For internal use only.
1712
+ _data: function( elem, name, data ) {
1713
+ return jQuery.data( elem, name, data, true );
1714
+ },
1715
+
1716
+ // A method for determining if a DOM node can handle the data expando
1717
+ acceptData: function( elem ) {
1718
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
1719
+
1720
+ // nodes accept data unless otherwise specified; rejection can be conditional
1721
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
1722
+ }
1723
+ });
1724
+
1725
+ jQuery.fn.extend({
1726
+ data: function( key, value ) {
1727
+ var parts, part, attr, name, l,
1728
+ elem = this[0],
1729
+ i = 0,
1730
+ data = null;
1731
+
1732
+ // Gets all values
1733
+ if ( key === undefined ) {
1734
+ if ( this.length ) {
1735
+ data = jQuery.data( elem );
1736
+
1737
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
1738
+ attr = elem.attributes;
1739
+ for ( l = attr.length; i < l; i++ ) {
1740
+ name = attr[i].name;
1741
+
1742
+ if ( name.indexOf( "data-" ) === 0 ) {
1743
+ name = jQuery.camelCase( name.substring(5) );
1744
+
1745
+ dataAttr( elem, name, data[ name ] );
1746
+ }
1747
+ }
1748
+ jQuery._data( elem, "parsedAttrs", true );
1749
+ }
1750
+ }
1751
+
1752
+ return data;
1753
+ }
1754
+
1755
+ // Sets multiple values
1756
+ if ( typeof key === "object" ) {
1757
+ return this.each(function() {
1758
+ jQuery.data( this, key );
1759
+ });
1760
+ }
1761
+
1762
+ parts = key.split( ".", 2 );
1763
+ parts[1] = parts[1] ? "." + parts[1] : "";
1764
+ part = parts[1] + "!";
1765
+
1766
+ return jQuery.access( this, function( value ) {
1767
+
1768
+ if ( value === undefined ) {
1769
+ data = this.triggerHandler( "getData" + part, [ parts[0] ] );
1770
+
1771
+ // Try to fetch any internally stored data first
1772
+ if ( data === undefined && elem ) {
1773
+ data = jQuery.data( elem, key );
1774
+ data = dataAttr( elem, key, data );
1775
+ }
1776
+
1777
+ return data === undefined && parts[1] ?
1778
+ this.data( parts[0] ) :
1779
+ data;
1780
+ }
1781
+
1782
+ parts[1] = value;
1783
+ this.each(function() {
1784
+ var self = jQuery( this );
1785
+
1786
+ self.triggerHandler( "setData" + part, parts );
1787
+ jQuery.data( this, key, value );
1788
+ self.triggerHandler( "changeData" + part, parts );
1789
+ });
1790
+ }, null, value, arguments.length > 1, null, false );
1791
+ },
1792
+
1793
+ removeData: function( key ) {
1794
+ return this.each(function() {
1795
+ jQuery.removeData( this, key );
1796
+ });
1797
+ }
1798
+ });
1799
+
1800
+ function dataAttr( elem, key, data ) {
1801
+ // If nothing was found internally, try to fetch any
1802
+ // data from the HTML5 data-* attribute
1803
+ if ( data === undefined && elem.nodeType === 1 ) {
1804
+
1805
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
1806
+
1807
+ data = elem.getAttribute( name );
1808
+
1809
+ if ( typeof data === "string" ) {
1810
+ try {
1811
+ data = data === "true" ? true :
1812
+ data === "false" ? false :
1813
+ data === "null" ? null :
1814
+ // Only convert to a number if it doesn't change the string
1815
+ +data + "" === data ? +data :
1816
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
1817
+ data;
1818
+ } catch( e ) {}
1819
+
1820
+ // Make sure we set the data so it isn't changed later
1821
+ jQuery.data( elem, key, data );
1822
+
1823
+ } else {
1824
+ data = undefined;
1825
+ }
1826
+ }
1827
+
1828
+ return data;
1829
+ }
1830
+
1831
+ // checks a cache object for emptiness
1832
+ function isEmptyDataObject( obj ) {
1833
+ var name;
1834
+ for ( name in obj ) {
1835
+
1836
+ // if the public data object is empty, the private is still empty
1837
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
1838
+ continue;
1839
+ }
1840
+ if ( name !== "toJSON" ) {
1841
+ return false;
1842
+ }
1843
+ }
1844
+
1845
+ return true;
1846
+ }
1847
+ jQuery.extend({
1848
+ queue: function( elem, type, data ) {
1849
+ var queue;
1850
+
1851
+ if ( elem ) {
1852
+ type = ( type || "fx" ) + "queue";
1853
+ queue = jQuery._data( elem, type );
1854
+
1855
+ // Speed up dequeue by getting out quickly if this is just a lookup
1856
+ if ( data ) {
1857
+ if ( !queue || jQuery.isArray(data) ) {
1858
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
1859
+ } else {
1860
+ queue.push( data );
1861
+ }
1862
+ }
1863
+ return queue || [];
1864
+ }
1865
+ },
1866
+
1867
+ dequeue: function( elem, type ) {
1868
+ type = type || "fx";
1869
+
1870
+ var queue = jQuery.queue( elem, type ),
1871
+ fn = queue.shift(),
1872
+ hooks = jQuery._queueHooks( elem, type ),
1873
+ next = function() {
1874
+ jQuery.dequeue( elem, type );
1875
+ };
1876
+
1877
+ // If the fx queue is dequeued, always remove the progress sentinel
1878
+ if ( fn === "inprogress" ) {
1879
+ fn = queue.shift();
1880
+ }
1881
+
1882
+ if ( fn ) {
1883
+
1884
+ // Add a progress sentinel to prevent the fx queue from being
1885
+ // automatically dequeued
1886
+ if ( type === "fx" ) {
1887
+ queue.unshift( "inprogress" );
1888
+ }
1889
+
1890
+ // clear up the last queue stop function
1891
+ delete hooks.stop;
1892
+ fn.call( elem, next, hooks );
1893
+ }
1894
+ if ( !queue.length && hooks ) {
1895
+ hooks.empty.fire();
1896
+ }
1897
+ },
1898
+
1899
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
1900
+ _queueHooks: function( elem, type ) {
1901
+ var key = type + "queueHooks";
1902
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
1903
+ empty: jQuery.Callbacks("once memory").add(function() {
1904
+ jQuery.removeData( elem, type + "queue", true );
1905
+ jQuery.removeData( elem, key, true );
1906
+ })
1907
+ });
1908
+ }
1909
+ });
1910
+
1911
+ jQuery.fn.extend({
1912
+ queue: function( type, data ) {
1913
+ var setter = 2;
1914
+
1915
+ if ( typeof type !== "string" ) {
1916
+ data = type;
1917
+ type = "fx";
1918
+ setter--;
1919
+ }
1920
+
1921
+ if ( arguments.length < setter ) {
1922
+ return jQuery.queue( this[0], type );
1923
+ }
1924
+
1925
+ return data === undefined ?
1926
+ this :
1927
+ this.each(function() {
1928
+ var queue = jQuery.queue( this, type, data );
1929
+
1930
+ // ensure a hooks for this queue
1931
+ jQuery._queueHooks( this, type );
1932
+
1933
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
1934
+ jQuery.dequeue( this, type );
1935
+ }
1936
+ });
1937
+ },
1938
+ dequeue: function( type ) {
1939
+ return this.each(function() {
1940
+ jQuery.dequeue( this, type );
1941
+ });
1942
+ },
1943
+ // Based off of the plugin by Clint Helfers, with permission.
1944
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
1945
+ delay: function( time, type ) {
1946
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
1947
+ type = type || "fx";
1948
+
1949
+ return this.queue( type, function( next, hooks ) {
1950
+ var timeout = setTimeout( next, time );
1951
+ hooks.stop = function() {
1952
+ clearTimeout( timeout );
1953
+ };
1954
+ });
1955
+ },
1956
+ clearQueue: function( type ) {
1957
+ return this.queue( type || "fx", [] );
1958
+ },
1959
+ // Get a promise resolved when queues of a certain type
1960
+ // are emptied (fx is the type by default)
1961
+ promise: function( type, obj ) {
1962
+ var tmp,
1963
+ count = 1,
1964
+ defer = jQuery.Deferred(),
1965
+ elements = this,
1966
+ i = this.length,
1967
+ resolve = function() {
1968
+ if ( !( --count ) ) {
1969
+ defer.resolveWith( elements, [ elements ] );
1970
+ }
1971
+ };
1972
+
1973
+ if ( typeof type !== "string" ) {
1974
+ obj = type;
1975
+ type = undefined;
1976
+ }
1977
+ type = type || "fx";
1978
+
1979
+ while( i-- ) {
1980
+ if ( (tmp = jQuery._data( elements[ i ], type + "queueHooks" )) && tmp.empty ) {
1981
+ count++;
1982
+ tmp.empty.add( resolve );
1983
+ }
1984
+ }
1985
+ resolve();
1986
+ return defer.promise( obj );
1987
+ }
1988
+ });
1989
+ var nodeHook, boolHook, fixSpecified,
1990
+ rclass = /[\t\r\n]/g,
1991
+ rreturn = /\r/g,
1992
+ rtype = /^(?:button|input)$/i,
1993
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
1994
+ rclickable = /^a(?:rea|)$/i,
1995
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
1996
+ getSetAttribute = jQuery.support.getSetAttribute;
1997
+
1998
+ jQuery.fn.extend({
1999
+ attr: function( name, value ) {
2000
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
2001
+ },
2002
+
2003
+ removeAttr: function( name ) {
2004
+ return this.each(function() {
2005
+ jQuery.removeAttr( this, name );
2006
+ });
2007
+ },
2008
+
2009
+ prop: function( name, value ) {
2010
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
2011
+ },
2012
+
2013
+ removeProp: function( name ) {
2014
+ name = jQuery.propFix[ name ] || name;
2015
+ return this.each(function() {
2016
+ // try/catch handles cases where IE balks (such as removing a property on window)
2017
+ try {
2018
+ this[ name ] = undefined;
2019
+ delete this[ name ];
2020
+ } catch( e ) {}
2021
+ });
2022
+ },
2023
+
2024
+ addClass: function( value ) {
2025
+ var classNames, i, l, elem,
2026
+ setClass, c, cl;
2027
+
2028
+ if ( jQuery.isFunction( value ) ) {
2029
+ return this.each(function( j ) {
2030
+ jQuery( this ).addClass( value.call(this, j, this.className) );
2031
+ });
2032
+ }
2033
+
2034
+ if ( value && typeof value === "string" ) {
2035
+ classNames = value.split( core_rspace );
2036
+
2037
+ for ( i = 0, l = this.length; i < l; i++ ) {
2038
+ elem = this[ i ];
2039
+
2040
+ if ( elem.nodeType === 1 ) {
2041
+ if ( !elem.className && classNames.length === 1 ) {
2042
+ elem.className = value;
2043
+
2044
+ } else {
2045
+ setClass = " " + elem.className + " ";
2046
+
2047
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
2048
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
2049
+ setClass += classNames[ c ] + " ";
2050
+ }
2051
+ }
2052
+ elem.className = jQuery.trim( setClass );
2053
+ }
2054
+ }
2055
+ }
2056
+ }
2057
+
2058
+ return this;
2059
+ },
2060
+
2061
+ removeClass: function( value ) {
2062
+ var removes, className, elem, c, cl, i, l;
2063
+
2064
+ if ( jQuery.isFunction( value ) ) {
2065
+ return this.each(function( j ) {
2066
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
2067
+ });
2068
+ }
2069
+ if ( (value && typeof value === "string") || value === undefined ) {
2070
+ removes = ( value || "" ).split( core_rspace );
2071
+
2072
+ for ( i = 0, l = this.length; i < l; i++ ) {
2073
+ elem = this[ i ];
2074
+ if ( elem.nodeType === 1 && elem.className ) {
2075
+
2076
+ className = (" " + elem.className + " ").replace( rclass, " " );
2077
+
2078
+ // loop over each item in the removal list
2079
+ for ( c = 0, cl = removes.length; c < cl; c++ ) {
2080
+ // Remove until there is nothing to remove,
2081
+ while ( className.indexOf(" " + removes[ c ] + " ") > -1 ) {
2082
+ className = className.replace( " " + removes[ c ] + " " , " " );
2083
+ }
2084
+ }
2085
+ elem.className = value ? jQuery.trim( className ) : "";
2086
+ }
2087
+ }
2088
+ }
2089
+
2090
+ return this;
2091
+ },
2092
+
2093
+ toggleClass: function( value, stateVal ) {
2094
+ var type = typeof value,
2095
+ isBool = typeof stateVal === "boolean";
2096
+
2097
+ if ( jQuery.isFunction( value ) ) {
2098
+ return this.each(function( i ) {
2099
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
2100
+ });
2101
+ }
2102
+
2103
+ return this.each(function() {
2104
+ if ( type === "string" ) {
2105
+ // toggle individual class names
2106
+ var className,
2107
+ i = 0,
2108
+ self = jQuery( this ),
2109
+ state = stateVal,
2110
+ classNames = value.split( core_rspace );
2111
+
2112
+ while ( (className = classNames[ i++ ]) ) {
2113
+ // check each className given, space separated list
2114
+ state = isBool ? state : !self.hasClass( className );
2115
+ self[ state ? "addClass" : "removeClass" ]( className );
2116
+ }
2117
+
2118
+ } else if ( type === "undefined" || type === "boolean" ) {
2119
+ if ( this.className ) {
2120
+ // store className if set
2121
+ jQuery._data( this, "__className__", this.className );
2122
+ }
2123
+
2124
+ // toggle whole className
2125
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
2126
+ }
2127
+ });
2128
+ },
2129
+
2130
+ hasClass: function( selector ) {
2131
+ var className = " " + selector + " ",
2132
+ i = 0,
2133
+ l = this.length;
2134
+ for ( ; i < l; i++ ) {
2135
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
2136
+ return true;
2137
+ }
2138
+ }
2139
+
2140
+ return false;
2141
+ },
2142
+
2143
+ val: function( value ) {
2144
+ var hooks, ret, isFunction,
2145
+ elem = this[0];
2146
+
2147
+ if ( !arguments.length ) {
2148
+ if ( elem ) {
2149
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
2150
+
2151
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
2152
+ return ret;
2153
+ }
2154
+
2155
+ ret = elem.value;
2156
+
2157
+ return typeof ret === "string" ?
2158
+ // handle most common string cases
2159
+ ret.replace(rreturn, "") :
2160
+ // handle cases where value is null/undef or number
2161
+ ret == null ? "" : ret;
2162
+ }
2163
+
2164
+ return;
2165
+ }
2166
+
2167
+ isFunction = jQuery.isFunction( value );
2168
+
2169
+ return this.each(function( i ) {
2170
+ var val,
2171
+ self = jQuery(this);
2172
+
2173
+ if ( this.nodeType !== 1 ) {
2174
+ return;
2175
+ }
2176
+
2177
+ if ( isFunction ) {
2178
+ val = value.call( this, i, self.val() );
2179
+ } else {
2180
+ val = value;
2181
+ }
2182
+
2183
+ // Treat null/undefined as ""; convert numbers to string
2184
+ if ( val == null ) {
2185
+ val = "";
2186
+ } else if ( typeof val === "number" ) {
2187
+ val += "";
2188
+ } else if ( jQuery.isArray( val ) ) {
2189
+ val = jQuery.map(val, function ( value ) {
2190
+ return value == null ? "" : value + "";
2191
+ });
2192
+ }
2193
+
2194
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
2195
+
2196
+ // If set returns undefined, fall back to normal setting
2197
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
2198
+ this.value = val;
2199
+ }
2200
+ });
2201
+ }
2202
+ });
2203
+
2204
+ jQuery.extend({
2205
+ valHooks: {
2206
+ option: {
2207
+ get: function( elem ) {
2208
+ // attributes.value is undefined in Blackberry 4.7 but
2209
+ // uses .value. See #6932
2210
+ var val = elem.attributes.value;
2211
+ return !val || val.specified ? elem.value : elem.text;
2212
+ }
2213
+ },
2214
+ select: {
2215
+ get: function( elem ) {
2216
+ var value, i, max, option,
2217
+ index = elem.selectedIndex,
2218
+ values = [],
2219
+ options = elem.options,
2220
+ one = elem.type === "select-one";
2221
+
2222
+ // Nothing was selected
2223
+ if ( index < 0 ) {
2224
+ return null;
2225
+ }
2226
+
2227
+ // Loop through all the selected options
2228
+ i = one ? index : 0;
2229
+ max = one ? index + 1 : options.length;
2230
+ for ( ; i < max; i++ ) {
2231
+ option = options[ i ];
2232
+
2233
+ // Don't return options that are disabled or in a disabled optgroup
2234
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
2235
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
2236
+
2237
+ // Get the specific value for the option
2238
+ value = jQuery( option ).val();
2239
+
2240
+ // We don't need an array for one selects
2241
+ if ( one ) {
2242
+ return value;
2243
+ }
2244
+
2245
+ // Multi-Selects return an array
2246
+ values.push( value );
2247
+ }
2248
+ }
2249
+
2250
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
2251
+ if ( one && !values.length && options.length ) {
2252
+ return jQuery( options[ index ] ).val();
2253
+ }
2254
+
2255
+ return values;
2256
+ },
2257
+
2258
+ set: function( elem, value ) {
2259
+ var values = jQuery.makeArray( value );
2260
+
2261
+ jQuery(elem).find("option").each(function() {
2262
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
2263
+ });
2264
+
2265
+ if ( !values.length ) {
2266
+ elem.selectedIndex = -1;
2267
+ }
2268
+ return values;
2269
+ }
2270
+ }
2271
+ },
2272
+
2273
+ // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
2274
+ attrFn: {},
2275
+
2276
+ attr: function( elem, name, value, pass ) {
2277
+ var ret, hooks, notxml,
2278
+ nType = elem.nodeType;
2279
+
2280
+ // don't get/set attributes on text, comment and attribute nodes
2281
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2282
+ return;
2283
+ }
2284
+
2285
+ if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
2286
+ return jQuery( elem )[ name ]( value );
2287
+ }
2288
+
2289
+ // Fallback to prop when attributes are not supported
2290
+ if ( typeof elem.getAttribute === "undefined" ) {
2291
+ return jQuery.prop( elem, name, value );
2292
+ }
2293
+
2294
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2295
+
2296
+ // All attributes are lowercase
2297
+ // Grab necessary hook if one is defined
2298
+ if ( notxml ) {
2299
+ name = name.toLowerCase();
2300
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
2301
+ }
2302
+
2303
+ if ( value !== undefined ) {
2304
+
2305
+ if ( value === null ) {
2306
+ jQuery.removeAttr( elem, name );
2307
+ return;
2308
+
2309
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
2310
+ return ret;
2311
+
2312
+ } else {
2313
+ elem.setAttribute( name, "" + value );
2314
+ return value;
2315
+ }
2316
+
2317
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
2318
+ return ret;
2319
+
2320
+ } else {
2321
+
2322
+ ret = elem.getAttribute( name );
2323
+
2324
+ // Non-existent attributes return null, we normalize to undefined
2325
+ return ret === null ?
2326
+ undefined :
2327
+ ret;
2328
+ }
2329
+ },
2330
+
2331
+ removeAttr: function( elem, value ) {
2332
+ var propName, attrNames, name, isBool,
2333
+ i = 0;
2334
+
2335
+ if ( value && elem.nodeType === 1 ) {
2336
+
2337
+ attrNames = value.split( core_rspace );
2338
+
2339
+ for ( ; i < attrNames.length; i++ ) {
2340
+ name = attrNames[ i ];
2341
+
2342
+ if ( name ) {
2343
+ propName = jQuery.propFix[ name ] || name;
2344
+ isBool = rboolean.test( name );
2345
+
2346
+ // See #9699 for explanation of this approach (setting first, then removal)
2347
+ // Do not do this for boolean attributes (see #10870)
2348
+ if ( !isBool ) {
2349
+ jQuery.attr( elem, name, "" );
2350
+ }
2351
+ elem.removeAttribute( getSetAttribute ? name : propName );
2352
+
2353
+ // Set corresponding property to false for boolean attributes
2354
+ if ( isBool && propName in elem ) {
2355
+ elem[ propName ] = false;
2356
+ }
2357
+ }
2358
+ }
2359
+ }
2360
+ },
2361
+
2362
+ attrHooks: {
2363
+ type: {
2364
+ set: function( elem, value ) {
2365
+ // We can't allow the type property to be changed (since it causes problems in IE)
2366
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
2367
+ jQuery.error( "type property can't be changed" );
2368
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
2369
+ // Setting the type on a radio button after the value resets the value in IE6-9
2370
+ // Reset value to it's default in case type is set after value
2371
+ // This is for element creation
2372
+ var val = elem.value;
2373
+ elem.setAttribute( "type", value );
2374
+ if ( val ) {
2375
+ elem.value = val;
2376
+ }
2377
+ return value;
2378
+ }
2379
+ }
2380
+ },
2381
+ // Use the value property for back compat
2382
+ // Use the nodeHook for button elements in IE6/7 (#1954)
2383
+ value: {
2384
+ get: function( elem, name ) {
2385
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
2386
+ return nodeHook.get( elem, name );
2387
+ }
2388
+ return name in elem ?
2389
+ elem.value :
2390
+ null;
2391
+ },
2392
+ set: function( elem, value, name ) {
2393
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
2394
+ return nodeHook.set( elem, value, name );
2395
+ }
2396
+ // Does not return so that setAttribute is also used
2397
+ elem.value = value;
2398
+ }
2399
+ }
2400
+ },
2401
+
2402
+ propFix: {
2403
+ tabindex: "tabIndex",
2404
+ readonly: "readOnly",
2405
+ "for": "htmlFor",
2406
+ "class": "className",
2407
+ maxlength: "maxLength",
2408
+ cellspacing: "cellSpacing",
2409
+ cellpadding: "cellPadding",
2410
+ rowspan: "rowSpan",
2411
+ colspan: "colSpan",
2412
+ usemap: "useMap",
2413
+ frameborder: "frameBorder",
2414
+ contenteditable: "contentEditable"
2415
+ },
2416
+
2417
+ prop: function( elem, name, value ) {
2418
+ var ret, hooks, notxml,
2419
+ nType = elem.nodeType;
2420
+
2421
+ // don't get/set properties on text, comment and attribute nodes
2422
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
2423
+ return;
2424
+ }
2425
+
2426
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2427
+
2428
+ if ( notxml ) {
2429
+ // Fix name and attach hooks
2430
+ name = jQuery.propFix[ name ] || name;
2431
+ hooks = jQuery.propHooks[ name ];
2432
+ }
2433
+
2434
+ if ( value !== undefined ) {
2435
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
2436
+ return ret;
2437
+
2438
+ } else {
2439
+ return ( elem[ name ] = value );
2440
+ }
2441
+
2442
+ } else {
2443
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
2444
+ return ret;
2445
+
2446
+ } else {
2447
+ return elem[ name ];
2448
+ }
2449
+ }
2450
+ },
2451
+
2452
+ propHooks: {
2453
+ tabIndex: {
2454
+ get: function( elem ) {
2455
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
2456
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
2457
+ var attributeNode = elem.getAttributeNode("tabindex");
2458
+
2459
+ return attributeNode && attributeNode.specified ?
2460
+ parseInt( attributeNode.value, 10 ) :
2461
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
2462
+ 0 :
2463
+ undefined;
2464
+ }
2465
+ }
2466
+ }
2467
+ });
2468
+
2469
+ // Hook for boolean attributes
2470
+ boolHook = {
2471
+ get: function( elem, name ) {
2472
+ // Align boolean attributes with corresponding properties
2473
+ // Fall back to attribute presence where some booleans are not supported
2474
+ var attrNode,
2475
+ property = jQuery.prop( elem, name );
2476
+ return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
2477
+ name.toLowerCase() :
2478
+ undefined;
2479
+ },
2480
+ set: function( elem, value, name ) {
2481
+ var propName;
2482
+ if ( value === false ) {
2483
+ // Remove boolean attributes when set to false
2484
+ jQuery.removeAttr( elem, name );
2485
+ } else {
2486
+ // value is true since we know at this point it's type boolean and not false
2487
+ // Set boolean attributes to the same name and set the DOM property
2488
+ propName = jQuery.propFix[ name ] || name;
2489
+ if ( propName in elem ) {
2490
+ // Only set the IDL specifically if it already exists on the element
2491
+ elem[ propName ] = true;
2492
+ }
2493
+
2494
+ elem.setAttribute( name, name.toLowerCase() );
2495
+ }
2496
+ return name;
2497
+ }
2498
+ };
2499
+
2500
+ // IE6/7 do not support getting/setting some attributes with get/setAttribute
2501
+ if ( !getSetAttribute ) {
2502
+
2503
+ fixSpecified = {
2504
+ name: true,
2505
+ id: true,
2506
+ coords: true
2507
+ };
2508
+
2509
+ // Use this for any attribute in IE6/7
2510
+ // This fixes almost every IE6/7 issue
2511
+ nodeHook = jQuery.valHooks.button = {
2512
+ get: function( elem, name ) {
2513
+ var ret;
2514
+ ret = elem.getAttributeNode( name );
2515
+ return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
2516
+ ret.value :
2517
+ undefined;
2518
+ },
2519
+ set: function( elem, value, name ) {
2520
+ // Set the existing or create a new attribute node
2521
+ var ret = elem.getAttributeNode( name );
2522
+ if ( !ret ) {
2523
+ ret = document.createAttribute( name );
2524
+ elem.setAttributeNode( ret );
2525
+ }
2526
+ return ( ret.value = value + "" );
2527
+ }
2528
+ };
2529
+
2530
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
2531
+ // This is for removals
2532
+ jQuery.each([ "width", "height" ], function( i, name ) {
2533
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2534
+ set: function( elem, value ) {
2535
+ if ( value === "" ) {
2536
+ elem.setAttribute( name, "auto" );
2537
+ return value;
2538
+ }
2539
+ }
2540
+ });
2541
+ });
2542
+
2543
+ // Set contenteditable to false on removals(#10429)
2544
+ // Setting to empty string throws an error as an invalid value
2545
+ jQuery.attrHooks.contenteditable = {
2546
+ get: nodeHook.get,
2547
+ set: function( elem, value, name ) {
2548
+ if ( value === "" ) {
2549
+ value = "false";
2550
+ }
2551
+ nodeHook.set( elem, value, name );
2552
+ }
2553
+ };
2554
+ }
2555
+
2556
+
2557
+ // Some attributes require a special call on IE
2558
+ if ( !jQuery.support.hrefNormalized ) {
2559
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
2560
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
2561
+ get: function( elem ) {
2562
+ var ret = elem.getAttribute( name, 2 );
2563
+ return ret === null ? undefined : ret;
2564
+ }
2565
+ });
2566
+ });
2567
+ }
2568
+
2569
+ if ( !jQuery.support.style ) {
2570
+ jQuery.attrHooks.style = {
2571
+ get: function( elem ) {
2572
+ // Return undefined in the case of empty string
2573
+ // Normalize to lowercase since IE uppercases css property names
2574
+ return elem.style.cssText.toLowerCase() || undefined;
2575
+ },
2576
+ set: function( elem, value ) {
2577
+ return ( elem.style.cssText = "" + value );
2578
+ }
2579
+ };
2580
+ }
2581
+
2582
+ // Safari mis-reports the default selected property of an option
2583
+ // Accessing the parent's selectedIndex property fixes it
2584
+ if ( !jQuery.support.optSelected ) {
2585
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
2586
+ get: function( elem ) {
2587
+ var parent = elem.parentNode;
2588
+
2589
+ if ( parent ) {
2590
+ parent.selectedIndex;
2591
+
2592
+ // Make sure that it also works with optgroups, see #5701
2593
+ if ( parent.parentNode ) {
2594
+ parent.parentNode.selectedIndex;
2595
+ }
2596
+ }
2597
+ return null;
2598
+ }
2599
+ });
2600
+ }
2601
+
2602
+ // IE6/7 call enctype encoding
2603
+ if ( !jQuery.support.enctype ) {
2604
+ jQuery.propFix.enctype = "encoding";
2605
+ }
2606
+
2607
+ // Radios and checkboxes getter/setter
2608
+ if ( !jQuery.support.checkOn ) {
2609
+ jQuery.each([ "radio", "checkbox" ], function() {
2610
+ jQuery.valHooks[ this ] = {
2611
+ get: function( elem ) {
2612
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
2613
+ return elem.getAttribute("value") === null ? "on" : elem.value;
2614
+ }
2615
+ };
2616
+ });
2617
+ }
2618
+ jQuery.each([ "radio", "checkbox" ], function() {
2619
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
2620
+ set: function( elem, value ) {
2621
+ if ( jQuery.isArray( value ) ) {
2622
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
2623
+ }
2624
+ }
2625
+ });
2626
+ });
2627
+ var rformElems = /^(?:textarea|input|select)$/i,
2628
+ rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
2629
+ rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
2630
+ rkeyEvent = /^key/,
2631
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
2632
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2633
+ hoverHack = function( events ) {
2634
+ return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
2635
+ };
2636
+
2637
+ /*
2638
+ * Helper functions for managing events -- not part of the public interface.
2639
+ * Props to Dean Edwards' addEvent library for many of the ideas.
2640
+ */
2641
+ jQuery.event = {
2642
+
2643
+ add: function( elem, types, handler, data, selector ) {
2644
+
2645
+ var elemData, eventHandle, events,
2646
+ t, tns, type, namespaces, handleObj,
2647
+ handleObjIn, handlers, special;
2648
+
2649
+ // Don't attach events to noData or text/comment nodes (allow plain objects tho)
2650
+ if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
2651
+ return;
2652
+ }
2653
+
2654
+ // Caller can pass in an object of custom data in lieu of the handler
2655
+ if ( handler.handler ) {
2656
+ handleObjIn = handler;
2657
+ handler = handleObjIn.handler;
2658
+ selector = handleObjIn.selector;
2659
+ }
2660
+
2661
+ // Make sure that the handler has a unique ID, used to find/remove it later
2662
+ if ( !handler.guid ) {
2663
+ handler.guid = jQuery.guid++;
2664
+ }
2665
+
2666
+ // Init the element's event structure and main handler, if this is the first
2667
+ events = elemData.events;
2668
+ if ( !events ) {
2669
+ elemData.events = events = {};
2670
+ }
2671
+ eventHandle = elemData.handle;
2672
+ if ( !eventHandle ) {
2673
+ elemData.handle = eventHandle = function( e ) {
2674
+ // Discard the second event of a jQuery.event.trigger() and
2675
+ // when an event is called after a page has unloaded
2676
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
2677
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
2678
+ undefined;
2679
+ };
2680
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
2681
+ eventHandle.elem = elem;
2682
+ }
2683
+
2684
+ // Handle multiple events separated by a space
2685
+ // jQuery(...).bind("mouseover mouseout", fn);
2686
+ types = jQuery.trim( hoverHack(types) ).split( " " );
2687
+ for ( t = 0; t < types.length; t++ ) {
2688
+
2689
+ tns = rtypenamespace.exec( types[t] ) || [];
2690
+ type = tns[1];
2691
+ namespaces = ( tns[2] || "" ).split( "." ).sort();
2692
+
2693
+ // If event changes its type, use the special event handlers for the changed type
2694
+ special = jQuery.event.special[ type ] || {};
2695
+
2696
+ // If selector defined, determine special event api type, otherwise given type
2697
+ type = ( selector ? special.delegateType : special.bindType ) || type;
2698
+
2699
+ // Update special based on newly reset type
2700
+ special = jQuery.event.special[ type ] || {};
2701
+
2702
+ // handleObj is passed to all event handlers
2703
+ handleObj = jQuery.extend({
2704
+ type: type,
2705
+ origType: tns[1],
2706
+ data: data,
2707
+ handler: handler,
2708
+ guid: handler.guid,
2709
+ selector: selector,
2710
+ namespace: namespaces.join(".")
2711
+ }, handleObjIn );
2712
+
2713
+ // Init the event handler queue if we're the first
2714
+ handlers = events[ type ];
2715
+ if ( !handlers ) {
2716
+ handlers = events[ type ] = [];
2717
+ handlers.delegateCount = 0;
2718
+
2719
+ // Only use addEventListener/attachEvent if the special events handler returns false
2720
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2721
+ // Bind the global event handler to the element
2722
+ if ( elem.addEventListener ) {
2723
+ elem.addEventListener( type, eventHandle, false );
2724
+
2725
+ } else if ( elem.attachEvent ) {
2726
+ elem.attachEvent( "on" + type, eventHandle );
2727
+ }
2728
+ }
2729
+ }
2730
+
2731
+ if ( special.add ) {
2732
+ special.add.call( elem, handleObj );
2733
+
2734
+ if ( !handleObj.handler.guid ) {
2735
+ handleObj.handler.guid = handler.guid;
2736
+ }
2737
+ }
2738
+
2739
+ // Add to the element's handler list, delegates in front
2740
+ if ( selector ) {
2741
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
2742
+ } else {
2743
+ handlers.push( handleObj );
2744
+ }
2745
+
2746
+ // Keep track of which events have ever been used, for event optimization
2747
+ jQuery.event.global[ type ] = true;
2748
+ }
2749
+
2750
+ // Nullify elem to prevent memory leaks in IE
2751
+ elem = null;
2752
+ },
2753
+
2754
+ global: {},
2755
+
2756
+ // Detach an event or set of events from an element
2757
+ remove: function( elem, types, handler, selector, mappedTypes ) {
2758
+
2759
+ var t, tns, type, origType, namespaces, origCount,
2760
+ j, events, special, eventType, handleObj,
2761
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
2762
+
2763
+ if ( !elemData || !(events = elemData.events) ) {
2764
+ return;
2765
+ }
2766
+
2767
+ // Once for each type.namespace in types; type may be omitted
2768
+ types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
2769
+ for ( t = 0; t < types.length; t++ ) {
2770
+ tns = rtypenamespace.exec( types[t] ) || [];
2771
+ type = origType = tns[1];
2772
+ namespaces = tns[2];
2773
+
2774
+ // Unbind all events (on this namespace, if provided) for the element
2775
+ if ( !type ) {
2776
+ for ( type in events ) {
2777
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
2778
+ }
2779
+ continue;
2780
+ }
2781
+
2782
+ special = jQuery.event.special[ type ] || {};
2783
+ type = ( selector? special.delegateType : special.bindType ) || type;
2784
+ eventType = events[ type ] || [];
2785
+ origCount = eventType.length;
2786
+ namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2787
+
2788
+ // Remove matching events
2789
+ for ( j = 0; j < eventType.length; j++ ) {
2790
+ handleObj = eventType[ j ];
2791
+
2792
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
2793
+ ( !handler || handler.guid === handleObj.guid ) &&
2794
+ ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
2795
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
2796
+ eventType.splice( j--, 1 );
2797
+
2798
+ if ( handleObj.selector ) {
2799
+ eventType.delegateCount--;
2800
+ }
2801
+ if ( special.remove ) {
2802
+ special.remove.call( elem, handleObj );
2803
+ }
2804
+ }
2805
+ }
2806
+
2807
+ // Remove generic event handler if we removed something and no more handlers exist
2808
+ // (avoids potential for endless recursion during removal of special event handlers)
2809
+ if ( eventType.length === 0 && origCount !== eventType.length ) {
2810
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
2811
+ jQuery.removeEvent( elem, type, elemData.handle );
2812
+ }
2813
+
2814
+ delete events[ type ];
2815
+ }
2816
+ }
2817
+
2818
+ // Remove the expando if it's no longer used
2819
+ if ( jQuery.isEmptyObject( events ) ) {
2820
+ delete elemData.handle;
2821
+
2822
+ // removeData also checks for emptiness and clears the expando if empty
2823
+ // so use it instead of delete
2824
+ jQuery.removeData( elem, "events", true );
2825
+ }
2826
+ },
2827
+
2828
+ // Events that are safe to short-circuit if no handlers are attached.
2829
+ // Native DOM events should not be added, they may have inline handlers.
2830
+ customEvent: {
2831
+ "getData": true,
2832
+ "setData": true,
2833
+ "changeData": true
2834
+ },
2835
+
2836
+ trigger: function( event, data, elem, onlyHandlers ) {
2837
+ // Don't do events on text and comment nodes
2838
+ if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
2839
+ return;
2840
+ }
2841
+
2842
+ // Event object or event type
2843
+ var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
2844
+ type = event.type || event,
2845
+ namespaces = [];
2846
+
2847
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
2848
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
2849
+ return;
2850
+ }
2851
+
2852
+ if ( type.indexOf( "!" ) >= 0 ) {
2853
+ // Exclusive events trigger only for the exact event (no namespaces)
2854
+ type = type.slice(0, -1);
2855
+ exclusive = true;
2856
+ }
2857
+
2858
+ if ( type.indexOf( "." ) >= 0 ) {
2859
+ // Namespaced trigger; create a regexp to match event type in handle()
2860
+ namespaces = type.split(".");
2861
+ type = namespaces.shift();
2862
+ namespaces.sort();
2863
+ }
2864
+
2865
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
2866
+ // No jQuery handlers for this event type, and it can't have inline handlers
2867
+ return;
2868
+ }
2869
+
2870
+ // Caller can pass in an Event, Object, or just an event type string
2871
+ event = typeof event === "object" ?
2872
+ // jQuery.Event object
2873
+ event[ jQuery.expando ] ? event :
2874
+ // Object literal
2875
+ new jQuery.Event( type, event ) :
2876
+ // Just the event type (string)
2877
+ new jQuery.Event( type );
2878
+
2879
+ event.type = type;
2880
+ event.isTrigger = true;
2881
+ event.exclusive = exclusive;
2882
+ event.namespace = namespaces.join( "." );
2883
+ event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2884
+ ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
2885
+
2886
+ // Handle a global trigger
2887
+ if ( !elem ) {
2888
+
2889
+ // TODO: Stop taunting the data cache; remove global events and always attach to document
2890
+ cache = jQuery.cache;
2891
+ for ( i in cache ) {
2892
+ if ( cache[ i ].events && cache[ i ].events[ type ] ) {
2893
+ jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
2894
+ }
2895
+ }
2896
+ return;
2897
+ }
2898
+
2899
+ // Clean up the event in case it is being reused
2900
+ event.result = undefined;
2901
+ if ( !event.target ) {
2902
+ event.target = elem;
2903
+ }
2904
+
2905
+ // Clone any incoming data and prepend the event, creating the handler arg list
2906
+ data = data != null ? jQuery.makeArray( data ) : [];
2907
+ data.unshift( event );
2908
+
2909
+ // Allow special events to draw outside the lines
2910
+ special = jQuery.event.special[ type ] || {};
2911
+ if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
2912
+ return;
2913
+ }
2914
+
2915
+ // Determine event propagation path in advance, per W3C events spec (#9951)
2916
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
2917
+ eventPath = [[ elem, special.bindType || type ]];
2918
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
2919
+
2920
+ bubbleType = special.delegateType || type;
2921
+ cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
2922
+ for ( old = elem; cur; cur = cur.parentNode ) {
2923
+ eventPath.push([ cur, bubbleType ]);
2924
+ old = cur;
2925
+ }
2926
+
2927
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
2928
+ if ( old === (elem.ownerDocument || document) ) {
2929
+ eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
2930
+ }
2931
+ }
2932
+
2933
+ // Fire handlers on the event path
2934
+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
2935
+
2936
+ cur = eventPath[i][0];
2937
+ event.type = eventPath[i][1];
2938
+
2939
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
2940
+ if ( handle ) {
2941
+ handle.apply( cur, data );
2942
+ }
2943
+ // Note that this is a bare JS function and not a jQuery handler
2944
+ handle = ontype && cur[ ontype ];
2945
+ if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
2946
+ event.preventDefault();
2947
+ }
2948
+ }
2949
+ event.type = type;
2950
+
2951
+ // If nobody prevented the default action, do it now
2952
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
2953
+
2954
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
2955
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
2956
+
2957
+ // Call a native DOM method on the target with the same name name as the event.
2958
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
2959
+ // Don't do default actions on window, that's where global variables be (#6170)
2960
+ // IE<9 dies on focus/blur to hidden element (#1486)
2961
+ if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
2962
+
2963
+ // Don't re-trigger an onFOO event when we call its FOO() method
2964
+ old = elem[ ontype ];
2965
+
2966
+ if ( old ) {
2967
+ elem[ ontype ] = null;
2968
+ }
2969
+
2970
+ // Prevent re-triggering of the same event, since we already bubbled it above
2971
+ jQuery.event.triggered = type;
2972
+ elem[ type ]();
2973
+ jQuery.event.triggered = undefined;
2974
+
2975
+ if ( old ) {
2976
+ elem[ ontype ] = old;
2977
+ }
2978
+ }
2979
+ }
2980
+ }
2981
+
2982
+ return event.result;
2983
+ },
2984
+
2985
+ dispatch: function( event ) {
2986
+
2987
+ // Make a writable jQuery.Event from the native event object
2988
+ event = jQuery.event.fix( event || window.event );
2989
+
2990
+ var i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related,
2991
+ handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
2992
+ delegateCount = handlers.delegateCount,
2993
+ args = [].slice.call( arguments ),
2994
+ run_all = !event.exclusive && !event.namespace,
2995
+ special = jQuery.event.special[ event.type ] || {},
2996
+ handlerQueue = [];
2997
+
2998
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
2999
+ args[0] = event;
3000
+ event.delegateTarget = this;
3001
+
3002
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
3003
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
3004
+ return;
3005
+ }
3006
+
3007
+ // Determine handlers that should run if there are delegated events
3008
+ // Avoid non-left-click bubbling in Firefox (#3861)
3009
+ if ( delegateCount && !(event.button && event.type === "click") ) {
3010
+
3011
+ // Pregenerate a single jQuery object for reuse with .is()
3012
+ jqcur = jQuery(this);
3013
+ jqcur.context = this;
3014
+
3015
+ for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
3016
+
3017
+ // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #xxxx)
3018
+ if ( cur.disabled !== true || event.type !== "click" ) {
3019
+ selMatch = {};
3020
+ matches = [];
3021
+ jqcur[0] = cur;
3022
+ for ( i = 0; i < delegateCount; i++ ) {
3023
+ handleObj = handlers[ i ];
3024
+ sel = handleObj.selector;
3025
+
3026
+ if ( selMatch[ sel ] === undefined ) {
3027
+ selMatch[ sel ] = jqcur.is( sel );
3028
+ }
3029
+ if ( selMatch[ sel ] ) {
3030
+ matches.push( handleObj );
3031
+ }
3032
+ }
3033
+ if ( matches.length ) {
3034
+ handlerQueue.push({ elem: cur, matches: matches });
3035
+ }
3036
+ }
3037
+ }
3038
+ }
3039
+
3040
+ // Add the remaining (directly-bound) handlers
3041
+ if ( handlers.length > delegateCount ) {
3042
+ handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
3043
+ }
3044
+
3045
+ // Run delegates first; they may want to stop propagation beneath us
3046
+ for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
3047
+ matched = handlerQueue[ i ];
3048
+ event.currentTarget = matched.elem;
3049
+
3050
+ for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
3051
+ handleObj = matched.matches[ j ];
3052
+
3053
+ // Triggered event must either 1) be non-exclusive and have no namespace, or
3054
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
3055
+ if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
3056
+
3057
+ event.data = handleObj.data;
3058
+ event.handleObj = handleObj;
3059
+
3060
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
3061
+ .apply( matched.elem, args );
3062
+
3063
+ if ( ret !== undefined ) {
3064
+ event.result = ret;
3065
+ if ( ret === false ) {
3066
+ event.preventDefault();
3067
+ event.stopPropagation();
3068
+ }
3069
+ }
3070
+ }
3071
+ }
3072
+ }
3073
+
3074
+ // Call the postDispatch hook for the mapped type
3075
+ if ( special.postDispatch ) {
3076
+ special.postDispatch.call( this, event );
3077
+ }
3078
+
3079
+ return event.result;
3080
+ },
3081
+
3082
+ // Includes some event props shared by KeyEvent and MouseEvent
3083
+ // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
3084
+ props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3085
+
3086
+ fixHooks: {},
3087
+
3088
+ keyHooks: {
3089
+ props: "char charCode key keyCode".split(" "),
3090
+ filter: function( event, original ) {
3091
+
3092
+ // Add which for key events
3093
+ if ( event.which == null ) {
3094
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
3095
+ }
3096
+
3097
+ return event;
3098
+ }
3099
+ },
3100
+
3101
+ mouseHooks: {
3102
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3103
+ filter: function( event, original ) {
3104
+ var eventDoc, doc, body,
3105
+ button = original.button,
3106
+ fromElement = original.fromElement;
3107
+
3108
+ // Calculate pageX/Y if missing and clientX/Y available
3109
+ if ( event.pageX == null && original.clientX != null ) {
3110
+ eventDoc = event.target.ownerDocument || document;
3111
+ doc = eventDoc.documentElement;
3112
+ body = eventDoc.body;
3113
+
3114
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
3115
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
3116
+ }
3117
+
3118
+ // Add relatedTarget, if necessary
3119
+ if ( !event.relatedTarget && fromElement ) {
3120
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
3121
+ }
3122
+
3123
+ // Add which for click: 1 === left; 2 === middle; 3 === right
3124
+ // Note: button is not normalized, so don't use it
3125
+ if ( !event.which && button !== undefined ) {
3126
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
3127
+ }
3128
+
3129
+ return event;
3130
+ }
3131
+ },
3132
+
3133
+ fix: function( event ) {
3134
+ if ( event[ jQuery.expando ] ) {
3135
+ return event;
3136
+ }
3137
+
3138
+ // Create a writable copy of the event object and normalize some properties
3139
+ var i, prop,
3140
+ originalEvent = event,
3141
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
3142
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
3143
+
3144
+ event = jQuery.Event( originalEvent );
3145
+
3146
+ for ( i = copy.length; i; ) {
3147
+ prop = copy[ --i ];
3148
+ event[ prop ] = originalEvent[ prop ];
3149
+ }
3150
+
3151
+ // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
3152
+ if ( !event.target ) {
3153
+ event.target = originalEvent.srcElement || document;
3154
+ }
3155
+
3156
+ // Target should not be a text node (#504, Safari)
3157
+ if ( event.target.nodeType === 3 ) {
3158
+ event.target = event.target.parentNode;
3159
+ }
3160
+
3161
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
3162
+ event.metaKey = !!event.metaKey;
3163
+
3164
+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
3165
+ },
3166
+
3167
+ special: {
3168
+ ready: {
3169
+ // Make sure the ready event is setup
3170
+ setup: jQuery.bindReady
3171
+ },
3172
+
3173
+ load: {
3174
+ // Prevent triggered image.load events from bubbling to window.load
3175
+ noBubble: true
3176
+ },
3177
+
3178
+ focus: {
3179
+ delegateType: "focusin"
3180
+ },
3181
+ blur: {
3182
+ delegateType: "focusout"
3183
+ },
3184
+
3185
+ beforeunload: {
3186
+ setup: function( data, namespaces, eventHandle ) {
3187
+ // We only want to do this special case on windows
3188
+ if ( jQuery.isWindow( this ) ) {
3189
+ this.onbeforeunload = eventHandle;
3190
+ }
3191
+ },
3192
+
3193
+ teardown: function( namespaces, eventHandle ) {
3194
+ if ( this.onbeforeunload === eventHandle ) {
3195
+ this.onbeforeunload = null;
3196
+ }
3197
+ }
3198
+ }
3199
+ },
3200
+
3201
+ simulate: function( type, elem, event, bubble ) {
3202
+ // Piggyback on a donor event to simulate a different one.
3203
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
3204
+ // simulated event prevents default then we do the same on the donor.
3205
+ var e = jQuery.extend(
3206
+ new jQuery.Event(),
3207
+ event,
3208
+ { type: type,
3209
+ isSimulated: true,
3210
+ originalEvent: {}
3211
+ }
3212
+ );
3213
+ if ( bubble ) {
3214
+ jQuery.event.trigger( e, null, elem );
3215
+ } else {
3216
+ jQuery.event.dispatch.call( elem, e );
3217
+ }
3218
+ if ( e.isDefaultPrevented() ) {
3219
+ event.preventDefault();
3220
+ }
3221
+ }
3222
+ };
3223
+
3224
+ // Some plugins are using, but it's undocumented/deprecated and will be removed.
3225
+ // The 1.7 special event interface should provide all the hooks needed now.
3226
+ jQuery.event.handle = jQuery.event.dispatch;
3227
+
3228
+ jQuery.removeEvent = document.removeEventListener ?
3229
+ function( elem, type, handle ) {
3230
+ if ( elem.removeEventListener ) {
3231
+ elem.removeEventListener( type, handle, false );
3232
+ }
3233
+ } :
3234
+ function( elem, type, handle ) {
3235
+ var name = "on" + type;
3236
+
3237
+ if ( elem.detachEvent ) {
3238
+
3239
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8 –
3240
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
3241
+ if ( typeof elem[ name ] === "undefined" ) {
3242
+ elem[ name ] = null;
3243
+ }
3244
+
3245
+ elem.detachEvent( name, handle );
3246
+ }
3247
+ };
3248
+
3249
+ jQuery.Event = function( src, props ) {
3250
+ // Allow instantiation without the 'new' keyword
3251
+ if ( !(this instanceof jQuery.Event) ) {
3252
+ return new jQuery.Event( src, props );
3253
+ }
3254
+
3255
+ // Event object
3256
+ if ( src && src.type ) {
3257
+ this.originalEvent = src;
3258
+ this.type = src.type;
3259
+
3260
+ // Events bubbling up the document may have been marked as prevented
3261
+ // by a handler lower down the tree; reflect the correct value.
3262
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
3263
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
3264
+
3265
+ // Event type
3266
+ } else {
3267
+ this.type = src;
3268
+ }
3269
+
3270
+ // Put explicitly provided properties onto the event object
3271
+ if ( props ) {
3272
+ jQuery.extend( this, props );
3273
+ }
3274
+
3275
+ // Create a timestamp if incoming event doesn't have one
3276
+ this.timeStamp = src && src.timeStamp || jQuery.now();
3277
+
3278
+ // Mark it as fixed
3279
+ this[ jQuery.expando ] = true;
3280
+ };
3281
+
3282
+ function returnFalse() {
3283
+ return false;
3284
+ }
3285
+ function returnTrue() {
3286
+ return true;
3287
+ }
3288
+
3289
+ // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
3290
+ // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
3291
+ jQuery.Event.prototype = {
3292
+ preventDefault: function() {
3293
+ this.isDefaultPrevented = returnTrue;
3294
+
3295
+ var e = this.originalEvent;
3296
+ if ( !e ) {
3297
+ return;
3298
+ }
3299
+
3300
+ // if preventDefault exists run it on the original event
3301
+ if ( e.preventDefault ) {
3302
+ e.preventDefault();
3303
+
3304
+ // otherwise set the returnValue property of the original event to false (IE)
3305
+ } else {
3306
+ e.returnValue = false;
3307
+ }
3308
+ },
3309
+ stopPropagation: function() {
3310
+ this.isPropagationStopped = returnTrue;
3311
+
3312
+ var e = this.originalEvent;
3313
+ if ( !e ) {
3314
+ return;
3315
+ }
3316
+ // if stopPropagation exists run it on the original event
3317
+ if ( e.stopPropagation ) {
3318
+ e.stopPropagation();
3319
+ }
3320
+ // otherwise set the cancelBubble property of the original event to true (IE)
3321
+ e.cancelBubble = true;
3322
+ },
3323
+ stopImmediatePropagation: function() {
3324
+ this.isImmediatePropagationStopped = returnTrue;
3325
+ this.stopPropagation();
3326
+ },
3327
+ isDefaultPrevented: returnFalse,
3328
+ isPropagationStopped: returnFalse,
3329
+ isImmediatePropagationStopped: returnFalse
3330
+ };
3331
+
3332
+ // Create mouseenter/leave events using mouseover/out and event-time checks
3333
+ jQuery.each({
3334
+ mouseenter: "mouseover",
3335
+ mouseleave: "mouseout"
3336
+ }, function( orig, fix ) {
3337
+ jQuery.event.special[ orig ] = {
3338
+ delegateType: fix,
3339
+ bindType: fix,
3340
+
3341
+ handle: function( event ) {
3342
+ var ret,
3343
+ target = this,
3344
+ related = event.relatedTarget,
3345
+ handleObj = event.handleObj,
3346
+ selector = handleObj.selector;
3347
+
3348
+ // For mousenter/leave call the handler if related is outside the target.
3349
+ // NB: No relatedTarget if the mouse left/entered the browser window
3350
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
3351
+ event.type = handleObj.origType;
3352
+ ret = handleObj.handler.apply( this, arguments );
3353
+ event.type = fix;
3354
+ }
3355
+ return ret;
3356
+ }
3357
+ };
3358
+ });
3359
+
3360
+ // IE submit delegation
3361
+ if ( !jQuery.support.submitBubbles ) {
3362
+
3363
+ jQuery.event.special.submit = {
3364
+ setup: function() {
3365
+ // Only need this for delegated form submit events
3366
+ if ( jQuery.nodeName( this, "form" ) ) {
3367
+ return false;
3368
+ }
3369
+
3370
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
3371
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
3372
+ // Node name check avoids a VML-related crash in IE (#9807)
3373
+ var elem = e.target,
3374
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
3375
+ if ( form && !jQuery._data( form, "_submit_attached" ) ) {
3376
+ jQuery.event.add( form, "submit._submit", function( event ) {
3377
+ event._submit_bubble = true;
3378
+ });
3379
+ jQuery._data( form, "_submit_attached", true );
3380
+ }
3381
+ });
3382
+ // return undefined since we don't need an event listener
3383
+ },
3384
+
3385
+ postDispatch: function( event ) {
3386
+ // If form was submitted by the user, bubble the event up the tree
3387
+ if ( event._submit_bubble ) {
3388
+ delete event._submit_bubble;
3389
+ if ( this.parentNode && !event.isTrigger ) {
3390
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
3391
+ }
3392
+ }
3393
+ },
3394
+
3395
+ teardown: function() {
3396
+ // Only need this for delegated form submit events
3397
+ if ( jQuery.nodeName( this, "form" ) ) {
3398
+ return false;
3399
+ }
3400
+
3401
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
3402
+ jQuery.event.remove( this, "._submit" );
3403
+ }
3404
+ };
3405
+ }
3406
+
3407
+ // IE change delegation and checkbox/radio fix
3408
+ if ( !jQuery.support.changeBubbles ) {
3409
+
3410
+ jQuery.event.special.change = {
3411
+
3412
+ setup: function() {
3413
+
3414
+ if ( rformElems.test( this.nodeName ) ) {
3415
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
3416
+ // after a propertychange. Eat the blur-change in special.change.handle.
3417
+ // This still fires onchange a second time for check/radio after blur.
3418
+ if ( this.type === "checkbox" || this.type === "radio" ) {
3419
+ jQuery.event.add( this, "propertychange._change", function( event ) {
3420
+ if ( event.originalEvent.propertyName === "checked" ) {
3421
+ this._just_changed = true;
3422
+ }
3423
+ });
3424
+ jQuery.event.add( this, "click._change", function( event ) {
3425
+ if ( this._just_changed && !event.isTrigger ) {
3426
+ this._just_changed = false;
3427
+ }
3428
+ // Allow triggered, simulated change events (#11500)
3429
+ jQuery.event.simulate( "change", this, event, true );
3430
+ });
3431
+ }
3432
+ return false;
3433
+ }
3434
+ // Delegated event; lazy-add a change handler on descendant inputs
3435
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
3436
+ var elem = e.target;
3437
+
3438
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
3439
+ jQuery.event.add( elem, "change._change", function( event ) {
3440
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
3441
+ jQuery.event.simulate( "change", this.parentNode, event, true );
3442
+ }
3443
+ });
3444
+ jQuery._data( elem, "_change_attached", true );
3445
+ }
3446
+ });
3447
+ },
3448
+
3449
+ handle: function( event ) {
3450
+ var elem = event.target;
3451
+
3452
+ // Swallow native change events from checkbox/radio, we already triggered them above
3453
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
3454
+ return event.handleObj.handler.apply( this, arguments );
3455
+ }
3456
+ },
3457
+
3458
+ teardown: function() {
3459
+ jQuery.event.remove( this, "._change" );
3460
+
3461
+ return rformElems.test( this.nodeName );
3462
+ }
3463
+ };
3464
+ }
3465
+
3466
+ // Create "bubbling" focus and blur events
3467
+ if ( !jQuery.support.focusinBubbles ) {
3468
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3469
+
3470
+ // Attach a single capturing handler while someone wants focusin/focusout
3471
+ var attaches = 0,
3472
+ handler = function( event ) {
3473
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
3474
+ };
3475
+
3476
+ jQuery.event.special[ fix ] = {
3477
+ setup: function() {
3478
+ if ( attaches++ === 0 ) {
3479
+ document.addEventListener( orig, handler, true );
3480
+ }
3481
+ },
3482
+ teardown: function() {
3483
+ if ( --attaches === 0 ) {
3484
+ document.removeEventListener( orig, handler, true );
3485
+ }
3486
+ }
3487
+ };
3488
+ });
3489
+ }
3490
+
3491
+ jQuery.fn.extend({
3492
+
3493
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
3494
+ var origFn, type;
3495
+
3496
+ // Types can be a map of types/handlers
3497
+ if ( typeof types === "object" ) {
3498
+ // ( types-Object, selector, data )
3499
+ if ( typeof selector !== "string" ) { // && selector != null
3500
+ // ( types-Object, data )
3501
+ data = data || selector;
3502
+ selector = undefined;
3503
+ }
3504
+ for ( type in types ) {
3505
+ this.on( type, selector, data, types[ type ], one );
3506
+ }
3507
+ return this;
3508
+ }
3509
+
3510
+ if ( data == null && fn == null ) {
3511
+ // ( types, fn )
3512
+ fn = selector;
3513
+ data = selector = undefined;
3514
+ } else if ( fn == null ) {
3515
+ if ( typeof selector === "string" ) {
3516
+ // ( types, selector, fn )
3517
+ fn = data;
3518
+ data = undefined;
3519
+ } else {
3520
+ // ( types, data, fn )
3521
+ fn = data;
3522
+ data = selector;
3523
+ selector = undefined;
3524
+ }
3525
+ }
3526
+ if ( fn === false ) {
3527
+ fn = returnFalse;
3528
+ } else if ( !fn ) {
3529
+ return this;
3530
+ }
3531
+
3532
+ if ( one === 1 ) {
3533
+ origFn = fn;
3534
+ fn = function( event ) {
3535
+ // Can use an empty set, since event contains the info
3536
+ jQuery().off( event );
3537
+ return origFn.apply( this, arguments );
3538
+ };
3539
+ // Use same guid so caller can remove using origFn
3540
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
3541
+ }
3542
+ return this.each( function() {
3543
+ jQuery.event.add( this, types, fn, data, selector );
3544
+ });
3545
+ },
3546
+ one: function( types, selector, data, fn ) {
3547
+ return this.on( types, selector, data, fn, 1 );
3548
+ },
3549
+ off: function( types, selector, fn ) {
3550
+ var handleObj, type;
3551
+ if ( types && types.preventDefault && types.handleObj ) {
3552
+ // ( event ) dispatched jQuery.Event
3553
+ handleObj = types.handleObj;
3554
+ jQuery( types.delegateTarget ).off(
3555
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
3556
+ handleObj.selector,
3557
+ handleObj.handler
3558
+ );
3559
+ return this;
3560
+ }
3561
+ if ( typeof types === "object" ) {
3562
+ // ( types-object [, selector] )
3563
+ for ( type in types ) {
3564
+ this.off( type, selector, types[ type ] );
3565
+ }
3566
+ return this;
3567
+ }
3568
+ if ( selector === false || typeof selector === "function" ) {
3569
+ // ( types [, fn] )
3570
+ fn = selector;
3571
+ selector = undefined;
3572
+ }
3573
+ if ( fn === false ) {
3574
+ fn = returnFalse;
3575
+ }
3576
+ return this.each(function() {
3577
+ jQuery.event.remove( this, types, fn, selector );
3578
+ });
3579
+ },
3580
+
3581
+ bind: function( types, data, fn ) {
3582
+ return this.on( types, null, data, fn );
3583
+ },
3584
+ unbind: function( types, fn ) {
3585
+ return this.off( types, null, fn );
3586
+ },
3587
+
3588
+ live: function( types, data, fn ) {
3589
+ jQuery( this.context ).on( types, this.selector, data, fn );
3590
+ return this;
3591
+ },
3592
+ die: function( types, fn ) {
3593
+ jQuery( this.context ).off( types, this.selector || "**", fn );
3594
+ return this;
3595
+ },
3596
+
3597
+ delegate: function( selector, types, data, fn ) {
3598
+ return this.on( types, selector, data, fn );
3599
+ },
3600
+ undelegate: function( selector, types, fn ) {
3601
+ // ( namespace ) or ( selector, types [, fn] )
3602
+ return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3603
+ },
3604
+
3605
+ trigger: function( type, data ) {
3606
+ return this.each(function() {
3607
+ jQuery.event.trigger( type, data, this );
3608
+ });
3609
+ },
3610
+ triggerHandler: function( type, data ) {
3611
+ if ( this[0] ) {
3612
+ return jQuery.event.trigger( type, data, this[0], true );
3613
+ }
3614
+ },
3615
+
3616
+ toggle: function( fn ) {
3617
+ // Save reference to arguments for access in closure
3618
+ var args = arguments,
3619
+ guid = fn.guid || jQuery.guid++,
3620
+ i = 0,
3621
+ toggler = function( event ) {
3622
+ // Figure out which function to execute
3623
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3624
+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3625
+
3626
+ // Make sure that clicks stop
3627
+ event.preventDefault();
3628
+
3629
+ // and execute the function
3630
+ return args[ lastToggle ].apply( this, arguments ) || false;
3631
+ };
3632
+
3633
+ // link all the functions, so any of them can unbind this click handler
3634
+ toggler.guid = guid;
3635
+ while ( i < args.length ) {
3636
+ args[ i++ ].guid = guid;
3637
+ }
3638
+
3639
+ return this.click( toggler );
3640
+ },
3641
+
3642
+ hover: function( fnOver, fnOut ) {
3643
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
3644
+ }
3645
+ });
3646
+
3647
+ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
3648
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
3649
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
3650
+
3651
+ // Handle event binding
3652
+ jQuery.fn[ name ] = function( data, fn ) {
3653
+ if ( fn == null ) {
3654
+ fn = data;
3655
+ data = null;
3656
+ }
3657
+
3658
+ return arguments.length > 0 ?
3659
+ this.on( name, null, data, fn ) :
3660
+ this.trigger( name );
3661
+ };
3662
+
3663
+ if ( rkeyEvent.test( name ) ) {
3664
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
3665
+ }
3666
+
3667
+ if ( rmouseEvent.test( name ) ) {
3668
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
3669
+ }
3670
+ });
3671
+ /*!
3672
+ * Sizzle CSS Selector Engine
3673
+ * Copyright 2012 jQuery Foundation and other contributors
3674
+ * Released under the MIT license
3675
+ * http://sizzlejs.com/
3676
+ */
3677
+ (function( window, undefined ) {
3678
+
3679
+ var cachedruns,
3680
+ dirruns,
3681
+ sortOrder,
3682
+ siblingCheck,
3683
+ assertGetIdNotName,
3684
+
3685
+ document = window.document,
3686
+ docElem = document.documentElement,
3687
+
3688
+ strundefined = "undefined",
3689
+ hasDuplicate = false,
3690
+ baseHasDuplicate = true,
3691
+ done = 0,
3692
+ slice = [].slice,
3693
+ push = [].push,
3694
+
3695
+ expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
3696
+
3697
+ // Regex
3698
+
3699
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
3700
+ whitespace = "[\\x20\\t\\r\\n\\f]",
3701
+ // http://www.w3.org/TR/css3-syntax/#characters
3702
+ characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
3703
+
3704
+ // Loosely modeled on CSS identifier characters
3705
+ // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
3706
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
3707
+ identifier = characterEncoding.replace( "w", "w#" ),
3708
+
3709
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
3710
+ operators = "([*^$|!~]?=)",
3711
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
3712
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
3713
+ pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",
3714
+ pos = ":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",
3715
+ combinators = whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*",
3716
+ groups = "(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|" + attributes + "|" + pseudos.replace( 2, 7 ) + "|[^\\\\(),])+",
3717
+
3718
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
3719
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
3720
+
3721
+ rcombinators = new RegExp( "^" + combinators ),
3722
+
3723
+ // All simple (non-comma) selectors, excluding insignifant trailing whitespace
3724
+ rgroups = new RegExp( groups + "?(?=" + whitespace + "*,|$)", "g" ),
3725
+
3726
+ // A selector, or everything after leading whitespace
3727
+ // Optionally followed in either case by a ")" for terminating sub-selectors
3728
+ rselector = new RegExp( "^(?:(?!,)(?:(?:^|,)" + whitespace + "*" + groups + ")*?|" + whitespace + "*(.*?))(\\)|$)" ),
3729
+
3730
+ // All combinators and selector components (attribute test, tag, pseudo, etc.), the latter appearing together when consecutive
3731
+ rtokens = new RegExp( groups.slice( 19, -6 ) + "\\x20\\t\\r\\n\\f>+~])+|" + combinators, "g" ),
3732
+
3733
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
3734
+ rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
3735
+
3736
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
3737
+ rendsWithNot = /:not\($/,
3738
+
3739
+ rheader = /h\d/i,
3740
+ rinputs = /input|select|textarea|button/i,
3741
+
3742
+ rbackslash = /\\(?!\\)/g,
3743
+
3744
+ matchExpr = {
3745
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
3746
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
3747
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
3748
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "[-", "[-\\*" ) + ")" ),
3749
+ "ATTR": new RegExp( "^" + attributes ),
3750
+ "PSEUDO": new RegExp( "^" + pseudos ),
3751
+ "CHILD": new RegExp( "^:(only|nth|last|first)-child(?:\\(" + whitespace +
3752
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
3753
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
3754
+ "POS": new RegExp( pos, "ig" ),
3755
+ // For use in libraries implementing .is()
3756
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
3757
+ },
3758
+
3759
+ classCache = {},
3760
+ cachedClasses = [],
3761
+ compilerCache = {},
3762
+ cachedSelectors = [],
3763
+
3764
+ // Mark a function for use in filtering
3765
+ markFunction = function( fn ) {
3766
+ fn.sizzleFilter = true;
3767
+ return fn;
3768
+ },
3769
+
3770
+ // Returns a function to use in pseudos for input types
3771
+ createInputFunction = function( type ) {
3772
+ return function( elem ) {
3773
+ // Check the input's nodeName and type
3774
+ return elem.nodeName.toLowerCase() === "input" && elem.type === type;
3775
+ };
3776
+ },
3777
+
3778
+ // Returns a function to use in pseudos for buttons
3779
+ createButtonFunction = function( type ) {
3780
+ return function( elem ) {
3781
+ var name = elem.nodeName.toLowerCase();
3782
+ return (name === "input" || name === "button") && elem.type === type;
3783
+ };
3784
+ },
3785
+
3786
+ // Used for testing something on an element
3787
+ assert = function( fn ) {
3788
+ var pass = false,
3789
+ div = document.createElement("div");
3790
+ try {
3791
+ pass = fn( div );
3792
+ } catch (e) {}
3793
+ // release memory in IE
3794
+ div = null;
3795
+ return pass;
3796
+ },
3797
+
3798
+ // Check if attributes should be retrieved by attribute nodes
3799
+ assertAttributes = assert(function( div ) {
3800
+ div.innerHTML = "<select></select>";
3801
+ var type = typeof div.lastChild.getAttribute("multiple");
3802
+ // IE8 returns a string for some attributes even when not present
3803
+ return type !== "boolean" && type !== "string";
3804
+ }),
3805
+
3806
+ // Check if getElementById returns elements by name
3807
+ // Check if getElementsByName privileges form controls or returns elements by ID
3808
+ assertUsableName = assert(function( div ) {
3809
+ // Inject content
3810
+ div.id = expando + 0;
3811
+ div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
3812
+ docElem.insertBefore( div, docElem.firstChild );
3813
+
3814
+ // Test
3815
+ var pass = document.getElementsByName &&
3816
+ // buggy browsers will return fewer than the correct 2
3817
+ document.getElementsByName( expando ).length ===
3818
+ // buggy browsers will return more than the correct 0
3819
+ 2 + document.getElementsByName( expando + 0 ).length;
3820
+ assertGetIdNotName = !document.getElementById( expando );
3821
+
3822
+ // Cleanup
3823
+ docElem.removeChild( div );
3824
+
3825
+ return pass;
3826
+ }),
3827
+
3828
+ // Check if the browser returns only elements
3829
+ // when doing getElementsByTagName("*")
3830
+ assertTagNameNoComments = assert(function( div ) {
3831
+ div.appendChild( document.createComment("") );
3832
+ return div.getElementsByTagName("*").length === 0;
3833
+ }),
3834
+
3835
+ // Check if getAttribute returns normalized href attributes
3836
+ assertHrefNotNormalized = assert(function( div ) {
3837
+ div.innerHTML = "<a href='#'></a>";
3838
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
3839
+ div.firstChild.getAttribute("href") === "#";
3840
+ }),
3841
+
3842
+ // Check if getElementsByClassName can be trusted
3843
+ assertUsableClassName = assert(function( div ) {
3844
+ // Opera can't find a second classname (in 9.6)
3845
+ div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
3846
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
3847
+ return false;
3848
+ }
3849
+
3850
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
3851
+ div.lastChild.className = "e";
3852
+ return div.getElementsByClassName("e").length !== 1;
3853
+ });
3854
+
3855
+ var Sizzle = function( selector, context, results, seed ) {
3856
+ results = results || [];
3857
+ context = context || document;
3858
+ var match, elem, xml, m,
3859
+ nodeType = context.nodeType;
3860
+
3861
+ if ( nodeType !== 1 && nodeType !== 9 ) {
3862
+ return [];
3863
+ }
3864
+
3865
+ if ( !selector || typeof selector !== "string" ) {
3866
+ return results;
3867
+ }
3868
+
3869
+ xml = isXML( context );
3870
+
3871
+ if ( !xml && !seed ) {
3872
+ if ( (match = rquickExpr.exec( selector )) ) {
3873
+ // Speed-up: Sizzle("#ID")
3874
+ if ( (m = match[1]) ) {
3875
+ if ( nodeType === 9 ) {
3876
+ elem = context.getElementById( m );
3877
+ // Check parentNode to catch when Blackberry 4.6 returns
3878
+ // nodes that are no longer in the document #6963
3879
+ if ( elem && elem.parentNode ) {
3880
+ // Handle the case where IE, Opera, and Webkit return items
3881
+ // by name instead of ID
3882
+ if ( elem.id === m ) {
3883
+ results.push( elem );
3884
+ return results;
3885
+ }
3886
+ } else {
3887
+ return results;
3888
+ }
3889
+ } else {
3890
+ // Context is not a document
3891
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3892
+ contains( context, elem ) && elem.id === m ) {
3893
+ results.push( elem );
3894
+ return results;
3895
+ }
3896
+ }
3897
+
3898
+ // Speed-up: Sizzle("TAG")
3899
+ } else if ( match[2] ) {
3900
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3901
+ return results;
3902
+
3903
+ // Speed-up: Sizzle(".CLASS")
3904
+ } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
3905
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3906
+ return results;
3907
+ }
3908
+ }
3909
+ }
3910
+
3911
+ // All others
3912
+ return select( selector, context, results, seed, xml );
3913
+ };
3914
+
3915
+ var Expr = Sizzle.selectors = {
3916
+
3917
+ // Can be adjusted by the user
3918
+ cacheLength: 50,
3919
+
3920
+ match: matchExpr,
3921
+
3922
+ order: [ "ID", "TAG" ],
3923
+
3924
+ attrHandle: {},
3925
+
3926
+ createPseudo: markFunction,
3927
+
3928
+ find: {
3929
+ "ID": assertGetIdNotName ?
3930
+ function( id, context, xml ) {
3931
+ if ( typeof context.getElementById !== strundefined && !xml ) {
3932
+ var m = context.getElementById( id );
3933
+ // Check parentNode to catch when Blackberry 4.6 returns
3934
+ // nodes that are no longer in the document #6963
3935
+ return m && m.parentNode ? [m] : [];
3936
+ }
3937
+ } :
3938
+ function( id, context, xml ) {
3939
+ if ( typeof context.getElementById !== strundefined && !xml ) {
3940
+ var m = context.getElementById( id );
3941
+
3942
+ return m ?
3943
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
3944
+ [m] :
3945
+ undefined :
3946
+ [];
3947
+ }
3948
+ },
3949
+
3950
+ "TAG": assertTagNameNoComments ?
3951
+ function( tag, context ) {
3952
+ if ( typeof context.getElementsByTagName !== strundefined ) {
3953
+ return context.getElementsByTagName( tag );
3954
+ }
3955
+ } :
3956
+ function( tag, context ) {
3957
+ var results = context.getElementsByTagName( tag );
3958
+
3959
+ // Filter out possible comments
3960
+ if ( tag === "*" ) {
3961
+ var elem,
3962
+ tmp = [],
3963
+ i = 0;
3964
+
3965
+ for ( ; (elem = results[i]); i++ ) {
3966
+ if ( elem.nodeType === 1 ) {
3967
+ tmp.push( elem );
3968
+ }
3969
+ }
3970
+
3971
+ return tmp;
3972
+ }
3973
+ return results;
3974
+ }
3975
+ },
3976
+
3977
+ relative: {
3978
+ ">": { dir: "parentNode", first: true },
3979
+ " ": { dir: "parentNode" },
3980
+ "+": { dir: "previousSibling", first: true },
3981
+ "~": { dir: "previousSibling" }
3982
+ },
3983
+
3984
+ preFilter: {
3985
+ "ATTR": function( match ) {
3986
+ match[1] = match[1].replace( rbackslash, "" );
3987
+
3988
+ // Move the given value to match[3] whether quoted or unquoted
3989
+ match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
3990
+
3991
+ if ( match[2] === "~=" ) {
3992
+ match[3] = " " + match[3] + " ";
3993
+ }
3994
+
3995
+ return match.slice( 0, 4 );
3996
+ },
3997
+
3998
+ "CHILD": function( match ) {
3999
+ /* matches from matchExpr.CHILD
4000
+ 1 type (only|nth|...)
4001
+ 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4002
+ 3 xn-component of xn+y argument ([+-]?\d*n|)
4003
+ 4 sign of xn-component
4004
+ 5 x of xn-component
4005
+ 6 sign of y-component
4006
+ 7 y of y-component
4007
+ */
4008
+ match[1] = match[1].toLowerCase();
4009
+
4010
+ if ( match[1] === "nth" ) {
4011
+ // nth-child requires argument
4012
+ if ( !match[2] ) {
4013
+ Sizzle.error( match[0] );
4014
+ }
4015
+
4016
+ // numeric x and y parameters for Expr.filter.CHILD
4017
+ // remember that false/true cast respectively to 0/1
4018
+ match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
4019
+ match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
4020
+
4021
+ // other types prohibit arguments
4022
+ } else if ( match[2] ) {
4023
+ Sizzle.error( match[0] );
4024
+ }
4025
+
4026
+ return match;
4027
+ },
4028
+
4029
+ "PSEUDO": function( match ) {
4030
+ var argument,
4031
+ unquoted = match[4];
4032
+
4033
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
4034
+ return null;
4035
+ }
4036
+
4037
+ // Relinquish our claim on characters in `unquoted` from a closing parenthesis on
4038
+ if ( unquoted && (argument = rselector.exec( unquoted )) && argument.pop() ) {
4039
+
4040
+ match[0] = match[0].slice( 0, argument[0].length - unquoted.length - 1 );
4041
+ unquoted = argument[0].slice( 0, -1 );
4042
+ }
4043
+
4044
+ // Quoted or unquoted, we have the full argument
4045
+ // Return only captures needed by the pseudo filter method (type and argument)
4046
+ match.splice( 2, 3, unquoted || match[3] );
4047
+ return match;
4048
+ }
4049
+ },
4050
+
4051
+ filter: {
4052
+ "ID": assertGetIdNotName ?
4053
+ function( id ) {
4054
+ id = id.replace( rbackslash, "" );
4055
+ return function( elem ) {
4056
+ return elem.getAttribute("id") === id;
4057
+ };
4058
+ } :
4059
+ function( id ) {
4060
+ id = id.replace( rbackslash, "" );
4061
+ return function( elem ) {
4062
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
4063
+ return node && node.value === id;
4064
+ };
4065
+ },
4066
+
4067
+ "TAG": function( nodeName ) {
4068
+ if ( nodeName === "*" ) {
4069
+ return function() { return true; };
4070
+ }
4071
+ nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
4072
+
4073
+ return function( elem ) {
4074
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
4075
+ };
4076
+ },
4077
+
4078
+ "CLASS": function( className ) {
4079
+ var pattern = classCache[ className ];
4080
+ if ( !pattern ) {
4081
+ pattern = classCache[ className ] = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" );
4082
+ cachedClasses.push( className );
4083
+ // Avoid too large of a cache
4084
+ if ( cachedClasses.length > Expr.cacheLength ) {
4085
+ delete classCache[ cachedClasses.shift() ];
4086
+ }
4087
+ }
4088
+ return function( elem ) {
4089
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
4090
+ };
4091
+ },
4092
+
4093
+ "ATTR": function( name, operator, check ) {
4094
+ if ( !operator ) {
4095
+ return function( elem ) {
4096
+ return Sizzle.attr( elem, name ) != null;
4097
+ };
4098
+ }
4099
+
4100
+ return function( elem ) {
4101
+ var result = Sizzle.attr( elem, name ),
4102
+ value = result + "";
4103
+
4104
+ if ( result == null ) {
4105
+ return operator === "!=";
4106
+ }
4107
+
4108
+ switch ( operator ) {
4109
+ case "=":
4110
+ return value === check;
4111
+ case "!=":
4112
+ return value !== check;
4113
+ case "^=":
4114
+ return check && value.indexOf( check ) === 0;
4115
+ case "*=":
4116
+ return check && value.indexOf( check ) > -1;
4117
+ case "$=":
4118
+ return check && value.substr( value.length - check.length ) === check;
4119
+ case "~=":
4120
+ return ( " " + value + " " ).indexOf( check ) > -1;
4121
+ case "|=":
4122
+ return value === check || value.substr( 0, check.length + 1 ) === check + "-";
4123
+ }
4124
+ };
4125
+ },
4126
+
4127
+ "CHILD": function( type, argument, first, last ) {
4128
+
4129
+ if ( type === "nth" ) {
4130
+ var doneName = done++;
4131
+
4132
+ return function( elem ) {
4133
+ var parent, diff,
4134
+ count = 0,
4135
+ node = elem;
4136
+
4137
+ if ( first === 1 && last === 0 ) {
4138
+ return true;
4139
+ }
4140
+
4141
+ parent = elem.parentNode;
4142
+
4143
+ if ( parent && (parent[ expando ] !== doneName || !elem.sizset) ) {
4144
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
4145
+ if ( node.nodeType === 1 ) {
4146
+ node.sizset = ++count;
4147
+ if ( node === elem ) {
4148
+ break;
4149
+ }
4150
+ }
4151
+ }
4152
+
4153
+ parent[ expando ] = doneName;
4154
+ }
4155
+
4156
+ diff = elem.sizset - last;
4157
+
4158
+ if ( first === 0 ) {
4159
+ return diff === 0;
4160
+
4161
+ } else {
4162
+ return ( diff % first === 0 && diff / first >= 0 );
4163
+ }
4164
+ };
4165
+ }
4166
+
4167
+ return function( elem ) {
4168
+ var node = elem;
4169
+
4170
+ switch ( type ) {
4171
+ case "only":
4172
+ case "first":
4173
+ while ( (node = node.previousSibling) ) {
4174
+ if ( node.nodeType === 1 ) {
4175
+ return false;
4176
+ }
4177
+ }
4178
+
4179
+ if ( type === "first" ) {
4180
+ return true;
4181
+ }
4182
+
4183
+ node = elem;
4184
+
4185
+ /* falls through */
4186
+ case "last":
4187
+ while ( (node = node.nextSibling) ) {
4188
+ if ( node.nodeType === 1 ) {
4189
+ return false;
4190
+ }
4191
+ }
4192
+
4193
+ return true;
4194
+ }
4195
+ };
4196
+ },
4197
+
4198
+ "PSEUDO": function( pseudo, argument, context, xml ) {
4199
+ // pseudo-class names are case-insensitive
4200
+ // http://www.w3.org/TR/selectors/#pseudo-classes
4201
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
4202
+ var fn = Expr.pseudos[ pseudo ] || Expr.pseudos[ pseudo.toLowerCase() ];
4203
+
4204
+ if ( !fn ) {
4205
+ Sizzle.error( "unsupported pseudo: " + pseudo );
4206
+ }
4207
+
4208
+ // The user may set fn.sizzleFilter to indicate
4209
+ // that arguments are needed to create the filter function
4210
+ // just as Sizzle does
4211
+ if ( !fn.sizzleFilter ) {
4212
+ return fn;
4213
+ }
4214
+
4215
+ return fn( argument, context, xml );
4216
+ }
4217
+ },
4218
+
4219
+ pseudos: {
4220
+ "not": markFunction(function( selector, context, xml ) {
4221
+ // Trim the selector passed to compile
4222
+ // to avoid treating leading and trailing
4223
+ // spaces as combinators
4224
+ var matcher = compile( selector.replace( rtrim, "$1" ), context, xml );
4225
+ return function( elem ) {
4226
+ return !matcher( elem );
4227
+ };
4228
+ }),
4229
+
4230
+ "enabled": function( elem ) {
4231
+ return elem.disabled === false;
4232
+ },
4233
+
4234
+ "disabled": function( elem ) {
4235
+ return elem.disabled === true;
4236
+ },
4237
+
4238
+ "checked": function( elem ) {
4239
+ // In CSS3, :checked should return both checked and selected elements
4240
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4241
+ var nodeName = elem.nodeName.toLowerCase();
4242
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
4243
+ },
4244
+
4245
+ "selected": function( elem ) {
4246
+ // Accessing this property makes selected-by-default
4247
+ // options in Safari work properly
4248
+ if ( elem.parentNode ) {
4249
+ elem.parentNode.selectedIndex;
4250
+ }
4251
+
4252
+ return elem.selected === true;
4253
+ },
4254
+
4255
+ "parent": function( elem ) {
4256
+ return !Expr.pseudos["empty"]( elem );
4257
+ },
4258
+
4259
+ "empty": function( elem ) {
4260
+ // http://www.w3.org/TR/selectors/#empty-pseudo
4261
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
4262
+ // not comment, processing instructions, or others
4263
+ // Thanks to Diego Perini for the nodeName shortcut
4264
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
4265
+ var nodeType;
4266
+ elem = elem.firstChild;
4267
+ while ( elem ) {
4268
+ if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
4269
+ return false;
4270
+ }
4271
+ elem = elem.nextSibling;
4272
+ }
4273
+ return true;
4274
+ },
4275
+
4276
+ "contains": markFunction(function( text ) {
4277
+ return function( elem ) {
4278
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
4279
+ };
4280
+ }),
4281
+
4282
+ "has": markFunction(function( selector ) {
4283
+ return function( elem ) {
4284
+ return Sizzle( selector, elem ).length > 0;
4285
+ };
4286
+ }),
4287
+
4288
+ "header": function( elem ) {
4289
+ return rheader.test( elem.nodeName );
4290
+ },
4291
+
4292
+ "text": function( elem ) {
4293
+ var type, attr;
4294
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4295
+ // use getAttribute instead to test this case
4296
+ return elem.nodeName.toLowerCase() === "input" &&
4297
+ (type = elem.type) === "text" &&
4298
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
4299
+ },
4300
+
4301
+ // Input types
4302
+ "radio": createInputFunction("radio"),
4303
+ "checkbox": createInputFunction("checkbox"),
4304
+ "file": createInputFunction("file"),
4305
+ "password": createInputFunction("password"),
4306
+ "image": createInputFunction("image"),
4307
+
4308
+ "submit": createButtonFunction("submit"),
4309
+ "reset": createButtonFunction("reset"),
4310
+
4311
+ "button": function( elem ) {
4312
+ var name = elem.nodeName.toLowerCase();
4313
+ return name === "input" && elem.type === "button" || name === "button";
4314
+ },
4315
+
4316
+ "input": function( elem ) {
4317
+ return rinputs.test( elem.nodeName );
4318
+ },
4319
+
4320
+ "focus": function( elem ) {
4321
+ var doc = elem.ownerDocument;
4322
+ return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
4323
+ },
4324
+
4325
+ "active": function( elem ) {
4326
+ return elem === elem.ownerDocument.activeElement;
4327
+ }
4328
+ },
4329
+
4330
+ setFilters: {
4331
+ "first": function( elements, argument, not ) {
4332
+ return not ? elements.slice( 1 ) : [ elements[0] ];
4333
+ },
4334
+
4335
+ "last": function( elements, argument, not ) {
4336
+ var elem = elements.pop();
4337
+ return not ? elements : [ elem ];
4338
+ },
4339
+
4340
+ "even": function( elements, argument, not ) {
4341
+ var results = [],
4342
+ i = not ? 1 : 0,
4343
+ len = elements.length;
4344
+ for ( ; i < len; i = i + 2 ) {
4345
+ results.push( elements[i] );
4346
+ }
4347
+ return results;
4348
+ },
4349
+
4350
+ "odd": function( elements, argument, not ) {
4351
+ var results = [],
4352
+ i = not ? 0 : 1,
4353
+ len = elements.length;
4354
+ for ( ; i < len; i = i + 2 ) {
4355
+ results.push( elements[i] );
4356
+ }
4357
+ return results;
4358
+ },
4359
+
4360
+ "lt": function( elements, argument, not ) {
4361
+ return not ? elements.slice( +argument ) : elements.slice( 0, +argument );
4362
+ },
4363
+
4364
+ "gt": function( elements, argument, not ) {
4365
+ return not ? elements.slice( 0, +argument + 1 ) : elements.slice( +argument + 1 );
4366
+ },
4367
+
4368
+ "eq": function( elements, argument, not ) {
4369
+ var elem = elements.splice( +argument, 1 );
4370
+ return not ? elements : elem;
4371
+ }
4372
+ }
4373
+ };
4374
+
4375
+ // Deprecated
4376
+ Expr.setFilters["nth"] = Expr.setFilters["eq"];
4377
+
4378
+ // Back-compat
4379
+ Expr.filters = Expr.pseudos;
4380
+
4381
+ // IE6/7 return a modified href
4382
+ if ( !assertHrefNotNormalized ) {
4383
+ Expr.attrHandle = {
4384
+ "href": function( elem ) {
4385
+ return elem.getAttribute( "href", 2 );
4386
+ },
4387
+ "type": function( elem ) {
4388
+ return elem.getAttribute("type");
4389
+ }
4390
+ };
4391
+ }
4392
+
4393
+ // Add getElementsByName if usable
4394
+ if ( assertUsableName ) {
4395
+ Expr.order.push("NAME");
4396
+ Expr.find["NAME"] = function( name, context ) {
4397
+ if ( typeof context.getElementsByName !== strundefined ) {
4398
+ return context.getElementsByName( name );
4399
+ }
4400
+ };
4401
+ }
4402
+
4403
+ // Add getElementsByClassName if usable
4404
+ if ( assertUsableClassName ) {
4405
+ Expr.order.splice( 1, 0, "CLASS" );
4406
+ Expr.find["CLASS"] = function( className, context, xml ) {
4407
+ if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
4408
+ return context.getElementsByClassName( className );
4409
+ }
4410
+ };
4411
+ }
4412
+
4413
+ // If slice is not available, provide a backup
4414
+ try {
4415
+ slice.call( docElem.childNodes, 0 )[0].nodeType;
4416
+ } catch ( e ) {
4417
+ slice = function( i ) {
4418
+ var elem, results = [];
4419
+ for ( ; (elem = this[i]); i++ ) {
4420
+ results.push( elem );
4421
+ }
4422
+ return results;
4423
+ };
4424
+ }
4425
+
4426
+ var isXML = Sizzle.isXML = function( elem ) {
4427
+ // documentElement is verified for cases where it doesn't yet exist
4428
+ // (such as loading iframes in IE - #4833)
4429
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
4430
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
4431
+ };
4432
+
4433
+ // Element contains another
4434
+ var contains = Sizzle.contains = docElem.compareDocumentPosition ?
4435
+ function( a, b ) {
4436
+ return !!( a.compareDocumentPosition( b ) & 16 );
4437
+ } :
4438
+ docElem.contains ?
4439
+ function( a, b ) {
4440
+ var adown = a.nodeType === 9 ? a.documentElement : a,
4441
+ bup = b.parentNode;
4442
+ return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
4443
+ } :
4444
+ function( a, b ) {
4445
+ while ( (b = b.parentNode) ) {
4446
+ if ( b === a ) {
4447
+ return true;
4448
+ }
4449
+ }
4450
+ return false;
4451
+ };
4452
+
4453
+ /**
4454
+ * Utility function for retrieving the text value of an array of DOM nodes
4455
+ * @param {Array|Element} elem
4456
+ */
4457
+ var getText = Sizzle.getText = function( elem ) {
4458
+ var node,
4459
+ ret = "",
4460
+ i = 0,
4461
+ nodeType = elem.nodeType;
4462
+
4463
+ if ( nodeType ) {
4464
+ if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
4465
+ // Use textContent for elements
4466
+ // innerText usage removed for consistency of new lines (see #11153)
4467
+ if ( typeof elem.textContent === "string" ) {
4468
+ return elem.textContent;
4469
+ } else {
4470
+ // Traverse its children
4471
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4472
+ ret += getText( elem );
4473
+ }
4474
+ }
4475
+ } else if ( nodeType === 3 || nodeType === 4 ) {
4476
+ return elem.nodeValue;
4477
+ }
4478
+ // Do not include comment or processing instruction nodes
4479
+ } else {
4480
+
4481
+ // If no nodeType, this is expected to be an array
4482
+ for ( ; (node = elem[i]); i++ ) {
4483
+ // Do not traverse comment nodes
4484
+ ret += getText( node );
4485
+ }
4486
+ }
4487
+ return ret;
4488
+ };
4489
+
4490
+ Sizzle.attr = function( elem, name ) {
4491
+ var attr,
4492
+ xml = isXML( elem );
4493
+
4494
+ if ( !xml ) {
4495
+ name = name.toLowerCase();
4496
+ }
4497
+ if ( Expr.attrHandle[ name ] ) {
4498
+ return Expr.attrHandle[ name ]( elem );
4499
+ }
4500
+ if ( assertAttributes || xml ) {
4501
+ return elem.getAttribute( name );
4502
+ }
4503
+ attr = elem.getAttributeNode( name );
4504
+ return attr ?
4505
+ typeof elem[ name ] === "boolean" ?
4506
+ elem[ name ] ? name : null :
4507
+ attr.specified ? attr.value : null :
4508
+ null;
4509
+ };
4510
+
4511
+ Sizzle.error = function( msg ) {
4512
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
4513
+ };
4514
+
4515
+ // Check if the JavaScript engine is using some sort of
4516
+ // optimization where it does not always call our comparision
4517
+ // function. If that is the case, discard the hasDuplicate value.
4518
+ // Thus far that includes Google Chrome.
4519
+ [0, 0].sort(function() {
4520
+ return (baseHasDuplicate = 0);
4521
+ });
4522
+
4523
+
4524
+ if ( docElem.compareDocumentPosition ) {
4525
+ sortOrder = function( a, b ) {
4526
+ if ( a === b ) {
4527
+ hasDuplicate = true;
4528
+ return 0;
4529
+ }
4530
+
4531
+ return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
4532
+ a.compareDocumentPosition :
4533
+ a.compareDocumentPosition(b) & 4
4534
+ ) ? -1 : 1;
4535
+ };
4536
+
4537
+ } else {
4538
+ sortOrder = function( a, b ) {
4539
+ // The nodes are identical, we can exit early
4540
+ if ( a === b ) {
4541
+ hasDuplicate = true;
4542
+ return 0;
4543
+
4544
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
4545
+ } else if ( a.sourceIndex && b.sourceIndex ) {
4546
+ return a.sourceIndex - b.sourceIndex;
4547
+ }
4548
+
4549
+ var al, bl,
4550
+ ap = [],
4551
+ bp = [],
4552
+ aup = a.parentNode,
4553
+ bup = b.parentNode,
4554
+ cur = aup;
4555
+
4556
+ // If the nodes are siblings (or identical) we can do a quick check
4557
+ if ( aup === bup ) {
4558
+ return siblingCheck( a, b );
4559
+
4560
+ // If no parents were found then the nodes are disconnected
4561
+ } else if ( !aup ) {
4562
+ return -1;
4563
+
4564
+ } else if ( !bup ) {
4565
+ return 1;
4566
+ }
4567
+
4568
+ // Otherwise they're somewhere else in the tree so we need
4569
+ // to build up a full list of the parentNodes for comparison
4570
+ while ( cur ) {
4571
+ ap.unshift( cur );
4572
+ cur = cur.parentNode;
4573
+ }
4574
+
4575
+ cur = bup;
4576
+
4577
+ while ( cur ) {
4578
+ bp.unshift( cur );
4579
+ cur = cur.parentNode;
4580
+ }
4581
+
4582
+ al = ap.length;
4583
+ bl = bp.length;
4584
+
4585
+ // Start walking down the tree looking for a discrepancy
4586
+ for ( var i = 0; i < al && i < bl; i++ ) {
4587
+ if ( ap[i] !== bp[i] ) {
4588
+ return siblingCheck( ap[i], bp[i] );
4589
+ }
4590
+ }
4591
+
4592
+ // We ended someplace up the tree so do a sibling check
4593
+ return i === al ?
4594
+ siblingCheck( a, bp[i], -1 ) :
4595
+ siblingCheck( ap[i], b, 1 );
4596
+ };
4597
+
4598
+ siblingCheck = function( a, b, ret ) {
4599
+ if ( a === b ) {
4600
+ return ret;
4601
+ }
4602
+
4603
+ var cur = a.nextSibling;
4604
+
4605
+ while ( cur ) {
4606
+ if ( cur === b ) {
4607
+ return -1;
4608
+ }
4609
+
4610
+ cur = cur.nextSibling;
4611
+ }
4612
+
4613
+ return 1;
4614
+ };
4615
+ }
4616
+
4617
+ // Document sorting and removing duplicates
4618
+ Sizzle.uniqueSort = function( results ) {
4619
+ var elem,
4620
+ i = 1;
4621
+
4622
+ if ( sortOrder ) {
4623
+ hasDuplicate = baseHasDuplicate;
4624
+ results.sort( sortOrder );
4625
+
4626
+ if ( hasDuplicate ) {
4627
+ for ( ; (elem = results[i]); i++ ) {
4628
+ if ( elem === results[ i - 1 ] ) {
4629
+ results.splice( i--, 1 );
4630
+ }
4631
+ }
4632
+ }
4633
+ }
4634
+
4635
+ return results;
4636
+ };
4637
+
4638
+ function multipleContexts( selector, contexts, results, seed ) {
4639
+ var i = 0,
4640
+ len = contexts.length;
4641
+ for ( ; i < len; i++ ) {
4642
+ Sizzle( selector, contexts[i], results, seed );
4643
+ }
4644
+ }
4645
+
4646
+ function handlePOSGroup( selector, posfilter, argument, contexts, seed, not ) {
4647
+ var results,
4648
+ fn = Expr.setFilters[ posfilter.toLowerCase() ];
4649
+
4650
+ if ( !fn ) {
4651
+ Sizzle.error( posfilter );
4652
+ }
4653
+
4654
+ if ( selector || !(results = seed) ) {
4655
+ multipleContexts( selector || "*", contexts, (results = []), seed );
4656
+ }
4657
+
4658
+ return results.length > 0 ? fn( results, argument, not ) : [];
4659
+ }
4660
+
4661
+ function handlePOS( selector, context, results, seed, groups ) {
4662
+ var match, not, anchor, ret, elements, currentContexts, part, lastIndex,
4663
+ i = 0,
4664
+ len = groups.length,
4665
+ rpos = matchExpr["POS"],
4666
+ // This is generated here in case matchExpr["POS"] is extended
4667
+ rposgroups = new RegExp( "^" + rpos.source + "(?!" + whitespace + ")", "i" ),
4668
+ // This is for making sure non-participating
4669
+ // matching groups are represented cross-browser (IE6-8)
4670
+ setUndefined = function() {
4671
+ var i = 1,
4672
+ len = arguments.length - 2;
4673
+ for ( ; i < len; i++ ) {
4674
+ if ( arguments[i] === undefined ) {
4675
+ match[i] = undefined;
4676
+ }
4677
+ }
4678
+ };
4679
+
4680
+ for ( ; i < len; i++ ) {
4681
+ // Reset regex index to 0
4682
+ rpos.exec("");
4683
+ selector = groups[i];
4684
+ ret = [];
4685
+ anchor = 0;
4686
+ elements = seed;
4687
+ while ( (match = rpos.exec( selector )) ) {
4688
+ lastIndex = rpos.lastIndex = match.index + match[0].length;
4689
+ if ( lastIndex > anchor ) {
4690
+ part = selector.slice( anchor, match.index );
4691
+ anchor = lastIndex;
4692
+ currentContexts = [ context ];
4693
+
4694
+ if ( rcombinators.test(part) ) {
4695
+ if ( elements ) {
4696
+ currentContexts = elements;
4697
+ }
4698
+ elements = seed;
4699
+ }
4700
+
4701
+ if ( (not = rendsWithNot.test( part )) ) {
4702
+ part = part.slice( 0, -5 ).replace( rcombinators, "$&*" );
4703
+ }
4704
+
4705
+ if ( match.length > 1 ) {
4706
+ match[0].replace( rposgroups, setUndefined );
4707
+ }
4708
+ elements = handlePOSGroup( part, match[1], match[2], currentContexts, elements, not );
4709
+ }
4710
+ }
4711
+
4712
+ if ( elements ) {
4713
+ ret = ret.concat( elements );
4714
+
4715
+ if ( (part = selector.slice( anchor )) && part !== ")" ) {
4716
+ if ( rcombinators.test(part) ) {
4717
+ multipleContexts( part, ret, results, seed );
4718
+ } else {
4719
+ Sizzle( part, context, results, seed ? seed.concat(elements) : elements );
4720
+ }
4721
+ } else {
4722
+ push.apply( results, ret );
4723
+ }
4724
+ } else {
4725
+ Sizzle( selector, context, results, seed );
4726
+ }
4727
+ }
4728
+
4729
+ // Do not sort if this is a single filter
4730
+ return len === 1 ? results : Sizzle.uniqueSort( results );
4731
+ }
4732
+
4733
+ function tokenize( selector, context, xml ) {
4734
+ var tokens, soFar, type,
4735
+ groups = [],
4736
+ i = 0,
4737
+
4738
+ // Catch obvious selector issues: terminal ")"; nonempty fallback match
4739
+ // rselector never fails to match *something*
4740
+ match = rselector.exec( selector ),
4741
+ matched = !match.pop() && !match.pop(),
4742
+ selectorGroups = matched && selector.match( rgroups ) || [""],
4743
+
4744
+ preFilters = Expr.preFilter,
4745
+ filters = Expr.filter,
4746
+ checkContext = !xml && context !== document;
4747
+
4748
+ for ( ; (soFar = selectorGroups[i]) != null && matched; i++ ) {
4749
+ groups.push( tokens = [] );
4750
+
4751
+ // Need to make sure we're within a narrower context if necessary
4752
+ // Adding a descendant combinator will generate what is needed
4753
+ if ( checkContext ) {
4754
+ soFar = " " + soFar;
4755
+ }
4756
+
4757
+ while ( soFar ) {
4758
+ matched = false;
4759
+
4760
+ // Combinators
4761
+ if ( (match = rcombinators.exec( soFar )) ) {
4762
+ soFar = soFar.slice( match[0].length );
4763
+
4764
+ // Cast descendant combinators to space
4765
+ matched = tokens.push({ part: match.pop().replace( rtrim, " " ), captures: match });
4766
+ }
4767
+
4768
+ // Filters
4769
+ for ( type in filters ) {
4770
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4771
+ (match = preFilters[ type ]( match, context, xml )) ) ) {
4772
+
4773
+ soFar = soFar.slice( match.shift().length );
4774
+ matched = tokens.push({ part: type, captures: match });
4775
+ }
4776
+ }
4777
+
4778
+ if ( !matched ) {
4779
+ break;
4780
+ }
4781
+ }
4782
+ }
4783
+
4784
+ if ( !matched ) {
4785
+ Sizzle.error( selector );
4786
+ }
4787
+
4788
+ return groups;
4789
+ }
4790
+
4791
+ function addCombinator( matcher, combinator, context ) {
4792
+ var dir = combinator.dir,
4793
+ doneName = done++;
4794
+
4795
+ if ( !matcher ) {
4796
+ // If there is no matcher to check, check against the context
4797
+ matcher = function( elem ) {
4798
+ return elem === context;
4799
+ };
4800
+ }
4801
+ return combinator.first ?
4802
+ function( elem, context ) {
4803
+ while ( (elem = elem[ dir ]) ) {
4804
+ if ( elem.nodeType === 1 ) {
4805
+ return matcher( elem, context ) && elem;
4806
+ }
4807
+ }
4808
+ } :
4809
+ function( elem, context ) {
4810
+ var cache,
4811
+ dirkey = doneName + "." + dirruns,
4812
+ cachedkey = dirkey + "." + cachedruns;
4813
+ while ( (elem = elem[ dir ]) ) {
4814
+ if ( elem.nodeType === 1 ) {
4815
+ if ( (cache = elem[ expando ]) === cachedkey ) {
4816
+ return elem.sizset;
4817
+ } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
4818
+ if ( elem.sizset ) {
4819
+ return elem;
4820
+ }
4821
+ } else {
4822
+ elem[ expando ] = cachedkey;
4823
+ if ( matcher( elem, context ) ) {
4824
+ elem.sizset = true;
4825
+ return elem;
4826
+ }
4827
+ elem.sizset = false;
4828
+ }
4829
+ }
4830
+ }
4831
+ };
4832
+ }
4833
+
4834
+ function addMatcher( higher, deeper ) {
4835
+ return higher ?
4836
+ function( elem, context ) {
4837
+ var result = deeper( elem, context );
4838
+ return result && higher( result === true ? elem : result, context );
4839
+ } :
4840
+ deeper;
4841
+ }
4842
+
4843
+ // ["TAG", ">", "ID", " ", "CLASS"]
4844
+ function matcherFromTokens( tokens, context, xml ) {
4845
+ var token, matcher,
4846
+ i = 0;
4847
+
4848
+ for ( ; (token = tokens[i]); i++ ) {
4849
+ if ( Expr.relative[ token.part ] ) {
4850
+ matcher = addCombinator( matcher, Expr.relative[ token.part ], context );
4851
+ } else {
4852
+ token.captures.push( context, xml );
4853
+ matcher = addMatcher( matcher, Expr.filter[ token.part ].apply( null, token.captures ) );
4854
+ }
4855
+ }
4856
+
4857
+ return matcher;
4858
+ }
4859
+
4860
+ function matcherFromGroupMatchers( matchers ) {
4861
+ return function( elem, context ) {
4862
+ var matcher,
4863
+ j = 0;
4864
+ for ( ; (matcher = matchers[j]); j++ ) {
4865
+ if ( matcher(elem, context) ) {
4866
+ return true;
4867
+ }
4868
+ }
4869
+ return false;
4870
+ };
4871
+ }
4872
+
4873
+ var compile = Sizzle.compile = function( selector, context, xml ) {
4874
+ var tokens, group, i,
4875
+ cached = compilerCache[ selector ];
4876
+
4877
+ // Return a cached group function if already generated (context dependent)
4878
+ if ( cached && cached.context === context ) {
4879
+ return cached;
4880
+ }
4881
+
4882
+ // Generate a function of recursive functions that can be used to check each element
4883
+ group = tokenize( selector, context, xml );
4884
+ for ( i = 0; (tokens = group[i]); i++ ) {
4885
+ group[i] = matcherFromTokens( tokens, context, xml );
4886
+ }
4887
+
4888
+ // Cache the compiled function
4889
+ cached = compilerCache[ selector ] = matcherFromGroupMatchers( group );
4890
+ cached.context = context;
4891
+ cached.runs = cached.dirruns = 0;
4892
+ cachedSelectors.push( selector );
4893
+ // Ensure only the most recent are cached
4894
+ if ( cachedSelectors.length > Expr.cacheLength ) {
4895
+ delete compilerCache[ cachedSelectors.shift() ];
4896
+ }
4897
+ return cached;
4898
+ };
4899
+
4900
+ Sizzle.matches = function( expr, elements ) {
4901
+ return Sizzle( expr, null, null, elements );
4902
+ };
4903
+
4904
+ Sizzle.matchesSelector = function( elem, expr ) {
4905
+ return Sizzle( expr, null, null, [ elem ] ).length > 0;
4906
+ };
4907
+
4908
+ var select = function( selector, context, results, seed, xml ) {
4909
+ // Remove excessive whitespace
4910
+ selector = selector.replace( rtrim, "$1" );
4911
+ var elements, matcher, i, len, elem, token,
4912
+ type, findContext, notTokens,
4913
+ match = selector.match( rgroups ),
4914
+ tokens = selector.match( rtokens ),
4915
+ contextNodeType = context.nodeType;
4916
+
4917
+ // POS handling
4918
+ if ( matchExpr["POS"].test(selector) ) {
4919
+ return handlePOS( selector, context, results, seed, match );
4920
+ }
4921
+
4922
+ if ( seed ) {
4923
+ elements = slice.call( seed, 0 );
4924
+
4925
+ // To maintain document order, only narrow the
4926
+ // set if there is one group
4927
+ } else if ( match && match.length === 1 ) {
4928
+
4929
+ // Take a shortcut and set the context if the root selector is an ID
4930
+ if ( tokens.length > 1 && contextNodeType === 9 && !xml &&
4931
+ (match = matchExpr["ID"].exec( tokens[0] )) ) {
4932
+
4933
+ context = Expr.find["ID"]( match[1], context, xml )[0];
4934
+ if ( !context ) {
4935
+ return results;
4936
+ }
4937
+
4938
+ selector = selector.slice( tokens.shift().length );
4939
+ }
4940
+
4941
+ findContext = ( (match = rsibling.exec( tokens[0] )) && !match.index && context.parentNode ) || context;
4942
+
4943
+ // Get the last token, excluding :not
4944
+ notTokens = tokens.pop();
4945
+ token = notTokens.split(":not")[0];
4946
+
4947
+ for ( i = 0, len = Expr.order.length; i < len; i++ ) {
4948
+ type = Expr.order[i];
4949
+
4950
+ if ( (match = matchExpr[ type ].exec( token )) ) {
4951
+ elements = Expr.find[ type ]( (match[1] || "").replace( rbackslash, "" ), findContext, xml );
4952
+
4953
+ if ( elements == null ) {
4954
+ continue;
4955
+ }
4956
+
4957
+ if ( token === notTokens ) {
4958
+ selector = selector.slice( 0, selector.length - notTokens.length ) +
4959
+ token.replace( matchExpr[ type ], "" );
4960
+
4961
+ if ( !selector ) {
4962
+ push.apply( results, slice.call(elements, 0) );
4963
+ }
4964
+ }
4965
+ break;
4966
+ }
4967
+ }
4968
+ }
4969
+
4970
+ // Only loop over the given elements once
4971
+ // If selector is empty, we're already done
4972
+ if ( selector ) {
4973
+ matcher = compile( selector, context, xml );
4974
+ dirruns = matcher.dirruns++;
4975
+
4976
+ if ( elements == null ) {
4977
+ elements = Expr.find["TAG"]( "*", (rsibling.test( selector ) && context.parentNode) || context );
4978
+ }
4979
+ for ( i = 0; (elem = elements[i]); i++ ) {
4980
+ cachedruns = matcher.runs++;
4981
+ if ( matcher(elem, context) ) {
4982
+ results.push( elem );
4983
+ }
4984
+ }
4985
+ }
4986
+
4987
+ return results;
4988
+ };
4989
+
4990
+ if ( document.querySelectorAll ) {
4991
+ (function() {
4992
+ var disconnectedMatch,
4993
+ oldSelect = select,
4994
+ rescape = /'|\\/g,
4995
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
4996
+ rbuggyQSA = [],
4997
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
4998
+ // A support test would require too much code (would include document ready)
4999
+ // just skip matchesSelector for :active
5000
+ rbuggyMatches = [":active"],
5001
+ matches = docElem.matchesSelector ||
5002
+ docElem.mozMatchesSelector ||
5003
+ docElem.webkitMatchesSelector ||
5004
+ docElem.oMatchesSelector ||
5005
+ docElem.msMatchesSelector;
5006
+
5007
+ // Build QSA regex
5008
+ // Regex strategy adopted from Diego Perini
5009
+ assert(function( div ) {
5010
+ div.innerHTML = "<select><option selected></option></select>";
5011
+
5012
+ // IE8 - Some boolean attributes are not treated correctly
5013
+ if ( !div.querySelectorAll("[selected]").length ) {
5014
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
5015
+ }
5016
+
5017
+ // Webkit/Opera - :checked should return selected option elements
5018
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
5019
+ // IE8 throws error here (do not put tests after this one)
5020
+ if ( !div.querySelectorAll(":checked").length ) {
5021
+ rbuggyQSA.push(":checked");
5022
+ }
5023
+ });
5024
+
5025
+ assert(function( div ) {
5026
+
5027
+ // Opera 10-12/IE9 - ^= $= *= and empty values
5028
+ // Should not select anything
5029
+ div.innerHTML = "<p test=''></p>";
5030
+ if ( div.querySelectorAll("[test^='']").length ) {
5031
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
5032
+ }
5033
+
5034
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
5035
+ // IE8 throws error here (do not put tests after this one)
5036
+ div.innerHTML = "<input type='hidden'>";
5037
+ if ( !div.querySelectorAll(":enabled").length ) {
5038
+ rbuggyQSA.push(":enabled", ":disabled");
5039
+ }
5040
+ });
5041
+
5042
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
5043
+
5044
+ select = function( selector, context, results, seed, xml ) {
5045
+ // Only use querySelectorAll when not filtering,
5046
+ // when this is not xml,
5047
+ // and when no QSA bugs apply
5048
+ if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
5049
+ if ( context.nodeType === 9 ) {
5050
+ try {
5051
+ push.apply( results, slice.call(context.querySelectorAll( selector ), 0) );
5052
+ return results;
5053
+ } catch(qsaError) {}
5054
+ // qSA works strangely on Element-rooted queries
5055
+ // We can work around this by specifying an extra ID on the root
5056
+ // and working up from there (Thanks to Andrew Dupont for the technique)
5057
+ // IE 8 doesn't work on object elements
5058
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
5059
+ var old = context.getAttribute("id"),
5060
+ nid = old || expando,
5061
+ newContext = rsibling.test( selector ) && context.parentNode || context;
5062
+
5063
+ if ( old ) {
5064
+ nid = nid.replace( rescape, "\\$&" );
5065
+ } else {
5066
+ context.setAttribute( "id", nid );
5067
+ }
5068
+
5069
+ try {
5070
+ push.apply( results, slice.call( newContext.querySelectorAll(
5071
+ selector.replace( rgroups, "[id='" + nid + "'] $&" )
5072
+ ), 0 ) );
5073
+ return results;
5074
+ } catch(qsaError) {
5075
+ } finally {
5076
+ if ( !old ) {
5077
+ context.removeAttribute("id");
5078
+ }
5079
+ }
5080
+ }
5081
+ }
5082
+
5083
+ return oldSelect( selector, context, results, seed, xml );
5084
+ };
5085
+
5086
+ if ( matches ) {
5087
+ assert(function( div ) {
5088
+ // Check to see if it's possible to do matchesSelector
5089
+ // on a disconnected node (IE 9)
5090
+ disconnectedMatch = matches.call( div, "div" );
5091
+
5092
+ // This should fail with an exception
5093
+ // Gecko does not error, returns false instead
5094
+ try {
5095
+ matches.call( div, "[test!='']:sizzle" );
5096
+ rbuggyMatches.push( Expr.match.PSEUDO );
5097
+ } catch ( e ) {}
5098
+ });
5099
+
5100
+ // rbuggyMatches always contains :active, so no need for a length check
5101
+ rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
5102
+
5103
+ Sizzle.matchesSelector = function( elem, expr ) {
5104
+ // Make sure that attribute selectors are quoted
5105
+ expr = expr.replace( rattributeQuotes, "='$1']" );
5106
+
5107
+ // rbuggyMatches always contains :active, so no need for an existence check
5108
+ if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
5109
+ try {
5110
+ var ret = matches.call( elem, expr );
5111
+
5112
+ // IE 9's matchesSelector returns false on disconnected nodes
5113
+ if ( ret || disconnectedMatch ||
5114
+ // As well, disconnected nodes are said to be in a document
5115
+ // fragment in IE 9
5116
+ elem.document && elem.document.nodeType !== 11 ) {
5117
+ return ret;
5118
+ }
5119
+ } catch(e) {}
5120
+ }
5121
+
5122
+ return Sizzle( expr, null, null, [ elem ] ).length > 0;
5123
+ };
5124
+ }
5125
+ })();
5126
+ }
5127
+
5128
+ // Override sizzle attribute retrieval
5129
+ Sizzle.attr = jQuery.attr;
5130
+ jQuery.find = Sizzle;
5131
+ jQuery.expr = Sizzle.selectors;
5132
+ jQuery.expr[":"] = jQuery.expr.pseudos;
5133
+ jQuery.unique = Sizzle.uniqueSort;
5134
+ jQuery.text = Sizzle.getText;
5135
+ jQuery.isXMLDoc = Sizzle.isXML;
5136
+ jQuery.contains = Sizzle.contains;
5137
+
5138
+
5139
+ })( window );
5140
+ var runtil = /Until$/,
5141
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
5142
+ isSimple = /^.[^:#\[\.,]*$/,
5143
+ rneedsContext = jQuery.expr.match.needsContext,
5144
+ // methods guaranteed to produce a unique set when starting from a unique set
5145
+ guaranteedUnique = {
5146
+ children: true,
5147
+ contents: true,
5148
+ next: true,
5149
+ prev: true
5150
+ };
5151
+
5152
+ jQuery.fn.extend({
5153
+ find: function( selector ) {
5154
+ var i, l, length, n, r, ret,
5155
+ self = this;
5156
+
5157
+ if ( typeof selector !== "string" ) {
5158
+ return jQuery( selector ).filter(function() {
5159
+ for ( i = 0, l = self.length; i < l; i++ ) {
5160
+ if ( jQuery.contains( self[ i ], this ) ) {
5161
+ return true;
5162
+ }
5163
+ }
5164
+ });
5165
+ }
5166
+
5167
+ ret = this.pushStack( "", "find", selector );
5168
+
5169
+ for ( i = 0, l = this.length; i < l; i++ ) {
5170
+ length = ret.length;
5171
+ jQuery.find( selector, this[i], ret );
5172
+
5173
+ if ( i > 0 ) {
5174
+ // Make sure that the results are unique
5175
+ for ( n = length; n < ret.length; n++ ) {
5176
+ for ( r = 0; r < length; r++ ) {
5177
+ if ( ret[r] === ret[n] ) {
5178
+ ret.splice(n--, 1);
5179
+ break;
5180
+ }
5181
+ }
5182
+ }
5183
+ }
5184
+ }
5185
+
5186
+ return ret;
5187
+ },
5188
+
5189
+ has: function( target ) {
5190
+ var i,
5191
+ targets = jQuery( target, this ),
5192
+ len = targets.length;
5193
+
5194
+ return this.filter(function() {
5195
+ for ( i = 0; i < len; i++ ) {
5196
+ if ( jQuery.contains( this, targets[i] ) ) {
5197
+ return true;
5198
+ }
5199
+ }
5200
+ });
5201
+ },
5202
+
5203
+ not: function( selector ) {
5204
+ return this.pushStack( winnow(this, selector, false), "not", selector);
5205
+ },
5206
+
5207
+ filter: function( selector ) {
5208
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
5209
+ },
5210
+
5211
+ is: function( selector ) {
5212
+ return !!selector && (
5213
+ typeof selector === "string" ?
5214
+ // If this is a positional/relative selector, check membership in the returned set
5215
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
5216
+ rneedsContext.test( selector ) ?
5217
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
5218
+ jQuery.filter( selector, this ).length > 0 :
5219
+ this.filter( selector ).length > 0 );
5220
+ },
5221
+
5222
+ closest: function( selectors, context ) {
5223
+ var cur,
5224
+ i = 0,
5225
+ l = this.length,
5226
+ ret = [],
5227
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
5228
+ jQuery( selectors, context || this.context ) :
5229
+ 0;
5230
+
5231
+ for ( ; i < l; i++ ) {
5232
+ cur = this[i];
5233
+
5234
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
5235
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
5236
+ ret.push( cur );
5237
+ break;
5238
+ }
5239
+ cur = cur.parentNode;
5240
+ }
5241
+ }
5242
+
5243
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
5244
+
5245
+ return this.pushStack( ret, "closest", selectors );
5246
+ },
5247
+
5248
+ // Determine the position of an element within
5249
+ // the matched set of elements
5250
+ index: function( elem ) {
5251
+
5252
+ // No argument, return index in parent
5253
+ if ( !elem ) {
5254
+ return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
5255
+ }
5256
+
5257
+ // index in selector
5258
+ if ( typeof elem === "string" ) {
5259
+ return jQuery.inArray( this[0], jQuery( elem ) );
5260
+ }
5261
+
5262
+ // Locate the position of the desired element
5263
+ return jQuery.inArray(
5264
+ // If it receives a jQuery object, the first element is used
5265
+ elem.jquery ? elem[0] : elem, this );
5266
+ },
5267
+
5268
+ add: function( selector, context ) {
5269
+ var set = typeof selector === "string" ?
5270
+ jQuery( selector, context ) :
5271
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
5272
+ all = jQuery.merge( this.get(), set );
5273
+
5274
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
5275
+ all :
5276
+ jQuery.unique( all ) );
5277
+ },
5278
+
5279
+ addBack: function( selector ) {
5280
+ return this.add( selector == null ?
5281
+ this.prevObject : this.prevObject.filter(selector)
5282
+ );
5283
+ }
5284
+ });
5285
+
5286
+ jQuery.fn.andSelf = jQuery.fn.addBack;
5287
+
5288
+ // A painfully simple check to see if an element is disconnected
5289
+ // from a document (should be improved, where feasible).
5290
+ function isDisconnected( node ) {
5291
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
5292
+ }
5293
+
5294
+ function sibling( cur, dir ) {
5295
+ do {
5296
+ cur = cur[ dir ];
5297
+ } while ( cur && cur.nodeType !== 1 );
5298
+
5299
+ return cur;
5300
+ }
5301
+
5302
+ jQuery.each({
5303
+ parent: function( elem ) {
5304
+ var parent = elem.parentNode;
5305
+ return parent && parent.nodeType !== 11 ? parent : null;
5306
+ },
5307
+ parents: function( elem ) {
5308
+ return jQuery.dir( elem, "parentNode" );
5309
+ },
5310
+ parentsUntil: function( elem, i, until ) {
5311
+ return jQuery.dir( elem, "parentNode", until );
5312
+ },
5313
+ next: function( elem ) {
5314
+ return sibling( elem, "nextSibling" );
5315
+ },
5316
+ prev: function( elem ) {
5317
+ return sibling( elem, "previousSibling" );
5318
+ },
5319
+ nextAll: function( elem ) {
5320
+ return jQuery.dir( elem, "nextSibling" );
5321
+ },
5322
+ prevAll: function( elem ) {
5323
+ return jQuery.dir( elem, "previousSibling" );
5324
+ },
5325
+ nextUntil: function( elem, i, until ) {
5326
+ return jQuery.dir( elem, "nextSibling", until );
5327
+ },
5328
+ prevUntil: function( elem, i, until ) {
5329
+ return jQuery.dir( elem, "previousSibling", until );
5330
+ },
5331
+ siblings: function( elem ) {
5332
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
5333
+ },
5334
+ children: function( elem ) {
5335
+ return jQuery.sibling( elem.firstChild );
5336
+ },
5337
+ contents: function( elem ) {
5338
+ return jQuery.nodeName( elem, "iframe" ) ?
5339
+ elem.contentDocument || elem.contentWindow.document :
5340
+ jQuery.merge( [], elem.childNodes );
5341
+ }
5342
+ }, function( name, fn ) {
5343
+ jQuery.fn[ name ] = function( until, selector ) {
5344
+ var ret = jQuery.map( this, fn, until );
5345
+
5346
+ if ( !runtil.test( name ) ) {
5347
+ selector = until;
5348
+ }
5349
+
5350
+ if ( selector && typeof selector === "string" ) {
5351
+ ret = jQuery.filter( selector, ret );
5352
+ }
5353
+
5354
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
5355
+
5356
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
5357
+ ret = ret.reverse();
5358
+ }
5359
+
5360
+ return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
5361
+ };
5362
+ });
5363
+
5364
+ jQuery.extend({
5365
+ filter: function( expr, elems, not ) {
5366
+ if ( not ) {
5367
+ expr = ":not(" + expr + ")";
5368
+ }
5369
+
5370
+ return elems.length === 1 ?
5371
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
5372
+ jQuery.find.matches(expr, elems);
5373
+ },
5374
+
5375
+ dir: function( elem, dir, until ) {
5376
+ var matched = [],
5377
+ cur = elem[ dir ];
5378
+
5379
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
5380
+ if ( cur.nodeType === 1 ) {
5381
+ matched.push( cur );
5382
+ }
5383
+ cur = cur[dir];
5384
+ }
5385
+ return matched;
5386
+ },
5387
+
5388
+ sibling: function( n, elem ) {
5389
+ var r = [];
5390
+
5391
+ for ( ; n; n = n.nextSibling ) {
5392
+ if ( n.nodeType === 1 && n !== elem ) {
5393
+ r.push( n );
5394
+ }
5395
+ }
5396
+
5397
+ return r;
5398
+ }
5399
+ });
5400
+
5401
+ // Implement the identical functionality for filter and not
5402
+ function winnow( elements, qualifier, keep ) {
5403
+
5404
+ // Can't pass null or undefined to indexOf in Firefox 4
5405
+ // Set to 0 to skip string check
5406
+ qualifier = qualifier || 0;
5407
+
5408
+ if ( jQuery.isFunction( qualifier ) ) {
5409
+ return jQuery.grep(elements, function( elem, i ) {
5410
+ var retVal = !!qualifier.call( elem, i, elem );
5411
+ return retVal === keep;
5412
+ });
5413
+
5414
+ } else if ( qualifier.nodeType ) {
5415
+ return jQuery.grep(elements, function( elem, i ) {
5416
+ return ( elem === qualifier ) === keep;
5417
+ });
5418
+
5419
+ } else if ( typeof qualifier === "string" ) {
5420
+ var filtered = jQuery.grep(elements, function( elem ) {
5421
+ return elem.nodeType === 1;
5422
+ });
5423
+
5424
+ if ( isSimple.test( qualifier ) ) {
5425
+ return jQuery.filter(qualifier, filtered, !keep);
5426
+ } else {
5427
+ qualifier = jQuery.filter( qualifier, filtered );
5428
+ }
5429
+ }
5430
+
5431
+ return jQuery.grep(elements, function( elem, i ) {
5432
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
5433
+ });
5434
+ }
5435
+ function createSafeFragment( document ) {
5436
+ var list = nodeNames.split( "|" ),
5437
+ safeFrag = document.createDocumentFragment();
5438
+
5439
+ if ( safeFrag.createElement ) {
5440
+ while ( list.length ) {
5441
+ safeFrag.createElement(
5442
+ list.pop()
5443
+ );
5444
+ }
5445
+ }
5446
+ return safeFrag;
5447
+ }
5448
+
5449
+ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
5450
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
5451
+ rinlinejQuery = / sQuery\d+="(?:null|\d+)"/g,
5452
+ rleadingWhitespace = /^\s+/,
5453
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
5454
+ rtagName = /<([\w:]+)/,
5455
+ rtbody = /<tbody/i,
5456
+ rhtml = /<|&#?\w+;/,
5457
+ rnoInnerhtml = /<(?:script|style|link)/i,
5458
+ rnocache = /<(?:script|object|embed|option|style)/i,
5459
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
5460
+ rcheckableType = /^(?:checkbox|radio)$/,
5461
+ // checked="checked" or checked
5462
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5463
+ rscriptType = /\/(java|ecma)script/i,
5464
+ rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
5465
+ wrapMap = {
5466
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
5467
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
5468
+ thead: [ 1, "<table>", "</table>" ],
5469
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5470
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5471
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5472
+ area: [ 1, "<map>", "</map>" ],
5473
+ _default: [ 0, "", "" ]
5474
+ },
5475
+ safeFragment = createSafeFragment( document ),
5476
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
5477
+
5478
+ wrapMap.optgroup = wrapMap.option;
5479
+ wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5480
+ wrapMap.th = wrapMap.td;
5481
+
5482
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
5483
+ // unless wrapped in a div with non-breaking characters in front of it.
5484
+ if ( !jQuery.support.htmlSerialize ) {
5485
+ wrapMap._default = [ 1, "X<div>", "</div>" ];
5486
+ }
5487
+
5488
+ jQuery.fn.extend({
5489
+ text: function( value ) {
5490
+ return jQuery.access( this, function( value ) {
5491
+ return value === undefined ?
5492
+ jQuery.text( this ) :
5493
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
5494
+ }, null, value, arguments.length );
5495
+ },
5496
+
5497
+ wrapAll: function( html ) {
5498
+ if ( jQuery.isFunction( html ) ) {
5499
+ return this.each(function(i) {
5500
+ jQuery(this).wrapAll( html.call(this, i) );
5501
+ });
5502
+ }
5503
+
5504
+ if ( this[0] ) {
5505
+ // The elements to wrap the target around
5506
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
5507
+
5508
+ if ( this[0].parentNode ) {
5509
+ wrap.insertBefore( this[0] );
5510
+ }
5511
+
5512
+ wrap.map(function() {
5513
+ var elem = this;
5514
+
5515
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
5516
+ elem = elem.firstChild;
5517
+ }
5518
+
5519
+ return elem;
5520
+ }).append( this );
5521
+ }
5522
+
5523
+ return this;
5524
+ },
5525
+
5526
+ wrapInner: function( html ) {
5527
+ if ( jQuery.isFunction( html ) ) {
5528
+ return this.each(function(i) {
5529
+ jQuery(this).wrapInner( html.call(this, i) );
5530
+ });
5531
+ }
5532
+
5533
+ return this.each(function() {
5534
+ var self = jQuery( this ),
5535
+ contents = self.contents();
5536
+
5537
+ if ( contents.length ) {
5538
+ contents.wrapAll( html );
5539
+
5540
+ } else {
5541
+ self.append( html );
5542
+ }
5543
+ });
5544
+ },
5545
+
5546
+ wrap: function( html ) {
5547
+ var isFunction = jQuery.isFunction( html );
5548
+
5549
+ return this.each(function(i) {
5550
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
5551
+ });
5552
+ },
5553
+
5554
+ unwrap: function() {
5555
+ return this.parent().each(function() {
5556
+ if ( !jQuery.nodeName( this, "body" ) ) {
5557
+ jQuery( this ).replaceWith( this.childNodes );
5558
+ }
5559
+ }).end();
5560
+ },
5561
+
5562
+ append: function() {
5563
+ return this.domManip(arguments, true, function( elem ) {
5564
+ if ( this.nodeType === 1 || this.nodeType === 11 ) {
5565
+ this.appendChild( elem );
5566
+ }
5567
+ });
5568
+ },
5569
+
5570
+ prepend: function() {
5571
+ return this.domManip(arguments, true, function( elem ) {
5572
+ if ( this.nodeType === 1 || this.nodeType === 11 ) {
5573
+ this.insertBefore( elem, this.firstChild );
5574
+ }
5575
+ });
5576
+ },
5577
+
5578
+ before: function() {
5579
+ if ( !isDisconnected( this[0] ) ) {
5580
+ return this.domManip(arguments, false, function( elem ) {
5581
+ this.parentNode.insertBefore( elem, this );
5582
+ });
5583
+ }
5584
+
5585
+ if ( arguments.length ) {
5586
+ var set = jQuery.clean( arguments );
5587
+ return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
5588
+ }
5589
+ },
5590
+
5591
+ after: function() {
5592
+ if ( !isDisconnected( this[0] ) ) {
5593
+ return this.domManip(arguments, false, function( elem ) {
5594
+ this.parentNode.insertBefore( elem, this.nextSibling );
5595
+ });
5596
+ }
5597
+
5598
+ if ( arguments.length ) {
5599
+ var set = jQuery.clean( arguments );
5600
+ return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
5601
+ }
5602
+ },
5603
+
5604
+ // keepData is for internal use only--do not document
5605
+ remove: function( selector, keepData ) {
5606
+ var elem,
5607
+ i = 0;
5608
+
5609
+ for ( ; (elem = this[i]) != null; i++ ) {
5610
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
5611
+ if ( !keepData && elem.nodeType === 1 ) {
5612
+ jQuery.cleanData( elem.getElementsByTagName("*") );
5613
+ jQuery.cleanData( [ elem ] );
5614
+ }
5615
+
5616
+ if ( elem.parentNode ) {
5617
+ elem.parentNode.removeChild( elem );
5618
+ }
5619
+ }
5620
+ }
5621
+
5622
+ return this;
5623
+ },
5624
+
5625
+ empty: function() {
5626
+ var elem,
5627
+ i = 0;
5628
+
5629
+ for ( ; (elem = this[i]) != null; i++ ) {
5630
+ // Remove element nodes and prevent memory leaks
5631
+ if ( elem.nodeType === 1 ) {
5632
+ jQuery.cleanData( elem.getElementsByTagName("*") );
5633
+ }
5634
+
5635
+ // Remove any remaining nodes
5636
+ while ( elem.firstChild ) {
5637
+ elem.removeChild( elem.firstChild );
5638
+ }
5639
+ }
5640
+
5641
+ return this;
5642
+ },
5643
+
5644
+ clone: function( dataAndEvents, deepDataAndEvents ) {
5645
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5646
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5647
+
5648
+ return this.map( function () {
5649
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5650
+ });
5651
+ },
5652
+
5653
+ html: function( value ) {
5654
+ return jQuery.access( this, function( value ) {
5655
+ var elem = this[0] || {},
5656
+ i = 0,
5657
+ l = this.length;
5658
+
5659
+ if ( value === undefined ) {
5660
+ return elem.nodeType === 1 ?
5661
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
5662
+ undefined;
5663
+ }
5664
+
5665
+ // See if we can take a shortcut and just use innerHTML
5666
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5667
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
5668
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
5669
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
5670
+
5671
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
5672
+
5673
+ try {
5674
+ for (; i < l; i++ ) {
5675
+ // Remove element nodes and prevent memory leaks
5676
+ elem = this[i] || {};
5677
+ if ( elem.nodeType === 1 ) {
5678
+ jQuery.cleanData( elem.getElementsByTagName( "*" ) );
5679
+ elem.innerHTML = value;
5680
+ }
5681
+ }
5682
+
5683
+ elem = 0;
5684
+
5685
+ // If using innerHTML throws an exception, use the fallback method
5686
+ } catch(e) {}
5687
+ }
5688
+
5689
+ if ( elem ) {
5690
+ this.empty().append( value );
5691
+ }
5692
+ }, null, value, arguments.length );
5693
+ },
5694
+
5695
+ replaceWith: function( value ) {
5696
+ if ( !isDisconnected( this[0] ) ) {
5697
+ // Make sure that the elements are removed from the DOM before they are inserted
5698
+ // this can help fix replacing a parent with child elements
5699
+ if ( jQuery.isFunction( value ) ) {
5700
+ return this.each(function(i) {
5701
+ var self = jQuery(this), old = self.html();
5702
+ self.replaceWith( value.call( this, i, old ) );
5703
+ });
5704
+ }
5705
+
5706
+ if ( typeof value !== "string" ) {
5707
+ value = jQuery( value ).detach();
5708
+ }
5709
+
5710
+ return this.each(function() {
5711
+ var next = this.nextSibling,
5712
+ parent = this.parentNode;
5713
+
5714
+ jQuery( this ).remove();
5715
+
5716
+ if ( next ) {
5717
+ jQuery(next).before( value );
5718
+ } else {
5719
+ jQuery(parent).append( value );
5720
+ }
5721
+ });
5722
+ }
5723
+
5724
+ return this.length ?
5725
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
5726
+ this;
5727
+ },
5728
+
5729
+ detach: function( selector ) {
5730
+ return this.remove( selector, true );
5731
+ },
5732
+
5733
+ domManip: function( args, table, callback ) {
5734
+
5735
+ // Flatten any nested arrays
5736
+ args = [].concat.apply( [], args );
5737
+
5738
+ var results, first, fragment, iNoClone,
5739
+ i = 0,
5740
+ value = args[0],
5741
+ scripts = [],
5742
+ l = this.length;
5743
+
5744
+ // We can't cloneNode fragments that contain checked, in WebKit
5745
+ if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
5746
+ return this.each(function() {
5747
+ jQuery(this).domManip( args, table, callback );
5748
+ });
5749
+ }
5750
+
5751
+ if ( jQuery.isFunction(value) ) {
5752
+ return this.each(function(i) {
5753
+ var self = jQuery(this);
5754
+ args[0] = value.call( this, i, table ? self.html() : undefined );
5755
+ self.domManip( args, table, callback );
5756
+ });
5757
+ }
5758
+
5759
+ if ( this[0] ) {
5760
+ results = jQuery.buildFragment( args, this, scripts );
5761
+ fragment = results.fragment;
5762
+ first = fragment.firstChild;
5763
+
5764
+ if ( fragment.childNodes.length === 1 ) {
5765
+ fragment = first;
5766
+ }
5767
+
5768
+ if ( first ) {
5769
+ table = table && jQuery.nodeName( first, "tr" );
5770
+
5771
+ // Use the original fragment for the last item instead of the first because it can end up
5772
+ // being emptied incorrectly in certain situations (#8070).
5773
+ // Fragments from the fragment cache must always be cloned and never used in place.
5774
+ for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
5775
+ callback.call(
5776
+ table && jQuery.nodeName( this[i], "table" ) ?
5777
+ findOrAppend( this[i], "tbody" ) :
5778
+ this[i],
5779
+ i === iNoClone ?
5780
+ fragment :
5781
+ jQuery.clone( fragment, true, true )
5782
+ );
5783
+ }
5784
+ }
5785
+
5786
+ // Fix #11809: Avoid leaking memory
5787
+ fragment = first = null;
5788
+
5789
+ if ( scripts.length ) {
5790
+ jQuery.each( scripts, function( i, elem ) {
5791
+ if ( elem.src ) {
5792
+ if ( jQuery.ajax ) {
5793
+ jQuery.ajax({
5794
+ url: elem.src,
5795
+ type: "GET",
5796
+ dataType: "script",
5797
+ async: false,
5798
+ global: false,
5799
+ "throws": true
5800
+ });
5801
+ } else {
5802
+ jQuery.error("no ajax");
5803
+ }
5804
+ } else {
5805
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
5806
+ }
5807
+
5808
+ if ( elem.parentNode ) {
5809
+ elem.parentNode.removeChild( elem );
5810
+ }
5811
+ });
5812
+ }
5813
+ }
5814
+
5815
+ return this;
5816
+ }
5817
+ });
5818
+
5819
+ function findOrAppend( elem, tag ) {
5820
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
5821
+ }
5822
+
5823
+ function cloneCopyEvent( src, dest ) {
5824
+
5825
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
5826
+ return;
5827
+ }
5828
+
5829
+ var type, i, l,
5830
+ oldData = jQuery._data( src ),
5831
+ curData = jQuery._data( dest, oldData ),
5832
+ events = oldData.events;
5833
+
5834
+ if ( events ) {
5835
+ delete curData.handle;
5836
+ curData.events = {};
5837
+
5838
+ for ( type in events ) {
5839
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5840
+ jQuery.event.add( dest, type, events[ type ][ i ] );
5841
+ }
5842
+ }
5843
+ }
5844
+
5845
+ // make the cloned public data object a copy from the original
5846
+ if ( curData.data ) {
5847
+ curData.data = jQuery.extend( {}, curData.data );
5848
+ }
5849
+ }
5850
+
5851
+ function cloneFixAttributes( src, dest ) {
5852
+ var nodeName;
5853
+
5854
+ // We do not need to do anything for non-Elements
5855
+ if ( dest.nodeType !== 1 ) {
5856
+ return;
5857
+ }
5858
+
5859
+ // clearAttributes removes the attributes, which we don't want,
5860
+ // but also removes the attachEvent events, which we *do* want
5861
+ if ( dest.clearAttributes ) {
5862
+ dest.clearAttributes();
5863
+ }
5864
+
5865
+ // mergeAttributes, in contrast, only merges back on the
5866
+ // original attributes, not the events
5867
+ if ( dest.mergeAttributes ) {
5868
+ dest.mergeAttributes( src );
5869
+ }
5870
+
5871
+ nodeName = dest.nodeName.toLowerCase();
5872
+
5873
+ if ( nodeName === "object" ) {
5874
+ // IE6-10 improperly clones children of object elements using classid.
5875
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
5876
+ if ( dest.parentNode ) {
5877
+ dest.outerHTML = src.outerHTML;
5878
+ }
5879
+
5880
+ // This path appears unavoidable for IE9. When cloning an object
5881
+ // element in IE9, the outerHTML strategy above is not sufficient.
5882
+ // If the src has innerHTML and the destination does not,
5883
+ // copy the src.innerHTML into the dest.innerHTML. #10324
5884
+ if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
5885
+ dest.innerHTML = src.innerHTML;
5886
+ }
5887
+
5888
+ } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5889
+ // IE6-8 fails to persist the checked state of a cloned checkbox
5890
+ // or radio button. Worse, IE6-7 fail to give the cloned element
5891
+ // a checked appearance if the defaultChecked value isn't also set
5892
+
5893
+ dest.defaultChecked = dest.checked = src.checked;
5894
+
5895
+ // IE6-7 get confused and end up setting the value of a cloned
5896
+ // checkbox/radio button to an empty string instead of "on"
5897
+ if ( dest.value !== src.value ) {
5898
+ dest.value = src.value;
5899
+ }
5900
+
5901
+ // IE6-8 fails to return the selected option to the default selected
5902
+ // state when cloning options
5903
+ } else if ( nodeName === "option" ) {
5904
+ dest.selected = src.defaultSelected;
5905
+
5906
+ // IE6-8 fails to set the defaultValue to the correct value when
5907
+ // cloning other types of input fields
5908
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
5909
+ dest.defaultValue = src.defaultValue;
5910
+
5911
+ // IE blanks contents when cloning scripts
5912
+ } else if ( nodeName === "script" && dest.text !== src.text ) {
5913
+ dest.text = src.text;
5914
+ }
5915
+
5916
+ // Event data gets referenced instead of copied if the expando
5917
+ // gets copied too
5918
+ dest.removeAttribute( jQuery.expando );
5919
+ }
5920
+
5921
+ jQuery.buildFragment = function( args, context, scripts ) {
5922
+ var fragment, cacheable, cachehit,
5923
+ first = args[ 0 ];
5924
+
5925
+ // Set context from what may come in as undefined or a jQuery collection or a node
5926
+ context = context || document;
5927
+ context = (context[0] || context).ownerDocument || context[0] || context;
5928
+
5929
+ // Ensure that an attr object doesn't incorrectly stand in as a document object
5930
+ // Chrome and Firefox seem to allow this to occur and will throw exception
5931
+ // Fixes #8950
5932
+ if ( typeof context.createDocumentFragment === "undefined" ) {
5933
+ context = document;
5934
+ }
5935
+
5936
+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
5937
+ // Cloning options loses the selected state, so don't cache them
5938
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
5939
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
5940
+ // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
5941
+ if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
5942
+ first.charAt(0) === "<" && !rnocache.test( first ) &&
5943
+ (jQuery.support.checkClone || !rchecked.test( first )) &&
5944
+ (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
5945
+
5946
+ // Mark cacheable and look for a hit
5947
+ cacheable = true;
5948
+ fragment = jQuery.fragments[ first ];
5949
+ cachehit = fragment !== undefined;
5950
+ }
5951
+
5952
+ if ( !fragment ) {
5953
+ fragment = context.createDocumentFragment();
5954
+ jQuery.clean( args, context, fragment, scripts );
5955
+
5956
+ // Update the cache, but only store false
5957
+ // unless this is a second parsing of the same content
5958
+ if ( cacheable ) {
5959
+ jQuery.fragments[ first ] = cachehit && fragment;
5960
+ }
5961
+ }
5962
+
5963
+ return { fragment: fragment, cacheable: cacheable };
5964
+ };
5965
+
5966
+ jQuery.fragments = {};
5967
+
5968
+ jQuery.each({
5969
+ appendTo: "append",
5970
+ prependTo: "prepend",
5971
+ insertBefore: "before",
5972
+ insertAfter: "after",
5973
+ replaceAll: "replaceWith"
5974
+ }, function( name, original ) {
5975
+ jQuery.fn[ name ] = function( selector ) {
5976
+ var elems,
5977
+ i = 0,
5978
+ ret = [],
5979
+ insert = jQuery( selector ),
5980
+ l = insert.length,
5981
+ parent = this.length === 1 && this[0].parentNode;
5982
+
5983
+ if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
5984
+ insert[ original ]( this[0] );
5985
+ return this;
5986
+ } else {
5987
+ for ( ; i < l; i++ ) {
5988
+ elems = ( i > 0 ? this.clone(true) : this ).get();
5989
+ jQuery( insert[i] )[ original ]( elems );
5990
+ ret = ret.concat( elems );
5991
+ }
5992
+
5993
+ return this.pushStack( ret, name, insert.selector );
5994
+ }
5995
+ };
5996
+ });
5997
+
5998
+ function getAll( elem ) {
5999
+ if ( typeof elem.getElementsByTagName !== "undefined" ) {
6000
+ return elem.getElementsByTagName( "*" );
6001
+
6002
+ } else if ( typeof elem.querySelectorAll !== "undefined" ) {
6003
+ return elem.querySelectorAll( "*" );
6004
+
6005
+ } else {
6006
+ return [];
6007
+ }
6008
+ }
6009
+
6010
+ // Used in clean, fixes the defaultChecked property
6011
+ function fixDefaultChecked( elem ) {
6012
+ if ( rcheckableType.test( elem.type ) ) {
6013
+ elem.defaultChecked = elem.checked;
6014
+ }
6015
+ }
6016
+
6017
+ jQuery.extend({
6018
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6019
+ var srcElements,
6020
+ destElements,
6021
+ i,
6022
+ clone;
6023
+
6024
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
6025
+ clone = elem.cloneNode( true );
6026
+
6027
+ // IE<=8 does not properly clone detached, unknown element nodes
6028
+ } else {
6029
+ fragmentDiv.innerHTML = elem.outerHTML;
6030
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
6031
+ }
6032
+
6033
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
6034
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
6035
+ // IE copies events bound via attachEvent when using cloneNode.
6036
+ // Calling detachEvent on the clone will also remove the events
6037
+ // from the original. In order to get around this, we use some
6038
+ // proprietary methods to clear the events. Thanks to MooTools
6039
+ // guys for this hotness.
6040
+
6041
+ cloneFixAttributes( elem, clone );
6042
+
6043
+ // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
6044
+ srcElements = getAll( elem );
6045
+ destElements = getAll( clone );
6046
+
6047
+ // Weird iteration because IE will replace the length property
6048
+ // with an element if you are cloning the body and one of the
6049
+ // elements on the page has a name or id of "length"
6050
+ for ( i = 0; srcElements[i]; ++i ) {
6051
+ // Ensure that the destination node is not null; Fixes #9587
6052
+ if ( destElements[i] ) {
6053
+ cloneFixAttributes( srcElements[i], destElements[i] );
6054
+ }
6055
+ }
6056
+ }
6057
+
6058
+ // Copy the events from the original to the clone
6059
+ if ( dataAndEvents ) {
6060
+ cloneCopyEvent( elem, clone );
6061
+
6062
+ if ( deepDataAndEvents ) {
6063
+ srcElements = getAll( elem );
6064
+ destElements = getAll( clone );
6065
+
6066
+ for ( i = 0; srcElements[i]; ++i ) {
6067
+ cloneCopyEvent( srcElements[i], destElements[i] );
6068
+ }
6069
+ }
6070
+ }
6071
+
6072
+ srcElements = destElements = null;
6073
+
6074
+ // Return the cloned set
6075
+ return clone;
6076
+ },
6077
+
6078
+ clean: function( elems, context, fragment, scripts ) {
6079
+ var j, safe, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
6080
+ i = 0,
6081
+ ret = [];
6082
+
6083
+ // Ensure that context is a document
6084
+ if ( !context || typeof context.createDocumentFragment === "undefined" ) {
6085
+ context = document;
6086
+ }
6087
+
6088
+ // Use the already-created safe fragment if context permits
6089
+ for ( safe = context === document && safeFragment; (elem = elems[i]) != null; i++ ) {
6090
+ if ( typeof elem === "number" ) {
6091
+ elem += "";
6092
+ }
6093
+
6094
+ if ( !elem ) {
6095
+ continue;
6096
+ }
6097
+
6098
+ // Convert html string into DOM nodes
6099
+ if ( typeof elem === "string" ) {
6100
+ if ( !rhtml.test( elem ) ) {
6101
+ elem = context.createTextNode( elem );
6102
+ } else {
6103
+ // Ensure a safe container in which to render the html
6104
+ safe = safe || createSafeFragment( context );
6105
+ div = div || safe.appendChild( context.createElement("div") );
6106
+
6107
+ // Fix "XHTML"-style tags in all browsers
6108
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
6109
+
6110
+ // Go to html and back, then peel off extra wrappers
6111
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
6112
+ wrap = wrapMap[ tag ] || wrapMap._default;
6113
+ depth = wrap[0];
6114
+ div.innerHTML = wrap[1] + elem + wrap[2];
6115
+
6116
+ // Move to the right depth
6117
+ while ( depth-- ) {
6118
+ div = div.lastChild;
6119
+ }
6120
+
6121
+ // Remove IE's autoinserted <tbody> from table fragments
6122
+ if ( !jQuery.support.tbody ) {
6123
+
6124
+ // String was a <table>, *may* have spurious <tbody>
6125
+ hasBody = rtbody.test(elem);
6126
+ tbody = tag === "table" && !hasBody ?
6127
+ div.firstChild && div.firstChild.childNodes :
6128
+
6129
+ // String was a bare <thead> or <tfoot>
6130
+ wrap[1] === "<table>" && !hasBody ?
6131
+ div.childNodes :
6132
+ [];
6133
+
6134
+ for ( j = tbody.length - 1; j >= 0 ; --j ) {
6135
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
6136
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
6137
+ }
6138
+ }
6139
+ }
6140
+
6141
+ // IE completely kills leading whitespace when innerHTML is used
6142
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
6143
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
6144
+ }
6145
+
6146
+ elem = div.childNodes;
6147
+
6148
+ // Remember the top-level container for proper cleanup
6149
+ div = safe.lastChild;
6150
+ }
6151
+ }
6152
+
6153
+ if ( elem.nodeType ) {
6154
+ ret.push( elem );
6155
+ } else {
6156
+ ret = jQuery.merge( ret, elem );
6157
+ }
6158
+ }
6159
+
6160
+ // Fix #11356: Clear elements from safeFragment
6161
+ if ( div ) {
6162
+ safe.removeChild( div );
6163
+ elem = div = safe = null;
6164
+ }
6165
+
6166
+ // Reset defaultChecked for any radios and checkboxes
6167
+ // about to be appended to the DOM in IE 6/7 (#8060)
6168
+ if ( !jQuery.support.appendChecked ) {
6169
+ for ( i = 0; (elem = ret[i]) != null; i++ ) {
6170
+ if ( jQuery.nodeName( elem, "input" ) ) {
6171
+ fixDefaultChecked( elem );
6172
+ } else if ( typeof elem.getElementsByTagName !== "undefined" ) {
6173
+ jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
6174
+ }
6175
+ }
6176
+ }
6177
+
6178
+ // Append elements to a provided document fragment
6179
+ if ( fragment ) {
6180
+ // Special handling of each script element
6181
+ handleScript = function( elem ) {
6182
+ // Check if we consider it executable
6183
+ if ( !elem.type || rscriptType.test( elem.type ) ) {
6184
+ // Detach the script and store it in the scripts array (if provided) or the fragment
6185
+ // Return truthy to indicate that it has been handled
6186
+ return scripts ?
6187
+ scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
6188
+ fragment.appendChild( elem );
6189
+ }
6190
+ };
6191
+
6192
+ for ( i = 0; (elem = ret[i]) != null; i++ ) {
6193
+ // Check if we're done after handling an executable script
6194
+ if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
6195
+ // Append to fragment and handle embedded scripts
6196
+ fragment.appendChild( elem );
6197
+ if ( typeof elem.getElementsByTagName !== "undefined" ) {
6198
+ // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
6199
+ jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
6200
+
6201
+ // Splice the scripts into ret after their former ancestor and advance our index beyond them
6202
+ ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
6203
+ i += jsTags.length;
6204
+ }
6205
+ }
6206
+ }
6207
+ }
6208
+
6209
+ return ret;
6210
+ },
6211
+
6212
+ cleanData: function( elems, /* internal */ acceptData ) {
6213
+ var data, id, elem, type,
6214
+ i = 0,
6215
+ internalKey = jQuery.expando,
6216
+ cache = jQuery.cache,
6217
+ deleteExpando = jQuery.support.deleteExpando,
6218
+ special = jQuery.event.special;
6219
+
6220
+ for ( ; (elem = elems[i]) != null; i++ ) {
6221
+
6222
+ if ( acceptData || jQuery.acceptData( elem ) ) {
6223
+
6224
+ id = elem[ internalKey ];
6225
+ data = id && cache[ id ];
6226
+
6227
+ if ( data ) {
6228
+ if ( data.events ) {
6229
+ for ( type in data.events ) {
6230
+ if ( special[ type ] ) {
6231
+ jQuery.event.remove( elem, type );
6232
+
6233
+ // This is a shortcut to avoid jQuery.event.remove's overhead
6234
+ } else {
6235
+ jQuery.removeEvent( elem, type, data.handle );
6236
+ }
6237
+ }
6238
+ }
6239
+
6240
+ // Remove cache only if it was not already removed by jQuery.event.remove
6241
+ if ( cache[ id ] ) {
6242
+
6243
+ delete cache[ id ];
6244
+
6245
+ // IE does not allow us to delete expando properties from nodes,
6246
+ // nor does it have a removeAttribute function on Document nodes;
6247
+ // we must handle all of these cases
6248
+ if ( deleteExpando ) {
6249
+ delete elem[ internalKey ];
6250
+
6251
+ } else if ( elem.removeAttribute ) {
6252
+ elem.removeAttribute( internalKey );
6253
+
6254
+ } else {
6255
+ elem[ internalKey ] = null;
6256
+ }
6257
+
6258
+ jQuery.deletedIds.push( id );
6259
+ }
6260
+ }
6261
+ }
6262
+ }
6263
+ }
6264
+ });
6265
+ // Limit scope pollution from any deprecated API
6266
+ (function() {
6267
+
6268
+ var matched, browser;
6269
+
6270
+ // Use of jQuery.browser is frowned upon.
6271
+ // More details: http://api.jquery.com/jQuery.browser
6272
+ // jQuery.uaMatch maintained for back-compat
6273
+ jQuery.uaMatch = function( ua ) {
6274
+ ua = ua.toLowerCase();
6275
+
6276
+ var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
6277
+ /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
6278
+ /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
6279
+ /(msie) ([\w.]+)/.exec( ua ) ||
6280
+ ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
6281
+ [];
6282
+
6283
+ return {
6284
+ browser: match[ 1 ] || "",
6285
+ version: match[ 2 ] || "0"
6286
+ };
6287
+ };
6288
+
6289
+ matched = jQuery.uaMatch( navigator.userAgent );
6290
+ browser = {};
6291
+
6292
+ if ( matched.browser ) {
6293
+ browser[ matched.browser ] = true;
6294
+ browser.version = matched.version;
6295
+ }
6296
+
6297
+ // Deprecated, use jQuery.browser.webkit instead
6298
+ // Maintained for back-compat only
6299
+ if ( browser.webkit ) {
6300
+ browser.safari = true;
6301
+ }
6302
+
6303
+ jQuery.browser = browser;
6304
+
6305
+ jQuery.sub = function() {
6306
+ function jQuerySub( selector, context ) {
6307
+ return new jQuerySub.fn.init( selector, context );
6308
+ }
6309
+ jQuery.extend( true, jQuerySub, this );
6310
+ jQuerySub.superclass = this;
6311
+ jQuerySub.fn = jQuerySub.prototype = this();
6312
+ jQuerySub.fn.constructor = jQuerySub;
6313
+ jQuerySub.sub = this.sub;
6314
+ jQuerySub.fn.init = function init( selector, context ) {
6315
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
6316
+ context = jQuerySub( context );
6317
+ }
6318
+
6319
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
6320
+ };
6321
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
6322
+ var rootjQuerySub = jQuerySub(document);
6323
+ return jQuerySub;
6324
+ };
6325
+
6326
+ })();
6327
+ var curCSS, iframe, iframeDoc,
6328
+ ralpha = /alpha\([^)]*\)/i,
6329
+ ropacity = /opacity=([^)]*)/,
6330
+ rposition = /^(top|right|bottom|left)$/,
6331
+ rmargin = /^margin/,
6332
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
6333
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
6334
+ rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
6335
+ elemdisplay = {},
6336
+
6337
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6338
+ cssNormalTransform = {
6339
+ letterSpacing: 0,
6340
+ fontWeight: 400,
6341
+ lineHeight: 1
6342
+ },
6343
+
6344
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
6345
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
6346
+
6347
+ eventsToggle = jQuery.fn.toggle;
6348
+
6349
+ // return a css property mapped to a potentially vendor prefixed property
6350
+ function vendorPropName( style, name ) {
6351
+
6352
+ // shortcut for names that are not vendor prefixed
6353
+ if ( name in style ) {
6354
+ return name;
6355
+ }
6356
+
6357
+ // check for vendor prefixed names
6358
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
6359
+ origName = name,
6360
+ i = cssPrefixes.length;
6361
+
6362
+ while ( i-- ) {
6363
+ name = cssPrefixes[ i ] + capName;
6364
+ if ( name in style ) {
6365
+ return name;
6366
+ }
6367
+ }
6368
+
6369
+ return origName;
6370
+ }
6371
+
6372
+ function isHidden( elem, el ) {
6373
+ elem = el || elem;
6374
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
6375
+ }
6376
+
6377
+ function showHide( elements, show ) {
6378
+ var elem, display,
6379
+ values = [],
6380
+ index = 0,
6381
+ length = elements.length;
6382
+
6383
+ for ( ; index < length; index++ ) {
6384
+ elem = elements[ index ];
6385
+ if ( !elem.style ) {
6386
+ continue;
6387
+ }
6388
+ values[ index ] = jQuery._data( elem, "olddisplay" );
6389
+ if ( show ) {
6390
+ // Reset the inline display of this element to learn if it is
6391
+ // being hidden by cascaded rules or not
6392
+ if ( !values[ index ] && elem.style.display === "none" ) {
6393
+ elem.style.display = "";
6394
+ }
6395
+
6396
+ // Set elements which have been overridden with display: none
6397
+ // in a stylesheet to whatever the default browser style is
6398
+ // for such an element
6399
+ if ( elem.style.display === "" && isHidden( elem ) ) {
6400
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
6401
+ }
6402
+ } else {
6403
+ display = curCSS( elem, "display" );
6404
+
6405
+ if ( !values[ index ] && display !== "none" ) {
6406
+ jQuery._data( elem, "olddisplay", display );
6407
+ }
6408
+ }
6409
+ }
6410
+
6411
+ // Set the display of most of the elements in a second loop
6412
+ // to avoid the constant reflow
6413
+ for ( index = 0; index < length; index++ ) {
6414
+ elem = elements[ index ];
6415
+ if ( !elem.style ) {
6416
+ continue;
6417
+ }
6418
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
6419
+ elem.style.display = show ? values[ index ] || "" : "none";
6420
+ }
6421
+ }
6422
+
6423
+ return elements;
6424
+ }
6425
+
6426
+ jQuery.fn.extend({
6427
+ css: function( name, value ) {
6428
+ return jQuery.access( this, function( elem, name, value ) {
6429
+ return value !== undefined ?
6430
+ jQuery.style( elem, name, value ) :
6431
+ jQuery.css( elem, name );
6432
+ }, name, value, arguments.length > 1 );
6433
+ },
6434
+ show: function() {
6435
+ return showHide( this, true );
6436
+ },
6437
+ hide: function() {
6438
+ return showHide( this );
6439
+ },
6440
+ toggle: function( state, fn2 ) {
6441
+ var bool = typeof state === "boolean";
6442
+
6443
+ if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
6444
+ return eventsToggle.apply( this, arguments );
6445
+ }
6446
+
6447
+ return this.each(function() {
6448
+ if ( bool ? state : isHidden( this ) ) {
6449
+ jQuery( this ).show();
6450
+ } else {
6451
+ jQuery( this ).hide();
6452
+ }
6453
+ });
6454
+ }
6455
+ });
6456
+
6457
+ jQuery.extend({
6458
+ // Add in style property hooks for overriding the default
6459
+ // behavior of getting and setting a style property
6460
+ cssHooks: {
6461
+ opacity: {
6462
+ get: function( elem, computed ) {
6463
+ if ( computed ) {
6464
+ // We should always get a number back from opacity
6465
+ var ret = curCSS( elem, "opacity" );
6466
+ return ret === "" ? "1" : ret;
6467
+
6468
+ }
6469
+ }
6470
+ }
6471
+ },
6472
+
6473
+ // Exclude the following css properties to add px
6474
+ cssNumber: {
6475
+ "fillOpacity": true,
6476
+ "fontWeight": true,
6477
+ "lineHeight": true,
6478
+ "opacity": true,
6479
+ "orphans": true,
6480
+ "widows": true,
6481
+ "zIndex": true,
6482
+ "zoom": true
6483
+ },
6484
+
6485
+ // Add in properties whose names you wish to fix before
6486
+ // setting or getting the value
6487
+ cssProps: {
6488
+ // normalize float css property
6489
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
6490
+ },
6491
+
6492
+ // Get and set the style property on a DOM Node
6493
+ style: function( elem, name, value, extra ) {
6494
+ // Don't set styles on text and comment nodes
6495
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6496
+ return;
6497
+ }
6498
+
6499
+ // Make sure that we're working with the right name
6500
+ var ret, type, hooks,
6501
+ origName = jQuery.camelCase( name ),
6502
+ style = elem.style;
6503
+
6504
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
6505
+
6506
+ // gets hook for the prefixed version
6507
+ // followed by the unprefixed version
6508
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6509
+
6510
+ // Check if we're setting a value
6511
+ if ( value !== undefined ) {
6512
+ type = typeof value;
6513
+
6514
+ // convert relative number strings (+= or -=) to relative numbers. #7345
6515
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
6516
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
6517
+ // Fixes bug #9237
6518
+ type = "number";
6519
+ }
6520
+
6521
+ // Make sure that NaN and null values aren't set. See: #7116
6522
+ if ( value == null || type === "number" && isNaN( value ) ) {
6523
+ return;
6524
+ }
6525
+
6526
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
6527
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
6528
+ value += "px";
6529
+ }
6530
+
6531
+ // If a hook was provided, use that value, otherwise just set the specified value
6532
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
6533
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
6534
+ // Fixes bug #5509
6535
+ try {
6536
+ style[ name ] = value;
6537
+ } catch(e) {}
6538
+ }
6539
+
6540
+ } else {
6541
+ // If a hook was provided get the non-computed value from there
6542
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
6543
+ return ret;
6544
+ }
6545
+
6546
+ // Otherwise just get the value from the style object
6547
+ return style[ name ];
6548
+ }
6549
+ },
6550
+
6551
+ css: function( elem, name, numeric, extra ) {
6552
+ var val, num, hooks,
6553
+ origName = jQuery.camelCase( name );
6554
+
6555
+ // Make sure that we're working with the right name
6556
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
6557
+
6558
+ // gets hook for the prefixed version
6559
+ // followed by the unprefixed version
6560
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6561
+
6562
+ // If a hook was provided get the computed value from there
6563
+ if ( hooks && "get" in hooks ) {
6564
+ val = hooks.get( elem, true, extra );
6565
+ }
6566
+
6567
+ // Otherwise, if a way to get the computed value exists, use that
6568
+ if ( val === undefined ) {
6569
+ val = curCSS( elem, name );
6570
+ }
6571
+
6572
+ //convert "normal" to computed value
6573
+ if ( val === "normal" && name in cssNormalTransform ) {
6574
+ val = cssNormalTransform[ name ];
6575
+ }
6576
+
6577
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
6578
+ if ( numeric || extra !== undefined ) {
6579
+ num = parseFloat( val );
6580
+ return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
6581
+ }
6582
+ return val;
6583
+ },
6584
+
6585
+ // A method for quickly swapping in/out CSS properties to get correct calculations
6586
+ swap: function( elem, options, callback ) {
6587
+ var ret, name,
6588
+ old = {};
6589
+
6590
+ // Remember the old values, and insert the new ones
6591
+ for ( name in options ) {
6592
+ old[ name ] = elem.style[ name ];
6593
+ elem.style[ name ] = options[ name ];
6594
+ }
6595
+
6596
+ ret = callback.call( elem );
6597
+
6598
+ // Revert the old values
6599
+ for ( name in options ) {
6600
+ elem.style[ name ] = old[ name ];
6601
+ }
6602
+
6603
+ return ret;
6604
+ }
6605
+ });
6606
+
6607
+ // NOTE: To any future maintainer, we've used both window.getComputedStyle
6608
+ // and getComputedStyle here to produce a better gzip size
6609
+ if ( window.getComputedStyle ) {
6610
+ curCSS = function( elem, name ) {
6611
+ var ret, width, minWidth, maxWidth,
6612
+ computed = getComputedStyle( elem, null ),
6613
+ style = elem.style;
6614
+
6615
+ if ( computed ) {
6616
+
6617
+ ret = computed[ name ];
6618
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
6619
+ ret = jQuery.style( elem, name );
6620
+ }
6621
+
6622
+ // A tribute to the "awesome hack by Dean Edwards"
6623
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
6624
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
6625
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
6626
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6627
+ width = style.width;
6628
+ minWidth = style.minWidth;
6629
+ maxWidth = style.maxWidth;
6630
+
6631
+ style.minWidth = style.maxWidth = style.width = ret;
6632
+ ret = computed.width;
6633
+
6634
+ style.width = width;
6635
+ style.minWidth = minWidth;
6636
+ style.maxWidth = maxWidth;
6637
+ }
6638
+ }
6639
+
6640
+ return ret;
6641
+ };
6642
+ } else if ( document.documentElement.currentStyle ) {
6643
+ curCSS = function( elem, name ) {
6644
+ var left, rsLeft,
6645
+ ret = elem.currentStyle && elem.currentStyle[ name ],
6646
+ style = elem.style;
6647
+
6648
+ // Avoid setting ret to empty string here
6649
+ // so we don't default to auto
6650
+ if ( ret == null && style && style[ name ] ) {
6651
+ ret = style[ name ];
6652
+ }
6653
+
6654
+ // From the awesome hack by Dean Edwards
6655
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
6656
+
6657
+ // If we're not dealing with a regular pixel number
6658
+ // but a number that has a weird ending, we need to convert it to pixels
6659
+ // but not position css attributes, as those are proportional to the parent element instead
6660
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
6661
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
6662
+
6663
+ // Remember the original values
6664
+ left = style.left;
6665
+ rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
6666
+
6667
+ // Put in the new values to get a computed value out
6668
+ if ( rsLeft ) {
6669
+ elem.runtimeStyle.left = elem.currentStyle.left;
6670
+ }
6671
+ style.left = name === "fontSize" ? "1em" : ret;
6672
+ ret = style.pixelLeft + "px";
6673
+
6674
+ // Revert the changed values
6675
+ style.left = left;
6676
+ if ( rsLeft ) {
6677
+ elem.runtimeStyle.left = rsLeft;
6678
+ }
6679
+ }
6680
+
6681
+ return ret === "" ? "auto" : ret;
6682
+ };
6683
+ }
6684
+
6685
+ function setPositiveNumber( elem, value, subtract ) {
6686
+ var matches = rnumsplit.exec( value );
6687
+ return matches ?
6688
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
6689
+ value;
6690
+ }
6691
+
6692
+ function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
6693
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
6694
+ // If we already have the right measurement, avoid augmentation
6695
+ 4 :
6696
+ // Otherwise initialize for horizontal or vertical properties
6697
+ name === "width" ? 1 : 0,
6698
+
6699
+ val = 0;
6700
+
6701
+ for ( ; i < 4; i += 2 ) {
6702
+ // both box models exclude margin, so add it if we want it
6703
+ if ( extra === "margin" ) {
6704
+ // we use jQuery.css instead of curCSS here
6705
+ // because of the reliableMarginRight CSS hook!
6706
+ val += jQuery.css( elem, extra + cssExpand[ i ], true );
6707
+ }
6708
+
6709
+ // From this point on we use curCSS for maximum performance (relevant in animations)
6710
+ if ( isBorderBox ) {
6711
+ // border-box includes padding, so remove it if we want content
6712
+ if ( extra === "content" ) {
6713
+ val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
6714
+ }
6715
+
6716
+ // at this point, extra isn't border nor margin, so remove border
6717
+ if ( extra !== "margin" ) {
6718
+ val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
6719
+ }
6720
+ } else {
6721
+ // at this point, extra isn't content, so add padding
6722
+ val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
6723
+
6724
+ // at this point, extra isn't content nor padding, so add border
6725
+ if ( extra !== "padding" ) {
6726
+ val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
6727
+ }
6728
+ }
6729
+ }
6730
+
6731
+ return val;
6732
+ }
6733
+
6734
+ function getWidthOrHeight( elem, name, extra ) {
6735
+
6736
+ // Start with offset property, which is equivalent to the border-box value
6737
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6738
+ valueIsBorderBox = true,
6739
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
6740
+
6741
+ if ( val <= 0 ) {
6742
+ // Fall back to computed then uncomputed css if necessary
6743
+ val = curCSS( elem, name );
6744
+ if ( val < 0 || val == null ) {
6745
+ val = elem.style[ name ];
6746
+ }
6747
+
6748
+ // Computed unit is not pixels. Stop here and return.
6749
+ if ( rnumnonpx.test(val) ) {
6750
+ return val;
6751
+ }
6752
+
6753
+ // we need the check for style in case a browser which returns unreliable values
6754
+ // for getComputedStyle silently falls back to the reliable elem.style
6755
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
6756
+
6757
+ // Normalize "", auto, and prepare for extra
6758
+ val = parseFloat( val ) || 0;
6759
+ }
6760
+
6761
+ // use the active box-sizing model to add/subtract irrelevant styles
6762
+ return ( val +
6763
+ augmentWidthOrHeight(
6764
+ elem,
6765
+ name,
6766
+ extra || ( isBorderBox ? "border" : "content" ),
6767
+ valueIsBorderBox
6768
+ )
6769
+ ) + "px";
6770
+ }
6771
+
6772
+
6773
+ // Try to determine the default display value of an element
6774
+ function css_defaultDisplay( nodeName ) {
6775
+ if ( elemdisplay[ nodeName ] ) {
6776
+ return elemdisplay[ nodeName ];
6777
+ }
6778
+
6779
+ var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
6780
+ display = elem.css("display");
6781
+ elem.remove();
6782
+
6783
+ // If the simple way fails,
6784
+ // get element's real default display by attaching it to a temp iframe
6785
+ if ( display === "none" || display === "" ) {
6786
+ // Use the already-created iframe if possible
6787
+ iframe = document.body.appendChild(
6788
+ iframe || jQuery.extend( document.createElement("iframe"), {
6789
+ frameBorder: 0,
6790
+ width: 0,
6791
+ height: 0
6792
+ })
6793
+ );
6794
+
6795
+ // Create a cacheable copy of the iframe document on first call.
6796
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
6797
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
6798
+ if ( !iframeDoc || !iframe.createElement ) {
6799
+ iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
6800
+ iframeDoc.write("<!doctype html><html><body>");
6801
+ iframeDoc.close();
6802
+ }
6803
+
6804
+ elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
6805
+
6806
+ display = curCSS( elem, "display" );
6807
+ document.body.removeChild( iframe );
6808
+ }
6809
+
6810
+ // Store the correct default display
6811
+ elemdisplay[ nodeName ] = display;
6812
+
6813
+ return display;
6814
+ }
6815
+
6816
+ jQuery.each([ "height", "width" ], function( i, name ) {
6817
+ jQuery.cssHooks[ name ] = {
6818
+ get: function( elem, computed, extra ) {
6819
+ if ( computed ) {
6820
+ if ( elem.offsetWidth !== 0 || curCSS( elem, "display" ) !== "none" ) {
6821
+ return getWidthOrHeight( elem, name, extra );
6822
+ } else {
6823
+ return jQuery.swap( elem, cssShow, function() {
6824
+ return getWidthOrHeight( elem, name, extra );
6825
+ });
6826
+ }
6827
+ }
6828
+ },
6829
+
6830
+ set: function( elem, value, extra ) {
6831
+ return setPositiveNumber( elem, value, extra ?
6832
+ augmentWidthOrHeight(
6833
+ elem,
6834
+ name,
6835
+ extra,
6836
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
6837
+ ) : 0
6838
+ );
6839
+ }
6840
+ };
6841
+ });
6842
+
6843
+ if ( !jQuery.support.opacity ) {
6844
+ jQuery.cssHooks.opacity = {
6845
+ get: function( elem, computed ) {
6846
+ // IE uses filters for opacity
6847
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6848
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
6849
+ computed ? "1" : "";
6850
+ },
6851
+
6852
+ set: function( elem, value ) {
6853
+ var style = elem.style,
6854
+ currentStyle = elem.currentStyle,
6855
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6856
+ filter = currentStyle && currentStyle.filter || style.filter || "";
6857
+
6858
+ // IE has trouble with opacity if it does not have layout
6859
+ // Force it by setting the zoom level
6860
+ style.zoom = 1;
6861
+
6862
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6863
+ if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
6864
+ style.removeAttribute ) {
6865
+
6866
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6867
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
6868
+ // style.removeAttribute is IE Only, but so apparently is this code path...
6869
+ style.removeAttribute( "filter" );
6870
+
6871
+ // if there there is no filter style applied in a css rule, we are done
6872
+ if ( currentStyle && !currentStyle.filter ) {
6873
+ return;
6874
+ }
6875
+ }
6876
+
6877
+ // otherwise, set new filter values
6878
+ style.filter = ralpha.test( filter ) ?
6879
+ filter.replace( ralpha, opacity ) :
6880
+ filter + " " + opacity;
6881
+ }
6882
+ };
6883
+ }
6884
+
6885
+ // These hooks cannot be added until DOM ready because the support test
6886
+ // for it is not run until after DOM ready
6887
+ jQuery(function() {
6888
+ if ( !jQuery.support.reliableMarginRight ) {
6889
+ jQuery.cssHooks.marginRight = {
6890
+ get: function( elem, computed ) {
6891
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6892
+ // Work around by temporarily setting element display to inline-block
6893
+ return jQuery.swap( elem, { "display": "inline-block" }, function() {
6894
+ if ( computed ) {
6895
+ return curCSS( elem, "marginRight" );
6896
+ }
6897
+ });
6898
+ }
6899
+ };
6900
+ }
6901
+
6902
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
6903
+ // getComputedStyle returns percent when specified for top/left/bottom/right
6904
+ // rather than make the css module depend on the offset module, we just check for it here
6905
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
6906
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
6907
+ jQuery.cssHooks[ prop ] = {
6908
+ get: function( elem, computed ) {
6909
+ if ( computed ) {
6910
+ var ret = curCSS( elem, prop );
6911
+ // if curCSS returns percentage, fallback to offset
6912
+ return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
6913
+ }
6914
+ }
6915
+ };
6916
+ });
6917
+ }
6918
+
6919
+ });
6920
+
6921
+ if ( jQuery.expr && jQuery.expr.filters ) {
6922
+ jQuery.expr.filters.hidden = function( elem ) {
6923
+ return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
6924
+ };
6925
+
6926
+ jQuery.expr.filters.visible = function( elem ) {
6927
+ return !jQuery.expr.filters.hidden( elem );
6928
+ };
6929
+ }
6930
+
6931
+ // These hooks are used by animate to expand properties
6932
+ jQuery.each({
6933
+ margin: "",
6934
+ padding: "",
6935
+ border: "Width"
6936
+ }, function( prefix, suffix ) {
6937
+ jQuery.cssHooks[ prefix + suffix ] = {
6938
+ expand: function( value ) {
6939
+ var i,
6940
+
6941
+ // assumes a single number if not a string
6942
+ parts = typeof value === "string" ? value.split(" ") : [ value ],
6943
+ expanded = {};
6944
+
6945
+ for ( i = 0; i < 4; i++ ) {
6946
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
6947
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6948
+ }
6949
+
6950
+ return expanded;
6951
+ }
6952
+ };
6953
+
6954
+ if ( !rmargin.test( prefix ) ) {
6955
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6956
+ }
6957
+ });
6958
+ var r20 = /%20/g,
6959
+ rbracket = /\[\]$/,
6960
+ rCRLF = /\r?\n/g,
6961
+ rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6962
+ rselectTextarea = /^(?:select|textarea)/i;
6963
+
6964
+ jQuery.fn.extend({
6965
+ serialize: function() {
6966
+ return jQuery.param( this.serializeArray() );
6967
+ },
6968
+ serializeArray: function() {
6969
+ return this.map(function(){
6970
+ return this.elements ? jQuery.makeArray( this.elements ) : this;
6971
+ })
6972
+ .filter(function(){
6973
+ return this.name && !this.disabled &&
6974
+ ( this.checked || rselectTextarea.test( this.nodeName ) ||
6975
+ rinput.test( this.type ) );
6976
+ })
6977
+ .map(function( i, elem ){
6978
+ var val = jQuery( this ).val();
6979
+
6980
+ return val == null ?
6981
+ null :
6982
+ jQuery.isArray( val ) ?
6983
+ jQuery.map( val, function( val, i ){
6984
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6985
+ }) :
6986
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
6987
+ }).get();
6988
+ }
6989
+ });
6990
+
6991
+ //Serialize an array of form elements or a set of
6992
+ //key/values into a query string
6993
+ jQuery.param = function( a, traditional ) {
6994
+ var prefix,
6995
+ s = [],
6996
+ add = function( key, value ) {
6997
+ // If value is a function, invoke it and return its value
6998
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
6999
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
7000
+ };
7001
+
7002
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
7003
+ if ( traditional === undefined ) {
7004
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
7005
+ }
7006
+
7007
+ // If an array was passed in, assume that it is an array of form elements.
7008
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7009
+ // Serialize the form elements
7010
+ jQuery.each( a, function() {
7011
+ add( this.name, this.value );
7012
+ });
7013
+
7014
+ } else {
7015
+ // If traditional, encode the "old" way (the way 1.3.2 or older
7016
+ // did it), otherwise encode params recursively.
7017
+ for ( prefix in a ) {
7018
+ buildParams( prefix, a[ prefix ], traditional, add );
7019
+ }
7020
+ }
7021
+
7022
+ // Return the resulting serialization
7023
+ return s.join( "&" ).replace( r20, "+" );
7024
+ };
7025
+
7026
+ function buildParams( prefix, obj, traditional, add ) {
7027
+ var name;
7028
+
7029
+ if ( jQuery.isArray( obj ) ) {
7030
+ // Serialize array item.
7031
+ jQuery.each( obj, function( i, v ) {
7032
+ if ( traditional || rbracket.test( prefix ) ) {
7033
+ // Treat each array item as a scalar.
7034
+ add( prefix, v );
7035
+
7036
+ } else {
7037
+ // If array item is non-scalar (array or object), encode its
7038
+ // numeric index to resolve deserialization ambiguity issues.
7039
+ // Note that rack (as of 1.0.0) can't currently deserialize
7040
+ // nested arrays properly, and attempting to do so may cause
7041
+ // a server error. Possible fixes are to modify rack's
7042
+ // deserialization algorithm or to provide an option or flag
7043
+ // to force array serialization to be shallow.
7044
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
7045
+ }
7046
+ });
7047
+
7048
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7049
+ // Serialize object item.
7050
+ for ( name in obj ) {
7051
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7052
+ }
7053
+
7054
+ } else {
7055
+ // Serialize scalar item.
7056
+ add( prefix, obj );
7057
+ }
7058
+ }
7059
+ var // Document location
7060
+ ajaxLocation,
7061
+ // Document location segments
7062
+ ajaxLocParts,
7063
+
7064
+ rhash = /#.*$/,
7065
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
7066
+ // #7653, #8125, #8152: local protocol detection
7067
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
7068
+ rnoContent = /^(?:GET|HEAD)$/,
7069
+ rprotocol = /^\/\//,
7070
+ rquery = /\?/,
7071
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
7072
+ rts = /([?&])_=[^&]*/,
7073
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
7074
+
7075
+ // Keep a copy of the old load method
7076
+ _load = jQuery.fn.load,
7077
+
7078
+ /* Prefilters
7079
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
7080
+ * 2) These are called:
7081
+ * - BEFORE asking for a transport
7082
+ * - AFTER param serialization (s.data is a string if s.processData is true)
7083
+ * 3) key is the dataType
7084
+ * 4) the catchall symbol "*" can be used
7085
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
7086
+ */
7087
+ prefilters = {},
7088
+
7089
+ /* Transports bindings
7090
+ * 1) key is the dataType
7091
+ * 2) the catchall symbol "*" can be used
7092
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
7093
+ */
7094
+ transports = {},
7095
+
7096
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
7097
+ allTypes = ["*/"] + ["*"];
7098
+
7099
+ // #8138, IE may throw an exception when accessing
7100
+ // a field from window.location if document.domain has been set
7101
+ try {
7102
+ ajaxLocation = location.href;
7103
+ } catch( e ) {
7104
+ // Use the href attribute of an A element
7105
+ // since IE will modify it given document.location
7106
+ ajaxLocation = document.createElement( "a" );
7107
+ ajaxLocation.href = "";
7108
+ ajaxLocation = ajaxLocation.href;
7109
+ }
7110
+
7111
+ // Segment location into parts
7112
+ ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
7113
+
7114
+ // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
7115
+ function addToPrefiltersOrTransports( structure ) {
7116
+
7117
+ // dataTypeExpression is optional and defaults to "*"
7118
+ return function( dataTypeExpression, func ) {
7119
+
7120
+ if ( typeof dataTypeExpression !== "string" ) {
7121
+ func = dataTypeExpression;
7122
+ dataTypeExpression = "*";
7123
+ }
7124
+
7125
+ var dataType, list, placeBefore,
7126
+ dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
7127
+ i = 0,
7128
+ length = dataTypes.length;
7129
+
7130
+ if ( jQuery.isFunction( func ) ) {
7131
+ // For each dataType in the dataTypeExpression
7132
+ for ( ; i < length; i++ ) {
7133
+ dataType = dataTypes[ i ];
7134
+ // We control if we're asked to add before
7135
+ // any existing element
7136
+ placeBefore = /^\+/.test( dataType );
7137
+ if ( placeBefore ) {
7138
+ dataType = dataType.substr( 1 ) || "*";
7139
+ }
7140
+ list = structure[ dataType ] = structure[ dataType ] || [];
7141
+ // then we add to the structure accordingly
7142
+ list[ placeBefore ? "unshift" : "push" ]( func );
7143
+ }
7144
+ }
7145
+ };
7146
+ }
7147
+
7148
+ // Base inspection function for prefilters and transports
7149
+ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
7150
+ dataType /* internal */, inspected /* internal */ ) {
7151
+
7152
+ dataType = dataType || options.dataTypes[ 0 ];
7153
+ inspected = inspected || {};
7154
+
7155
+ inspected[ dataType ] = true;
7156
+
7157
+ var selection,
7158
+ list = structure[ dataType ],
7159
+ i = 0,
7160
+ length = list ? list.length : 0,
7161
+ executeOnly = ( structure === prefilters );
7162
+
7163
+ for ( ; i < length && ( executeOnly || !selection ); i++ ) {
7164
+ selection = list[ i ]( options, originalOptions, jqXHR );
7165
+ // If we got redirected to another dataType
7166
+ // we try there if executing only and not done already
7167
+ if ( typeof selection === "string" ) {
7168
+ if ( !executeOnly || inspected[ selection ] ) {
7169
+ selection = undefined;
7170
+ } else {
7171
+ options.dataTypes.unshift( selection );
7172
+ selection = inspectPrefiltersOrTransports(
7173
+ structure, options, originalOptions, jqXHR, selection, inspected );
7174
+ }
7175
+ }
7176
+ }
7177
+ // If we're only executing or nothing was selected
7178
+ // we try the catchall dataType if not done already
7179
+ if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
7180
+ selection = inspectPrefiltersOrTransports(
7181
+ structure, options, originalOptions, jqXHR, "*", inspected );
7182
+ }
7183
+ // unnecessary when only executing (prefilters)
7184
+ // but it'll be ignored by the caller in that case
7185
+ return selection;
7186
+ }
7187
+
7188
+ // A special extend for ajax options
7189
+ // that takes "flat" options (not to be deep extended)
7190
+ // Fixes #9887
7191
+ function ajaxExtend( target, src ) {
7192
+ var key, deep,
7193
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
7194
+ for ( key in src ) {
7195
+ if ( src[ key ] !== undefined ) {
7196
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
7197
+ }
7198
+ }
7199
+ if ( deep ) {
7200
+ jQuery.extend( true, target, deep );
7201
+ }
7202
+ }
7203
+
7204
+ jQuery.fn.load = function( url, params, callback ) {
7205
+ if ( typeof url !== "string" && _load ) {
7206
+ return _load.apply( this, arguments );
7207
+ }
7208
+
7209
+ // Don't do a request if no elements are being requested
7210
+ if ( !this.length ) {
7211
+ return this;
7212
+ }
7213
+
7214
+ var selector, type, response,
7215
+ self = this,
7216
+ off = url.indexOf(" ");
7217
+
7218
+ if ( off >= 0 ) {
7219
+ selector = url.slice( off, url.length );
7220
+ url = url.slice( 0, off );
7221
+ }
7222
+
7223
+ // If it's a function
7224
+ if ( jQuery.isFunction( params ) ) {
7225
+
7226
+ // We assume that it's the callback
7227
+ callback = params;
7228
+ params = undefined;
7229
+
7230
+ // Otherwise, build a param string
7231
+ } else if ( typeof params === "object" ) {
7232
+ type = "POST";
7233
+ }
7234
+
7235
+ // Request the remote document
7236
+ jQuery.ajax({
7237
+ url: url,
7238
+
7239
+ // if "type" variable is undefined, then "GET" method will be used
7240
+ type: type,
7241
+ dataType: "html",
7242
+ data: params,
7243
+ complete: function( jqXHR, status ) {
7244
+ if ( callback ) {
7245
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
7246
+ }
7247
+ }
7248
+ }).done(function( responseText ) {
7249
+
7250
+ // Save response for use in complete callback
7251
+ response = arguments;
7252
+
7253
+ // See if a selector was specified
7254
+ self.html( selector ?
7255
+
7256
+ // Create a dummy div to hold the results
7257
+ jQuery("<div>")
7258
+
7259
+ // inject the contents of the document in, removing the scripts
7260
+ // to avoid any 'Permission Denied' errors in IE
7261
+ .append( responseText.replace( rscript, "" ) )
7262
+
7263
+ // Locate the specified elements
7264
+ .find( selector ) :
7265
+
7266
+ // If not, just inject the full result
7267
+ responseText );
7268
+
7269
+ });
7270
+
7271
+ return this;
7272
+ };
7273
+
7274
+ // Attach a bunch of functions for handling common AJAX events
7275
+ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
7276
+ jQuery.fn[ o ] = function( f ){
7277
+ return this.on( o, f );
7278
+ };
7279
+ });
7280
+
7281
+ jQuery.each( [ "get", "post" ], function( i, method ) {
7282
+ jQuery[ method ] = function( url, data, callback, type ) {
7283
+ // shift arguments if data argument was omitted
7284
+ if ( jQuery.isFunction( data ) ) {
7285
+ type = type || callback;
7286
+ callback = data;
7287
+ data = undefined;
7288
+ }
7289
+
7290
+ return jQuery.ajax({
7291
+ type: method,
7292
+ url: url,
7293
+ data: data,
7294
+ success: callback,
7295
+ dataType: type
7296
+ });
7297
+ };
7298
+ });
7299
+
7300
+ jQuery.extend({
7301
+
7302
+ getScript: function( url, callback ) {
7303
+ return jQuery.get( url, undefined, callback, "script" );
7304
+ },
7305
+
7306
+ getJSON: function( url, data, callback ) {
7307
+ return jQuery.get( url, data, callback, "json" );
7308
+ },
7309
+
7310
+ // Creates a full fledged settings object into target
7311
+ // with both ajaxSettings and settings fields.
7312
+ // If target is omitted, writes into ajaxSettings.
7313
+ ajaxSetup: function( target, settings ) {
7314
+ if ( settings ) {
7315
+ // Building a settings object
7316
+ ajaxExtend( target, jQuery.ajaxSettings );
7317
+ } else {
7318
+ // Extending ajaxSettings
7319
+ settings = target;
7320
+ target = jQuery.ajaxSettings;
7321
+ }
7322
+ ajaxExtend( target, settings );
7323
+ return target;
7324
+ },
7325
+
7326
+ ajaxSettings: {
7327
+ url: ajaxLocation,
7328
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
7329
+ global: true,
7330
+ type: "GET",
7331
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
7332
+ processData: true,
7333
+ async: true,
7334
+ /*
7335
+ timeout: 0,
7336
+ data: null,
7337
+ dataType: null,
7338
+ username: null,
7339
+ password: null,
7340
+ cache: null,
7341
+ throws: false,
7342
+ traditional: false,
7343
+ headers: {},
7344
+ */
7345
+
7346
+ accepts: {
7347
+ xml: "application/xml, text/xml",
7348
+ html: "text/html",
7349
+ text: "text/plain",
7350
+ json: "application/json, text/javascript",
7351
+ "*": allTypes
7352
+ },
7353
+
7354
+ contents: {
7355
+ xml: /xml/,
7356
+ html: /html/,
7357
+ json: /json/
7358
+ },
7359
+
7360
+ responseFields: {
7361
+ xml: "responseXML",
7362
+ text: "responseText"
7363
+ },
7364
+
7365
+ // List of data converters
7366
+ // 1) key format is "source_type destination_type" (a single space in-between)
7367
+ // 2) the catchall symbol "*" can be used for source_type
7368
+ converters: {
7369
+
7370
+ // Convert anything to text
7371
+ "* text": window.String,
7372
+
7373
+ // Text to html (true = no transformation)
7374
+ "text html": true,
7375
+
7376
+ // Evaluate text as a json expression
7377
+ "text json": jQuery.parseJSON,
7378
+
7379
+ // Parse text as xml
7380
+ "text xml": jQuery.parseXML
7381
+ },
7382
+
7383
+ // For options that shouldn't be deep extended:
7384
+ // you can add your own custom options here if
7385
+ // and when you create one that shouldn't be
7386
+ // deep extended (see ajaxExtend)
7387
+ flatOptions: {
7388
+ context: true,
7389
+ url: true
7390
+ }
7391
+ },
7392
+
7393
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
7394
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
7395
+
7396
+ // Main method
7397
+ ajax: function( url, options ) {
7398
+
7399
+ // If url is an object, simulate pre-1.5 signature
7400
+ if ( typeof url === "object" ) {
7401
+ options = url;
7402
+ url = undefined;
7403
+ }
7404
+
7405
+ // Force options to be an object
7406
+ options = options || {};
7407
+
7408
+ var // ifModified key
7409
+ ifModifiedKey,
7410
+ // Response headers
7411
+ responseHeadersString,
7412
+ responseHeaders,
7413
+ // transport
7414
+ transport,
7415
+ // timeout handle
7416
+ timeoutTimer,
7417
+ // Cross-domain detection vars
7418
+ parts,
7419
+ // To know if global events are to be dispatched
7420
+ fireGlobals,
7421
+ // Loop variable
7422
+ i,
7423
+ // Create the final options object
7424
+ s = jQuery.ajaxSetup( {}, options ),
7425
+ // Callbacks context
7426
+ callbackContext = s.context || s,
7427
+ // Context for global events
7428
+ // It's the callbackContext if one was provided in the options
7429
+ // and if it's a DOM node or a jQuery collection
7430
+ globalEventContext = callbackContext !== s &&
7431
+ ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
7432
+ jQuery( callbackContext ) : jQuery.event,
7433
+ // Deferreds
7434
+ deferred = jQuery.Deferred(),
7435
+ completeDeferred = jQuery.Callbacks( "once memory" ),
7436
+ // Status-dependent callbacks
7437
+ statusCode = s.statusCode || {},
7438
+ // Headers (they are sent all at once)
7439
+ requestHeaders = {},
7440
+ requestHeadersNames = {},
7441
+ // The jqXHR state
7442
+ state = 0,
7443
+ // Default abort message
7444
+ strAbort = "canceled",
7445
+ // Fake xhr
7446
+ jqXHR = {
7447
+
7448
+ readyState: 0,
7449
+
7450
+ // Caches the header
7451
+ setRequestHeader: function( name, value ) {
7452
+ if ( !state ) {
7453
+ var lname = name.toLowerCase();
7454
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
7455
+ requestHeaders[ name ] = value;
7456
+ }
7457
+ return this;
7458
+ },
7459
+
7460
+ // Raw string
7461
+ getAllResponseHeaders: function() {
7462
+ return state === 2 ? responseHeadersString : null;
7463
+ },
7464
+
7465
+ // Builds headers hashtable if needed
7466
+ getResponseHeader: function( key ) {
7467
+ var match;
7468
+ if ( state === 2 ) {
7469
+ if ( !responseHeaders ) {
7470
+ responseHeaders = {};
7471
+ while( ( match = rheaders.exec( responseHeadersString ) ) ) {
7472
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
7473
+ }
7474
+ }
7475
+ match = responseHeaders[ key.toLowerCase() ];
7476
+ }
7477
+ return match === undefined ? null : match;
7478
+ },
7479
+
7480
+ // Overrides response content-type header
7481
+ overrideMimeType: function( type ) {
7482
+ if ( !state ) {
7483
+ s.mimeType = type;
7484
+ }
7485
+ return this;
7486
+ },
7487
+
7488
+ // Cancel the request
7489
+ abort: function( statusText ) {
7490
+ statusText = statusText || strAbort;
7491
+ if ( transport ) {
7492
+ transport.abort( statusText );
7493
+ }
7494
+ done( 0, statusText );
7495
+ return this;
7496
+ }
7497
+ };
7498
+
7499
+ // Callback for when everything is done
7500
+ // It is defined here because jslint complains if it is declared
7501
+ // at the end of the function (which would be more logical and readable)
7502
+ function done( status, nativeStatusText, responses, headers ) {
7503
+ var isSuccess, success, error, response, modified,
7504
+ statusText = nativeStatusText;
7505
+
7506
+ // Called once
7507
+ if ( state === 2 ) {
7508
+ return;
7509
+ }
7510
+
7511
+ // State is "done" now
7512
+ state = 2;
7513
+
7514
+ // Clear timeout if it exists
7515
+ if ( timeoutTimer ) {
7516
+ clearTimeout( timeoutTimer );
7517
+ }
7518
+
7519
+ // Dereference transport for early garbage collection
7520
+ // (no matter how long the jqXHR object will be used)
7521
+ transport = undefined;
7522
+
7523
+ // Cache response headers
7524
+ responseHeadersString = headers || "";
7525
+
7526
+ // Set readyState
7527
+ jqXHR.readyState = status > 0 ? 4 : 0;
7528
+
7529
+ // Get response data
7530
+ if ( responses ) {
7531
+ response = ajaxHandleResponses( s, jqXHR, responses );
7532
+ }
7533
+
7534
+ // If successful, handle type chaining
7535
+ if ( status >= 200 && status < 300 || status === 304 ) {
7536
+
7537
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
7538
+ if ( s.ifModified ) {
7539
+
7540
+ modified = jqXHR.getResponseHeader("Last-Modified");
7541
+ if ( modified ) {
7542
+ jQuery.lastModified[ ifModifiedKey ] = modified;
7543
+ }
7544
+ modified = jqXHR.getResponseHeader("Etag");
7545
+ if ( modified ) {
7546
+ jQuery.etag[ ifModifiedKey ] = modified;
7547
+ }
7548
+ }
7549
+
7550
+ // If not modified
7551
+ if ( status === 304 ) {
7552
+
7553
+ statusText = "notmodified";
7554
+ isSuccess = true;
7555
+
7556
+ // If we have data
7557
+ } else {
7558
+
7559
+ isSuccess = ajaxConvert( s, response );
7560
+ statusText = isSuccess.state;
7561
+ success = isSuccess.data;
7562
+ error = isSuccess.error;
7563
+ isSuccess = !error;
7564
+ }
7565
+ } else {
7566
+ // We extract error from statusText
7567
+ // then normalize statusText and status for non-aborts
7568
+ error = statusText;
7569
+ if ( !statusText || status ) {
7570
+ statusText = "error";
7571
+ if ( status < 0 ) {
7572
+ status = 0;
7573
+ }
7574
+ }
7575
+ }
7576
+
7577
+ // Set data for the fake xhr object
7578
+ jqXHR.status = status;
7579
+ jqXHR.statusText = "" + ( nativeStatusText || statusText );
7580
+
7581
+ // Success/Error
7582
+ if ( isSuccess ) {
7583
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
7584
+ } else {
7585
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
7586
+ }
7587
+
7588
+ // Status-dependent callbacks
7589
+ jqXHR.statusCode( statusCode );
7590
+ statusCode = undefined;
7591
+
7592
+ if ( fireGlobals ) {
7593
+ globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
7594
+ [ jqXHR, s, isSuccess ? success : error ] );
7595
+ }
7596
+
7597
+ // Complete
7598
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
7599
+
7600
+ if ( fireGlobals ) {
7601
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
7602
+ // Handle the global AJAX counter
7603
+ if ( !( --jQuery.active ) ) {
7604
+ jQuery.event.trigger( "ajaxStop" );
7605
+ }
7606
+ }
7607
+ }
7608
+
7609
+ // Attach deferreds
7610
+ deferred.promise( jqXHR );
7611
+ jqXHR.success = jqXHR.done;
7612
+ jqXHR.error = jqXHR.fail;
7613
+ jqXHR.complete = completeDeferred.add;
7614
+
7615
+ // Status-dependent callbacks
7616
+ jqXHR.statusCode = function( map ) {
7617
+ if ( map ) {
7618
+ var tmp;
7619
+ if ( state < 2 ) {
7620
+ for ( tmp in map ) {
7621
+ statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
7622
+ }
7623
+ } else {
7624
+ tmp = map[ jqXHR.status ];
7625
+ jqXHR.always( tmp );
7626
+ }
7627
+ }
7628
+ return this;
7629
+ };
7630
+
7631
+ // Remove hash character (#7531: and string promotion)
7632
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
7633
+ // We also use the url parameter if available
7634
+ s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
7635
+
7636
+ // Extract dataTypes list
7637
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
7638
+
7639
+ // Determine if a cross-domain request is in order
7640
+ if ( s.crossDomain == null ) {
7641
+ parts = rurl.exec( s.url.toLowerCase() );
7642
+ s.crossDomain = !!( parts &&
7643
+ ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
7644
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
7645
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
7646
+ );
7647
+ }
7648
+
7649
+ // Convert data if not already a string
7650
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
7651
+ s.data = jQuery.param( s.data, s.traditional );
7652
+ }
7653
+
7654
+ // Apply prefilters
7655
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
7656
+
7657
+ // If request was aborted inside a prefilter, stop there
7658
+ if ( state === 2 ) {
7659
+ return jqXHR;
7660
+ }
7661
+
7662
+ // We can fire global events as of now if asked to
7663
+ fireGlobals = s.global;
7664
+
7665
+ // Uppercase the type
7666
+ s.type = s.type.toUpperCase();
7667
+
7668
+ // Determine if request has content
7669
+ s.hasContent = !rnoContent.test( s.type );
7670
+
7671
+ // Watch for a new set of requests
7672
+ if ( fireGlobals && jQuery.active++ === 0 ) {
7673
+ jQuery.event.trigger( "ajaxStart" );
7674
+ }
7675
+
7676
+ // More options handling for requests with no content
7677
+ if ( !s.hasContent ) {
7678
+
7679
+ // If data is available, append data to url
7680
+ if ( s.data ) {
7681
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
7682
+ // #9682: remove data so that it's not used in an eventual retry
7683
+ delete s.data;
7684
+ }
7685
+
7686
+ // Get ifModifiedKey before adding the anti-cache parameter
7687
+ ifModifiedKey = s.url;
7688
+
7689
+ // Add anti-cache in url if needed
7690
+ if ( s.cache === false ) {
7691
+
7692
+ var ts = jQuery.now(),
7693
+ // try replacing _= if it is there
7694
+ ret = s.url.replace( rts, "$1_=" + ts );
7695
+
7696
+ // if nothing was replaced, add timestamp to the end
7697
+ s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
7698
+ }
7699
+ }
7700
+
7701
+ // Set the correct header, if data is being sent
7702
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
7703
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
7704
+ }
7705
+
7706
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
7707
+ if ( s.ifModified ) {
7708
+ ifModifiedKey = ifModifiedKey || s.url;
7709
+ if ( jQuery.lastModified[ ifModifiedKey ] ) {
7710
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
7711
+ }
7712
+ if ( jQuery.etag[ ifModifiedKey ] ) {
7713
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
7714
+ }
7715
+ }
7716
+
7717
+ // Set the Accepts header for the server, depending on the dataType
7718
+ jqXHR.setRequestHeader(
7719
+ "Accept",
7720
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
7721
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
7722
+ s.accepts[ "*" ]
7723
+ );
7724
+
7725
+ // Check for headers option
7726
+ for ( i in s.headers ) {
7727
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
7728
+ }
7729
+
7730
+ // Allow custom headers/mimetypes and early abort
7731
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
7732
+ // Abort if not done already and return
7733
+ return jqXHR.abort();
7734
+
7735
+ }
7736
+
7737
+ // aborting is no longer a cancellation
7738
+ strAbort = "abort";
7739
+
7740
+ // Install callbacks on deferreds
7741
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
7742
+ jqXHR[ i ]( s[ i ] );
7743
+ }
7744
+
7745
+ // Get transport
7746
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
7747
+
7748
+ // If no transport, we auto-abort
7749
+ if ( !transport ) {
7750
+ done( -1, "No Transport" );
7751
+ } else {
7752
+ jqXHR.readyState = 1;
7753
+ // Send global event
7754
+ if ( fireGlobals ) {
7755
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
7756
+ }
7757
+ // Timeout
7758
+ if ( s.async && s.timeout > 0 ) {
7759
+ timeoutTimer = setTimeout( function(){
7760
+ jqXHR.abort( "timeout" );
7761
+ }, s.timeout );
7762
+ }
7763
+
7764
+ try {
7765
+ state = 1;
7766
+ transport.send( requestHeaders, done );
7767
+ } catch (e) {
7768
+ // Propagate exception as error if not done
7769
+ if ( state < 2 ) {
7770
+ done( -1, e );
7771
+ // Simply rethrow otherwise
7772
+ } else {
7773
+ throw e;
7774
+ }
7775
+ }
7776
+ }
7777
+
7778
+ return jqXHR;
7779
+ },
7780
+
7781
+ // Counter for holding the number of active queries
7782
+ active: 0,
7783
+
7784
+ // Last-Modified header cache for next request
7785
+ lastModified: {},
7786
+ etag: {}
7787
+
7788
+ });
7789
+
7790
+ /* Handles responses to an ajax request:
7791
+ * - sets all responseXXX fields accordingly
7792
+ * - finds the right dataType (mediates between content-type and expected dataType)
7793
+ * - returns the corresponding response
7794
+ */
7795
+ function ajaxHandleResponses( s, jqXHR, responses ) {
7796
+
7797
+ var ct, type, finalDataType, firstDataType,
7798
+ contents = s.contents,
7799
+ dataTypes = s.dataTypes,
7800
+ responseFields = s.responseFields;
7801
+
7802
+ // Fill responseXXX fields
7803
+ for ( type in responseFields ) {
7804
+ if ( type in responses ) {
7805
+ jqXHR[ responseFields[type] ] = responses[ type ];
7806
+ }
7807
+ }
7808
+
7809
+ // Remove auto dataType and get content-type in the process
7810
+ while( dataTypes[ 0 ] === "*" ) {
7811
+ dataTypes.shift();
7812
+ if ( ct === undefined ) {
7813
+ ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
7814
+ }
7815
+ }
7816
+
7817
+ // Check if we're dealing with a known content-type
7818
+ if ( ct ) {
7819
+ for ( type in contents ) {
7820
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
7821
+ dataTypes.unshift( type );
7822
+ break;
7823
+ }
7824
+ }
7825
+ }
7826
+
7827
+ // Check to see if we have a response for the expected dataType
7828
+ if ( dataTypes[ 0 ] in responses ) {
7829
+ finalDataType = dataTypes[ 0 ];
7830
+ } else {
7831
+ // Try convertible dataTypes
7832
+ for ( type in responses ) {
7833
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
7834
+ finalDataType = type;
7835
+ break;
7836
+ }
7837
+ if ( !firstDataType ) {
7838
+ firstDataType = type;
7839
+ }
7840
+ }
7841
+ // Or just use first one
7842
+ finalDataType = finalDataType || firstDataType;
7843
+ }
7844
+
7845
+ // If we found a dataType
7846
+ // We add the dataType to the list if needed
7847
+ // and return the corresponding response
7848
+ if ( finalDataType ) {
7849
+ if ( finalDataType !== dataTypes[ 0 ] ) {
7850
+ dataTypes.unshift( finalDataType );
7851
+ }
7852
+ return responses[ finalDataType ];
7853
+ }
7854
+ }
7855
+
7856
+ // Chain conversions given the request and the original response
7857
+ function ajaxConvert( s, response ) {
7858
+
7859
+ var conv, conv2, current, tmp,
7860
+ // Work with a copy of dataTypes in case we need to modify it for conversion
7861
+ dataTypes = s.dataTypes.slice(),
7862
+ prev = dataTypes[ 0 ],
7863
+ converters = {},
7864
+ i = 0;
7865
+
7866
+ // Apply the dataFilter if provided
7867
+ if ( s.dataFilter ) {
7868
+ response = s.dataFilter( response, s.dataType );
7869
+ }
7870
+
7871
+ // Create converters map with lowercased keys
7872
+ if ( dataTypes[ 1 ] ) {
7873
+ for ( conv in s.converters ) {
7874
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
7875
+ }
7876
+ }
7877
+
7878
+ // Convert to each sequential dataType, tolerating list modification
7879
+ for ( ; (current = dataTypes[++i]); ) {
7880
+
7881
+ // There's only work to do if current dataType is non-auto
7882
+ if ( current !== "*" ) {
7883
+
7884
+ // Convert response if prev dataType is non-auto and differs from current
7885
+ if ( prev !== "*" && prev !== current ) {
7886
+
7887
+ // Seek a direct converter
7888
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
7889
+
7890
+ // If none found, seek a pair
7891
+ if ( !conv ) {
7892
+ for ( conv2 in converters ) {
7893
+
7894
+ // If conv2 outputs current
7895
+ tmp = conv2.split(" ");
7896
+ if ( tmp[ 1 ] === current ) {
7897
+
7898
+ // If prev can be converted to accepted input
7899
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
7900
+ converters[ "* " + tmp[ 0 ] ];
7901
+ if ( conv ) {
7902
+ // Condense equivalence converters
7903
+ if ( conv === true ) {
7904
+ conv = converters[ conv2 ];
7905
+
7906
+ // Otherwise, insert the intermediate dataType
7907
+ } else if ( converters[ conv2 ] !== true ) {
7908
+ current = tmp[ 0 ];
7909
+ dataTypes.splice( i--, 0, current );
7910
+ }
7911
+
7912
+ break;
7913
+ }
7914
+ }
7915
+ }
7916
+ }
7917
+
7918
+ // Apply converter (if not an equivalence)
7919
+ if ( conv !== true ) {
7920
+
7921
+ // Unless errors are allowed to bubble, catch and return them
7922
+ if ( conv && s["throws"] ) {
7923
+ response = conv( response );
7924
+ } else {
7925
+ try {
7926
+ response = conv( response );
7927
+ } catch ( e ) {
7928
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
7929
+ }
7930
+ }
7931
+ }
7932
+ }
7933
+
7934
+ // Update prev for next iteration
7935
+ prev = current;
7936
+ }
7937
+ }
7938
+
7939
+ return { state: "success", data: response };
7940
+ }
7941
+ var oldCallbacks = [],
7942
+ rquestion = /\?/,
7943
+ rjsonp = /(=)\?(?=&|$)|\?\?/,
7944
+ nonce = jQuery.now();
7945
+
7946
+ // Default jsonp settings
7947
+ jQuery.ajaxSetup({
7948
+ jsonp: "callback",
7949
+ jsonpCallback: function() {
7950
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
7951
+ this[ callback ] = true;
7952
+ return callback;
7953
+ }
7954
+ });
7955
+
7956
+ // Detect, normalize options and install callbacks for jsonp requests
7957
+ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7958
+
7959
+ var callbackName, overwritten, responseContainer,
7960
+ data = s.data,
7961
+ url = s.url,
7962
+ hasCallback = s.jsonp !== false,
7963
+ replaceInUrl = hasCallback && rjsonp.test( url ),
7964
+ replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
7965
+ !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
7966
+ rjsonp.test( data );
7967
+
7968
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
7969
+ if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
7970
+
7971
+ // Get callback name, remembering preexisting value associated with it
7972
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
7973
+ s.jsonpCallback() :
7974
+ s.jsonpCallback;
7975
+ overwritten = window[ callbackName ];
7976
+
7977
+ // Insert callback into url or form data
7978
+ if ( replaceInUrl ) {
7979
+ s.url = url.replace( rjsonp, "$1" + callbackName );
7980
+ } else if ( replaceInData ) {
7981
+ s.data = data.replace( rjsonp, "$1" + callbackName );
7982
+ } else if ( hasCallback ) {
7983
+ s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
7984
+ }
7985
+
7986
+ // Use data converter to retrieve json after script execution
7987
+ s.converters["script json"] = function() {
7988
+ if ( !responseContainer ) {
7989
+ jQuery.error( callbackName + " was not called" );
7990
+ }
7991
+ return responseContainer[ 0 ];
7992
+ };
7993
+
7994
+ // force json dataType
7995
+ s.dataTypes[ 0 ] = "json";
7996
+
7997
+ // Install callback
7998
+ window[ callbackName ] = function() {
7999
+ responseContainer = arguments;
8000
+ };
8001
+
8002
+ // Clean-up function (fires after converters)
8003
+ jqXHR.always(function() {
8004
+ // Restore preexisting value
8005
+ window[ callbackName ] = overwritten;
8006
+
8007
+ // Save back as free
8008
+ if ( s[ callbackName ] ) {
8009
+ // make sure that re-using the options doesn't screw things around
8010
+ s.jsonpCallback = originalSettings.jsonpCallback;
8011
+
8012
+ // save the callback name for future use
8013
+ oldCallbacks.push( callbackName );
8014
+ }
8015
+
8016
+ // Call if it was a function and we have a response
8017
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
8018
+ overwritten( responseContainer[ 0 ] );
8019
+ }
8020
+
8021
+ responseContainer = overwritten = undefined;
8022
+ });
8023
+
8024
+ // Delegate to script
8025
+ return "script";
8026
+ }
8027
+ });
8028
+ // Install script dataType
8029
+ jQuery.ajaxSetup({
8030
+ accepts: {
8031
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
8032
+ },
8033
+ contents: {
8034
+ script: /javascript|ecmascript/
8035
+ },
8036
+ converters: {
8037
+ "text script": function( text ) {
8038
+ jQuery.globalEval( text );
8039
+ return text;
8040
+ }
8041
+ }
8042
+ });
8043
+
8044
+ // Handle cache's special case and global
8045
+ jQuery.ajaxPrefilter( "script", function( s ) {
8046
+ if ( s.cache === undefined ) {
8047
+ s.cache = false;
8048
+ }
8049
+ if ( s.crossDomain ) {
8050
+ s.type = "GET";
8051
+ s.global = false;
8052
+ }
8053
+ });
8054
+
8055
+ // Bind script tag hack transport
8056
+ jQuery.ajaxTransport( "script", function(s) {
8057
+
8058
+ // This transport only deals with cross domain requests
8059
+ if ( s.crossDomain ) {
8060
+
8061
+ var script,
8062
+ head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
8063
+
8064
+ return {
8065
+
8066
+ send: function( _, callback ) {
8067
+
8068
+ script = document.createElement( "script" );
8069
+
8070
+ script.async = "async";
8071
+
8072
+ if ( s.scriptCharset ) {
8073
+ script.charset = s.scriptCharset;
8074
+ }
8075
+
8076
+ script.src = s.url;
8077
+
8078
+ // Attach handlers for all browsers
8079
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
8080
+
8081
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
8082
+
8083
+ // Handle memory leak in IE
8084
+ script.onload = script.onreadystatechange = null;
8085
+
8086
+ // Remove the script
8087
+ if ( head && script.parentNode ) {
8088
+ head.removeChild( script );
8089
+ }
8090
+
8091
+ // Dereference the script
8092
+ script = undefined;
8093
+
8094
+ // Callback if not abort
8095
+ if ( !isAbort ) {
8096
+ callback( 200, "success" );
8097
+ }
8098
+ }
8099
+ };
8100
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
8101
+ // This arises when a base node is used (#2709 and #4378).
8102
+ head.insertBefore( script, head.firstChild );
8103
+ },
8104
+
8105
+ abort: function() {
8106
+ if ( script ) {
8107
+ script.onload( 0, 1 );
8108
+ }
8109
+ }
8110
+ };
8111
+ }
8112
+ });
8113
+ var xhrCallbacks,
8114
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
8115
+ xhrOnUnloadAbort = window.ActiveXObject ? function() {
8116
+ // Abort all pending requests
8117
+ for ( var key in xhrCallbacks ) {
8118
+ xhrCallbacks[ key ]( 0, 1 );
8119
+ }
8120
+ } : false,
8121
+ xhrId = 0;
8122
+
8123
+ // Functions to create xhrs
8124
+ function createStandardXHR() {
8125
+ try {
8126
+ return new window.XMLHttpRequest();
8127
+ } catch( e ) {}
8128
+ }
8129
+
8130
+ function createActiveXHR() {
8131
+ try {
8132
+ return new window.ActiveXObject( "Microsoft.XMLHTTP" );
8133
+ } catch( e ) {}
8134
+ }
8135
+
8136
+ // Create the request object
8137
+ // (This is still attached to ajaxSettings for backward compatibility)
8138
+ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
8139
+ /* Microsoft failed to properly
8140
+ * implement the XMLHttpRequest in IE7 (can't request local files),
8141
+ * so we use the ActiveXObject when it is available
8142
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
8143
+ * we need a fallback.
8144
+ */
8145
+ function() {
8146
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
8147
+ } :
8148
+ // For all other browsers, use the standard XMLHttpRequest object
8149
+ createStandardXHR;
8150
+
8151
+ // Determine support properties
8152
+ (function( xhr ) {
8153
+ jQuery.extend( jQuery.support, {
8154
+ ajax: !!xhr,
8155
+ cors: !!xhr && ( "withCredentials" in xhr )
8156
+ });
8157
+ })( jQuery.ajaxSettings.xhr() );
8158
+
8159
+ // Create transport if the browser can provide an xhr
8160
+ if ( jQuery.support.ajax ) {
8161
+
8162
+ jQuery.ajaxTransport(function( s ) {
8163
+ // Cross domain only allowed if supported through XMLHttpRequest
8164
+ if ( !s.crossDomain || jQuery.support.cors ) {
8165
+
8166
+ var callback;
8167
+
8168
+ return {
8169
+ send: function( headers, complete ) {
8170
+
8171
+ // Get a new xhr
8172
+ var handle, i,
8173
+ xhr = s.xhr();
8174
+
8175
+ // Open the socket
8176
+ // Passing null username, generates a login popup on Opera (#2865)
8177
+ if ( s.username ) {
8178
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
8179
+ } else {
8180
+ xhr.open( s.type, s.url, s.async );
8181
+ }
8182
+
8183
+ // Apply custom fields if provided
8184
+ if ( s.xhrFields ) {
8185
+ for ( i in s.xhrFields ) {
8186
+ xhr[ i ] = s.xhrFields[ i ];
8187
+ }
8188
+ }
8189
+
8190
+ // Override mime type if needed
8191
+ if ( s.mimeType && xhr.overrideMimeType ) {
8192
+ xhr.overrideMimeType( s.mimeType );
8193
+ }
8194
+
8195
+ // X-Requested-With header
8196
+ // For cross-domain requests, seeing as conditions for a preflight are
8197
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
8198
+ // (it can always be set on a per-request basis or even using ajaxSetup)
8199
+ // For same-domain requests, won't change header if already provided.
8200
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
8201
+ headers[ "X-Requested-With" ] = "XMLHttpRequest";
8202
+ }
8203
+
8204
+ // Need an extra try/catch for cross domain requests in Firefox 3
8205
+ try {
8206
+ for ( i in headers ) {
8207
+ xhr.setRequestHeader( i, headers[ i ] );
8208
+ }
8209
+ } catch( _ ) {}
8210
+
8211
+ // Do send the request
8212
+ // This may raise an exception which is actually
8213
+ // handled in jQuery.ajax (so no try/catch here)
8214
+ xhr.send( ( s.hasContent && s.data ) || null );
8215
+
8216
+ // Listener
8217
+ callback = function( _, isAbort ) {
8218
+
8219
+ var status,
8220
+ statusText,
8221
+ responseHeaders,
8222
+ responses,
8223
+ xml;
8224
+
8225
+ // Firefox throws exceptions when accessing properties
8226
+ // of an xhr when a network error occurred
8227
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
8228
+ try {
8229
+
8230
+ // Was never called and is aborted or complete
8231
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
8232
+
8233
+ // Only called once
8234
+ callback = undefined;
8235
+
8236
+ // Do not keep as active anymore
8237
+ if ( handle ) {
8238
+ xhr.onreadystatechange = jQuery.noop;
8239
+ if ( xhrOnUnloadAbort ) {
8240
+ delete xhrCallbacks[ handle ];
8241
+ }
8242
+ }
8243
+
8244
+ // If it's an abort
8245
+ if ( isAbort ) {
8246
+ // Abort it manually if needed
8247
+ if ( xhr.readyState !== 4 ) {
8248
+ xhr.abort();
8249
+ }
8250
+ } else {
8251
+ status = xhr.status;
8252
+ responseHeaders = xhr.getAllResponseHeaders();
8253
+ responses = {};
8254
+ xml = xhr.responseXML;
8255
+
8256
+ // Construct response list
8257
+ if ( xml && xml.documentElement /* #4958 */ ) {
8258
+ responses.xml = xml;
8259
+ }
8260
+
8261
+ // When requesting binary data, IE6-9 will throw an exception
8262
+ // on any attempt to access responseText (#11426)
8263
+ try {
8264
+ responses.text = xhr.responseText;
8265
+ } catch( _ ) {
8266
+ }
8267
+
8268
+ // Firefox throws an exception when accessing
8269
+ // statusText for faulty cross-domain requests
8270
+ try {
8271
+ statusText = xhr.statusText;
8272
+ } catch( e ) {
8273
+ // We normalize with Webkit giving an empty statusText
8274
+ statusText = "";
8275
+ }
8276
+
8277
+ // Filter status for non standard behaviors
8278
+
8279
+ // If the request is local and we have data: assume a success
8280
+ // (success with no data won't get notified, that's the best we
8281
+ // can do given current implementations)
8282
+ if ( !status && s.isLocal && !s.crossDomain ) {
8283
+ status = responses.text ? 200 : 404;
8284
+ // IE - #1450: sometimes returns 1223 when it should be 204
8285
+ } else if ( status === 1223 ) {
8286
+ status = 204;
8287
+ }
8288
+ }
8289
+ }
8290
+ } catch( firefoxAccessException ) {
8291
+ if ( !isAbort ) {
8292
+ complete( -1, firefoxAccessException );
8293
+ }
8294
+ }
8295
+
8296
+ // Call complete if needed
8297
+ if ( responses ) {
8298
+ complete( status, statusText, responses, responseHeaders );
8299
+ }
8300
+ };
8301
+
8302
+ if ( !s.async ) {
8303
+ // if we're in sync mode we fire the callback
8304
+ callback();
8305
+ } else if ( xhr.readyState === 4 ) {
8306
+ // (IE6 & IE7) if it's in cache and has been
8307
+ // retrieved directly we need to fire the callback
8308
+ setTimeout( callback, 0 );
8309
+ } else {
8310
+ handle = ++xhrId;
8311
+ if ( xhrOnUnloadAbort ) {
8312
+ // Create the active xhrs callbacks list if needed
8313
+ // and attach the unload handler
8314
+ if ( !xhrCallbacks ) {
8315
+ xhrCallbacks = {};
8316
+ jQuery( window ).unload( xhrOnUnloadAbort );
8317
+ }
8318
+ // Add to list of active xhrs callbacks
8319
+ xhrCallbacks[ handle ] = callback;
8320
+ }
8321
+ xhr.onreadystatechange = callback;
8322
+ }
8323
+ },
8324
+
8325
+ abort: function() {
8326
+ if ( callback ) {
8327
+ callback(0,1);
8328
+ }
8329
+ }
8330
+ };
8331
+ }
8332
+ });
8333
+ }
8334
+ var fxNow, timerId,
8335
+ rfxtypes = /^(?:toggle|show|hide)$/,
8336
+ rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
8337
+ rrun = /queueHooks$/,
8338
+ animationPrefilters = [ defaultPrefilter ],
8339
+ tweeners = {
8340
+ "*": [function( prop, value ) {
8341
+ var end, unit, prevScale,
8342
+ tween = this.createTween( prop, value ),
8343
+ parts = rfxnum.exec( value ),
8344
+ target = tween.cur(),
8345
+ start = +target || 0,
8346
+ scale = 1;
8347
+
8348
+ if ( parts ) {
8349
+ end = +parts[2];
8350
+ unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8351
+
8352
+ // We need to compute starting value
8353
+ if ( unit !== "px" && start ) {
8354
+ // Iteratively approximate from a nonzero starting point
8355
+ // Prefer the current property, because this process will be trivial if it uses the same units
8356
+ // Fallback to end or a simple constant
8357
+ start = jQuery.css( tween.elem, prop, true ) || end || 1;
8358
+
8359
+ do {
8360
+ // If previous iteration zeroed out, double until we get *something*
8361
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
8362
+ prevScale = scale = scale || ".5";
8363
+
8364
+ // Adjust and apply
8365
+ start = start / scale;
8366
+ jQuery.style( tween.elem, prop, start + unit );
8367
+
8368
+ // Update scale, tolerating zeroes from tween.cur()
8369
+ scale = tween.cur() / target;
8370
+
8371
+ // Stop looping if we've hit the mark or scale is unchanged
8372
+ } while ( scale !== 1 && scale !== prevScale );
8373
+ }
8374
+
8375
+ tween.unit = unit;
8376
+ tween.start = start;
8377
+ // If a +=/-= token was provided, we're doing a relative animation
8378
+ tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
8379
+ }
8380
+ return tween;
8381
+ }]
8382
+ };
8383
+
8384
+ // Animations created synchronously will run synchronously
8385
+ function createFxNow() {
8386
+ setTimeout(function() {
8387
+ fxNow = undefined;
8388
+ }, 0 );
8389
+ return ( fxNow = jQuery.now() );
8390
+ }
8391
+
8392
+ function createTweens( animation, props ) {
8393
+ jQuery.each( props, function( prop, value ) {
8394
+ var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
8395
+ index = 0,
8396
+ length = collection.length;
8397
+ for ( ; index < length; index++ ) {
8398
+ if ( collection[ index ].call( animation, prop, value ) ) {
8399
+
8400
+ // we're done with this property
8401
+ return;
8402
+ }
8403
+ }
8404
+ });
8405
+ }
8406
+
8407
+ function Animation( elem, properties, options ) {
8408
+ var result,
8409
+ index = 0,
8410
+ tweenerIndex = 0,
8411
+ length = animationPrefilters.length,
8412
+ deferred = jQuery.Deferred().always( function() {
8413
+ // don't match elem in the :animated selector
8414
+ delete tick.elem;
8415
+ }),
8416
+ tick = function() {
8417
+ var currentTime = fxNow || createFxNow(),
8418
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8419
+ percent = 1 - ( remaining / animation.duration || 0 ),
8420
+ index = 0,
8421
+ length = animation.tweens.length;
8422
+
8423
+ for ( ; index < length ; index++ ) {
8424
+ animation.tweens[ index ].run( percent );
8425
+ }
8426
+
8427
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
8428
+
8429
+ if ( percent < 1 && length ) {
8430
+ return remaining;
8431
+ } else {
8432
+ deferred.resolveWith( elem, [ animation ] );
8433
+ return false;
8434
+ }
8435
+ },
8436
+ animation = deferred.promise({
8437
+ elem: elem,
8438
+ props: jQuery.extend( {}, properties ),
8439
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
8440
+ originalProperties: properties,
8441
+ originalOptions: options,
8442
+ startTime: fxNow || createFxNow(),
8443
+ duration: options.duration,
8444
+ tweens: [],
8445
+ createTween: function( prop, end, easing ) {
8446
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
8447
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
8448
+ animation.tweens.push( tween );
8449
+ return tween;
8450
+ },
8451
+ stop: function( gotoEnd ) {
8452
+ var index = 0,
8453
+ // if we are going to the end, we want to run all the tweens
8454
+ // otherwise we skip this part
8455
+ length = gotoEnd ? animation.tweens.length : 0;
8456
+
8457
+ for ( ; index < length ; index++ ) {
8458
+ animation.tweens[ index ].run( 1 );
8459
+ }
8460
+
8461
+ // resolve when we played the last frame
8462
+ // otherwise, reject
8463
+ if ( gotoEnd ) {
8464
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
8465
+ } else {
8466
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
8467
+ }
8468
+ return this;
8469
+ }
8470
+ }),
8471
+ props = animation.props;
8472
+
8473
+ propFilter( props, animation.opts.specialEasing );
8474
+
8475
+ for ( ; index < length ; index++ ) {
8476
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
8477
+ if ( result ) {
8478
+ return result;
8479
+ }
8480
+ }
8481
+
8482
+ createTweens( animation, props );
8483
+
8484
+ if ( jQuery.isFunction( animation.opts.start ) ) {
8485
+ animation.opts.start.call( elem, animation );
8486
+ }
8487
+
8488
+ jQuery.fx.timer(
8489
+ jQuery.extend( tick, {
8490
+ anim: animation,
8491
+ queue: animation.opts.queue,
8492
+ elem: elem
8493
+ })
8494
+ );
8495
+
8496
+ // attach callbacks from options
8497
+ return animation.progress( animation.opts.progress )
8498
+ .done( animation.opts.done, animation.opts.complete )
8499
+ .fail( animation.opts.fail )
8500
+ .always( animation.opts.always );
8501
+ }
8502
+
8503
+ function propFilter( props, specialEasing ) {
8504
+ var index, name, easing, value, hooks;
8505
+
8506
+ // camelCase, specialEasing and expand cssHook pass
8507
+ for ( index in props ) {
8508
+ name = jQuery.camelCase( index );
8509
+ easing = specialEasing[ name ];
8510
+ value = props[ index ];
8511
+ if ( jQuery.isArray( value ) ) {
8512
+ easing = value[ 1 ];
8513
+ value = props[ index ] = value[ 0 ];
8514
+ }
8515
+
8516
+ if ( index !== name ) {
8517
+ props[ name ] = value;
8518
+ delete props[ index ];
8519
+ }
8520
+
8521
+ hooks = jQuery.cssHooks[ name ];
8522
+ if ( hooks && "expand" in hooks ) {
8523
+ value = hooks.expand( value );
8524
+ delete props[ name ];
8525
+
8526
+ // not quite $.extend, this wont overwrite keys already present.
8527
+ // also - reusing 'index' from above because we have the correct "name"
8528
+ for ( index in value ) {
8529
+ if ( !( index in props ) ) {
8530
+ props[ index ] = value[ index ];
8531
+ specialEasing[ index ] = easing;
8532
+ }
8533
+ }
8534
+ } else {
8535
+ specialEasing[ name ] = easing;
8536
+ }
8537
+ }
8538
+ }
8539
+
8540
+ jQuery.Animation = jQuery.extend( Animation, {
8541
+
8542
+ tweener: function( props, callback ) {
8543
+ if ( jQuery.isFunction( props ) ) {
8544
+ callback = props;
8545
+ props = [ "*" ];
8546
+ } else {
8547
+ props = props.split(" ");
8548
+ }
8549
+
8550
+ var prop,
8551
+ index = 0,
8552
+ length = props.length;
8553
+
8554
+ for ( ; index < length ; index++ ) {
8555
+ prop = props[ index ];
8556
+ tweeners[ prop ] = tweeners[ prop ] || [];
8557
+ tweeners[ prop ].unshift( callback );
8558
+ }
8559
+ },
8560
+
8561
+ prefilter: function( callback, prepend ) {
8562
+ if ( prepend ) {
8563
+ animationPrefilters.unshift( callback );
8564
+ } else {
8565
+ animationPrefilters.push( callback );
8566
+ }
8567
+ }
8568
+ });
8569
+
8570
+ function defaultPrefilter( elem, props, opts ) {
8571
+ var index, prop, value, length, dataShow, tween, hooks, oldfire,
8572
+ anim = this,
8573
+ style = elem.style,
8574
+ orig = {},
8575
+ handled = [],
8576
+ hidden = elem.nodeType && isHidden( elem );
8577
+
8578
+ // handle queue: false promises
8579
+ if ( !opts.queue ) {
8580
+ hooks = jQuery._queueHooks( elem, "fx" );
8581
+ if ( hooks.unqueued == null ) {
8582
+ hooks.unqueued = 0;
8583
+ oldfire = hooks.empty.fire;
8584
+ hooks.empty.fire = function() {
8585
+ if ( !hooks.unqueued ) {
8586
+ oldfire();
8587
+ }
8588
+ };
8589
+ }
8590
+ hooks.unqueued++;
8591
+
8592
+ anim.always(function() {
8593
+ // doing this makes sure that the complete handler will be called
8594
+ // before this completes
8595
+ anim.always(function() {
8596
+ hooks.unqueued--;
8597
+ if ( !jQuery.queue( elem, "fx" ).length ) {
8598
+ hooks.empty.fire();
8599
+ }
8600
+ });
8601
+ });
8602
+ }
8603
+
8604
+ // height/width overflow pass
8605
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
8606
+ // Make sure that nothing sneaks out
8607
+ // Record all 3 overflow attributes because IE does not
8608
+ // change the overflow attribute when overflowX and
8609
+ // overflowY are set to the same value
8610
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
8611
+
8612
+ // Set display property to inline-block for height/width
8613
+ // animations on inline elements that are having width/height animated
8614
+ if ( jQuery.css( elem, "display" ) === "inline" &&
8615
+ jQuery.css( elem, "float" ) === "none" ) {
8616
+
8617
+ // inline-level elements accept inline-block;
8618
+ // block-level elements need to be inline with layout
8619
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
8620
+ style.display = "inline-block";
8621
+
8622
+ } else {
8623
+ style.zoom = 1;
8624
+ }
8625
+ }
8626
+ }
8627
+
8628
+ if ( opts.overflow ) {
8629
+ style.overflow = "hidden";
8630
+ if ( !jQuery.support.shrinkWrapBlocks ) {
8631
+ anim.done(function() {
8632
+ style.overflow = opts.overflow[ 0 ];
8633
+ style.overflowX = opts.overflow[ 1 ];
8634
+ style.overflowY = opts.overflow[ 2 ];
8635
+ });
8636
+ }
8637
+ }
8638
+
8639
+
8640
+ // show/hide pass
8641
+ for ( index in props ) {
8642
+ value = props[ index ];
8643
+ if ( rfxtypes.exec( value ) ) {
8644
+ delete props[ index ];
8645
+ if ( value === ( hidden ? "hide" : "show" ) ) {
8646
+ continue;
8647
+ }
8648
+ handled.push( index );
8649
+ }
8650
+ }
8651
+
8652
+ length = handled.length;
8653
+ if ( length ) {
8654
+ dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
8655
+ if ( hidden ) {
8656
+ jQuery( elem ).show();
8657
+ } else {
8658
+ anim.done(function() {
8659
+ jQuery( elem ).hide();
8660
+ });
8661
+ }
8662
+ anim.done(function() {
8663
+ var prop;
8664
+ jQuery.removeData( elem, "fxshow", true );
8665
+ for ( prop in orig ) {
8666
+ jQuery.style( elem, prop, orig[ prop ] );
8667
+ }
8668
+ });
8669
+ for ( index = 0 ; index < length ; index++ ) {
8670
+ prop = handled[ index ];
8671
+ tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
8672
+ orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
8673
+
8674
+ if ( !( prop in dataShow ) ) {
8675
+ dataShow[ prop ] = tween.start;
8676
+ if ( hidden ) {
8677
+ tween.end = tween.start;
8678
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
8679
+ }
8680
+ }
8681
+ }
8682
+ }
8683
+ }
8684
+
8685
+ function Tween( elem, options, prop, end, easing ) {
8686
+ return new Tween.prototype.init( elem, options, prop, end, easing );
8687
+ }
8688
+ jQuery.Tween = Tween;
8689
+
8690
+ Tween.prototype = {
8691
+ constructor: Tween,
8692
+ init: function( elem, options, prop, end, easing, unit ) {
8693
+ this.elem = elem;
8694
+ this.prop = prop;
8695
+ this.easing = easing || "swing";
8696
+ this.options = options;
8697
+ this.start = this.now = this.cur();
8698
+ this.end = end;
8699
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8700
+ },
8701
+ cur: function() {
8702
+ var hooks = Tween.propHooks[ this.prop ];
8703
+
8704
+ return hooks && hooks.get ?
8705
+ hooks.get( this ) :
8706
+ Tween.propHooks._default.get( this );
8707
+ },
8708
+ run: function( percent ) {
8709
+ var eased,
8710
+ hooks = Tween.propHooks[ this.prop ];
8711
+
8712
+ this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration );
8713
+ this.now = ( this.end - this.start ) * eased + this.start;
8714
+
8715
+ if ( this.options.step ) {
8716
+ this.options.step.call( this.elem, this.now, this );
8717
+ }
8718
+
8719
+ if ( hooks && hooks.set ) {
8720
+ hooks.set( this );
8721
+ } else {
8722
+ Tween.propHooks._default.set( this );
8723
+ }
8724
+ return this;
8725
+ }
8726
+ };
8727
+
8728
+ Tween.prototype.init.prototype = Tween.prototype;
8729
+
8730
+ Tween.propHooks = {
8731
+ _default: {
8732
+ get: function( tween ) {
8733
+ var result;
8734
+
8735
+ if ( tween.elem[ tween.prop ] != null &&
8736
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
8737
+ return tween.elem[ tween.prop ];
8738
+ }
8739
+
8740
+ // passing any value as a 4th parameter to .css will automatically
8741
+ // attempt a parseFloat and fallback to a string if the parse fails
8742
+ // so, simple values such as "10px" are parsed to Float.
8743
+ // complex values such as "rotate(1rad)" are returned as is.
8744
+ result = jQuery.css( tween.elem, tween.prop, false, "" );
8745
+ // Empty strings, null, undefined and "auto" are converted to 0.
8746
+ return !result || result === "auto" ? 0 : result;
8747
+ },
8748
+ set: function( tween ) {
8749
+ // use step hook for back compat - use cssHook if its there - use .style if its
8750
+ // available and use plain properties where available
8751
+ if ( jQuery.fx.step[ tween.prop ] ) {
8752
+ jQuery.fx.step[ tween.prop ]( tween );
8753
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
8754
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
8755
+ } else {
8756
+ tween.elem[ tween.prop ] = tween.now;
8757
+ }
8758
+ }
8759
+ }
8760
+ };
8761
+
8762
+ // Remove in 2.0 - this supports IE8's panic based approach
8763
+ // to setting things on disconnected nodes
8764
+
8765
+ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
8766
+ set: function( tween ) {
8767
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
8768
+ tween.elem[ tween.prop ] = tween.now;
8769
+ }
8770
+ }
8771
+ };
8772
+
8773
+ jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
8774
+ var cssFn = jQuery.fn[ name ];
8775
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
8776
+ return speed == null || typeof speed === "boolean" ||
8777
+ // special check for .toggle( handler, handler, ... )
8778
+ ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
8779
+ cssFn.apply( this, arguments ) :
8780
+ this.animate( genFx( name, true ), speed, easing, callback );
8781
+ };
8782
+ });
8783
+
8784
+ jQuery.fn.extend({
8785
+ fadeTo: function( speed, to, easing, callback ) {
8786
+
8787
+ // show any hidden elements after setting opacity to 0
8788
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
8789
+
8790
+ // animate to the value specified
8791
+ .end().animate({ opacity: to }, speed, easing, callback );
8792
+ },
8793
+ animate: function( prop, speed, easing, callback ) {
8794
+ var empty = jQuery.isEmptyObject( prop ),
8795
+ optall = jQuery.speed( speed, easing, callback ),
8796
+ doAnimation = function() {
8797
+ // Operate on a copy of prop so per-property easing won't be lost
8798
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
8799
+
8800
+ // Empty animations resolve immediately
8801
+ if ( empty ) {
8802
+ anim.stop( true );
8803
+ }
8804
+ };
8805
+
8806
+ return empty || optall.queue === false ?
8807
+ this.each( doAnimation ) :
8808
+ this.queue( optall.queue, doAnimation );
8809
+ },
8810
+ stop: function( type, clearQueue, gotoEnd ) {
8811
+ var stopQueue = function( hooks ) {
8812
+ var stop = hooks.stop;
8813
+ delete hooks.stop;
8814
+ stop( gotoEnd );
8815
+ };
8816
+
8817
+ if ( typeof type !== "string" ) {
8818
+ gotoEnd = clearQueue;
8819
+ clearQueue = type;
8820
+ type = undefined;
8821
+ }
8822
+ if ( clearQueue && type !== false ) {
8823
+ this.queue( type || "fx", [] );
8824
+ }
8825
+
8826
+ return this.each(function() {
8827
+ var dequeue = true,
8828
+ index = type != null && type + "queueHooks",
8829
+ timers = jQuery.timers,
8830
+ data = jQuery._data( this );
8831
+
8832
+ if ( index ) {
8833
+ if ( data[ index ] && data[ index ].stop ) {
8834
+ stopQueue( data[ index ] );
8835
+ }
8836
+ } else {
8837
+ for ( index in data ) {
8838
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
8839
+ stopQueue( data[ index ] );
8840
+ }
8841
+ }
8842
+ }
8843
+
8844
+ for ( index = timers.length; index--; ) {
8845
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
8846
+ timers[ index ].anim.stop( gotoEnd );
8847
+ dequeue = false;
8848
+ timers.splice( index, 1 );
8849
+ }
8850
+ }
8851
+
8852
+ // start the next in the queue if the last step wasn't forced
8853
+ // timers currently will call their complete callbacks, which will dequeue
8854
+ // but only if they were gotoEnd
8855
+ if ( dequeue || !gotoEnd ) {
8856
+ jQuery.dequeue( this, type );
8857
+ }
8858
+ });
8859
+ }
8860
+ });
8861
+
8862
+ // Generate parameters to create a standard animation
8863
+ function genFx( type, includeWidth ) {
8864
+ var which,
8865
+ attrs = { height: type },
8866
+ i = 0;
8867
+
8868
+ // if we include width, step value is 1 to do all cssExpand values,
8869
+ // if we don't include width, step value is 2 to skip over Left and Right
8870
+ for( ; i < 4 ; i += 2 - includeWidth ) {
8871
+ which = cssExpand[ i ];
8872
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
8873
+ }
8874
+
8875
+ if ( includeWidth ) {
8876
+ attrs.opacity = attrs.width = type;
8877
+ }
8878
+
8879
+ return attrs;
8880
+ }
8881
+
8882
+ // Generate shortcuts for custom animations
8883
+ jQuery.each({
8884
+ slideDown: genFx("show"),
8885
+ slideUp: genFx("hide"),
8886
+ slideToggle: genFx("toggle"),
8887
+ fadeIn: { opacity: "show" },
8888
+ fadeOut: { opacity: "hide" },
8889
+ fadeToggle: { opacity: "toggle" }
8890
+ }, function( name, props ) {
8891
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
8892
+ return this.animate( props, speed, easing, callback );
8893
+ };
8894
+ });
8895
+
8896
+ jQuery.speed = function( speed, easing, fn ) {
8897
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
8898
+ complete: fn || !fn && easing ||
8899
+ jQuery.isFunction( speed ) && speed,
8900
+ duration: speed,
8901
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
8902
+ };
8903
+
8904
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
8905
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
8906
+
8907
+ // normalize opt.queue - true/undefined/null -> "fx"
8908
+ if ( opt.queue == null || opt.queue === true ) {
8909
+ opt.queue = "fx";
8910
+ }
8911
+
8912
+ // Queueing
8913
+ opt.old = opt.complete;
8914
+
8915
+ opt.complete = function() {
8916
+ if ( jQuery.isFunction( opt.old ) ) {
8917
+ opt.old.call( this );
8918
+ }
8919
+
8920
+ if ( opt.queue ) {
8921
+ jQuery.dequeue( this, opt.queue );
8922
+ }
8923
+ };
8924
+
8925
+ return opt;
8926
+ };
8927
+
8928
+ jQuery.easing = {
8929
+ linear: function( p ) {
8930
+ return p;
8931
+ },
8932
+ swing: function( p ) {
8933
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
8934
+ }
8935
+ };
8936
+
8937
+ jQuery.timers = [];
8938
+ jQuery.fx = Tween.prototype.init;
8939
+ jQuery.fx.tick = function() {
8940
+ var timer,
8941
+ timers = jQuery.timers,
8942
+ i = 0;
8943
+
8944
+ for ( ; i < timers.length; i++ ) {
8945
+ timer = timers[ i ];
8946
+ // Checks the timer has not already been removed
8947
+ if ( !timer() && timers[ i ] === timer ) {
8948
+ timers.splice( i--, 1 );
8949
+ }
8950
+ }
8951
+
8952
+ if ( !timers.length ) {
8953
+ jQuery.fx.stop();
8954
+ }
8955
+ };
8956
+
8957
+ jQuery.fx.timer = function( timer ) {
8958
+ if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
8959
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
8960
+ }
8961
+ };
8962
+
8963
+ jQuery.fx.interval = 13;
8964
+
8965
+ jQuery.fx.stop = function() {
8966
+ clearInterval( timerId );
8967
+ timerId = null;
8968
+ };
8969
+
8970
+ jQuery.fx.speeds = {
8971
+ slow: 600,
8972
+ fast: 200,
8973
+ // Default speed
8974
+ _default: 400
8975
+ };
8976
+
8977
+ // Back Compat <1.8 extension point
8978
+ jQuery.fx.step = {};
8979
+
8980
+ if ( jQuery.expr && jQuery.expr.filters ) {
8981
+ jQuery.expr.filters.animated = function( elem ) {
8982
+ return jQuery.grep(jQuery.timers, function( fn ) {
8983
+ return elem === fn.elem;
8984
+ }).length;
8985
+ };
8986
+ }
8987
+ var rroot = /^(?:body|html)$/i;
8988
+
8989
+ jQuery.fn.offset = function( options ) {
8990
+ if ( arguments.length ) {
8991
+ return options === undefined ?
8992
+ this :
8993
+ this.each(function( i ) {
8994
+ jQuery.offset.setOffset( this, options, i );
8995
+ });
8996
+ }
8997
+
8998
+ var box, docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
8999
+ elem = this[ 0 ],
9000
+ doc = elem && elem.ownerDocument;
9001
+
9002
+ if ( !doc ) {
9003
+ return;
9004
+ }
9005
+
9006
+ if ( (body = doc.body) === elem ) {
9007
+ return jQuery.offset.bodyOffset( elem );
9008
+ }
9009
+
9010
+ docElem = doc.documentElement;
9011
+
9012
+ // Make sure we're not dealing with a disconnected DOM node
9013
+ if ( !jQuery.contains( docElem, elem ) ) {
9014
+ return { top: 0, left: 0 };
9015
+ }
9016
+
9017
+ box = elem.getBoundingClientRect();
9018
+ win = getWindow( doc );
9019
+ clientTop = docElem.clientTop || body.clientTop || 0;
9020
+ clientLeft = docElem.clientLeft || body.clientLeft || 0;
9021
+ scrollTop = win.pageYOffset || docElem.scrollTop;
9022
+ scrollLeft = win.pageXOffset || docElem.scrollLeft;
9023
+ top = box.top + scrollTop - clientTop;
9024
+ left = box.left + scrollLeft - clientLeft;
9025
+
9026
+ return { top: top, left: left };
9027
+ };
9028
+
9029
+ jQuery.offset = {
9030
+
9031
+ bodyOffset: function( body ) {
9032
+ var top = body.offsetTop,
9033
+ left = body.offsetLeft;
9034
+
9035
+ if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
9036
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
9037
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
9038
+ }
9039
+
9040
+ return { top: top, left: left };
9041
+ },
9042
+
9043
+ setOffset: function( elem, options, i ) {
9044
+ var position = jQuery.css( elem, "position" );
9045
+
9046
+ // set position first, in-case top/left are set even on static elem
9047
+ if ( position === "static" ) {
9048
+ elem.style.position = "relative";
9049
+ }
9050
+
9051
+ var curElem = jQuery( elem ),
9052
+ curOffset = curElem.offset(),
9053
+ curCSSTop = jQuery.css( elem, "top" ),
9054
+ curCSSLeft = jQuery.css( elem, "left" ),
9055
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
9056
+ props = {}, curPosition = {}, curTop, curLeft;
9057
+
9058
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
9059
+ if ( calculatePosition ) {
9060
+ curPosition = curElem.position();
9061
+ curTop = curPosition.top;
9062
+ curLeft = curPosition.left;
9063
+ } else {
9064
+ curTop = parseFloat( curCSSTop ) || 0;
9065
+ curLeft = parseFloat( curCSSLeft ) || 0;
9066
+ }
9067
+
9068
+ if ( jQuery.isFunction( options ) ) {
9069
+ options = options.call( elem, i, curOffset );
9070
+ }
9071
+
9072
+ if ( options.top != null ) {
9073
+ props.top = ( options.top - curOffset.top ) + curTop;
9074
+ }
9075
+ if ( options.left != null ) {
9076
+ props.left = ( options.left - curOffset.left ) + curLeft;
9077
+ }
9078
+
9079
+ if ( "using" in options ) {
9080
+ options.using.call( elem, props );
9081
+ } else {
9082
+ curElem.css( props );
9083
+ }
9084
+ }
9085
+ };
9086
+
9087
+
9088
+ jQuery.fn.extend({
9089
+
9090
+ position: function() {
9091
+ if ( !this[0] ) {
9092
+ return;
9093
+ }
9094
+
9095
+ var elem = this[0],
9096
+
9097
+ // Get *real* offsetParent
9098
+ offsetParent = this.offsetParent(),
9099
+
9100
+ // Get correct offsets
9101
+ offset = this.offset(),
9102
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
9103
+
9104
+ // Subtract element margins
9105
+ // note: when an element has margin: auto the offsetLeft and marginLeft
9106
+ // are the same in Safari causing offset.left to incorrectly be 0
9107
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
9108
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
9109
+
9110
+ // Add offsetParent borders
9111
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
9112
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
9113
+
9114
+ // Subtract the two offsets
9115
+ return {
9116
+ top: offset.top - parentOffset.top,
9117
+ left: offset.left - parentOffset.left
9118
+ };
9119
+ },
9120
+
9121
+ offsetParent: function() {
9122
+ return this.map(function() {
9123
+ var offsetParent = this.offsetParent || document.body;
9124
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
9125
+ offsetParent = offsetParent.offsetParent;
9126
+ }
9127
+ return offsetParent || document.body;
9128
+ });
9129
+ }
9130
+ });
9131
+
9132
+
9133
+ // Create scrollLeft and scrollTop methods
9134
+ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
9135
+ var top = /Y/.test( prop );
9136
+
9137
+ jQuery.fn[ method ] = function( val ) {
9138
+ return jQuery.access( this, function( elem, method, val ) {
9139
+ var win = getWindow( elem );
9140
+
9141
+ if ( val === undefined ) {
9142
+ return win ? (prop in win) ? win[ prop ] :
9143
+ win.document.documentElement[ method ] :
9144
+ elem[ method ];
9145
+ }
9146
+
9147
+ if ( win ) {
9148
+ win.scrollTo(
9149
+ !top ? val : jQuery( win ).scrollLeft(),
9150
+ top ? val : jQuery( win ).scrollTop()
9151
+ );
9152
+
9153
+ } else {
9154
+ elem[ method ] = val;
9155
+ }
9156
+ }, method, val, arguments.length, null );
9157
+ };
9158
+ });
9159
+
9160
+ function getWindow( elem ) {
9161
+ return jQuery.isWindow( elem ) ?
9162
+ elem :
9163
+ elem.nodeType === 9 ?
9164
+ elem.defaultView || elem.parentWindow :
9165
+ false;
9166
+ }
9167
+ // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9168
+ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9169
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
9170
+ // margin is only for outerHeight, outerWidth
9171
+ jQuery.fn[ funcName ] = function( margin, value ) {
9172
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9173
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9174
+
9175
+ return jQuery.access( this, function( elem, type, value ) {
9176
+ var doc;
9177
+
9178
+ if ( jQuery.isWindow( elem ) ) {
9179
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
9180
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
9181
+ // https://github.com/jquery/jquery/pull/764
9182
+ return elem.document.documentElement[ "client" + name ];
9183
+ }
9184
+
9185
+ // Get document width or height
9186
+ if ( elem.nodeType === 9 ) {
9187
+ doc = elem.documentElement;
9188
+
9189
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
9190
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
9191
+ return Math.max(
9192
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9193
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
9194
+ doc[ "client" + name ]
9195
+ );
9196
+ }
9197
+
9198
+ return value === undefined ?
9199
+ // Get width or height on the element, requesting but not forcing parseFloat
9200
+ jQuery.css( elem, type, value, extra ) :
9201
+
9202
+ // Set width or height on the element
9203
+ jQuery.style( elem, type, value, extra );
9204
+ }, type, chainable ? margin : undefined, chainable );
9205
+ };
9206
+ });
9207
+ });
9208
+ // Expose jQuery to the global object
9209
+ window.sQuery = jQuery;
9210
+
9211
+ // Expose jQuery as an AMD module, but only for AMD loaders that
9212
+ // understand the issues with loading multiple versions of jQuery
9213
+ // in a page that all might call define(). The loader will indicate
9214
+ // they have special allowances for multiple jQuery versions by
9215
+ // specifying define.amd.jQuery = true. Register as a named module,
9216
+ // since jQuery can be concatenated with other files that may use define,
9217
+ // but not use a proper concatenation script that understands anonymous
9218
+ // AMD modules. A named AMD is safest and most robust way to register.
9219
+ // Lowercase jquery is used because AMD module names are derived from
9220
+ // file names, and jQuery is normally delivered in a lowercase file name.
9221
+ // Do this after creating the global so that if an AMD module wants to call
9222
+ // noConflict to hide this version of jQuery, it will work.
9223
+ if ( typeof define === "function" && define.amd && define.amd.sQuery ) {
9224
+ define( "jquery", [], function () { return jQuery; } );
9225
+ }
9226
+
9227
+ })( window );
assets/js/jquery_ui_custom.js ADDED
@@ -0,0 +1,2353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.2 - 2012-12-18
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
4
+ * Copyright (c) 2012 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.9.2",
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().andSelf().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
179
+ $(function() {
180
+ var body = document.body,
181
+ div = body.appendChild( div = document.createElement( "div" ) );
182
+
183
+ // access offsetHeight before setting the style to prevent a layout bug
184
+ // in IE 9 which causes the element to continue to take up space even
185
+ // after it is removed from the DOM (#8026)
186
+ div.offsetHeight;
187
+
188
+ $.extend( div.style, {
189
+ minHeight: "100px",
190
+ height: "auto",
191
+ padding: 0,
192
+ borderWidth: 0
193
+ });
194
+
195
+ $.support.minHeight = div.offsetHeight === 100;
196
+ $.support.selectstart = "onselectstart" in div;
197
+
198
+ // set display to none to avoid a layout bug in IE
199
+ // http://dev.jquery.com/ticket/4014
200
+ body.removeChild( div ).style.display = "none";
201
+ });
202
+
203
+ // support: jQuery <1.8
204
+ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
205
+ $.each( [ "Width", "Height" ], function( i, name ) {
206
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
207
+ type = name.toLowerCase(),
208
+ orig = {
209
+ innerWidth: $.fn.innerWidth,
210
+ innerHeight: $.fn.innerHeight,
211
+ outerWidth: $.fn.outerWidth,
212
+ outerHeight: $.fn.outerHeight
213
+ };
214
+
215
+ function reduce( elem, size, border, margin ) {
216
+ $.each( side, function() {
217
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
218
+ if ( border ) {
219
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
220
+ }
221
+ if ( margin ) {
222
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
223
+ }
224
+ });
225
+ return size;
226
+ }
227
+
228
+ $.fn[ "inner" + name ] = function( size ) {
229
+ if ( size === undefined ) {
230
+ return orig[ "inner" + name ].call( this );
231
+ }
232
+
233
+ return this.each(function() {
234
+ $( this ).css( type, reduce( this, size ) + "px" );
235
+ });
236
+ };
237
+
238
+ $.fn[ "outer" + name] = function( size, margin ) {
239
+ if ( typeof size !== "number" ) {
240
+ return orig[ "outer" + name ].call( this, size );
241
+ }
242
+
243
+ return this.each(function() {
244
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
245
+ });
246
+ };
247
+ });
248
+ }
249
+
250
+ // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
251
+ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
252
+ $.fn.removeData = (function( removeData ) {
253
+ return function( key ) {
254
+ if ( arguments.length ) {
255
+ return removeData.call( this, $.camelCase( key ) );
256
+ } else {
257
+ return removeData.call( this );
258
+ }
259
+ };
260
+ })( $.fn.removeData );
261
+ }
262
+
263
+
264
+
265
+
266
+
267
+ // deprecated
268
+
269
+ (function() {
270
+ var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
271
+ $.ui.ie = uaMatch.length ? true : false;
272
+ $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
273
+ })();
274
+
275
+ $.fn.extend({
276
+ disableSelection: function() {
277
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
278
+ ".ui-disableSelection", function( event ) {
279
+ event.preventDefault();
280
+ });
281
+ },
282
+
283
+ enableSelection: function() {
284
+ return this.unbind( ".ui-disableSelection" );
285
+ }
286
+ });
287
+
288
+ $.extend( $.ui, {
289
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
290
+ plugin: {
291
+ add: function( module, option, set ) {
292
+ var i,
293
+ proto = $.ui[ module ].prototype;
294
+ for ( i in set ) {
295
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
296
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
297
+ }
298
+ },
299
+ call: function( instance, name, args ) {
300
+ var i,
301
+ set = instance.plugins[ name ];
302
+ if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
303
+ return;
304
+ }
305
+
306
+ for ( i = 0; i < set.length; i++ ) {
307
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
308
+ set[ i ][ 1 ].apply( instance.element, args );
309
+ }
310
+ }
311
+ }
312
+ },
313
+
314
+ contains: $.contains,
315
+
316
+ // only used by resizable
317
+ hasScroll: function( el, a ) {
318
+
319
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
320
+ if ( $( el ).css( "overflow" ) === "hidden") {
321
+ return false;
322
+ }
323
+
324
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
325
+ has = false;
326
+
327
+ if ( el[ scroll ] > 0 ) {
328
+ return true;
329
+ }
330
+
331
+ // TODO: determine which cases actually cause this to happen
332
+ // if the element doesn't have the scroll set, see if it's possible to
333
+ // set the scroll
334
+ el[ scroll ] = 1;
335
+ has = ( el[ scroll ] > 0 );
336
+ el[ scroll ] = 0;
337
+ return has;
338
+ },
339
+
340
+ // these are odd functions, fix the API or move into individual plugins
341
+ isOverAxis: function( x, reference, size ) {
342
+ //Determines when x coordinate is over "b" element axis
343
+ return ( x > reference ) && ( x < ( reference + size ) );
344
+ },
345
+ isOver: function( y, x, top, left, height, width ) {
346
+ //Determines when x, y coordinates is over "b" element
347
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
348
+ }
349
+ });
350
+
351
+ })( sQuery );
352
+ (function( $, undefined ) {
353
+
354
+ var uuid = 0,
355
+ slice = Array.prototype.slice,
356
+ _cleanData = $.cleanData;
357
+ $.cleanData = function( elems ) {
358
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
359
+ try {
360
+ $( elem ).triggerHandler( "remove" );
361
+ // http://bugs.jquery.com/ticket/8235
362
+ } catch( e ) {}
363
+ }
364
+ _cleanData( elems );
365
+ };
366
+
367
+ $.widget = function( name, base, prototype ) {
368
+ var fullName, existingConstructor, constructor, basePrototype,
369
+ namespace = name.split( "." )[ 0 ];
370
+
371
+ name = name.split( "." )[ 1 ];
372
+ fullName = namespace + "-" + name;
373
+
374
+ if ( !prototype ) {
375
+ prototype = base;
376
+ base = $.Widget;
377
+ }
378
+
379
+ // create selector for plugin
380
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
381
+ return !!$.data( elem, fullName );
382
+ };
383
+
384
+ $[ namespace ] = $[ namespace ] || {};
385
+ existingConstructor = $[ namespace ][ name ];
386
+ constructor = $[ namespace ][ name ] = function( options, element ) {
387
+ // allow instantiation without "new" keyword
388
+ if ( !this._createWidget ) {
389
+ return new constructor( options, element );
390
+ }
391
+
392
+ // allow instantiation without initializing for simple inheritance
393
+ // must use "new" keyword (the code above always passes args)
394
+ if ( arguments.length ) {
395
+ this._createWidget( options, element );
396
+ }
397
+ };
398
+ // extend with the existing constructor to carry over any static properties
399
+ $.extend( constructor, existingConstructor, {
400
+ version: prototype.version,
401
+ // copy the object used to create the prototype in case we need to
402
+ // redefine the widget later
403
+ _proto: $.extend( {}, prototype ),
404
+ // track widgets that inherit from this widget in case this widget is
405
+ // redefined after a widget inherits from it
406
+ _childConstructors: []
407
+ });
408
+
409
+ basePrototype = new base();
410
+ // we need to make the options hash a property directly on the new instance
411
+ // otherwise we'll modify the options hash on the prototype that we're
412
+ // inheriting from
413
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
414
+ $.each( prototype, function( prop, value ) {
415
+ if ( $.isFunction( value ) ) {
416
+ prototype[ prop ] = (function() {
417
+ var _super = function() {
418
+ return base.prototype[ prop ].apply( this, arguments );
419
+ },
420
+ _superApply = function( args ) {
421
+ return base.prototype[ prop ].apply( this, args );
422
+ };
423
+ return function() {
424
+ var __super = this._super,
425
+ __superApply = this._superApply,
426
+ returnValue;
427
+
428
+ this._super = _super;
429
+ this._superApply = _superApply;
430
+
431
+ returnValue = value.apply( this, arguments );
432
+
433
+ this._super = __super;
434
+ this._superApply = __superApply;
435
+
436
+ return returnValue;
437
+ };
438
+ })();
439
+ }
440
+ });
441
+ constructor.prototype = $.widget.extend( basePrototype, {
442
+ // TODO: remove support for widgetEventPrefix
443
+ // always use the name + a colon as the prefix, e.g., draggable:start
444
+ // don't prefix for widgets that aren't DOM-based
445
+ widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
446
+ }, prototype, {
447
+ constructor: constructor,
448
+ namespace: namespace,
449
+ widgetName: name,
450
+ // TODO remove widgetBaseClass, see #8155
451
+ widgetBaseClass: fullName,
452
+ widgetFullName: fullName
453
+ });
454
+
455
+ // If this widget is being redefined then we need to find all widgets that
456
+ // are inheriting from it and redefine all of them so that they inherit from
457
+ // the new version of this widget. We're essentially trying to replace one
458
+ // level in the prototype chain.
459
+ if ( existingConstructor ) {
460
+ $.each( existingConstructor._childConstructors, function( i, child ) {
461
+ var childPrototype = child.prototype;
462
+
463
+ // redefine the child widget using the same prototype that was
464
+ // originally used, but inherit from the new version of the base
465
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
466
+ });
467
+ // remove the list of existing child constructors from the old constructor
468
+ // so the old child constructors can be garbage collected
469
+ delete existingConstructor._childConstructors;
470
+ } else {
471
+ base._childConstructors.push( constructor );
472
+ }
473
+
474
+ $.widget.bridge( name, constructor );
475
+ };
476
+
477
+ $.widget.extend = function( target ) {
478
+ var input = slice.call( arguments, 1 ),
479
+ inputIndex = 0,
480
+ inputLength = input.length,
481
+ key,
482
+ value;
483
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
484
+ for ( key in input[ inputIndex ] ) {
485
+ value = input[ inputIndex ][ key ];
486
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
487
+ // Clone objects
488
+ if ( $.isPlainObject( value ) ) {
489
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
490
+ $.widget.extend( {}, target[ key ], value ) :
491
+ // Don't extend strings, arrays, etc. with objects
492
+ $.widget.extend( {}, value );
493
+ // Copy everything else by reference
494
+ } else {
495
+ target[ key ] = value;
496
+ }
497
+ }
498
+ }
499
+ }
500
+ return target;
501
+ };
502
+
503
+ $.widget.bridge = function( name, object ) {
504
+ var fullName = object.prototype.widgetFullName || name;
505
+ $.fn[ name ] = function( options ) {
506
+ var isMethodCall = typeof options === "string",
507
+ args = slice.call( arguments, 1 ),
508
+ returnValue = this;
509
+
510
+ // allow multiple hashes to be passed on init
511
+ options = !isMethodCall && args.length ?
512
+ $.widget.extend.apply( null, [ options ].concat(args) ) :
513
+ options;
514
+
515
+ if ( isMethodCall ) {
516
+ this.each(function() {
517
+ var methodValue,
518
+ instance = $.data( this, fullName );
519
+ if ( !instance ) {
520
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
521
+ "attempted to call method '" + options + "'" );
522
+ }
523
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
524
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
525
+ }
526
+ methodValue = instance[ options ].apply( instance, args );
527
+ if ( methodValue !== instance && methodValue !== undefined ) {
528
+ returnValue = methodValue && methodValue.jquery ?
529
+ returnValue.pushStack( methodValue.get() ) :
530
+ methodValue;
531
+ return false;
532
+ }
533
+ });
534
+ } else {
535
+ this.each(function() {
536
+ var instance = $.data( this, fullName );
537
+ if ( instance ) {
538
+ instance.option( options || {} )._init();
539
+ } else {
540
+ $.data( this, fullName, new object( options, this ) );
541
+ }
542
+ });
543
+ }
544
+
545
+ return returnValue;
546
+ };
547
+ };
548
+
549
+ $.Widget = function( /* options, element */ ) {};
550
+ $.Widget._childConstructors = [];
551
+
552
+ $.Widget.prototype = {
553
+ widgetName: "widget",
554
+ widgetEventPrefix: "",
555
+ defaultElement: "<div>",
556
+ options: {
557
+ disabled: false,
558
+
559
+ // callbacks
560
+ create: null
561
+ },
562
+ _createWidget: function( options, element ) {
563
+ element = $( element || this.defaultElement || this )[ 0 ];
564
+ this.element = $( element );
565
+ this.uuid = uuid++;
566
+ this.eventNamespace = "." + this.widgetName + this.uuid;
567
+ this.options = $.widget.extend( {},
568
+ this.options,
569
+ this._getCreateOptions(),
570
+ options );
571
+
572
+ this.bindings = $();
573
+ this.hoverable = $();
574
+ this.focusable = $();
575
+
576
+ if ( element !== this ) {
577
+ // 1.9 BC for #7810
578
+ // TODO remove dual storage
579
+ $.data( element, this.widgetName, this );
580
+ $.data( element, this.widgetFullName, this );
581
+ this._on( true, this.element, {
582
+ remove: function( event ) {
583
+ if ( event.target === element ) {
584
+ this.destroy();
585
+ }
586
+ }
587
+ });
588
+ this.document = $( element.style ?
589
+ // element within the document
590
+ element.ownerDocument :
591
+ // element is window or document
592
+ element.document || element );
593
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
594
+ }
595
+
596
+ this._create();
597
+ this._trigger( "create", null, this._getCreateEventData() );
598
+ this._init();
599
+ },
600
+ _getCreateOptions: $.noop,
601
+ _getCreateEventData: $.noop,
602
+ _create: $.noop,
603
+ _init: $.noop,
604
+
605
+ destroy: function() {
606
+ this._destroy();
607
+ // we can probably remove the unbind calls in 2.0
608
+ // all event bindings should go through this._on()
609
+ this.element
610
+ .unbind( this.eventNamespace )
611
+ // 1.9 BC for #7810
612
+ // TODO remove dual storage
613
+ .removeData( this.widgetName )
614
+ .removeData( this.widgetFullName )
615
+ // support: jquery <1.6.3
616
+ // http://bugs.jquery.com/ticket/9413
617
+ .removeData( $.camelCase( this.widgetFullName ) );
618
+ this.widget()
619
+ .unbind( this.eventNamespace )
620
+ .removeAttr( "aria-disabled" )
621
+ .removeClass(
622
+ this.widgetFullName + "-disabled " +
623
+ "ui-state-disabled" );
624
+
625
+ // clean up events and states
626
+ this.bindings.unbind( this.eventNamespace );
627
+ this.hoverable.removeClass( "ui-state-hover" );
628
+ this.focusable.removeClass( "ui-state-focus" );
629
+ },
630
+ _destroy: $.noop,
631
+
632
+ widget: function() {
633
+ return this.element;
634
+ },
635
+
636
+ option: function( key, value ) {
637
+ var options = key,
638
+ parts,
639
+ curOption,
640
+ i;
641
+
642
+ if ( arguments.length === 0 ) {
643
+ // don't return a reference to the internal hash
644
+ return $.widget.extend( {}, this.options );
645
+ }
646
+
647
+ if ( typeof key === "string" ) {
648
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
649
+ options = {};
650
+ parts = key.split( "." );
651
+ key = parts.shift();
652
+ if ( parts.length ) {
653
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
654
+ for ( i = 0; i < parts.length - 1; i++ ) {
655
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
656
+ curOption = curOption[ parts[ i ] ];
657
+ }
658
+ key = parts.pop();
659
+ if ( value === undefined ) {
660
+ return curOption[ key ] === undefined ? null : curOption[ key ];
661
+ }
662
+ curOption[ key ] = value;
663
+ } else {
664
+ if ( value === undefined ) {
665
+ return this.options[ key ] === undefined ? null : this.options[ key ];
666
+ }
667
+ options[ key ] = value;
668
+ }
669
+ }
670
+
671
+ this._setOptions( options );
672
+
673
+ return this;
674
+ },
675
+ _setOptions: function( options ) {
676
+ var key;
677
+
678
+ for ( key in options ) {
679
+ this._setOption( key, options[ key ] );
680
+ }
681
+
682
+ return this;
683
+ },
684
+ _setOption: function( key, value ) {
685
+ this.options[ key ] = value;
686
+
687
+ if ( key === "disabled" ) {
688
+ this.widget()
689
+ .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
690
+ .attr( "aria-disabled", value );
691
+ this.hoverable.removeClass( "ui-state-hover" );
692
+ this.focusable.removeClass( "ui-state-focus" );
693
+ }
694
+
695
+ return this;
696
+ },
697
+
698
+ enable: function() {
699
+ return this._setOption( "disabled", false );
700
+ },
701
+ disable: function() {
702
+ return this._setOption( "disabled", true );
703
+ },
704
+
705
+ _on: function( suppressDisabledCheck, element, handlers ) {
706
+ var delegateElement,
707
+ instance = this;
708
+
709
+ // no suppressDisabledCheck flag, shuffle arguments
710
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
711
+ handlers = element;
712
+ element = suppressDisabledCheck;
713
+ suppressDisabledCheck = false;
714
+ }
715
+
716
+ // no element argument, shuffle and use this.element
717
+ if ( !handlers ) {
718
+ handlers = element;
719
+ element = this.element;
720
+ delegateElement = this.widget();
721
+ } else {
722
+ // accept selectors, DOM elements
723
+ element = delegateElement = $( element );
724
+ this.bindings = this.bindings.add( element );
725
+ }
726
+
727
+ $.each( handlers, function( event, handler ) {
728
+ function handlerProxy() {
729
+ // allow widgets to customize the disabled handling
730
+ // - disabled as an array instead of boolean
731
+ // - disabled class as method for disabling individual parts
732
+ if ( !suppressDisabledCheck &&
733
+ ( instance.options.disabled === true ||
734
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
735
+ return;
736
+ }
737
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
738
+ .apply( instance, arguments );
739
+ }
740
+
741
+ // copy the guid so direct unbinding works
742
+ if ( typeof handler !== "string" ) {
743
+ handlerProxy.guid = handler.guid =
744
+ handler.guid || handlerProxy.guid || $.guid++;
745
+ }
746
+
747
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
748
+ eventName = match[1] + instance.eventNamespace,
749
+ selector = match[2];
750
+ if ( selector ) {
751
+ delegateElement.delegate( selector, eventName, handlerProxy );
752
+ } else {
753
+ element.bind( eventName, handlerProxy );
754
+ }
755
+ });
756
+ },
757
+
758
+ _off: function( element, eventName ) {
759
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
760
+ element.unbind( eventName ).undelegate( eventName );
761
+ },
762
+
763
+ _delay: function( handler, delay ) {
764
+ function handlerProxy() {
765
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
766
+ .apply( instance, arguments );
767
+ }
768
+ var instance = this;
769
+ return setTimeout( handlerProxy, delay || 0 );
770
+ },
771
+
772
+ _hoverable: function( element ) {
773
+ this.hoverable = this.hoverable.add( element );
774
+ this._on( element, {
775
+ mouseenter: function( event ) {
776
+ $( event.currentTarget ).addClass( "ui-state-hover" );
777
+ },
778
+ mouseleave: function( event ) {
779
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
780
+ }
781
+ });
782
+ },
783
+
784
+ _focusable: function( element ) {
785
+ this.focusable = this.focusable.add( element );
786
+ this._on( element, {
787
+ focusin: function( event ) {
788
+ $( event.currentTarget ).addClass( "ui-state-focus" );
789
+ },
790
+ focusout: function( event ) {
791
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
792
+ }
793
+ });
794
+ },
795
+
796
+ _trigger: function( type, event, data ) {
797
+ var prop, orig,
798
+ callback = this.options[ type ];
799
+
800
+ data = data || {};
801
+ event = $.Event( event );
802
+ event.type = ( type === this.widgetEventPrefix ?
803
+ type :
804
+ this.widgetEventPrefix + type ).toLowerCase();
805
+ // the original event may come from any element
806
+ // so we need to reset the target on the new event
807
+ event.target = this.element[ 0 ];
808
+
809
+ // copy original event properties over to the new event
810
+ orig = event.originalEvent;
811
+ if ( orig ) {
812
+ for ( prop in orig ) {
813
+ if ( !( prop in event ) ) {
814
+ event[ prop ] = orig[ prop ];
815
+ }
816
+ }
817
+ }
818
+
819
+ this.element.trigger( event, data );
820
+ return !( $.isFunction( callback ) &&
821
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
822
+ event.isDefaultPrevented() );
823
+ }
824
+ };
825
+
826
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
827
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
828
+ if ( typeof options === "string" ) {
829
+ options = { effect: options };
830
+ }
831
+ var hasOptions,
832
+ effectName = !options ?
833
+ method :
834
+ options === true || typeof options === "number" ?
835
+ defaultEffect :
836
+ options.effect || defaultEffect;
837
+ options = options || {};
838
+ if ( typeof options === "number" ) {
839
+ options = { duration: options };
840
+ }
841
+ hasOptions = !$.isEmptyObject( options );
842
+ options.complete = callback;
843
+ if ( options.delay ) {
844
+ element.delay( options.delay );
845
+ }
846
+ if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
847
+ element[ method ]( options );
848
+ } else if ( effectName !== method && element[ effectName ] ) {
849
+ element[ effectName ]( options.duration, options.easing, callback );
850
+ } else {
851
+ element.queue(function( next ) {
852
+ $( this )[ method ]();
853
+ if ( callback ) {
854
+ callback.call( element[ 0 ] );
855
+ }
856
+ next();
857
+ });
858
+ }
859
+ };
860
+ });
861
+
862
+ // DEPRECATED
863
+ if ( $.uiBackCompat !== false ) {
864
+ $.Widget.prototype._getCreateOptions = function() {
865
+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
866
+ };
867
+ }
868
+
869
+ })( sQuery );
870
+ (function( $, undefined ) {
871
+
872
+ var mouseHandled = false;
873
+ $( document ).mouseup( function( e ) {
874
+ mouseHandled = false;
875
+ });
876
+
877
+ $.widget("ui.mouse", {
878
+ version: "1.9.2",
879
+ options: {
880
+ cancel: 'input,textarea,button,select,option',
881
+ distance: 1,
882
+ delay: 0
883
+ },
884
+ _mouseInit: function() {
885
+ var that = this;
886
+
887
+ this.element
888
+ .bind('mousedown.'+this.widgetName, function(event) {
889
+ return that._mouseDown(event);
890
+ })
891
+ .bind('click.'+this.widgetName, function(event) {
892
+ if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
893
+ $.removeData(event.target, that.widgetName + '.preventClickEvent');
894
+ event.stopImmediatePropagation();
895
+ return false;
896
+ }
897
+ });
898
+
899
+ this.started = false;
900
+ },
901
+
902
+ // TODO: make sure destroying one instance of mouse doesn't mess with
903
+ // other instances of mouse
904
+ _mouseDestroy: function() {
905
+ this.element.unbind('.'+this.widgetName);
906
+ if ( this._mouseMoveDelegate ) {
907
+ $(document)
908
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
909
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
910
+ }
911
+ },
912
+
913
+ _mouseDown: function(event) {
914
+ // don't let more than one widget handle mouseStart
915
+ if( mouseHandled ) { return; }
916
+
917
+ // we may have missed mouseup (out of window)
918
+ (this._mouseStarted && this._mouseUp(event));
919
+
920
+ this._mouseDownEvent = event;
921
+
922
+ var that = this,
923
+ btnIsLeft = (event.which === 1),
924
+ // event.target.nodeName works around a bug in IE 8 with
925
+ // disabled inputs (#7620)
926
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
927
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
928
+ return true;
929
+ }
930
+
931
+ this.mouseDelayMet = !this.options.delay;
932
+ if (!this.mouseDelayMet) {
933
+ this._mouseDelayTimer = setTimeout(function() {
934
+ that.mouseDelayMet = true;
935
+ }, this.options.delay);
936
+ }
937
+
938
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
939
+ this._mouseStarted = (this._mouseStart(event) !== false);
940
+ if (!this._mouseStarted) {
941
+ event.preventDefault();
942
+ return true;
943
+ }
944
+ }
945
+
946
+ // Click event may never have fired (Gecko & Opera)
947
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
948
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
949
+ }
950
+
951
+ // these delegates are required to keep context
952
+ this._mouseMoveDelegate = function(event) {
953
+ return that._mouseMove(event);
954
+ };
955
+ this._mouseUpDelegate = function(event) {
956
+ return that._mouseUp(event);
957
+ };
958
+ $(document)
959
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
960
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
961
+
962
+ event.preventDefault();
963
+
964
+ mouseHandled = true;
965
+ return true;
966
+ },
967
+
968
+ _mouseMove: function(event) {
969
+ // IE mouseup check - mouseup happened when mouse was out of window
970
+ if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
971
+ return this._mouseUp(event);
972
+ }
973
+
974
+ if (this._mouseStarted) {
975
+ this._mouseDrag(event);
976
+ return event.preventDefault();
977
+ }
978
+
979
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
980
+ this._mouseStarted =
981
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
982
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
983
+ }
984
+
985
+ return !this._mouseStarted;
986
+ },
987
+
988
+ _mouseUp: function(event) {
989
+ $(document)
990
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
991
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
992
+
993
+ if (this._mouseStarted) {
994
+ this._mouseStarted = false;
995
+
996
+ if (event.target === this._mouseDownEvent.target) {
997
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
998
+ }
999
+
1000
+ this._mouseStop(event);
1001
+ }
1002
+
1003
+ return false;
1004
+ },
1005
+
1006
+ _mouseDistanceMet: function(event) {
1007
+ return (Math.max(
1008
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
1009
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
1010
+ ) >= this.options.distance
1011
+ );
1012
+ },
1013
+
1014
+ _mouseDelayMet: function(event) {
1015
+ return this.mouseDelayMet;
1016
+ },
1017
+
1018
+ // These are placeholder methods, to be overriden by extending plugin
1019
+ _mouseStart: function(event) {},
1020
+ _mouseDrag: function(event) {},
1021
+ _mouseStop: function(event) {},
1022
+ _mouseCapture: function(event) { return true; }
1023
+ });
1024
+
1025
+ })(sQuery);
1026
+ (function( $, undefined ) {
1027
+
1028
+ $.ui = $.ui || {};
1029
+
1030
+ var cachedScrollbarWidth,
1031
+ max = Math.max,
1032
+ abs = Math.abs,
1033
+ round = Math.round,
1034
+ rhorizontal = /left|center|right/,
1035
+ rvertical = /top|center|bottom/,
1036
+ roffset = /[\+\-]\d+%?/,
1037
+ rposition = /^\w+/,
1038
+ rpercent = /%$/,
1039
+ _position = $.fn.position;
1040
+
1041
+ function getOffsets( offsets, width, height ) {
1042
+ return [
1043
+ parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
1044
+ parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
1045
+ ];
1046
+ }
1047
+ function parseCss( element, property ) {
1048
+ return parseInt( $.css( element, property ), 10 ) || 0;
1049
+ }
1050
+
1051
+ $.position = {
1052
+ scrollbarWidth: function() {
1053
+ if ( cachedScrollbarWidth !== undefined ) {
1054
+ return cachedScrollbarWidth;
1055
+ }
1056
+ var w1, w2,
1057
+ div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
1058
+ innerDiv = div.children()[0];
1059
+
1060
+ $( "body" ).append( div );
1061
+ w1 = innerDiv.offsetWidth;
1062
+ div.css( "overflow", "scroll" );
1063
+
1064
+ w2 = innerDiv.offsetWidth;
1065
+
1066
+ if ( w1 === w2 ) {
1067
+ w2 = div[0].clientWidth;
1068
+ }
1069
+
1070
+ div.remove();
1071
+
1072
+ return (cachedScrollbarWidth = w1 - w2);
1073
+ },
1074
+ getScrollInfo: function( within ) {
1075
+ var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
1076
+ overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
1077
+ hasOverflowX = overflowX === "scroll" ||
1078
+ ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
1079
+ hasOverflowY = overflowY === "scroll" ||
1080
+ ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
1081
+ return {
1082
+ width: hasOverflowX ? $.position.scrollbarWidth() : 0,
1083
+ height: hasOverflowY ? $.position.scrollbarWidth() : 0
1084
+ };
1085
+ },
1086
+ getWithinInfo: function( element ) {
1087
+ var withinElement = $( element || window ),
1088
+ isWindow = $.isWindow( withinElement[0] );
1089
+ return {
1090
+ element: withinElement,
1091
+ isWindow: isWindow,
1092
+ offset: withinElement.offset() || { left: 0, top: 0 },
1093
+ scrollLeft: withinElement.scrollLeft(),
1094
+ scrollTop: withinElement.scrollTop(),
1095
+ width: isWindow ? withinElement.width() : withinElement.outerWidth(),
1096
+ height: isWindow ? withinElement.height() : withinElement.outerHeight()
1097
+ };
1098
+ }
1099
+ };
1100
+
1101
+ $.fn.position = function( options ) {
1102
+ if ( !options || !options.of ) {
1103
+ return _position.apply( this, arguments );
1104
+ }
1105
+
1106
+ // make a copy, we don't want to modify arguments
1107
+ options = $.extend( {}, options );
1108
+
1109
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
1110
+ target = $( options.of ),
1111
+ within = $.position.getWithinInfo( options.within ),
1112
+ scrollInfo = $.position.getScrollInfo( within ),
1113
+ targetElem = target[0],
1114
+ collision = ( options.collision || "flip" ).split( " " ),
1115
+ offsets = {};
1116
+
1117
+ if ( targetElem.nodeType === 9 ) {
1118
+ targetWidth = target.width();
1119
+ targetHeight = target.height();
1120
+ targetOffset = { top: 0, left: 0 };
1121
+ } else if ( $.isWindow( targetElem ) ) {
1122
+ targetWidth = target.width();
1123
+ targetHeight = target.height();
1124
+ targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
1125
+ } else if ( targetElem.preventDefault ) {
1126
+ // force left top to allow flipping
1127
+ options.at = "left top";
1128
+ targetWidth = targetHeight = 0;
1129
+ targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
1130
+ } else {
1131
+ targetWidth = target.outerWidth();
1132
+ targetHeight = target.outerHeight();
1133
+ targetOffset = target.offset();
1134
+ }
1135
+ // clone to reuse original targetOffset later
1136
+ basePosition = $.extend( {}, targetOffset );
1137
+
1138
+ // force my and at to have valid horizontal and vertical positions
1139
+ // if a value is missing or invalid, it will be converted to center
1140
+ $.each( [ "my", "at" ], function() {
1141
+ var pos = ( options[ this ] || "" ).split( " " ),
1142
+ horizontalOffset,
1143
+ verticalOffset;
1144
+
1145
+ if ( pos.length === 1) {
1146
+ pos = rhorizontal.test( pos[ 0 ] ) ?
1147
+ pos.concat( [ "center" ] ) :
1148
+ rvertical.test( pos[ 0 ] ) ?
1149
+ [ "center" ].concat( pos ) :
1150
+ [ "center", "center" ];
1151
+ }
1152
+ pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
1153
+ pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
1154
+
1155
+ // calculate offsets
1156
+ horizontalOffset = roffset.exec( pos[ 0 ] );
1157
+ verticalOffset = roffset.exec( pos[ 1 ] );
1158
+ offsets[ this ] = [
1159
+ horizontalOffset ? horizontalOffset[ 0 ] : 0,
1160
+ verticalOffset ? verticalOffset[ 0 ] : 0
1161
+ ];
1162
+
1163
+ // reduce to just the positions without the offsets
1164
+ options[ this ] = [
1165
+ rposition.exec( pos[ 0 ] )[ 0 ],
1166
+ rposition.exec( pos[ 1 ] )[ 0 ]
1167
+ ];
1168
+ });
1169
+
1170
+ // normalize collision option
1171
+ if ( collision.length === 1 ) {
1172
+ collision[ 1 ] = collision[ 0 ];
1173
+ }
1174
+
1175
+ if ( options.at[ 0 ] === "right" ) {
1176
+ basePosition.left += targetWidth;
1177
+ } else if ( options.at[ 0 ] === "center" ) {
1178
+ basePosition.left += targetWidth / 2;
1179
+ }
1180
+
1181
+ if ( options.at[ 1 ] === "bottom" ) {
1182
+ basePosition.top += targetHeight;
1183
+ } else if ( options.at[ 1 ] === "center" ) {
1184
+ basePosition.top += targetHeight / 2;
1185
+ }
1186
+
1187
+ atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
1188
+ basePosition.left += atOffset[ 0 ];
1189
+ basePosition.top += atOffset[ 1 ];
1190
+
1191
+ return this.each(function() {
1192
+ var collisionPosition, using,
1193
+ elem = $( this ),
1194
+ elemWidth = elem.outerWidth(),
1195
+ elemHeight = elem.outerHeight(),
1196
+ marginLeft = parseCss( this, "marginLeft" ),
1197
+ marginTop = parseCss( this, "marginTop" ),
1198
+ collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
1199
+ collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
1200
+ position = $.extend( {}, basePosition ),
1201
+ myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
1202
+
1203
+ if ( options.my[ 0 ] === "right" ) {
1204
+ position.left -= elemWidth;
1205
+ } else if ( options.my[ 0 ] === "center" ) {
1206
+ position.left -= elemWidth / 2;
1207
+ }
1208
+
1209
+ if ( options.my[ 1 ] === "bottom" ) {
1210
+ position.top -= elemHeight;
1211
+ } else if ( options.my[ 1 ] === "center" ) {
1212
+ position.top -= elemHeight / 2;
1213
+ }
1214
+
1215
+ position.left += myOffset[ 0 ];
1216
+ position.top += myOffset[ 1 ];
1217
+
1218
+ // if the browser doesn't support fractions, then round for consistent results
1219
+ if ( !$.support.offsetFractions ) {
1220
+ position.left = round( position.left );
1221
+ position.top = round( position.top );
1222
+ }
1223
+
1224
+ collisionPosition = {
1225
+ marginLeft: marginLeft,
1226
+ marginTop: marginTop
1227
+ };
1228
+
1229
+ $.each( [ "left", "top" ], function( i, dir ) {
1230
+ if ( $.ui.position[ collision[ i ] ] ) {
1231
+ $.ui.position[ collision[ i ] ][ dir ]( position, {
1232
+ targetWidth: targetWidth,
1233
+ targetHeight: targetHeight,
1234
+ elemWidth: elemWidth,
1235
+ elemHeight: elemHeight,
1236
+ collisionPosition: collisionPosition,
1237
+ collisionWidth: collisionWidth,
1238
+ collisionHeight: collisionHeight,
1239
+ offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
1240
+ my: options.my,
1241
+ at: options.at,
1242
+ within: within,
1243
+ elem : elem
1244
+ });
1245
+ }
1246
+ });
1247
+
1248
+ if ( $.fn.bgiframe ) {
1249
+ elem.bgiframe();
1250
+ }
1251
+
1252
+ if ( options.using ) {
1253
+ // adds feedback as second argument to using callback, if present
1254
+ using = function( props ) {
1255
+ var left = targetOffset.left - position.left,
1256
+ right = left + targetWidth - elemWidth,
1257
+ top = targetOffset.top - position.top,
1258
+ bottom = top + targetHeight - elemHeight,
1259
+ feedback = {
1260
+ target: {
1261
+ element: target,
1262
+ left: targetOffset.left,
1263
+ top: targetOffset.top,
1264
+ width: targetWidth,
1265
+ height: targetHeight
1266
+ },
1267
+ element: {
1268
+ element: elem,
1269
+ left: position.left,
1270
+ top: position.top,
1271
+ width: elemWidth,
1272
+ height: elemHeight
1273
+ },
1274
+ horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
1275
+ vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
1276
+ };
1277
+ if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
1278
+ feedback.horizontal = "center";
1279
+ }
1280
+ if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
1281
+ feedback.vertical = "middle";
1282
+ }
1283
+ if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
1284
+ feedback.important = "horizontal";
1285
+ } else {
1286
+ feedback.important = "vertical";
1287
+ }
1288
+ options.using.call( this, props, feedback );
1289
+ };
1290
+ }
1291
+
1292
+ elem.offset( $.extend( position, { using: using } ) );
1293
+ });
1294
+ };
1295
+
1296
+ $.ui.position = {
1297
+ fit: {
1298
+ left: function( position, data ) {
1299
+ var within = data.within,
1300
+ withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
1301
+ outerWidth = within.width,
1302
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
1303
+ overLeft = withinOffset - collisionPosLeft,
1304
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
1305
+ newOverRight;
1306
+
1307
+ // element is wider than within
1308
+ if ( data.collisionWidth > outerWidth ) {
1309
+ // element is initially over the left side of within
1310
+ if ( overLeft > 0 && overRight <= 0 ) {
1311
+ newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
1312
+ position.left += overLeft - newOverRight;
1313
+ // element is initially over right side of within
1314
+ } else if ( overRight > 0 && overLeft <= 0 ) {
1315
+ position.left = withinOffset;
1316
+ // element is initially over both left and right sides of within
1317
+ } else {
1318
+ if ( overLeft > overRight ) {
1319
+ position.left = withinOffset + outerWidth - data.collisionWidth;
1320
+ } else {
1321
+ position.left = withinOffset;
1322
+ }
1323
+ }
1324
+ // too far left -> align with left edge
1325
+ } else if ( overLeft > 0 ) {
1326
+ position.left += overLeft;
1327
+ // too far right -> align with right edge
1328
+ } else if ( overRight > 0 ) {
1329
+ position.left -= overRight;
1330
+ // adjust based on position and margin
1331
+ } else {
1332
+ position.left = max( position.left - collisionPosLeft, position.left );
1333
+ }
1334
+ },
1335
+ top: function( position, data ) {
1336
+ var within = data.within,
1337
+ withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
1338
+ outerHeight = data.within.height,
1339
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
1340
+ overTop = withinOffset - collisionPosTop,
1341
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
1342
+ newOverBottom;
1343
+
1344
+ // element is taller than within
1345
+ if ( data.collisionHeight > outerHeight ) {
1346
+ // element is initially over the top of within
1347
+ if ( overTop > 0 && overBottom <= 0 ) {
1348
+ newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
1349
+ position.top += overTop - newOverBottom;
1350
+ // element is initially over bottom of within
1351
+ } else if ( overBottom > 0 && overTop <= 0 ) {
1352
+ position.top = withinOffset;
1353
+ // element is initially over both top and bottom of within
1354
+ } else {
1355
+ if ( overTop > overBottom ) {
1356
+ position.top = withinOffset + outerHeight - data.collisionHeight;
1357
+ } else {
1358
+ position.top = withinOffset;
1359
+ }
1360
+ }
1361
+ // too far up -> align with top
1362
+ } else if ( overTop > 0 ) {
1363
+ position.top += overTop;
1364
+ // too far down -> align with bottom edge
1365
+ } else if ( overBottom > 0 ) {
1366
+ position.top -= overBottom;
1367
+ // adjust based on position and margin
1368
+ } else {
1369
+ position.top = max( position.top - collisionPosTop, position.top );
1370
+ }
1371
+ }
1372
+ },
1373
+ flip: {
1374
+ left: function( position, data ) {
1375
+ var within = data.within,
1376
+ withinOffset = within.offset.left + within.scrollLeft,
1377
+ outerWidth = within.width,
1378
+ offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
1379
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
1380
+ overLeft = collisionPosLeft - offsetLeft,
1381
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
1382
+ myOffset = data.my[ 0 ] === "left" ?
1383
+ -data.elemWidth :
1384
+ data.my[ 0 ] === "right" ?
1385
+ data.elemWidth :
1386
+ 0,
1387
+ atOffset = data.at[ 0 ] === "left" ?
1388
+ data.targetWidth :
1389
+ data.at[ 0 ] === "right" ?
1390
+ -data.targetWidth :
1391
+ 0,
1392
+ offset = -2 * data.offset[ 0 ],
1393
+ newOverRight,
1394
+ newOverLeft;
1395
+
1396
+ if ( overLeft < 0 ) {
1397
+ newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
1398
+ if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
1399
+ position.left += myOffset + atOffset + offset;
1400
+ }
1401
+ }
1402
+ else if ( overRight > 0 ) {
1403
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
1404
+ if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
1405
+ position.left += myOffset + atOffset + offset;
1406
+ }
1407
+ }
1408
+ },
1409
+ top: function( position, data ) {
1410
+ var within = data.within,
1411
+ withinOffset = within.offset.top + within.scrollTop,
1412
+ outerHeight = within.height,
1413
+ offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
1414
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
1415
+ overTop = collisionPosTop - offsetTop,
1416
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
1417
+ top = data.my[ 1 ] === "top",
1418
+ myOffset = top ?
1419
+ -data.elemHeight :
1420
+ data.my[ 1 ] === "bottom" ?
1421
+ data.elemHeight :
1422
+ 0,
1423
+ atOffset = data.at[ 1 ] === "top" ?
1424
+ data.targetHeight :
1425
+ data.at[ 1 ] === "bottom" ?
1426
+ -data.targetHeight :
1427
+ 0,
1428
+ offset = -2 * data.offset[ 1 ],
1429
+ newOverTop,
1430
+ newOverBottom;
1431
+ if ( overTop < 0 ) {
1432
+ newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
1433
+ if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
1434
+ position.top += myOffset + atOffset + offset;
1435
+ }
1436
+ }
1437
+ else if ( overBottom > 0 ) {
1438
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
1439
+ if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
1440
+ position.top += myOffset + atOffset + offset;
1441
+ }
1442
+ }
1443
+ }
1444
+ },
1445
+ flipfit: {
1446
+ left: function() {
1447
+ $.ui.position.flip.left.apply( this, arguments );
1448
+ $.ui.position.fit.left.apply( this, arguments );
1449
+ },
1450
+ top: function() {
1451
+ $.ui.position.flip.top.apply( this, arguments );
1452
+ $.ui.position.fit.top.apply( this, arguments );
1453
+ }
1454
+ }
1455
+ };
1456
+
1457
+ // fraction support test
1458
+ (function () {
1459
+ var testElement, testElementParent, testElementStyle, offsetLeft, i,
1460
+ body = document.getElementsByTagName( "body" )[ 0 ],
1461
+ div = document.createElement( "div" );
1462
+
1463
+ //Create a "fake body" for testing based on method used in jQuery.support
1464
+ testElement = document.createElement( body ? "div" : "body" );
1465
+ testElementStyle = {
1466
+ visibility: "hidden",
1467
+ width: 0,
1468
+ height: 0,
1469
+ border: 0,
1470
+ margin: 0,
1471
+ background: "none"
1472
+ };
1473
+ if ( body ) {
1474
+ $.extend( testElementStyle, {
1475
+ position: "absolute",
1476
+ left: "-1000px",
1477
+ top: "-1000px"
1478
+ });
1479
+ }
1480
+ for ( i in testElementStyle ) {
1481
+ testElement.style[ i ] = testElementStyle[ i ];
1482
+ }
1483
+ testElement.appendChild( div );
1484
+ testElementParent = body || document.documentElement;
1485
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
1486
+
1487
+ div.style.cssText = "position: absolute; left: 10.7432222px;";
1488
+
1489
+ offsetLeft = $( div ).offset().left;
1490
+ $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
1491
+
1492
+ testElement.innerHTML = "";
1493
+ testElementParent.removeChild( testElement );
1494
+ })();
1495
+
1496
+ // DEPRECATED
1497
+ if ( $.uiBackCompat !== false ) {
1498
+ // offset option
1499
+ (function( $ ) {
1500
+ var _position = $.fn.position;
1501
+ $.fn.position = function( options ) {
1502
+ if ( !options || !options.offset ) {
1503
+ return _position.call( this, options );
1504
+ }
1505
+ var offset = options.offset.split( " " ),
1506
+ at = options.at.split( " " );
1507
+ if ( offset.length === 1 ) {
1508
+ offset[ 1 ] = offset[ 0 ];
1509
+ }
1510
+ if ( /^\d/.test( offset[ 0 ] ) ) {
1511
+ offset[ 0 ] = "+" + offset[ 0 ];
1512
+ }
1513
+ if ( /^\d/.test( offset[ 1 ] ) ) {
1514
+ offset[ 1 ] = "+" + offset[ 1 ];
1515
+ }
1516
+ if ( at.length === 1 ) {
1517
+ if ( /left|center|right/.test( at[ 0 ] ) ) {
1518
+ at[ 1 ] = "center";
1519
+ } else {
1520
+ at[ 1 ] = at[ 0 ];
1521
+ at[ 0 ] = "center";
1522
+ }
1523
+ }
1524
+ return _position.call( this, $.extend( options, {
1525
+ at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
1526
+ offset: undefined
1527
+ } ) );
1528
+ };
1529
+ }( sQuery ) );
1530
+ }
1531
+
1532
+ }( sQuery ) );
1533
+ (function( $, undefined ) {
1534
+
1535
+ $.widget("ui.draggable", $.ui.mouse, {
1536
+ version: "1.9.2",
1537
+ widgetEventPrefix: "drag",
1538
+ options: {
1539
+ addClasses: true,
1540
+ appendTo: "parent",
1541
+ axis: false,
1542
+ connectToSortable: false,
1543
+ containment: false,
1544
+ cursor: "auto",
1545
+ cursorAt: false,
1546
+ grid: false,
1547
+ handle: false,
1548
+ helper: "original",
1549
+ iframeFix: false,
1550
+ opacity: false,
1551
+ refreshPositions: false,
1552
+ revert: false,
1553
+ revertDuration: 500,
1554
+ scope: "default",
1555
+ scroll: true,
1556
+ scrollSensitivity: 20,
1557
+ scrollSpeed: 20,
1558
+ snap: false,
1559
+ snapMode: "both",
1560
+ snapTolerance: 20,
1561
+ stack: false,
1562
+ zIndex: false
1563
+ },
1564
+ _create: function() {
1565
+
1566
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
1567
+ this.element[0].style.position = 'relative';
1568
+
1569
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
1570
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
1571
+
1572
+ this._mouseInit();
1573
+
1574
+ },
1575
+
1576
+ _destroy: function() {
1577
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
1578
+ this._mouseDestroy();
1579
+ },
1580
+
1581
+ _mouseCapture: function(event) {
1582
+
1583
+ var o = this.options;
1584
+
1585
+ // among others, prevent a drag on a resizable-handle
1586
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
1587
+ return false;
1588
+
1589
+ //Quit if we're not on a valid handle
1590
+ this.handle = this._getHandle(event);
1591
+ if (!this.handle)
1592
+ return false;
1593
+
1594
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
1595
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
1596
+ .css({
1597
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1598
+ position: "absolute", opacity: "0.001", zIndex: 1000
1599
+ })
1600
+ .css($(this).offset())
1601
+ .appendTo("body");
1602
+ });
1603
+
1604
+ return true;
1605
+
1606
+ },
1607
+
1608
+ _mouseStart: function(event) {
1609
+
1610
+ var o = this.options;
1611
+
1612
+ //Create and append the visible helper
1613
+ this.helper = this._createHelper(event);
1614
+
1615
+ this.helper.addClass("ui-draggable-dragging");
1616
+
1617
+ //Cache the helper size
1618
+ this._cacheHelperProportions();
1619
+
1620
+ //If ddmanager is used for droppables, set the global draggable
1621
+ if($.ui.ddmanager)
1622
+ $.ui.ddmanager.current = this;
1623
+
1624
+ /*
1625
+ * - Position generation -
1626
+ * This block generates everything position related - it's the core of draggables.
1627
+ */
1628
+
1629
+ //Cache the margins of the original element
1630
+ this._cacheMargins();
1631
+
1632
+ //Store the helper's css position
1633
+ this.cssPosition = this.helper.css("position");
1634
+ this.scrollParent = this.helper.scrollParent();
1635
+
1636
+ //The element's absolute position on the page minus margins
1637
+ this.offset = this.positionAbs = this.element.offset();
1638
+ this.offset = {
1639
+ top: this.offset.top - this.margins.top,
1640
+ left: this.offset.left - this.margins.left
1641
+ };
1642
+
1643
+ $.extend(this.offset, {
1644
+ click: { //Where the click happened, relative to the element
1645
+ left: event.pageX - this.offset.left,
1646
+ top: event.pageY - this.offset.top
1647
+ },
1648
+ parent: this._getParentOffset(),
1649
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
1650
+ });
1651
+
1652
+ //Generate the original position
1653
+ this.originalPosition = this.position = this._generatePosition(event);
1654
+ this.originalPageX = event.pageX;
1655
+ this.originalPageY = event.pageY;
1656
+
1657
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
1658
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
1659
+
1660
+ //Set a containment if given in the options
1661
+ if(o.containment)
1662
+ this._setContainment();
1663
+
1664
+ //Trigger event + callbacks
1665
+ if(this._trigger("start", event) === false) {
1666
+ this._clear();
1667
+ return false;
1668
+ }
1669
+
1670
+ //Recache the helper size
1671
+ this._cacheHelperProportions();
1672
+
1673
+ //Prepare the droppable offsets
1674
+ if ($.ui.ddmanager && !o.dropBehaviour)
1675
+ $.ui.ddmanager.prepareOffsets(this, event);
1676
+
1677
+
1678
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
1679
+
1680
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
1681
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
1682
+
1683
+ return true;
1684
+ },
1685
+
1686
+ _mouseDrag: function(event, noPropagation) {
1687
+
1688
+ //Compute the helpers position
1689
+ this.position = this._generatePosition(event);
1690
+ this.positionAbs = this._convertPositionTo("absolute");
1691
+
1692
+ //Call plugins and callbacks and use the resulting position if something is returned
1693
+ if (!noPropagation) {
1694
+ var ui = this._uiHash();
1695
+ if(this._trigger('drag', event, ui) === false) {
1696
+ this._mouseUp({});
1697
+ return false;
1698
+ }
1699
+ this.position = ui.position;
1700
+ }
1701
+
1702
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
1703
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
1704
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
1705
+
1706
+ return false;
1707
+ },
1708
+
1709
+ _mouseStop: function(event) {
1710
+
1711
+ //If we are using droppables, inform the manager about the drop
1712
+ var dropped = false;
1713
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
1714
+ dropped = $.ui.ddmanager.drop(this, event);
1715
+
1716
+ //if a drop comes from outside (a sortable)
1717
+ if(this.dropped) {
1718
+ dropped = this.dropped;
1719
+ this.dropped = false;
1720
+ }
1721
+
1722
+ //if the original element is no longer in the DOM don't bother to continue (see #8269)
1723
+ var element = this.element[0], elementInDom = false;
1724
+ while ( element && (element = element.parentNode) ) {
1725
+ if (element == document ) {
1726
+ elementInDom = true;
1727
+ }
1728
+ }
1729
+ if ( !elementInDom && this.options.helper === "original" )
1730
+ return false;
1731
+
1732
+ 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))) {
1733
+ var that = this;
1734
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
1735
+ if(that._trigger("stop", event) !== false) {
1736
+ that._clear();
1737
+ }
1738
+ });
1739
+ } else {
1740
+ if(this._trigger("stop", event) !== false) {
1741
+ this._clear();
1742
+ }
1743
+ }
1744
+
1745
+ return false;
1746
+ },
1747
+
1748
+ _mouseUp: function(event) {
1749
+ //Remove frame helpers
1750
+ $("div.ui-draggable-iframeFix").each(function() {
1751
+ this.parentNode.removeChild(this);
1752
+ });
1753
+
1754
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
1755
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
1756
+
1757
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
1758
+ },
1759
+
1760
+ cancel: function() {
1761
+
1762
+ if(this.helper.is(".ui-draggable-dragging")) {
1763
+ this._mouseUp({});
1764
+ } else {
1765
+ this._clear();
1766
+ }
1767
+
1768
+ return this;
1769
+
1770
+ },
1771
+
1772
+ _getHandle: function(event) {
1773
+
1774
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
1775
+ $(this.options.handle, this.element)
1776
+ .find("*")
1777
+ .andSelf()
1778
+ .each(function() {
1779
+ if(this == event.target) handle = true;
1780
+ });
1781
+
1782
+ return handle;
1783
+
1784
+ },
1785
+
1786
+ _createHelper: function(event) {
1787
+
1788
+ var o = this.options;
1789
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
1790
+
1791
+ if(!helper.parents('body').length)
1792
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
1793
+
1794
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
1795
+ helper.css("position", "absolute");
1796
+
1797
+ return helper;
1798
+
1799
+ },
1800
+
1801
+ _adjustOffsetFromHelper: function(obj) {
1802
+ if (typeof obj == 'string') {
1803
+ obj = obj.split(' ');
1804
+ }
1805
+ if ($.isArray(obj)) {
1806
+ obj = {left: +obj[0], top: +obj[1] || 0};
1807
+ }
1808
+ if ('left' in obj) {
1809
+ this.offset.click.left = obj.left + this.margins.left;
1810
+ }
1811
+ if ('right' in obj) {
1812
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
1813
+ }
1814
+ if ('top' in obj) {
1815
+ this.offset.click.top = obj.top + this.margins.top;
1816
+ }
1817
+ if ('bottom' in obj) {
1818
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
1819
+ }
1820
+ },
1821
+
1822
+ _getParentOffset: function() {
1823
+
1824
+ //Get the offsetParent and cache its position
1825
+ this.offsetParent = this.helper.offsetParent();
1826
+ var po = this.offsetParent.offset();
1827
+
1828
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
1829
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
1830
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
1831
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
1832
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
1833
+ po.left += this.scrollParent.scrollLeft();
1834
+ po.top += this.scrollParent.scrollTop();
1835
+ }
1836
+
1837
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
1838
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
1839
+ po = { top: 0, left: 0 };
1840
+
1841
+ return {
1842
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
1843
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
1844
+ };
1845
+
1846
+ },
1847
+
1848
+ _getRelativeOffset: function() {
1849
+
1850
+ if(this.cssPosition == "relative") {
1851
+ var p = this.element.position();
1852
+ return {
1853
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
1854
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
1855
+ };
1856
+ } else {
1857
+ return { top: 0, left: 0 };
1858
+ }
1859
+
1860
+ },
1861
+
1862
+ _cacheMargins: function() {
1863
+ this.margins = {
1864
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
1865
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
1866
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
1867
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
1868
+ };
1869
+ },
1870
+
1871
+ _cacheHelperProportions: function() {
1872
+ this.helperProportions = {
1873
+ width: this.helper.outerWidth(),
1874
+ height: this.helper.outerHeight()
1875
+ };
1876
+ },
1877
+
1878
+ _setContainment: function() {
1879
+
1880
+ var o = this.options;
1881
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
1882
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
1883
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
1884
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
1885
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
1886
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
1887
+ ];
1888
+
1889
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
1890
+ var c = $(o.containment);
1891
+ var ce = c[0]; if(!ce) return;
1892
+ var co = c.offset();
1893
+ var over = ($(ce).css("overflow") != 'hidden');
1894
+
1895
+ this.containment = [
1896
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
1897
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
1898
+ (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,
1899
+ (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
1900
+ ];
1901
+ this.relative_container = c;
1902
+
1903
+ } else if(o.containment.constructor == Array) {
1904
+ this.containment = o.containment;
1905
+ }
1906
+
1907
+ },
1908
+
1909
+ _convertPositionTo: function(d, pos) {
1910
+
1911
+ if(!pos) pos = this.position;
1912
+ var mod = d == "absolute" ? 1 : -1;
1913
+ var o = this.options, 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);
1914
+
1915
+ return {
1916
+ top: (
1917
+ pos.top // The absolute mouse position
1918
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
1919
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
1920
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
1921
+ ),
1922
+ left: (
1923
+ pos.left // The absolute mouse position
1924
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
1925
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
1926
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
1927
+ )
1928
+ };
1929
+
1930
+ },
1931
+
1932
+ _generatePosition: function(event) {
1933
+
1934
+ var o = this.options, 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);
1935
+ var pageX = event.pageX;
1936
+ var pageY = event.pageY;
1937
+
1938
+ /*
1939
+ * - Position constraining -
1940
+ * Constrain the position to a mix of grid, containment.
1941
+ */
1942
+
1943
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
1944
+ var containment;
1945
+ if(this.containment) {
1946
+ if (this.relative_container){
1947
+ var co = this.relative_container.offset();
1948
+ containment = [ this.containment[0] + co.left,
1949
+ this.containment[1] + co.top,
1950
+ this.containment[2] + co.left,
1951
+ this.containment[3] + co.top ];
1952
+ }
1953
+ else {
1954
+ containment = this.containment;
1955
+ }
1956
+
1957
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
1958
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
1959
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
1960
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
1961
+ }
1962
+
1963
+ if(o.grid) {
1964
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
1965
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
1966
+ 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;
1967
+
1968
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
1969
+ 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;
1970
+ }
1971
+
1972
+ }
1973
+
1974
+ return {
1975
+ top: (
1976
+ pageY // The absolute mouse position
1977
+ - this.offset.click.top // Click offset (relative to the element)
1978
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
1979
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
1980
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
1981
+ ),
1982
+ left: (
1983
+ pageX // The absolute mouse position
1984
+ - this.offset.click.left // Click offset (relative to the element)
1985
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
1986
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
1987
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
1988
+ )
1989
+ };
1990
+
1991
+ },
1992
+
1993
+ _clear: function() {
1994
+ this.helper.removeClass("ui-draggable-dragging");
1995
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
1996
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
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
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
2007
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
2008
+ },
2009
+
2010
+ plugins: {},
2011
+
2012
+ _uiHash: function(event) {
2013
+ return {
2014
+ helper: this.helper,
2015
+ position: this.position,
2016
+ originalPosition: this.originalPosition,
2017
+ offset: this.positionAbs
2018
+ };
2019
+ }
2020
+
2021
+ });
2022
+
2023
+ $.ui.plugin.add("draggable", "connectToSortable", {
2024
+ start: function(event, ui) {
2025
+
2026
+ var inst = $(this).data("draggable"), o = inst.options,
2027
+ uiSortable = $.extend({}, ui, { item: inst.element });
2028
+ inst.sortables = [];
2029
+ $(o.connectToSortable).each(function() {
2030
+ var sortable = $.data(this, 'sortable');
2031
+ if (sortable && !sortable.options.disabled) {
2032
+ inst.sortables.push({
2033
+ instance: sortable,
2034
+ shouldRevert: sortable.options.revert
2035
+ });
2036
+ 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).
2037
+ sortable._trigger("activate", event, uiSortable);
2038
+ }
2039
+ });
2040
+
2041
+ },
2042
+ stop: function(event, ui) {
2043
+
2044
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
2045
+ var inst = $(this).data("draggable"),
2046
+ uiSortable = $.extend({}, ui, { item: inst.element });
2047
+
2048
+ $.each(inst.sortables, function() {
2049
+ if(this.instance.isOver) {
2050
+
2051
+ this.instance.isOver = 0;
2052
+
2053
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
2054
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
2055
+
2056
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
2057
+ if(this.shouldRevert) this.instance.options.revert = true;
2058
+
2059
+ //Trigger the stop of the sortable
2060
+ this.instance._mouseStop(event);
2061
+
2062
+ this.instance.options.helper = this.instance.options._helper;
2063
+
2064
+ //If the helper has been the original item, restore properties in the sortable
2065
+ if(inst.options.helper == 'original')
2066
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
2067
+
2068
+ } else {
2069
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
2070
+ this.instance._trigger("deactivate", event, uiSortable);
2071
+ }
2072
+
2073
+ });
2074
+
2075
+ },
2076
+ drag: function(event, ui) {
2077
+
2078
+ var inst = $(this).data("draggable"), that = this;
2079
+
2080
+ var checkPos = function(o) {
2081
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
2082
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
2083
+ var itemHeight = o.height, itemWidth = o.width;
2084
+ var itemTop = o.top, itemLeft = o.left;
2085
+
2086
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
2087
+ };
2088
+
2089
+ $.each(inst.sortables, function(i) {
2090
+
2091
+ var innermostIntersecting = false;
2092
+ var thisSortable = this;
2093
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
2094
+ this.instance.positionAbs = inst.positionAbs;
2095
+ this.instance.helperProportions = inst.helperProportions;
2096
+ this.instance.offset.click = inst.offset.click;
2097
+
2098
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
2099
+ innermostIntersecting = true;
2100
+ $.each(inst.sortables, function () {
2101
+ this.instance.positionAbs = inst.positionAbs;
2102
+ this.instance.helperProportions = inst.helperProportions;
2103
+ this.instance.offset.click = inst.offset.click;
2104
+ if (this != thisSortable
2105
+ && this.instance._intersectsWith(this.instance.containerCache)
2106
+ && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
2107
+ innermostIntersecting = false;
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("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) this.instance._mouseDrag(event);
2145
+
2146
+ } else {
2147
+
2148
+ //If it doesn't intersect with the sortable, and it intersected before,
2149
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
2150
+ if(this.instance.isOver) {
2151
+
2152
+ this.instance.isOver = 0;
2153
+ this.instance.cancelHelperRemoval = true;
2154
+
2155
+ //Prevent reverting on this forced stop
2156
+ this.instance.options.revert = false;
2157
+
2158
+ // The out event needs to be triggered independently
2159
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
2160
+
2161
+ this.instance._mouseStop(event, true);
2162
+ this.instance.options.helper = this.instance.options._helper;
2163
+
2164
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
2165
+ this.instance.currentItem.remove();
2166
+ if(this.instance.placeholder) this.instance.placeholder.remove();
2167
+
2168
+ inst._trigger("fromSortable", event);
2169
+ inst.dropped = false; //draggable revert needs that
2170
+ }
2171
+
2172
+ };
2173
+
2174
+ });
2175
+
2176
+ }
2177
+ });
2178
+
2179
+ $.ui.plugin.add("draggable", "cursor", {
2180
+ start: function(event, ui) {
2181
+ var t = $('body'), o = $(this).data('draggable').options;
2182
+ if (t.css("cursor")) o._cursor = t.css("cursor");
2183
+ t.css("cursor", o.cursor);
2184
+ },
2185
+ stop: function(event, ui) {
2186
+ var o = $(this).data('draggable').options;
2187
+ if (o._cursor) $('body').css("cursor", o._cursor);
2188
+ }
2189
+ });
2190
+
2191
+ $.ui.plugin.add("draggable", "opacity", {
2192
+ start: function(event, ui) {
2193
+ var t = $(ui.helper), o = $(this).data('draggable').options;
2194
+ if(t.css("opacity")) o._opacity = t.css("opacity");
2195
+ t.css('opacity', o.opacity);
2196
+ },
2197
+ stop: function(event, ui) {
2198
+ var o = $(this).data('draggable').options;
2199
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
2200
+ }
2201
+ });
2202
+
2203
+ $.ui.plugin.add("draggable", "scroll", {
2204
+ start: function(event, ui) {
2205
+ var i = $(this).data("draggable");
2206
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
2207
+ },
2208
+ drag: function(event, ui) {
2209
+
2210
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
2211
+
2212
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
2213
+
2214
+ if(!o.axis || o.axis != 'x') {
2215
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
2216
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
2217
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
2218
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
2219
+ }
2220
+
2221
+ if(!o.axis || o.axis != 'y') {
2222
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
2223
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
2224
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
2225
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
2226
+ }
2227
+
2228
+ } else {
2229
+
2230
+ if(!o.axis || o.axis != 'x') {
2231
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
2232
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
2233
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
2234
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
2235
+ }
2236
+
2237
+ if(!o.axis || o.axis != 'y') {
2238
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
2239
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
2240
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
2241
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
2242
+ }
2243
+
2244
+ }
2245
+
2246
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
2247
+ $.ui.ddmanager.prepareOffsets(i, event);
2248
+
2249
+ }
2250
+ });
2251
+
2252
+ $.ui.plugin.add("draggable", "snap", {
2253
+ start: function(event, ui) {
2254
+
2255
+ var i = $(this).data("draggable"), o = i.options;
2256
+ i.snapElements = [];
2257
+
2258
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
2259
+ var $t = $(this); var $o = $t.offset();
2260
+ if(this != i.element[0]) i.snapElements.push({
2261
+ item: this,
2262
+ width: $t.outerWidth(), height: $t.outerHeight(),
2263
+ top: $o.top, left: $o.left
2264
+ });
2265
+ });
2266
+
2267
+ },
2268
+ drag: function(event, ui) {
2269
+
2270
+ var inst = $(this).data("draggable"), o = inst.options;
2271
+ var d = o.snapTolerance;
2272
+
2273
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
2274
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
2275
+
2276
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
2277
+
2278
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
2279
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
2280
+
2281
+ //Yes, I know, this is insane ;)
2282
+ 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))) {
2283
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
2284
+ inst.snapElements[i].snapping = false;
2285
+ continue;
2286
+ }
2287
+
2288
+ if(o.snapMode != 'inner') {
2289
+ var ts = Math.abs(t - y2) <= d;
2290
+ var bs = Math.abs(b - y1) <= d;
2291
+ var ls = Math.abs(l - x2) <= d;
2292
+ var rs = Math.abs(r - x1) <= d;
2293
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
2294
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
2295
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
2296
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
2297
+ }
2298
+
2299
+ var first = (ts || bs || ls || rs);
2300
+
2301
+ if(o.snapMode != 'outer') {
2302
+ var ts = Math.abs(t - y1) <= d;
2303
+ var bs = Math.abs(b - y2) <= d;
2304
+ var ls = Math.abs(l - x1) <= d;
2305
+ var rs = Math.abs(r - x2) <= d;
2306
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
2307
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
2308
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
2309
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
2310
+ }
2311
+
2312
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
2313
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
2314
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
2315
+
2316
+ };
2317
+
2318
+ }
2319
+ });
2320
+
2321
+ $.ui.plugin.add("draggable", "stack", {
2322
+ start: function(event, ui) {
2323
+
2324
+ var o = $(this).data("draggable").options;
2325
+
2326
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
2327
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
2328
+ });
2329
+ if (!group.length) { return; }
2330
+
2331
+ var min = parseInt(group[0].style.zIndex) || 0;
2332
+ $(group).each(function(i) {
2333
+ this.style.zIndex = min + i;
2334
+ });
2335
+
2336
+ this[0].style.zIndex = min + group.length;
2337
+
2338
+ }
2339
+ });
2340
+
2341
+ $.ui.plugin.add("draggable", "zIndex", {
2342
+ start: function(event, ui) {
2343
+ var t = $(ui.helper), o = $(this).data("draggable").options;
2344
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
2345
+ t.css('zIndex', o.zIndex);
2346
+ },
2347
+ stop: function(event, ui) {
2348
+ var o = $(this).data("draggable").options;
2349
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
2350
+ }
2351
+ });
2352
+
2353
+ })(sQuery);
assets/js/main.js CHANGED
@@ -1,3 +1,4 @@
 
1
  window.Shareaholic = window.Shareaholic || {};
2
  window.shareaholic_debug = true;
3
 
@@ -7,6 +8,7 @@ Shareaholic.bind_button_clicks = function(click_object, off) {
7
  }
8
 
9
  $(click_object.selector).off('click.app_settings').on('click.app_settings', function(e) {
 
10
  e.preventDefault();
11
  url = click_object.url(this);
12
  $frame = $('<iframe>', { src: url }).appendTo('#iframe_container');
@@ -153,8 +155,10 @@ $(document).ready(function() {
153
 
154
  Shareaholic.disable_buttons();
155
 
156
- for (button in Shareaholic.click_objects) {
157
- Shareaholic.bind_button_clicks(Shareaholic.click_objects[button]);
 
 
158
  }
159
 
160
  $('#terms_of_service_modal').reveal({
@@ -183,3 +187,4 @@ $(document).ready(function() {
183
  }
184
  });
185
  });
 
1
+ (function($) {
2
  window.Shareaholic = window.Shareaholic || {};
3
  window.shareaholic_debug = true;
4
 
8
  }
9
 
10
  $(click_object.selector).off('click.app_settings').on('click.app_settings', function(e) {
11
+ button = this;
12
  e.preventDefault();
13
  url = click_object.url(this);
14
  $frame = $('<iframe>', { src: url }).appendTo('#iframe_container');
155
 
156
  Shareaholic.disable_buttons();
157
 
158
+ Shareaholic.bind_button_clicks(Shareaholic.click_objects['app_settings']);
159
+ Shareaholic.bind_button_clicks(Shareaholic.click_objects['general_settings']);
160
+ if (Shareaholic.click_objects['unverified_general_settings']) {
161
+ Shareaholic.bind_button_clicks(Shareaholic.click_objects['unverified_general_settings'], true);
162
  }
163
 
164
  $('#terms_of_service_modal').reveal({
187
  }
188
  });
189
  });
190
+ })(sQuery);
deprecation.php CHANGED
@@ -75,4 +75,4 @@ class ShareaholicDeprecation {
75
  }
76
 
77
 
78
- ?>
75
  }
76
 
77
 
78
+ ?>
global_functions.php CHANGED
@@ -48,4 +48,4 @@ function get_shr_like_buttonset($position) {
48
  echo ShareaholicPublic::canvas($id, 'share_buttons');
49
  }
50
 
51
- ?>
48
  echo ShareaholicPublic::canvas($id, 'share_buttons');
49
  }
50
 
51
+ ?>
notifier.php CHANGED
@@ -95,14 +95,15 @@ class ShareaholicNotifier {
95
  /**
96
  * Actually sends the request to the notification API
97
  *
98
- * @param array $notification an associative array of data
99
- * to send to the API
 
100
  */
101
  private static function send_notification($notification) {
102
  $url = self::URL . '/notify';
103
  $response = ShareaholicCurl::post($url, $notification, 'json');
104
 
105
- if ($response && $response['body']['result'] == 'success') {
106
  return true;
107
  } else {
108
  return false;
95
  /**
96
  * Actually sends the request to the notification API
97
  *
98
+ * @param array $notification an associative array of data
99
+ * to send to the API
100
+ * @return bool
101
  */
102
  private static function send_notification($notification) {
103
  $url = self::URL . '/notify';
104
  $response = ShareaholicCurl::post($url, $notification, 'json');
105
 
106
+ if ($response && preg_match('/20*/', $response['response']['code'])) {
107
  return true;
108
  } else {
109
  return false;
public.php CHANGED
@@ -32,7 +32,8 @@ class ShareaholicPublic {
32
  * Inserts the script code snippet into the head of the page
33
  */
34
  public static function script_tag() {
35
- if (ShareaholicUtilities::get_option('api_key')){
 
36
  ShareaholicUtilities::load_template('script_tag', array(
37
  'shareaholic_url' => Shareaholic::URL,
38
  'api_key' => ShareaholicUtilities::get_option('api_key')
@@ -217,4 +218,4 @@ class ShareaholicPublic {
217
  }
218
  }
219
 
220
- ?>
32
  * Inserts the script code snippet into the head of the page
33
  */
34
  public static function script_tag() {
35
+ if (ShareaholicUtilities::has_accepted_terms_of_service() &&
36
+ ShareaholicUtilities::get_or_create_api_key()) {
37
  ShareaholicUtilities::load_template('script_tag', array(
38
  'shareaholic_url' => Shareaholic::URL,
39
  'api_key' => ShareaholicUtilities::get_option('api_key')
218
  }
219
  }
220
 
221
+ ?>
query_string_builder.php CHANGED
@@ -143,4 +143,4 @@ class ShareaholicQueryStringBuilder {
143
  }
144
  }
145
 
146
- ?>
143
  }
144
  }
145
 
146
+ ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: shareaholic
3
  Tags: sexybookmarks, shareaholic, shareholic, facebook, twitter, linkedin, URL Shortener, bitly, tinyurl, Goo.gl, Google+1, Google Analytics, Google Plus, Google, Instapaper, Wish List, Digg, Gmail, Google Bookmarks, Translate, Tumblr, AIM, Yahoo Messenger, Delicious, StumbleUpon, mister wong, evernote, add this, addtoany, share this, sharethis, share and follow, share and enjoy, sharing is sexy, sharing is caring, yahoo, reddit, hackernews, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, pinterest, google translate, bookmarks, social, email button, social share, socialize, sociable, sharebar, bookmark button, share button, social bookmarking, bookmarks menu, bookmarking, share, seo, analytics, stats, sharing, facebook like, facebook recommend, WPMU, mutisite, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
4
  Requires at least: 2.7
5
  Tested up to: 3.5.2
6
- Stable tag: 7.0.1.0
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
@@ -141,6 +141,13 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
 
 
144
  = 7.0.1.0 =
145
  * Several bug fixes, in addition to -
146
  * Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
@@ -877,6 +884,9 @@ Please see here: [Usage & Installation Instructions](https://shareaholic.com/too
877
 
878
  == Upgrade Notice ==
879
 
 
 
 
880
  = 7.0.1.0 =
881
  * Huge update! Completely re-written from the ground up to be faster and with a new simple interface! Includes brand new Share button themes (including vertical share buttons!) and Related posts themes. Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given. You can now even customize your "You may also like" text and exclude URLs.
882
 
3
  Tags: sexybookmarks, shareaholic, shareholic, facebook, twitter, linkedin, URL Shortener, bitly, tinyurl, Goo.gl, Google+1, Google Analytics, Google Plus, Google, Instapaper, Wish List, Digg, Gmail, Google Bookmarks, Translate, Tumblr, AIM, Yahoo Messenger, Delicious, StumbleUpon, mister wong, evernote, add this, addtoany, share this, sharethis, share and follow, share and enjoy, sharing is sexy, sharing is caring, yahoo, reddit, hackernews, tweet button, twitter button, fark, buffer, myspace, orkut, netlog, hubspot, weheartit, printfriendly, yammer, pinterest, google translate, bookmarks, social, email button, social share, socialize, sociable, sharebar, bookmark button, share button, social bookmarking, bookmarks menu, bookmarking, share, seo, analytics, stats, sharing, facebook like, facebook recommend, WPMU, mutisite, shortcode, yaarp, yarpp, nrelate, outbrain, linkwithin, related content, related posts, related, popular posts, popular, thumbnails, recommendations
4
  Requires at least: 2.7
5
  Tested up to: 3.5.2
6
+ Stable tag: 7.0.2.0
7
 
8
  Adds an attractive social bookmarking menu and related content widget to your posts, pages, index, or any combination of the three.
9
 
141
 
142
  == Changelog ==
143
 
144
+ = 7.0.2.0 =
145
+ * This is a big update based on a lot of user feedback!
146
+ * For Facebook, sharers are now taken directly to Facebook
147
+ * Fixed how Twitter and Facebook sharing work on mobile devices
148
+ * Now access Share Button and Related Content settings without a (free) account, although it is highly encouraged
149
+ * Bugfix: Unresponsive "Edit Button" and "General Website Settings" button
150
+
151
  = 7.0.1.0 =
152
  * Several bug fixes, in addition to -
153
  * Huge update! The plugin has been completely re-written from the ground up to be faster, simpler to use
884
 
885
  == Upgrade Notice ==
886
 
887
+ = 7.0.2.0 =
888
+ As always, we're listening and reacting to all your feedback. This release represents a slew of updates based on a lot of user feedback. For Facebook sharing, sharers are now taken directly to Facebook, now access Share Button and Related Content settings without an (free) account, and much much more.
889
+
890
  = 7.0.1.0 =
891
  * Huge update! Completely re-written from the ground up to be faster and with a new simple interface! Includes brand new Share button themes (including vertical share buttons!) and Related posts themes. Related Posts now come mobile optimized and responsive out of the box - Shareaholic automagically determines how many Related Posts to show given how much screen width it is given. You can now even customize your "You may also like" text and exclude URLs.
892
 
shareaholic.php CHANGED
@@ -3,14 +3,14 @@
3
  * The main and first file!
4
  *
5
  * @package shareaholic
6
- * @version 7.0.1.0
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
- Version: 7.0.1.0
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Credits & Thanks: https://shareaholic.com/tools/wordpress/credits
@@ -43,7 +43,7 @@ require_once(SHAREAHOLIC_DIR . '/deprecation.php');
43
  */
44
  class Shareaholic {
45
  const URL = 'https://shareaholic.com';
46
- const VERSION = '7.0.1.0';
47
  /**
48
  * Starts off as false so that ::get_instance() returns
49
  * a new instance.
3
  * The main and first file!
4
  *
5
  * @package shareaholic
6
+ * @version 7.0.2.0
7
  */
8
 
9
  /*
10
  Plugin Name: Shareaholic | share buttons, analytics, related content
11
  Plugin URI: https://shareaholic.com/publishers/
12
  Description: Whether you want to get people sharing, grow your fans, make money, or know who's reading your content, Shareaholic will help you get it done. See <a href="admin.php?page=shareaholic-settings">configuration panel</a> for more settings.
13
+ Version: 7.0.2.0
14
  Author: Shareaholic
15
  Author URI: https://shareaholic.com
16
  Credits & Thanks: https://shareaholic.com/tools/wordpress/credits
43
  */
44
  class Shareaholic {
45
  const URL = 'https://shareaholic.com';
46
+ const VERSION = '7.0.2.0';
47
  /**
48
  * Starts off as false so that ::get_instance() returns
49
  * a new instance.
six_to_seven.php CHANGED
@@ -116,7 +116,8 @@ class ShareaholicSixToSeven {
116
 
117
  $result[$share_buttons_configuration['position']] = array(
118
  'services' => self::services($share_buttons_configuration['bookmark']),
119
- 'theme' => 'diglett'
 
120
  );
121
 
122
  if (!isset($result['above']) && $share_buttons_configuration['likeButtonSetTop'] == '1') {
@@ -220,12 +221,14 @@ class ShareaholicSixToSeven {
220
 
221
  switch ($shortener) {
222
  case 'goog':
 
223
  return array('shortener' => 'googl');
224
  break;
225
  case 'tiny':
226
  return array('shortener' => 'tinyurl');
227
  break;
228
  case 'shrlc':
 
229
  case 'yourls':
230
  case 'tflp':
231
  case 'slly':
@@ -399,4 +402,4 @@ class ShareaholicSixToSeven {
399
  }
400
  }
401
 
402
- ?>
116
 
117
  $result[$share_buttons_configuration['position']] = array(
118
  'services' => self::services($share_buttons_configuration['bookmark']),
119
+ 'theme' => 'diglett',
120
+ 'counter' => 'badge-counter'
121
  );
122
 
123
  if (!isset($result['above']) && $share_buttons_configuration['likeButtonSetTop'] == '1') {
221
 
222
  switch ($shortener) {
223
  case 'goog':
224
+ case 'google':
225
  return array('shortener' => 'googl');
226
  break;
227
  case 'tiny':
228
  return array('shortener' => 'tinyurl');
229
  break;
230
  case 'shrlc':
231
+ case 'shr.lc':
232
  case 'yourls':
233
  case 'tflp':
234
  case 'slly':
402
  }
403
  }
404
 
405
+ ?>
templates/advanced_settings.php CHANGED
@@ -36,5 +36,5 @@
36
  </form>
37
  </div>
38
  </div>
39
- <?php ShareaholicAdmin::include_snapengage(); ?>
40
  <?php ShareaholicAdmin::show_footer(); ?>
 
36
  </form>
37
  </div>
38
  </div>
 
39
  <?php ShareaholicAdmin::show_footer(); ?>
40
+ <?php ShareaholicAdmin::include_snapengage(); ?>
templates/deprecation_warnings.php CHANGED
@@ -1,9 +1,9 @@
1
  <div class='error'>
2
- <p><strong>Shareaholic now supports Shortcodes! Yay!</strong> Please upgrade your theme to use the Shareaholic shortcode by following <a href="http://wordpress.org/plugins/shareaholic/installation/" target="_new">these instructions</a>.</p>
3
  <dl>
4
  <?php foreach($deprecation_warnings as $function => $places) { ?>
5
  <dt>
6
- <code><?php echo $function ?>()</code> <?php echo sprintf(__('is being deprecated. Please update the code found in the following files:', 'shareaholic')); ?></dt>
7
  <?php foreach($places as $file => $numbers) { ?>
8
  <dd>
9
  <?php echo $file ?> at line(s) <?php echo implode(', ', $numbers) ?><br /><br />
1
  <div class='error'>
2
+ <p><strong>Shareaholic now supports Shortcodes! Yay!</strong> Please upgrade your theme to use the Shareaholic shortcode by <strong><a href="http://wordpress.org/plugins/shareaholic/installation/" target="_new">following these installation instructions</a></strong>.</p>
3
  <dl>
4
  <?php foreach($deprecation_warnings as $function => $places) { ?>
5
  <dt>
6
+ <code><?php echo $function ?>()</code> <?php echo sprintf(__('will be deprecated SOON. Please update the code found in the following files at your convenience:', 'shareaholic')); ?></dt>
7
  <?php foreach($places as $file => $numbers) { ?>
8
  <dd>
9
  <?php echo $file ?> at line(s) <?php echo implode(', ', $numbers) ?><br /><br />
templates/script_snapengage.php CHANGED
@@ -3,15 +3,7 @@
3
  (function() {
4
  var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
5
  se.src = '//commondatastorage.googleapis.com/code.snapengage.com/js/62fa2e8b-38a9-4304-ba5c-86503444d30c.js';
6
- var done = false;
7
- se.onload = se.onreadystatechange = function() {
8
- if (!done&&(!this.readyState||this.readyState==='loaded'||this.readyState==='complete')) {
9
- done = true;
10
- // Place your SnapEngage JS API code below
11
- //SnapEngage.openProactiveChat(true, true); // Example: open the proactive chat on load
12
- }
13
- };
14
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
15
  })();
16
  </script>
17
- <!-- end SnapEngage code -->
3
  (function() {
4
  var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
5
  se.src = '//commondatastorage.googleapis.com/code.snapengage.com/js/62fa2e8b-38a9-4304-ba5c-86503444d30c.js';
 
 
 
 
 
 
 
 
6
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
7
  })();
8
  </script>
9
+ <!-- end SnapEngage code -->
templates/settings.php CHANGED
@@ -16,7 +16,11 @@ window.verification_key = '<?php echo $settings['verification_key'] ?>'
16
  <input type="hidden" name="already_submitted" value="Y">
17
 
18
  <div id='app_settings'>
19
- <fieldset><legend><h2><img src="<?php echo SHAREAHOLIC_ASSET_DIR; ?>/img/sharebuttons@2x.png" height=32 width=32 /> <?php echo sprintf(__('Share Buttons', 'shareaholic')); ?></h2></legend>
 
 
 
 
20
  <span class="helper"><i class="icon-question-sign"></i><?php echo sprintf(__('Pick where you want your buttons to be displayed. Click "Edit" to customize look & feel, themes, share counters, alignment, etc.', 'shareaholic')); ?></span>
21
 
22
  <?php foreach(array('post', 'page', 'index', 'category') as $page_type) { ?>
@@ -43,7 +47,7 @@ window.verification_key = '<?php echo $settings['verification_key'] ?>'
43
 
44
  <div class='clear'></div>
45
 
46
- <fieldset><legend><h2><img src="<?php echo SHAREAHOLIC_ASSET_DIR; ?>/img/related_content@2x.png" height=32 width=32 /> <?php echo sprintf(__('Related Content / Recommendations', 'shareaholic')); ?></h2></legend>
47
  <span class="helper"><i class="icon-question-sign"></i><?php echo sprintf(__('Pick where you want Related Content to be displayed. Click "Edit" to customize look & feel, themes, block lists, etc.', 'shareaholic')); ?></span>
48
  <?php foreach(array('post', 'page', 'index', 'category') as $page_type) { ?>
49
  <?php if (isset($settings['location_name_ids']['recommendations']["{$page_type}_{$position}_content"])) { ?>
@@ -77,7 +81,7 @@ window.verification_key = '<?php echo $settings['verification_key'] ?>'
77
  ?>
78
 
79
  </fieldset>
80
- </div>
81
 
82
  <div class='clear'></div>
83
  <div class="row" style="padding-top:20px; padding-bottom:35px;">
@@ -88,6 +92,6 @@ window.verification_key = '<?php echo $settings['verification_key'] ?>'
88
  <?php ShareaholicUtilities::load_template('why_to_sign_up', array('url' => Shareaholic::URL)) ?>
89
  </div>
90
 
91
- <?php ShareaholicAdmin::include_snapengage(); ?>
92
 
93
  <?php ShareaholicAdmin::show_footer(); ?>
 
16
  <input type="hidden" name="already_submitted" value="Y">
17
 
18
  <div id='app_settings'>
19
+
20
+ <fieldset class="app" style="line-height:18px;"><?php echo sprintf(__('First time here? Read %sUnderstanding the new Shareaholic for WordPress interface and configuration settings%s', 'shareaholic'), '<a href="https://blog.shareaholic.com/2013/07/understanding-the-new-shareaholic-for-wordpress-interface-and-configuration-settings/" target="_blank">','</a>'); ?>
21
+ </fieldset>
22
+
23
+ <fieldset class="app"><legend><h2><img src="<?php echo SHAREAHOLIC_ASSET_DIR; ?>/img/sharebuttons@2x.png" height=32 width=32 /> <?php echo sprintf(__('Share Buttons', 'shareaholic')); ?></h2></legend>
24
  <span class="helper"><i class="icon-question-sign"></i><?php echo sprintf(__('Pick where you want your buttons to be displayed. Click "Edit" to customize look & feel, themes, share counters, alignment, etc.', 'shareaholic')); ?></span>
25
 
26
  <?php foreach(array('post', 'page', 'index', 'category') as $page_type) { ?>
47
 
48
  <div class='clear'></div>
49
 
50
+ <fieldset class="app"><legend><h2><img src="<?php echo SHAREAHOLIC_ASSET_DIR; ?>/img/related_content@2x.png" height=32 width=32 /> <?php echo sprintf(__('Related Content / Recommendations', 'shareaholic')); ?></h2></legend>
51
  <span class="helper"><i class="icon-question-sign"></i><?php echo sprintf(__('Pick where you want Related Content to be displayed. Click "Edit" to customize look & feel, themes, block lists, etc.', 'shareaholic')); ?></span>
52
  <?php foreach(array('post', 'page', 'index', 'category') as $page_type) { ?>
53
  <?php if (isset($settings['location_name_ids']['recommendations']["{$page_type}_{$position}_content"])) { ?>
81
  ?>
82
 
83
  </fieldset>
84
+ </div>
85
 
86
  <div class='clear'></div>
87
  <div class="row" style="padding-top:20px; padding-bottom:35px;">
92
  <?php ShareaholicUtilities::load_template('why_to_sign_up', array('url' => Shareaholic::URL)) ?>
93
  </div>
94
 
 
95
 
96
  <?php ShareaholicAdmin::show_footer(); ?>
97
+ <?php ShareaholicAdmin::include_snapengage(); ?>
templates/verify_api_key_js.php CHANGED
@@ -34,7 +34,4 @@ Shareaholic.click_objects['unverified_general_settings'] = {
34
  },
35
  close: Shareaholic.click_objects['general_settings'].close
36
  }
37
-
38
- Shareaholic.bind_button_clicks(Shareaholic.click_objects['unverified_app_settings'], true);
39
- Shareaholic.bind_button_clicks(Shareaholic.click_objects['unverified_general_settings'], true);
40
  </script>
34
  },
35
  close: Shareaholic.click_objects['general_settings'].close
36
  }
 
 
 
37
  </script>
utilities.php CHANGED
@@ -441,10 +441,10 @@ class ShareaholicUtilities {
441
  ),
442
  'share_buttons_attributes' => array(
443
  'locations_attributes' => array(
444
- array('name' => 'post_below_content'),
445
- array('name' => 'page_below_content'),
446
- array('name' => 'index_below_content'),
447
- array('name' => 'category_below_content')
448
  )
449
  )
450
  )
@@ -597,4 +597,4 @@ class ShareaholicUtilities {
597
  }
598
 
599
  }
600
- ?>
441
  ),
442
  'share_buttons_attributes' => array(
443
  'locations_attributes' => array(
444
+ array('name' => 'post_below_content', 'counter' => 'badge-counter'),
445
+ array('name' => 'page_below_content', 'counter' => 'badge-counter'),
446
+ array('name' => 'index_below_content', 'counter' => 'badge-counter'),
447
+ array('name' => 'category_below_content', 'counter' => 'badge-counter')
448
  )
449
  )
450
  )
597
  }
598
 
599
  }
600
+ ?>