wco_email 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +7 -0
  2. data/README.txt +129 -0
  3. data/Rakefile +5 -0
  4. data/app/assets/config/wco_email_manifest.js +7 -0
  5. data/app/assets/javascript/vendor-trash/jquery-ui.min.js +13 -0
  6. data/app/assets/javascript/vendor-trash/jquery.fileupload.js +1482 -0
  7. data/app/assets/javascript/vendor-trash/jquery.iframe-transport.js +224 -0
  8. data/app/assets/javascript/vendor-trash/jquery.ui.widget.js +572 -0
  9. data/app/assets/javascript/vendor-trash/summernote-bs4.min.js +3 -0
  10. data/app/assets/javascript/wco_email/application.js +11 -0
  11. data/app/assets/javascript/wco_email/contexts.js +19 -0
  12. data/app/assets/javascript/wco_email/conversations.js +177 -0
  13. data/app/assets/javascript/wco_email/file_upload.js-trash +32 -0
  14. data/app/assets/javascript/wco_email/shared.js +22 -0
  15. data/app/assets/stylesheets/wco_email/application.scss +29 -0
  16. data/app/assets/stylesheets/wco_email/contexts.scss +63 -0
  17. data/app/assets/stylesheets/wco_email/conversations.scss +16 -0
  18. data/app/assets/stylesheets/wco_email/tags.scss +6 -0
  19. data/app/controllers/wco_email/application_controller.rb +16 -0
  20. data/app/controllers/wco_email/contexts_controller.rb +156 -0
  21. data/app/controllers/wco_email/conversations_controller.rb +129 -0
  22. data/app/controllers/wco_email/email_action_templates_controller.rb +77 -0
  23. data/app/controllers/wco_email/email_actions_controller.rb +55 -0
  24. data/app/controllers/wco_email/email_campaigns_controller.rb +73 -0
  25. data/app/controllers/wco_email/email_filters_controller.rb +72 -0
  26. data/app/controllers/wco_email/email_layouts_controller.rb +13 -0
  27. data/app/controllers/wco_email/email_templates_controller.rb +124 -0
  28. data/app/controllers/wco_email/message_stubs_controller.rb +14 -0
  29. data/app/controllers/wco_email/messages_controller.rb +28 -0
  30. data/app/controllers/wco_email/obfuscated_redirects_controller.rb +20 -0
  31. data/app/controllers/wco_email/sessions_controller.rb +19 -0
  32. data/app/controllers/wco_email/unsubscribes_controller.rb +40 -0
  33. data/app/helpers/wco_email/application_helper.rb +20 -0
  34. data/app/jobs/wco_email/message_intake_job.rb +54 -0
  35. data/app/mailers/wco_email/application_mailer.rb +98 -0
  36. data/app/views/202212 Mailchimp Templates/202212 1col fixed-width.html +863 -0
  37. data/app/views/202212 Mailchimp Templates/202212 1col full-width.html +906 -0
  38. data/app/views/202212 Mailchimp Templates/202212 2col fixed-width 2.html +1003 -0
  39. data/app/views/202212 Mailchimp Templates/202212 2col fixed-width.html +1082 -0
  40. data/app/views/202212 Mailchimp Templates/202212 2col full-width 2.html +1053 -0
  41. data/app/views/202212 Mailchimp Templates/202212 2col full-width.html +1147 -0
  42. data/app/views/202212 Mailchimp Templates/202212 3col fixed-width.html +1087 -0
  43. data/app/views/202212 Mailchimp Templates/202212 3col full-width.html +1136 -0
  44. data/app/views/202212 Mailchimp Templates/202212 catalog various-colors-1.html +1223 -0
  45. data/app/views/202212 Mailchimp Templates/202212 educate.html +1080 -0
  46. data/app/views/202212 Mailchimp Templates/202212 follow up.html +1001 -0
  47. data/app/views/202212 Mailchimp Templates/202212 make an announcement.html +1048 -0
  48. data/app/views/202212 Mailchimp Templates/202212 sell-a-product.html +977 -0
  49. data/app/views/202212 Mailchimp Templates/202212 tell a story.html +1168 -0
  50. data/app/views/202212 Mailchimp Templates/202212 theme art-newsletter.html +1612 -0
  51. data/app/views/202212 Mailchimp Templates/202212 theme caribou-xmas.html +856 -0
  52. data/app/views/202212 Mailchimp Templates/202212 theme colorbox.html +1027 -0
  53. data/app/views/202212 Mailchimp Templates/202212 theme competition-invitation.html +918 -0
  54. data/app/views/202212 Mailchimp Templates/202212 theme event-veerle.html +1132 -0
  55. data/app/views/202212 Mailchimp Templates/202212 theme fall-colors.html +1407 -0
  56. data/app/views/202212 Mailchimp Templates/202212 theme gift-giving.html +787 -0
  57. data/app/views/202212 Mailchimp Templates/202212 theme giftgiving-snowmen.html +731 -0
  58. data/app/views/202212 Mailchimp Templates/202212 theme heart-of-flowers.html +795 -0
  59. data/app/views/202212 Mailchimp Templates/202212 theme hero-card.html +915 -0
  60. data/app/views/202212 Mailchimp Templates/202212 theme hero-image.html +1148 -0
  61. data/app/views/202212 Mailchimp Templates/202212 theme monthly-contest.html +967 -0
  62. data/app/views/202212 Mailchimp Templates/202212 theme multiple-event.html +1189 -0
  63. data/app/views/202212 Mailchimp Templates/202212 theme postcard.html +914 -0
  64. data/app/views/202212 Mailchimp Templates/202212 theme snowy-fields.html +733 -0
  65. data/app/views/202212 Mailchimp Templates/202212 theme soft.html +849 -0
  66. data/app/views/202212 Mailchimp Templates/202212 theme sophisticated.html +1079 -0
  67. data/app/views/202212 Mailchimp Templates/202212 theme subtle.html +1218 -0
  68. data/app/views/202212 Mailchimp Templates/202212 theme ticket.html +1015 -0
  69. data/app/views/202212 Mailchimp Templates/202212 theme whale.html +888 -0
  70. data/app/views/202310 Email Templates/_acknowledgement_of_document_receipt.html.erb +23 -0
  71. data/app/views/202310 Email Templates/_support_ticket_created.html.erb +26 -0
  72. data/app/views/layouts/wco_email/application.haml +64 -0
  73. data/app/views/layouts/wco_email/mailbox.haml-trash +62 -0
  74. data/app/views/wco_email/_analytics.erb +16 -0
  75. data/app/views/wco_email/_main_header.haml +31 -0
  76. data/app/views/wco_email/_sidebar.haml +10 -0
  77. data/app/views/wco_email/application_mailer/_footer_unsubscribe.html.erb +24 -0
  78. data/app/views/wco_email/application_mailer/_header_logo.html.erb +12 -0
  79. data/app/views/wco_email/application_mailer/forwarder_notify.html.erb +17 -0
  80. data/app/views/wco_email/contexts/_form.haml +59 -0
  81. data/app/views/wco_email/contexts/_form_reply.haml +27 -0
  82. data/app/views/wco_email/contexts/_header.haml +22 -0
  83. data/app/views/wco_email/contexts/_index.haml +8 -0
  84. data/app/views/wco_email/contexts/edit.haml +8 -0
  85. data/app/views/wco_email/contexts/iframe_src.haml +3 -0
  86. data/app/views/wco_email/contexts/index.haml +51 -0
  87. data/app/views/wco_email/contexts/new.haml +5 -0
  88. data/app/views/wco_email/contexts/show.haml +34 -0
  89. data/app/views/wco_email/contexts/summary.csv.erb +4 -0
  90. data/app/views/wco_email/contexts/summary.haml +16 -0
  91. data/app/views/wco_email/conversations/_actions.haml +21 -0
  92. data/app/views/wco_email/conversations/_search.haml +14 -0
  93. data/app/views/wco_email/conversations/index.haml +43 -0
  94. data/app/views/wco_email/conversations/show.haml +27 -0
  95. data/app/views/wco_email/email_action_templates/_form.haml +45 -0
  96. data/app/views/wco_email/email_action_templates/_header.haml +8 -0
  97. data/app/views/wco_email/email_action_templates/edit.haml +7 -0
  98. data/app/views/wco_email/email_action_templates/index.haml +36 -0
  99. data/app/views/wco_email/email_action_templates/new.haml +9 -0
  100. data/app/views/wco_email/email_action_templates/show.haml +11 -0
  101. data/app/views/wco_email/email_actions/_form.haml +24 -0
  102. data/app/views/wco_email/email_actions/_form_mini.haml-trash +28 -0
  103. data/app/views/wco_email/email_actions/_header.haml +8 -0
  104. data/app/views/wco_email/email_actions/edit.haml +4 -0
  105. data/app/views/wco_email/email_actions/index.haml +31 -0
  106. data/app/views/wco_email/email_actions/new.haml +4 -0
  107. data/app/views/wco_email/email_actions/show.haml +0 -0
  108. data/app/views/wco_email/email_campaigns/_form.haml +33 -0
  109. data/app/views/wco_email/email_campaigns/_header.haml +5 -0
  110. data/app/views/wco_email/email_campaigns/edit.haml +5 -0
  111. data/app/views/wco_email/email_campaigns/index.haml +14 -0
  112. data/app/views/wco_email/email_campaigns/new.haml +5 -0
  113. data/app/views/wco_email/email_campaigns/show.haml +17 -0
  114. data/app/views/wco_email/email_filters/_form.haml +40 -0
  115. data/app/views/wco_email/email_filters/_header.haml +5 -0
  116. data/app/views/wco_email/email_filters/edit.haml +5 -0
  117. data/app/views/wco_email/email_filters/index.haml +48 -0
  118. data/app/views/wco_email/email_filters/new.haml +5 -0
  119. data/app/views/wco_email/email_templates/_form.haml +48 -0
  120. data/app/views/wco_email/email_templates/_form_mini.haml +9 -0
  121. data/app/views/wco_email/email_templates/_form_reply_mini.haml +8 -0
  122. data/app/views/wco_email/email_templates/_form_schedule_mini.haml +11 -0
  123. data/app/views/wco_email/email_templates/_header.haml +6 -0
  124. data/app/views/wco_email/email_templates/_index.haml +26 -0
  125. data/app/views/wco_email/email_templates/_index_expanded.haml +13 -0
  126. data/app/views/wco_email/email_templates/_m20221201react.html.erb +1202 -0
  127. data/app/views/wco_email/email_templates/_m20221222merryxmas.html.erb +766 -0
  128. data/app/views/wco_email/email_templates/_m202309_feedback.html.erb +1161 -0
  129. data/app/views/wco_email/email_templates/_m202309_ror4.html.erb +1068 -0
  130. data/app/views/wco_email/email_templates/_marketing_node_1.html.erb +984 -0
  131. data/app/views/wco_email/email_templates/_marketing_react_1.html +0 -0
  132. data/app/views/wco_email/email_templates/_marketing_react_2.html.erb +749 -0
  133. data/app/views/wco_email/email_templates/_marketing_react_3.html.erb +628 -0
  134. data/app/views/wco_email/email_templates/_marketing_ror_1.html +751 -0
  135. data/app/views/wco_email/email_templates/_marketing_ror_2.html.erb +755 -0
  136. data/app/views/wco_email/email_templates/_marketing_ror_3.html.erb +25 -0
  137. data/app/views/wco_email/email_templates/_marketing_ror_4.html.erb +25 -0
  138. data/app/views/wco_email/email_templates/_marketing_ror_5.html.erb +17 -0
  139. data/app/views/wco_email/email_templates/_marketing_wordpress_1.html +0 -0
  140. data/app/views/wco_email/email_templates/_marketing_wordpress_2.html +0 -0
  141. data/app/views/wco_email/email_templates/_meta.haml +6 -0
  142. data/app/views/wco_email/email_templates/_piousbox_roundborders.html.erb +1007 -0
  143. data/app/views/wco_email/email_templates/_piousbox_social.html.erb +181 -0
  144. data/app/views/wco_email/email_templates/_plain.haml +15 -0
  145. data/app/views/wco_email/email_templates/_rec_resume_shared_with_you.html.erb +39 -0
  146. data/app/views/wco_email/email_templates/_slug-1.html.erb +0 -0
  147. data/app/views/wco_email/email_templates/_slug-2.html.erb +0 -0
  148. data/app/views/wco_email/email_templates/_slug-3.html.erb +0 -0
  149. data/app/views/wco_email/email_templates/_tracking_footer.html.erb +13 -0
  150. data/app/views/wco_email/email_templates/_wasyaco_roundborders.html.erb +686 -0
  151. data/app/views/wco_email/email_templates/_wasyaco_social.html.erb +181 -0
  152. data/app/views/wco_email/email_templates/edit.haml +6 -0
  153. data/app/views/wco_email/email_templates/new.haml +6 -0
  154. data/app/views/wco_email/email_templates/show.haml +11 -0
  155. data/app/views/wco_email/email_templates/show_iframe.haml +2 -0
  156. data/app/views/wco_email/lead_action_templates/_header.haml +7 -0
  157. data/app/views/wco_email/lead_actions/_header.haml +8 -0
  158. data/app/views/wco_email/message_stubs/_index.haml +10 -0
  159. data/app/views/wco_email/messages/_form_reply.haml-trash +17 -0
  160. data/app/views/wco_email/messages/_meta.haml +30 -0
  161. data/app/views/wco_email/messages/show.haml +13 -0
  162. data/app/views/wco_email/messages/show_iframe.haml +5 -0
  163. data/app/views/wco_email/sessions/new.html.erb +4 -0
  164. data/app/views/wco_email/unsubscribes/_header.haml +4 -0
  165. data/app/views/wco_email/unsubscribes/_table.haml +22 -0
  166. data/config/initializers/assets.rb +10 -0
  167. data/config/routes.rb +49 -0
  168. data/lib/tasks/bjjcollective/sitemap.rb +50 -0
  169. data/lib/tasks/db_tasks.rake +12 -0
  170. data/lib/tasks/direct_mail_tasks.rake +35 -0
  171. data/lib/tasks/infinite_shelter/sitemap.rb +25 -0
  172. data/lib/tasks/piousbox/sitemap.rb +80 -0
  173. data/lib/tasks/publish2_wordpress_tasks.rake +54 -0
  174. data/lib/tasks/scrape_reddit_tasks.rake-bk +23 -0
  175. data/lib/tasks/trash/email_tasks.rake-trash +126 -0
  176. data/lib/tasks/trash/sitemap_tasks.rake-trash +146 -0
  177. data/lib/tasks/wasya_co/sitemap.rb +281 -0
  178. data/lib/tasks/wco_email_tasks.rake +117 -0
  179. data/lib/wco_email/README_email_actions.rb +7 -0
  180. data/lib/wco_email/README_email_contexts.rb +7 -0
  181. data/lib/wco_email/engine.rb +8 -0
  182. data/lib/wco_email.rb +19 -0
  183. metadata +493 -0
