social_stream 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/README.rdoc +17 -7
  2. data/app/controllers/frontpage_controller.rb +16 -0
  3. data/app/models/actor.rb +25 -10
  4. data/app/models/user.rb +4 -0
  5. data/app/views/{home → activities}/_activities.html.erb +4 -4
  6. data/app/views/activities/_new.html.erb +2 -2
  7. data/app/views/comments/_new.html.erb +1 -1
  8. data/app/views/frontpage/_header.html.erb +23 -0
  9. data/app/views/frontpage/_sponsor.html.erb +13 -0
  10. data/app/views/frontpage/index.html.erb +87 -0
  11. data/app/views/groups/_follow.html.erb +9 -0
  12. data/app/views/groups/_followers.html.erb +14 -0
  13. data/app/views/groups/_logo.html.erb +4 -0
  14. data/app/views/groups/_middle_show.html.erb +7 -0
  15. data/app/views/groups/_right_show.html.erb +6 -0
  16. data/app/views/groups/_tabs.html.erb +32 -0
  17. data/app/views/groups/show.html.erb +5 -12
  18. data/app/views/home/_contacts.html.erb +17 -0
  19. data/app/views/home/_groups.html.erb +6 -7
  20. data/app/views/home/_location.html.erb +1 -1
  21. data/app/views/home/_middle.html.erb +4 -0
  22. data/app/views/home/_options.html.erb +14 -0
  23. data/app/views/home/_right.html.erb +22 -0
  24. data/app/views/home/index.html.erb +15 -3
  25. data/app/views/layouts/_footer.html.erb +12 -0
  26. data/app/views/layouts/_header.erb +36 -0
  27. data/app/views/layouts/application.html.erb +81 -0
  28. data/app/views/layouts/frontpage.html.erb +51 -0
  29. data/app/views/ties/_suggestions.html.erb +18 -14
  30. data/app/views/users/_contacts.html.erb +19 -0
  31. data/app/views/users/_logo.html.erb +6 -0
  32. data/app/views/users/_menu.html.erb +30 -0
  33. data/app/views/users/_middle_show.html.erb +2 -0
  34. data/app/views/users/_profile.html.erb +121 -0
  35. data/app/views/users/_right_show.html.erb +5 -0
  36. data/app/views/users/show.html.erb +18 -0
  37. data/config/locales/en.yml +1 -1
  38. data/config/routes.rb +5 -1
  39. data/init.rb +2 -0
  40. data/lib/generators/social_stream/install_generator.rb +13 -1
  41. data/lib/generators/social_stream/templates/public/images/boxy/boxy-ne.png +0 -0
  42. data/lib/generators/social_stream/templates/public/images/boxy/boxy-nw.png +0 -0
  43. data/lib/generators/social_stream/templates/public/images/boxy/boxy-se.png +0 -0
  44. data/lib/generators/social_stream/templates/public/images/boxy/boxy-sw.png +0 -0
  45. data/lib/generators/social_stream/templates/public/images/btn/_notes/btn_certificates.png.mno +4 -0
  46. data/lib/generators/social_stream/templates/public/images/btn/arrows-ffffff.png +0 -0
  47. data/lib/generators/social_stream/templates/public/images/btn/bold.png +0 -0
  48. data/lib/generators/social_stream/templates/public/images/btn/btn_activities.png +0 -0
  49. data/lib/generators/social_stream/templates/public/images/btn/btn_bookmark.png +0 -0
  50. data/lib/generators/social_stream/templates/public/images/btn/btn_browse.png +0 -0
  51. data/lib/generators/social_stream/templates/public/images/btn/btn_certificates.png +0 -0
  52. data/lib/generators/social_stream/templates/public/images/btn/btn_check.png +0 -0
  53. data/lib/generators/social_stream/templates/public/images/btn/btn_conferences.png +0 -0
  54. data/lib/generators/social_stream/templates/public/images/btn/btn_config.png +0 -0
  55. data/lib/generators/social_stream/templates/public/images/btn/btn_date.png +0 -0
  56. data/lib/generators/social_stream/templates/public/images/btn/btn_delete.png +0 -0
  57. data/lib/generators/social_stream/templates/public/images/btn/btn_documents.png +0 -0
  58. data/lib/generators/social_stream/templates/public/images/btn/btn_embebed.png +0 -0
  59. data/lib/generators/social_stream/templates/public/images/btn/btn_exit.png +0 -0
  60. data/lib/generators/social_stream/templates/public/images/btn/btn_find.png +0 -0
  61. data/lib/generators/social_stream/templates/public/images/btn/btn_follow.png +0 -0
  62. data/lib/generators/social_stream/templates/public/images/btn/btn_follower.png +0 -0
  63. data/lib/generators/social_stream/templates/public/images/btn/btn_foward.png +0 -0
  64. data/lib/generators/social_stream/templates/public/images/btn/btn_friend.png +0 -0
  65. data/lib/generators/social_stream/templates/public/images/btn/btn_gallery.png +0 -0
  66. data/lib/generators/social_stream/templates/public/images/btn/btn_help.png +0 -0
  67. data/lib/generators/social_stream/templates/public/images/btn/btn_home.png +0 -0
  68. data/lib/generators/social_stream/templates/public/images/btn/btn_inbox.png +0 -0
  69. data/lib/generators/social_stream/templates/public/images/btn/btn_info.png +0 -0
  70. data/lib/generators/social_stream/templates/public/images/btn/btn_like.png +0 -0
  71. data/lib/generators/social_stream/templates/public/images/btn/btn_next.png +0 -0
  72. data/lib/generators/social_stream/templates/public/images/btn/btn_notifications.png +0 -0
  73. data/lib/generators/social_stream/templates/public/images/btn/btn_outline.png +0 -0
  74. data/lib/generators/social_stream/templates/public/images/btn/btn_partner.png +0 -0
  75. data/lib/generators/social_stream/templates/public/images/btn/btn_photo.png +0 -0
  76. data/lib/generators/social_stream/templates/public/images/btn/btn_profile.png +0 -0
  77. data/lib/generators/social_stream/templates/public/images/btn/btn_rank.png +0 -0
  78. data/lib/generators/social_stream/templates/public/images/btn/btn_security.png +0 -0
  79. data/lib/generators/social_stream/templates/public/images/btn/btn_send.png +0 -0
  80. data/lib/generators/social_stream/templates/public/images/btn/btn_share.png +0 -0
  81. data/lib/generators/social_stream/templates/public/images/btn/btn_spam.png +0 -0
  82. data/lib/generators/social_stream/templates/public/images/btn/btn_tag.png +0 -0
  83. data/lib/generators/social_stream/templates/public/images/btn/btn_video.png +0 -0
  84. data/lib/generators/social_stream/templates/public/images/btn/btn_write.png +0 -0
  85. data/lib/generators/social_stream/templates/public/images/btn/close.png +0 -0
  86. data/lib/generators/social_stream/templates/public/images/btn/facebook.png +0 -0
  87. data/lib/generators/social_stream/templates/public/images/btn/flyer.png +0 -0
  88. data/lib/generators/social_stream/templates/public/images/btn/index_71.png +0 -0
  89. data/lib/generators/social_stream/templates/public/images/btn/italic.png +0 -0
  90. data/lib/generators/social_stream/templates/public/images/btn/keynote.png +0 -0
  91. data/lib/generators/social_stream/templates/public/images/btn/live.png +0 -0
  92. data/lib/generators/social_stream/templates/public/images/btn/new.png +0 -0
  93. data/lib/generators/social_stream/templates/public/images/btn/next_conference.png +0 -0
  94. data/lib/generators/social_stream/templates/public/images/btn/next_space.png +0 -0
  95. data/lib/generators/social_stream/templates/public/images/btn/notifications.png +0 -0
  96. data/lib/generators/social_stream/templates/public/images/btn/pixel.png +0 -0
  97. data/lib/generators/social_stream/templates/public/images/btn/point_blue.png +0 -0
  98. data/lib/generators/social_stream/templates/public/images/btn/point_gray.png +0 -0
  99. data/lib/generators/social_stream/templates/public/images/btn/subtime.png +0 -0
  100. data/lib/generators/social_stream/templates/public/images/btn/tag_cloud.png +0 -0
  101. data/lib/generators/social_stream/templates/public/images/btn/time.png +0 -0
  102. data/lib/generators/social_stream/templates/public/images/btn/title_background.png +0 -0
  103. data/lib/generators/social_stream/templates/public/images/btn/viewer.png +0 -0
  104. data/lib/generators/social_stream/templates/public/images/frontpage/collaborate.gif +0 -0
  105. data/lib/generators/social_stream/templates/public/images/frontpage/collaborate.png +0 -0
  106. data/lib/generators/social_stream/templates/public/images/frontpage/comments.png +0 -0
  107. data/lib/generators/social_stream/templates/public/images/frontpage/facebook.png +0 -0
  108. data/lib/generators/social_stream/templates/public/images/frontpage/green_sq.png +0 -0
  109. data/lib/generators/social_stream/templates/public/images/frontpage/join.gif +0 -0
  110. data/lib/generators/social_stream/templates/public/images/frontpage/meet.gif +0 -0
  111. data/lib/generators/social_stream/templates/public/images/frontpage/meet.png +0 -0
  112. data/lib/generators/social_stream/templates/public/images/frontpage/people.png +0 -0
  113. data/lib/generators/social_stream/templates/public/images/frontpage/purple_sq.png +0 -0
  114. data/lib/generators/social_stream/templates/public/images/frontpage/right_comments.gif +0 -0
  115. data/lib/generators/social_stream/templates/public/images/frontpage/right_organizers.gif +0 -0
  116. data/lib/generators/social_stream/templates/public/images/frontpage/right_people.gif +0 -0
  117. data/lib/generators/social_stream/templates/public/images/frontpage/right_social.gif +0 -0
  118. data/lib/generators/social_stream/templates/public/images/frontpage/right_tags.gif +0 -0
  119. data/lib/generators/social_stream/templates/public/images/frontpage/right_webcam.gif +0 -0
  120. data/lib/generators/social_stream/templates/public/images/frontpage/share.gif +0 -0
  121. data/lib/generators/social_stream/templates/public/images/frontpage/share.png +0 -0
  122. data/lib/generators/social_stream/templates/public/images/frontpage/tags.png +0 -0
  123. data/lib/generators/social_stream/templates/public/images/frontpage/yellow_sq.png +0 -0
  124. data/lib/generators/social_stream/templates/public/images/logo.png +0 -0
  125. data/lib/generators/social_stream/templates/public/images/logo/dit.png +0 -0
  126. data/lib/generators/social_stream/templates/public/images/logos/original/group.png +0 -0
  127. data/lib/generators/social_stream/templates/public/images/logos/original/user.png +0 -0
  128. data/lib/generators/social_stream/templates/public/javascripts/hoverIntent.js +84 -0
  129. data/lib/generators/social_stream/templates/public/javascripts/jquery-ui-personalized-1.5.2.packed.js +1 -0
  130. data/lib/generators/social_stream/templates/public/javascripts/jquery.boxy.js +570 -0
  131. data/lib/generators/social_stream/templates/public/javascripts/jquery.livequery.js +250 -0
  132. data/lib/generators/social_stream/templates/public/javascripts/main.js +82 -0
  133. data/lib/generators/social_stream/templates/public/javascripts/menu.js +99 -0
  134. data/lib/generators/social_stream/templates/public/javascripts/superfish.js +121 -0
  135. data/lib/generators/social_stream/templates/public/stylesheets/activities.css +231 -0
  136. data/lib/generators/social_stream/templates/public/stylesheets/base.css +68 -0
  137. data/lib/generators/social_stream/templates/public/stylesheets/boxy.css +49 -0
  138. data/lib/generators/social_stream/templates/public/stylesheets/browse.css +120 -0
  139. data/lib/generators/social_stream/templates/public/stylesheets/frontpage.css +708 -0
  140. data/lib/generators/social_stream/templates/public/stylesheets/header.css +107 -0
  141. data/lib/generators/social_stream/templates/public/stylesheets/home.css +98 -0
  142. data/lib/generators/social_stream/templates/public/stylesheets/index.css +632 -0
  143. data/lib/generators/social_stream/templates/public/stylesheets/menu.css +83 -0
  144. data/lib/generators/social_stream/templates/public/stylesheets/middle.css +94 -0
  145. data/lib/generators/social_stream/templates/public/stylesheets/right.css +57 -0
  146. data/lib/generators/social_stream/templates/public/stylesheets/social_stream.css +75 -0
  147. data/lib/generators/social_stream/templates/seeds.yml +1 -1
  148. data/lib/paperclip/{ext.rb → social_stream.rb} +0 -0
  149. data/lib/social_stream/models/actor.rb +1 -1
  150. data/lib/social_stream/rails.rb +3 -2
  151. data/lib/social_stream/rails/common.rb +1 -0
  152. data/lib/social_stream/version.rb +1 -1
  153. data/social_stream.gemspec +2 -1
  154. metadata +156 -11