@@ -0,0 +1,572 @@
1
+ /*! jQuery UI - v1.11.4+CommonJS - 2015-08-28
2
+ * http://jqueryui.com
3
+ * Includes: widget.js
4
+ * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( factory ) {
7
+ if ( typeof define === "function" && define.amd ) {
8
+
9
+ // AMD. Register as an anonymous module.
10
+ define([ "jquery" ], factory );
11
+
12
+ } else if ( typeof exports === "object" ) {
13
+
14
+ // Node/CommonJS
15
+ factory( require( "jquery" ) );
16
+
17
+ } else {
18
+
19
+ // Browser globals
20
+ factory( jQuery );
21
+ }
22
+ }(function( $ ) {
23
+ /*!
24
+ * jQuery UI Widget 1.11.4
25
+ * http://jqueryui.com
26
+ *
27
+ * Copyright jQuery Foundation and other contributors
28
+ * Released under the MIT license.
29
+ * http://jquery.org/license
30
+ *
31
+ * http://api.jqueryui.com/jQuery.widget/
32
+ */
33
+
34
+
35
+ var widget_uuid = 0,
36
+ widget_slice = Array.prototype.slice;
37
+
38
+ $.cleanData = (function( orig ) {
39
+ return function( elems ) {
40
+ var events, elem, i;
41
+ for ( i = 0; (elem = elems[i]) != null; i++ ) {
42
+ try {
43
+
44
+ // Only trigger remove when necessary to save time
45
+ events = $._data( elem, "events" );
46
+ if ( events && events.remove ) {
47
+ $( elem ).triggerHandler( "remove" );
48
+ }
49
+
50
+ // http://bugs.jquery.com/ticket/8235
51
+ } catch ( e ) {}
52
+ }
53
+ orig( elems );
54
+ };
55
+ })( $.cleanData );
56
+
57
+ $.widget = function( name, base, prototype ) {
58
+ var fullName, existingConstructor, constructor, basePrototype,
59
+ // proxiedPrototype allows the provided prototype to remain unmodified
60
+ // so that it can be used as a mixin for multiple widgets (#8876)
61
+ proxiedPrototype = {},
62
+ namespace = name.split( "." )[ 0 ];
63
+
64
+ name = name.split( "." )[ 1 ];
65
+ fullName = namespace + "-" + name;
66
+
67
+ if ( !prototype ) {
68
+ prototype = base;
69
+ base = $.Widget;
70
+ }
71
+
72
+ // create selector for plugin
73
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
74
+ return !!$.data( elem, fullName );
75
+ };
76
+
77
+ $[ namespace ] = $[ namespace ] || {};
78
+ existingConstructor = $[ namespace ][ name ];
79
+ constructor = $[ namespace ][ name ] = function( options, element ) {
80
+ // allow instantiation without "new" keyword
81
+ if ( !this._createWidget ) {
82
+ return new constructor( options, element );
83
+ }
84
+
85
+ // allow instantiation without initializing for simple inheritance
86
+ // must use "new" keyword (the code above always passes args)
87
+ if ( arguments.length ) {
88
+ this._createWidget( options, element );
89
+ }
90
+ };
91
+ // extend with the existing constructor to carry over any static properties
92
+ $.extend( constructor, existingConstructor, {
93
+ version: prototype.version,
94
+ // copy the object used to create the prototype in case we need to
95
+ // redefine the widget later
96
+ _proto: $.extend( {}, prototype ),
97
+ // track widgets that inherit from this widget in case this widget is
98
+ // redefined after a widget inherits from it
99
+ _childConstructors: []
100
+ });
101
+
102
+ basePrototype = new base();
103
+ // we need to make the options hash a property directly on the new instance
104
+ // otherwise we'll modify the options hash on the prototype that we're
105
+ // inheriting from
106
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
107
+ $.each( prototype, function( prop, value ) {
108
+ if ( !$.isFunction( value ) ) {
109
+ proxiedPrototype[ prop ] = value;
110
+ return;
111
+ }
112
+ proxiedPrototype[ prop ] = (function() {
113
+ var _super = function() {
114
+ return base.prototype[ prop ].apply( this, arguments );
115
+ },
116
+ _superApply = function( args ) {
117
+ return base.prototype[ prop ].apply( this, args );
118
+ };
119
+ return function() {
120
+ var __super = this._super,
121
+ __superApply = this._superApply,
122
+ returnValue;
123
+
124
+ this._super = _super;
125
+ this._superApply = _superApply;
126
+
127
+ returnValue = value.apply( this, arguments );
128
+
129
+ this._super = __super;
130
+ this._superApply = __superApply;
131
+
132
+ return returnValue;
133
+ };
134
+ })();
135
+ });
136
+ constructor.prototype = $.widget.extend( basePrototype, {
137
+ // TODO: remove support for widgetEventPrefix
138
+ // always use the name + a colon as the prefix, e.g., draggable:start
139
+ // don't prefix for widgets that aren't DOM-based
140
+ widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
141
+ }, proxiedPrototype, {
142
+ constructor: constructor,
143
+ namespace: namespace,
144
+ widgetName: name,
145
+ widgetFullName: fullName
146
+ });
147
+
148
+ // If this widget is being redefined then we need to find all widgets that
149
+ // are inheriting from it and redefine all of them so that they inherit from
150
+ // the new version of this widget. We're essentially trying to replace one
151
+ // level in the prototype chain.
152
+ if ( existingConstructor ) {
153
+ $.each( existingConstructor._childConstructors, function( i, child ) {
154
+ var childPrototype = child.prototype;
155
+
156
+ // redefine the child widget using the same prototype that was
157
+ // originally used, but inherit from the new version of the base
158
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
159
+ });
160
+ // remove the list of existing child constructors from the old constructor
161
+ // so the old child constructors can be garbage collected
162
+ delete existingConstructor._childConstructors;
163
+ } else {
164
+ base._childConstructors.push( constructor );
165
+ }
166
+
167
+ $.widget.bridge( name, constructor );
168
+
169
+ return constructor;
170
+ };
171
+
172
+ $.widget.extend = function( target ) {
173
+ var input = widget_slice.call( arguments, 1 ),
174
+ inputIndex = 0,
175
+ inputLength = input.length,
176
+ key,
177
+ value;
178
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
179
+ for ( key in input[ inputIndex ] ) {
180
+ value = input[ inputIndex ][ key ];
181
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
182
+ // Clone objects
183
+ if ( $.isPlainObject( value ) ) {
184
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
185
+ $.widget.extend( {}, target[ key ], value ) :
186
+ // Don't extend strings, arrays, etc. with objects
187
+ $.widget.extend( {}, value );
188
+ // Copy everything else by reference
189
+ } else {
190
+ target[ key ] = value;
191
+ }
192
+ }
193
+ }
194
+ }
195
+ return target;
196
+ };
197
+
198
+ $.widget.bridge = function( name, object ) {
199
+ var fullName = object.prototype.widgetFullName || name;
200
+ $.fn[ name ] = function( options ) {
201
+ var isMethodCall = typeof options === "string",
202
+ args = widget_slice.call( arguments, 1 ),
203
+ returnValue = this;
204
+
205
+ if ( isMethodCall ) {
206
+ this.each(function() {
207
+ var methodValue,
208
+ instance = $.data( this, fullName );
209
+ if ( options === "instance" ) {
210
+ returnValue = instance;
211
+ return false;
212
+ }
213
+ if ( !instance ) {
214
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
215
+ "attempted to call method '" + options + "'" );
216
+ }
217
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
218
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
219
+ }
220
+ methodValue = instance[ options ].apply( instance, args );
221
+ if ( methodValue !== instance && methodValue !== undefined ) {
222
+ returnValue = methodValue && methodValue.jquery ?
223
+ returnValue.pushStack( methodValue.get() ) :
224
+ methodValue;
225
+ return false;
226
+ }
227
+ });
228
+ } else {
229
+
230
+ // Allow multiple hashes to be passed on init
231
+ if ( args.length ) {
232
+ options = $.widget.extend.apply( null, [ options ].concat(args) );
233
+ }
234
+
235
+ this.each(function() {
236
+ var instance = $.data( this, fullName );
237
+ if ( instance ) {
238
+ instance.option( options || {} );
239
+ if ( instance._init ) {
240
+ instance._init();
241
+ }
242
+ } else {
243
+ $.data( this, fullName, new object( options, this ) );
244
+ }
245
+ });
246
+ }
247
+
248
+ return returnValue;
249
+ };
250
+ };
251
+
252
+ $.Widget = function( /* options, element */ ) {};
253
+ $.Widget._childConstructors = [];
254
+
255
+ $.Widget.prototype = {
256
+ widgetName: "widget",
257
+ widgetEventPrefix: "",
258
+ defaultElement: "<div>",
259
+ options: {
260
+ disabled: false,
261
+
262
+ // callbacks
263
+ create: null
264
+ },
265
+ _createWidget: function( options, element ) {
266
+ element = $( element || this.defaultElement || this )[ 0 ];
267
+ this.element = $( element );
268
+ this.uuid = widget_uuid++;
269
+ this.eventNamespace = "." + this.widgetName + this.uuid;
270
+
271
+ this.bindings = $();
272
+ this.hoverable = $();
273
+ this.focusable = $();
274
+
275
+ if ( element !== this ) {
276
+ $.data( element, this.widgetFullName, this );
277
+ this._on( true, this.element, {
278
+ remove: function( event ) {
279
+ if ( event.target === element ) {
280
+ this.destroy();
281
+ }
282
+ }
283
+ });
284
+ this.document = $( element.style ?
285
+ // element within the document
286
+ element.ownerDocument :
287
+ // element is window or document
288
+ element.document || element );
289
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
290
+ }
291
+
292
+ this.options = $.widget.extend( {},
293
+ this.options,
294
+ this._getCreateOptions(),
295
+ options );
296
+
297
+ this._create();
298
+ this._trigger( "create", null, this._getCreateEventData() );
299
+ this._init();
300
+ },
301
+ _getCreateOptions: $.noop,
302
+ _getCreateEventData: $.noop,
303
+ _create: $.noop,
304
+ _init: $.noop,
305
+
306
+ destroy: function() {
307
+ this._destroy();
308
+ // we can probably remove the unbind calls in 2.0
309
+ // all event bindings should go through this._on()
310
+ this.element
311
+ .unbind( this.eventNamespace )
312
+ .removeData( this.widgetFullName )
313
+ // support: jquery <1.6.3
314
+ // http://bugs.jquery.com/ticket/9413
315
+ .removeData( $.camelCase( this.widgetFullName ) );
316
+ this.widget()
317
+ .unbind( this.eventNamespace )
318
+ .removeAttr( "aria-disabled" )
319
+ .removeClass(
320
+ this.widgetFullName + "-disabled " +
321
+ "ui-state-disabled" );
322
+
323
+ // clean up events and states
324
+ this.bindings.unbind( this.eventNamespace );
325
+ this.hoverable.removeClass( "ui-state-hover" );
326
+ this.focusable.removeClass( "ui-state-focus" );
327
+ },
328
+ _destroy: $.noop,
329
+
330
+ widget: function() {
331
+ return this.element;
332
+ },
333
+
334
+ option: function( key, value ) {
335
+ var options = key,
336
+ parts,
337
+ curOption,
338
+ i;
339
+
340
+ if ( arguments.length === 0 ) {
341
+ // don't return a reference to the internal hash
342
+ return $.widget.extend( {}, this.options );
343
+ }
344
+
345
+ if ( typeof key === "string" ) {
346
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
347
+ options = {};
348
+ parts = key.split( "." );
349
+ key = parts.shift();
350
+ if ( parts.length ) {
351
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
352
+ for ( i = 0; i < parts.length - 1; i++ ) {
353
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
354
+ curOption = curOption[ parts[ i ] ];
355
+ }
356
+ key = parts.pop();
357
+ if ( arguments.length === 1 ) {
358
+ return curOption[ key ] === undefined ? null : curOption[ key ];
359
+ }
360
+ curOption[ key ] = value;
361
+ } else {
362
+ if ( arguments.length === 1 ) {
363
+ return this.options[ key ] === undefined ? null : this.options[ key ];
364
+ }
365
+ options[ key ] = value;
366
+ }
367
+ }
368
+
369
+ this._setOptions( options );
370
+
371
+ return this;
372
+ },
373
+ _setOptions: function( options ) {
374
+ var key;
375
+
376
+ for ( key in options ) {
377
+ this._setOption( key, options[ key ] );
378
+ }
379
+
380
+ return this;
381
+ },
382
+ _setOption: function( key, value ) {
383
+ this.options[ key ] = value;
384
+
385
+ if ( key === "disabled" ) {
386
+ this.widget()
387
+ .toggleClass( this.widgetFullName + "-disabled", !!value );
388
+
389
+ // If the widget is becoming disabled, then nothing is interactive
390
+ if ( value ) {
391
+ this.hoverable.removeClass( "ui-state-hover" );
392
+ this.focusable.removeClass( "ui-state-focus" );
393
+ }
394
+ }
395
+
396
+ return this;
397
+ },
398
+
399
+ enable: function() {
400
+ return this._setOptions({ disabled: false });
401
+ },
402
+ disable: function() {
403
+ return this._setOptions({ disabled: true });
404
+ },
405
+
406
+ _on: function( suppressDisabledCheck, element, handlers ) {
407
+ var delegateElement,
408
+ instance = this;
409
+
410
+ // no suppressDisabledCheck flag, shuffle arguments
411
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
412
+ handlers = element;
413
+ element = suppressDisabledCheck;
414
+ suppressDisabledCheck = false;
415
+ }
416
+
417
+ // no element argument, shuffle and use this.element
418
+ if ( !handlers ) {
419
+ handlers = element;
420
+ element = this.element;
421
+ delegateElement = this.widget();
422
+ } else {
423
+ element = delegateElement = $( element );
424
+ this.bindings = this.bindings.add( element );
425
+ }
426
+
427
+ $.each( handlers, function( event, handler ) {
428
+ function handlerProxy() {
429
+ // allow widgets to customize the disabled handling
430
+ // - disabled as an array instead of boolean
431
+ // - disabled class as method for disabling individual parts
432
+ if ( !suppressDisabledCheck &&
433
+ ( instance.options.disabled === true ||
434
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
435
+ return;
436
+ }
437
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
438
+ .apply( instance, arguments );
439
+ }
440
+
441
+ // copy the guid so direct unbinding works
442
+ if ( typeof handler !== "string" ) {
443
+ handlerProxy.guid = handler.guid =
444
+ handler.guid || handlerProxy.guid || $.guid++;
445
+ }
446
+
447
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
448
+ eventName = match[1] + instance.eventNamespace,
449
+ selector = match[2];
450
+ if ( selector ) {
451
+ delegateElement.delegate( selector, eventName, handlerProxy );
452
+ } else {
453
+ element.bind( eventName, handlerProxy );
454
+ }
455
+ });
456
+ },
457
+
458
+ _off: function( element, eventName ) {
459
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
460
+ this.eventNamespace;
461
+ element.unbind( eventName ).undelegate( eventName );
462
+
463
+ // Clear the stack to avoid memory leaks (#10056)
464
+ this.bindings = $( this.bindings.not( element ).get() );
465
+ this.focusable = $( this.focusable.not( element ).get() );
466
+ this.hoverable = $( this.hoverable.not( element ).get() );
467
+ },
468
+
469
+ _delay: function( handler, delay ) {
470
+ function handlerProxy() {
471
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
472
+ .apply( instance, arguments );
473
+ }
474
+ var instance = this;
475
+ return setTimeout( handlerProxy, delay || 0 );
476
+ },
477
+
478
+ _hoverable: function( element ) {
479
+ this.hoverable = this.hoverable.add( element );
480
+ this._on( element, {
481
+ mouseenter: function( event ) {
482
+ $( event.currentTarget ).addClass( "ui-state-hover" );
483
+ },
484
+ mouseleave: function( event ) {
485
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
486
+ }
487
+ });
488
+ },
489
+
490
+ _focusable: function( element ) {
491
+ this.focusable = this.focusable.add( element );
492
+ this._on( element, {
493
+ focusin: function( event ) {
494
+ $( event.currentTarget ).addClass( "ui-state-focus" );
495
+ },
496
+ focusout: function( event ) {
497
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
498
+ }
499
+ });
500
+ },
501
+
502
+ _trigger: function( type, event, data ) {
503
+ var prop, orig,
504
+ callback = this.options[ type ];
505
+
506
+ data = data || {};
507
+ event = $.Event( event );
508
+ event.type = ( type === this.widgetEventPrefix ?
509
+ type :
510
+ this.widgetEventPrefix + type ).toLowerCase();
511
+ // the original event may come from any element
512
+ // so we need to reset the target on the new event
513
+ event.target = this.element[ 0 ];
514
+
515
+ // copy original event properties over to the new event
516
+ orig = event.originalEvent;
517
+ if ( orig ) {
518
+ for ( prop in orig ) {
519
+ if ( !( prop in event ) ) {
520
+ event[ prop ] = orig[ prop ];
521
+ }
522
+ }
523
+ }
524
+
525
+ this.element.trigger( event, data );
526
+ return !( $.isFunction( callback ) &&
527
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
528
+ event.isDefaultPrevented() );
529
+ }
530
+ };
531
+
532
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
533
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
534
+ if ( typeof options === "string" ) {
535
+ options = { effect: options };
536
+ }
537
+ var hasOptions,
538
+ effectName = !options ?
539
+ method :
540
+ options === true || typeof options === "number" ?
541
+ defaultEffect :
542
+ options.effect || defaultEffect;
543
+ options = options || {};
544
+ if ( typeof options === "number" ) {
545
+ options = { duration: options };
546
+ }
547
+ hasOptions = !$.isEmptyObject( options );
548
+ options.complete = callback;
549
+ if ( options.delay ) {
550
+ element.delay( options.delay );
551
+ }
552
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
553
+ element[ method ]( options );
554
+ } else if ( effectName !== method && element[ effectName ] ) {
555
+ element[ effectName ]( options.duration, options.easing, callback );
556
+ } else {
557
+ element.queue(function( next ) {
558
+ $( this )[ method ]();
559
+ if ( callback ) {
560
+ callback.call( element[ 0 ] );
561
+ }
562
+ next();
563
+ });
564
+ }
565
+ };
566
+ });
567
+
568
+ var widget = $.widget;
569
+
570
+
571
+
572
+ }));