@@ -0,0 +1,250 @@
1
+ /*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
2
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4
+ *
5
+ * Version: 1.0.3
6
+ * Requires jQuery 1.1.3+
7
+ * Docs: http://docs.jquery.com/Plugins/livequery
8
+ */
9
+
10
+ (function($) {
11
+
12
+ $.extend($.fn, {
13
+ livequery: function(type, fn, fn2) {
14
+ var self = this, q;
15
+
16
+ // Handle different call patterns
17
+ if ($.isFunction(type))
18
+ fn2 = fn, fn = type, type = undefined;
19
+
20
+ // See if Live Query already exists
21
+ $.each( $.livequery.queries, function(i, query) {
22
+ if ( self.selector == query.selector && self.context == query.context &&
23
+ type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
24
+ // Found the query, exit the each loop
25
+ return (q = query) && false;
26
+ });
27
+
28
+ // Create new Live Query if it wasn't found
29
+ q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
30
+
31
+ // Make sure it is running
32
+ q.stopped = false;
33
+
34
+ // Run it immediately for the first time
35
+ q.run();
36
+
37
+ // Contnue the chain
38
+ return this;
39
+ },
40
+
41
+ expire: function(type, fn, fn2) {
42
+ var self = this;
43
+
44
+ // Handle different call patterns
45
+ if ($.isFunction(type))
46
+ fn2 = fn, fn = type, type = undefined;
47
+
48
+ // Find the Live Query based on arguments and stop it
49
+ $.each( $.livequery.queries, function(i, query) {
50
+ if ( self.selector == query.selector && self.context == query.context &&
51
+ (!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
52
+ $.livequery.stop(query.id);
53
+ });
54
+
55
+ // Continue the chain
56
+ return this;
57
+ }
58
+ });
59
+
60
+ $.livequery = function(selector, context, type, fn, fn2) {
61
+ this.selector = selector;
62
+ this.context = context || document;
63
+ this.type = type;
64
+ this.fn = fn;
65
+ this.fn2 = fn2;
66
+ this.elements = [];
67
+ this.stopped = false;
68
+
69
+ // The id is the index of the Live Query in $.livequery.queries
70
+ this.id = $.livequery.queries.push(this)-1;
71
+
72
+ // Mark the functions for matching later on
73
+ fn.$lqguid = fn.$lqguid || $.livequery.guid++;
74
+ if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
75
+
76
+ // Return the Live Query
77
+ return this;
78
+ };
79
+
80
+ $.livequery.prototype = {
81
+ stop: function() {
82
+ var query = this;
83
+
84
+ if ( this.type )
85
+ // Unbind all bound events
86
+ this.elements.unbind(this.type, this.fn);
87
+ else if (this.fn2)
88
+ // Call the second function for all matched elements
89
+ this.elements.each(function(i, el) {
90
+ query.fn2.apply(el);
91
+ });
92
+
93
+ // Clear out matched elements
94
+ this.elements = [];
95
+
96
+ // Stop the Live Query from running until restarted
97
+ this.stopped = true;
98
+ },
99
+
100
+ run: function() {
101
+ // Short-circuit if stopped
102
+ if ( this.stopped ) return;
103
+ var query = this;
104
+
105
+ var oEls = this.elements,
106
+ els = $(this.selector, this.context),
107
+ nEls = els.not(oEls);
108
+
109
+ // Set elements to the latest set of matched elements
110
+ this.elements = els;
111
+
112
+ if (this.type) {
113
+ // Bind events to newly matched elements
114
+ nEls.bind(this.type, this.fn);
115
+
116
+ // Unbind events to elements no longer matched
117
+ if (oEls.length > 0)
118
+ $.each(oEls, function(i, el) {
119
+ if ( $.inArray(el, els) < 0 )
120
+ $.event.remove(el, query.type, query.fn);
121
+ });
122
+ }
123
+ else {
124
+ // Call the first function for newly matched elements
125
+ nEls.each(function() {
126
+ query.fn.apply(this);
127
+ });
128
+
129
+ // Call the second function for elements no longer matched
130
+ if ( this.fn2 && oEls.length > 0 )
131
+ $.each(oEls, function(i, el) {
132
+ if ( $.inArray(el, els) < 0 )
133
+ query.fn2.apply(el);
134
+ });
135
+ }
136
+ }
137
+ };
138
+
139
+ $.extend($.livequery, {
140
+ guid: 0,
141
+ queries: [],
142
+ queue: [],
143
+ running: false,
144
+ timeout: null,
145
+
146
+ checkQueue: function() {
147
+ if ( $.livequery.running && $.livequery.queue.length ) {
148
+ var length = $.livequery.queue.length;
149
+ // Run each Live Query currently in the queue
150
+ while ( length-- )
151
+ $.livequery.queries[ $.livequery.queue.shift() ].run();
152
+ }
153
+ },
154
+
155
+ pause: function() {
156
+ // Don't run anymore Live Queries until restarted
157
+ $.livequery.running = false;
158
+ },
159
+
160
+ play: function() {
161
+ // Restart Live Queries
162
+ $.livequery.running = true;
163
+ // Request a run of the Live Queries
164
+ $.livequery.run();
165
+ },
166
+
167
+ registerPlugin: function() {
168
+ $.each( arguments, function(i,n) {
169
+ // Short-circuit if the method doesn't exist
170
+ if (!$.fn[n]) return;
171
+
172
+ // Save a reference to the original method
173
+ var old = $.fn[n];
174
+
175
+ // Create a new method
176
+ $.fn[n] = function() {
177
+ // Call the original method
178
+ var r = old.apply(this, arguments);
179
+
180
+ // Request a run of the Live Queries
181
+ $.livequery.run();
182
+
183
+ // Return the original methods result
184
+ return r;
185
+ }
186
+ });
187
+ },
188
+
189
+ run: function(id) {
190
+ if (id != undefined) {
191
+ // Put the particular Live Query in the queue if it doesn't already exist
192
+ if ( $.inArray(id, $.livequery.queue) < 0 )
193
+ $.livequery.queue.push( id );
194
+ }
195
+ else
196
+ // Put each Live Query in the queue if it doesn't already exist
197
+ $.each( $.livequery.queries, function(id) {
198
+ if ( $.inArray(id, $.livequery.queue) < 0 )
199
+ $.livequery.queue.push( id );
200
+ });
201
+
202
+ // Clear timeout if it already exists
203
+ if ($.livequery.timeout) clearTimeout($.livequery.timeout);
204
+ // Create a timeout to check the queue and actually run the Live Queries
205
+ $.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
206
+ },
207
+
208
+ stop: function(id) {
209
+ if (id != undefined)
210
+ // Stop are particular Live Query
211
+ $.livequery.queries[ id ].stop();
212
+ else
213
+ // Stop all Live Queries
214
+ $.each( $.livequery.queries, function(id) {
215
+ $.livequery.queries[ id ].stop();
216
+ });
217
+ }
218
+ });
219
+
220
+ // Register core DOM manipulation methods
221
+ $.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');
222
+
223
+ // Run Live Queries when the Document is ready
224
+ $(function() { $.livequery.play(); });
225
+
226
+
227
+ // Save a reference to the original init method
228
+ var init = $.prototype.init;
229
+
230
+ // Create a new init method that exposes two new properties: selector and context
231
+ $.prototype.init = function(a,c) {
232
+ // Call the original init and save the result
233
+ var r = init.apply(this, arguments);
234
+
235
+ // Copy over properties if they exist already
236
+ if (a && a.selector)
237
+ r.context = a.context, r.selector = a.selector;
238
+
239
+ // Set properties
240
+ if ( typeof a == 'string' )
241
+ r.context = c || document, r.selector = a;
242
+
243
+ // Return the result
244
+ return r;
245
+ };
246
+
247
+ // Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
248
+ $.prototype.init.prototype = $.prototype;
249
+
250
+ })(jQuery);
@@ -0,0 +1,82 @@
1
+ // initialise plugins
2
+ jQuery(function(){
3
+ jQuery('ul.sf-menu').superfish();
4
+ });
5
+
6
+ $(document).ready(function() {
7
+ $('#tabvanilla > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
8
+
9
+ });
10
+ $(document).ready(function() {
11
+ $('#tabright> ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
12
+
13
+ });
14
+
15
+ $(document).ready(function() {
16
+ $('#tabconferences> ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
17
+
18
+ });
19
+
20
+ $(document).ready(function() {
21
+ $('#tabconference_browse> ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
22
+
23
+ });
24
+
25
+ $(document).ready(function() {
26
+
27
+
28
+ $("#info_evento").hide();
29
+ $("#dia_1").hide();
30
+
31
+
32
+
33
+ $("#hiddenMiddle").hide();
34
+ $("#hiddenRight").hide();
35
+
36
+
37
+ $(".menu > li").click(function(e){
38
+ var a = e.target.id;
39
+ //desactivamos seccion y activamos elemento de menu
40
+ $(".menu li.active").removeClass("active");
41
+ $(".menu #"+a).addClass("active");
42
+ //ocultamos divisiones, mostramos la seleccionada
43
+ $(".content_chat").css("display", "none");
44
+ $("."+a).fadeIn();
45
+ });
46
+
47
+ $('#wideViewMiddle').toggle(
48
+ function(){
49
+ $("#middleContent").hide();
50
+ $('#content').addClass("wideA");
51
+ $('#middle').addClass("wideA");
52
+ $('#right').addClass("wideA");
53
+ $('#chat').addClass("wideA");
54
+ $("#hiddenMiddle").show();
55
+
56
+ },
57
+ function(){
58
+ $("#rightContent").hide();
59
+ $('#content').addClass("wideB");
60
+ $('#middle').addClass("wideB");
61
+ $('#right').addClass("wideB");
62
+ $('#chat').addClass("wideB");
63
+ $("#hiddenRight").show();
64
+ },
65
+ function(){
66
+ $("#hiddenRight").hide();
67
+ $('#content').removeClass("wideB");
68
+ $('#middle').removeClass("wideB");
69
+ $('#right').removeClass("wideB");
70
+ $('#chat').removeClass("wideB");
71
+ $("#rightContent").show();
72
+
73
+ },
74
+ function(){
75
+ $("#hiddenMiddle").hide();
76
+ $('#content').removeClass("wideA");
77
+ $('#middle').removeClass("wideA");
78
+ $('#right').removeClass("wideA");
79
+ $('#chat').removeClass("wideA");
80
+ $("#middleContent").show();
81
+ });
82
+ });
@@ -0,0 +1,99 @@
1
+ /*
2
+ Simple JQuery menu.
3
+ HTML structure to use:
4
+
5
+ Notes:
6
+
7
+ Each menu MUST have a class 'menu' set. If the menu doesn't have this, the JS won't make it dynamic
8
+ If you want a panel to be expanded at page load, give the containing LI element the classname 'expand'.
9
+ Use this to set the right state in your page (generation) code.
10
+
11
+ Optional extra classnames for the UL element that holds an accordion:
12
+
13
+ noaccordion : no accordion functionality
14
+ collapsible : menu works like an accordion but can be fully collapsed
15
+
16
+ <ul class="menu [optional class] [optional class]">
17
+ <li><a href="#">Sub menu heading</a>
18
+ <ul>
19
+ <li><a href="http://site.com/">Link</a></li>
20
+ <li><a href="http://site.com/">Link</a></li>
21
+ <li><a href="http://site.com/">Link</a></li>
22
+ ...
23
+ ...
24
+ </ul>
25
+ // This item is open at page load time
26
+ <li class="expand"><a href="#">Sub menu heading</a>
27
+ <ul>
28
+ <li><a href="http://site.com/">Link</a></li>
29
+ <li><a href="http://site.com/">Link</a></li>
30
+ <li><a href="http://site.com/">Link</a></li>
31
+ ...
32
+ ...
33
+ </ul>
34
+ ...
35
+ ...
36
+ </ul>
37
+
38
+ Copyright 2007-2010 by Marco van Hylckama Vlieg
39
+
40
+ web: http://www.i-marco.nl/weblog/
41
+ email: marco@i-marco.nl
42
+
43
+ Free to use any way you like.
44
+ */
45
+
46
+
47
+ jQuery.fn.initMenu = function() {
48
+ return this.each(function(){
49
+ var theMenu = $(this).get(0);
50
+ $('.acitem', this).hide();
51
+ $('li.expand > .acitem', this).show();
52
+ $('li.expand > .acitem', this).prev().addClass('active');
53
+ $('li a', this).click(
54
+ function(e) {
55
+ e.stopImmediatePropagation();
56
+ var theElement = $(this).next();
57
+ var parent = this.parentNode.parentNode;
58
+ if($(parent).hasClass('noaccordion')) {
59
+ if(theElement[0] === undefined) {
60
+ window.location.href = this.href;
61
+ }
62
+ $(theElement).slideToggle('normal', function() {
63
+ if ($(this).is(':visible')) {
64
+ $(this).prev().addClass('active');
65
+ }
66
+ else {
67
+ $(this).prev().removeClass('active');
68
+ }
69
+ });
70
+ return false;
71
+ }
72
+ else {
73
+ if(theElement.hasClass('acitem') && theElement.is(':visible')) {
74
+ if($(parent).hasClass('collapsible')) {
75
+ $('.acitem:visible', parent).first().slideUp('normal',
76
+ function() {
77
+ $(this).prev().removeClass('active');
78
+ }
79
+ );
80
+ return false;
81
+ }
82
+ return false;
83
+ }
84
+ if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
85
+ $('.acitem:visible', parent).first().slideUp('normal', function() {
86
+ $(this).prev().removeClass('active');
87
+ });
88
+ theElement.slideDown('normal', function() {
89
+ $(this).prev().addClass('active');
90
+ });
91
+ return false;
92
+ }
93
+ }
94
+ }
95
+ );
96
+ });
97
+ };
98
+
99
+ $(document).ready(function() {$('.menu').initMenu();});
@@ -0,0 +1,121 @@
1
+
2
+ /*
3
+ * Superfish v1.4.8 - jQuery menu widget
4
+ * Copyright (c) 2008 Joel Birch
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ *
10
+ * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
11
+ */
12
+
13
+ ;(function($){
14
+ $.fn.superfish = function(op){
15
+
16
+ var sf = $.fn.superfish,
17
+ c = sf.c,
18
+ $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
19
+ over = function(){
20
+ var $$ = $(this), menu = getMenu($$);
21
+ clearTimeout(menu.sfTimer);
22
+ $$.showSuperfishUl().siblings().hideSuperfishUl();
23
+ },
24
+ out = function(){
25
+ var $$ = $(this), menu = getMenu($$), o = sf.op;
26
+ clearTimeout(menu.sfTimer);
27
+ menu.sfTimer=setTimeout(function(){
28
+ o.retainPath=($.inArray($$[0],o.$path)>-1);
29
+ $$.hideSuperfishUl();
30
+ if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
31
+ },o.delay);
32
+ },
33
+ getMenu = function($menu){
34
+ var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
35
+ sf.op = sf.o[menu.serial];
36
+ return menu;
37
+ },
38
+ addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
39
+
40
+ return this.each(function() {
41
+ var s = this.serial = sf.o.length;
42
+ var o = $.extend({},sf.defaults,op);
43
+ o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
44
+ $(this).addClass([o.hoverClass,c.bcClass].join(' '))
45
+ .filter('li:has(ul)').removeClass(o.pathClass);
46
+ });
47
+ sf.o[s] = sf.op = o;
48
+
49
+ $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
50
+ if (o.autoArrows) addArrow( $('>a:first-child',this) );
51
+ })
52
+ .not('.'+c.bcClass)
53
+ .hideSuperfishUl();
54
+
55
+ var $a = $('a',this);
56
+ $a.each(function(i){
57
+ var $li = $a.eq(i).parents('li');
58
+ $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
59
+ });
60
+ o.onInit.call(this);
61
+
62
+ }).each(function() {
63
+ var menuClasses = [c.menuClass];
64
+ if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
65
+ $(this).addClass(menuClasses.join(' '));
66
+ });
67
+ };
68
+
69
+ var sf = $.fn.superfish;
70
+ sf.o = [];
71
+ sf.op = {};
72
+ sf.IE7fix = function(){
73
+ var o = sf.op;
74
+ if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
75
+ this.toggleClass(sf.c.shadowClass+'-off');
76
+ };
77
+ sf.c = {
78
+ bcClass : 'sf-breadcrumb',
79
+ menuClass : 'sf-js-enabled',
80
+ anchorClass : 'sf-with-ul',
81
+ arrowClass : 'sf-sub-indicator',
82
+ shadowClass : 'sf-shadow'
83
+ };
84
+ sf.defaults = {
85
+ hoverClass : 'sfHover',
86
+ pathClass : 'overideThisToUse',
87
+ pathLevels : 1,
88
+ delay : 800,
89
+ animation : {opacity:'show'},
90
+ speed : 'normal',
91
+ autoArrows : true,
92
+ dropShadows : true,
93
+ disableHI : false, // true disables hoverIntent detection
94
+ onInit : function(){}, // callback functions
95
+ onBeforeShow: function(){},
96
+ onShow : function(){},
97
+ onHide : function(){}
98
+ };
99
+ $.fn.extend({
100
+ hideSuperfishUl : function(){
101
+ var o = sf.op,
102
+ not = (o.retainPath===true) ? o.$path : '';
103
+ o.retainPath = false;
104
+ var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
105
+ .find('>ul').hide().css('visibility','hidden');
106
+ o.onHide.call($ul);
107
+ return this;
108
+ },
109
+ showSuperfishUl : function(){
110
+ var o = sf.op,
111
+ sh = sf.c.shadowClass+'-off',
112
+ $ul = this.addClass(o.hoverClass)
113
+ .find('>ul:hidden').css('visibility','visible');
114
+ sf.IE7fix.call($ul);
115
+ o.onBeforeShow.call($ul);
116
+ $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
117
+ return this;
118
+ }
119
+ });
120
+
121
+ })(jQuery);