spontaneous 0.2.0.beta5 → 0.2.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +39 -0
  4. data/Gemfile +2 -0
  5. data/Readme.markdown +4 -4
  6. data/application/css/core.css.scss +144 -43
  7. data/application/css/definitions.css.scss +50 -16
  8. data/application/css/dialogue.css.scss +5 -2
  9. data/application/css/editing.css.scss +7 -7
  10. data/application/css/font.css.scss +1 -1
  11. data/application/css/meta.css.scss +6 -6
  12. data/application/css/popover.css.scss +6 -6
  13. data/application/css/top.css.scss +8 -1
  14. data/application/js/add_alias_dialogue.js +137 -36
  15. data/application/js/add_home_dialogue.js +10 -10
  16. data/application/js/ajax.js +26 -26
  17. data/application/js/authentication.js +2 -2
  18. data/application/js/box.js +21 -10
  19. data/application/js/box_container.js +13 -7
  20. data/application/js/compatibility.js +19 -17
  21. data/application/js/conflicted_field_dialogue.js +5 -5
  22. data/application/js/content.js +22 -16
  23. data/application/js/content_area.js +62 -33
  24. data/application/js/dialogue.js +16 -16
  25. data/application/js/dom.js +9 -10
  26. data/application/js/edit_panel.js +25 -20
  27. data/application/js/editing.js +21 -8
  28. data/application/js/entry.js +1 -1
  29. data/application/js/extensions.js +11 -11
  30. data/application/js/field/boolean.js +6 -6
  31. data/application/js/field/date.js +1 -1
  32. data/application/js/field/file.js +17 -17
  33. data/application/js/field/image.js +27 -27
  34. data/application/js/field/markdown.js +72 -71
  35. data/application/js/field/select.js +9 -9
  36. data/application/js/field/string.js +3 -3
  37. data/application/js/field/webvideo.js +2 -2
  38. data/application/js/field_preview.js +3 -0
  39. data/application/js/init.js +3 -2
  40. data/application/js/jquery-selection-position.js +13 -13
  41. data/application/js/location.js +17 -12
  42. data/application/js/login.js +2 -2
  43. data/application/js/meta_view/user_admin.js +101 -101
  44. data/application/js/metadata.js +1 -1
  45. data/application/js/page.js +2 -2
  46. data/application/js/page_browser.js +13 -13
  47. data/application/js/page_entry.js +1 -1
  48. data/application/js/panel/root_menu.js +10 -10
  49. data/application/js/popover.js +6 -5
  50. data/application/js/popover_view.js +5 -5
  51. data/application/js/preview.js +10 -4
  52. data/application/js/progress.js +6 -6
  53. data/application/js/properties.js +35 -6
  54. data/application/js/publish.js +43 -43
  55. data/application/js/require.js +14 -14
  56. data/application/js/services.js +3 -3
  57. data/application/js/sharded_upload.js +9 -8
  58. data/application/js/side_bar.js +5 -5
  59. data/application/js/state.js +2 -2
  60. data/application/js/status_bar.js +6 -6
  61. data/application/js/top_bar.js +97 -65
  62. data/application/js/types.js +9 -6
  63. data/application/js/upload.js +4 -4
  64. data/application/js/upload_manager.js +21 -21
  65. data/application/js/user.js +1 -1
  66. data/application/js/vendor/jquery.velocity.min.js +7 -0
  67. data/application/js/views.js +32 -8
  68. data/application/js/views/box_view.js +51 -31
  69. data/application/js/views/page_piece_view.js +17 -15
  70. data/application/js/views/page_view.js +54 -43
  71. data/application/js/views/piece_view.js +44 -37
  72. data/application/static/font/fontawesome-webfont-4f0022f25672c7f501c339cbf98d9117.ttf +0 -0
  73. data/application/views/index.erb +1 -0
  74. data/db/migrations/20130114120000_create_revision_tables.rb +2 -1
  75. data/db/migrations/20130813111009_increase_path_length.rb +11 -2
  76. data/db/migrations/20140506171823_add_index_to_target_id.rb +11 -0
  77. data/db/migrations/20140514090204_add_content_hash.rb +59 -0
  78. data/db/migrations/20140519150253_add_content_hash_timestamp.rb +20 -0
  79. data/lib/spontaneous.rb +0 -1
  80. data/lib/spontaneous/asset/environment.rb +77 -15
  81. data/lib/spontaneous/box.rb +21 -0
  82. data/lib/spontaneous/capistrano/deploy.rb +1 -1
  83. data/lib/spontaneous/capistrano/sync.rb +8 -7
  84. data/lib/spontaneous/change.rb +4 -2
  85. data/lib/spontaneous/cli/fields.rb +7 -3
  86. data/lib/spontaneous/cli/generate.rb +2 -0
  87. data/lib/spontaneous/cli/init.rb +24 -93
  88. data/lib/spontaneous/cli/init/db.rb +94 -0
  89. data/lib/spontaneous/cli/init/mysql.rb +17 -0
  90. data/lib/spontaneous/cli/init/postgresql.rb +33 -0
  91. data/lib/spontaneous/cli/init/sqlite.rb +14 -0
  92. data/lib/spontaneous/cli/site.rb +45 -20
  93. data/lib/spontaneous/collections/box_set.rb +3 -0
  94. data/lib/spontaneous/collections/entry_set.rb +43 -4
  95. data/lib/spontaneous/collections/field_set.rb +14 -2
  96. data/lib/spontaneous/data_mapper.rb +40 -7
  97. data/lib/spontaneous/data_mapper/content_model.rb +1 -1
  98. data/lib/spontaneous/data_mapper/content_model/associations.rb +63 -12
  99. data/lib/spontaneous/data_mapper/content_model/timestamps.rb +9 -14
  100. data/lib/spontaneous/data_mapper/content_table.rb +4 -2
  101. data/lib/spontaneous/data_mapper/dataset.rb +31 -2
  102. data/lib/spontaneous/data_mapper/scope.rb +37 -20
  103. data/lib/spontaneous/errors.rb +6 -0
  104. data/lib/spontaneous/facet.rb +20 -10
  105. data/lib/spontaneous/field/base.rb +8 -1
  106. data/lib/spontaneous/field/file.rb +28 -3
  107. data/lib/spontaneous/field/image.rb +2 -0
  108. data/lib/spontaneous/field/update.rb +6 -0
  109. data/lib/spontaneous/field/webvideo/vimeo.rb +6 -1
  110. data/lib/spontaneous/field/webvideo/vine.rb +1 -1
  111. data/lib/spontaneous/field/webvideo/youtube.rb +1 -1
  112. data/lib/spontaneous/generators/site.rb +6 -4
  113. data/lib/spontaneous/generators/site/.gitignore +1 -0
  114. data/lib/spontaneous/generators/site/Gemfile.tt +3 -3
  115. data/lib/spontaneous/generators/site/config/{indexes.rb.tt → initializers/indexes.rb.tt} +0 -0
  116. data/lib/spontaneous/generators/site/config/initializers/publishing.rb.tt +78 -0
  117. data/lib/spontaneous/generators/site/{config/database.yml.tt → db/mysql2.yml.tt} +7 -6
  118. data/lib/spontaneous/generators/site/db/postgres.yml.tt +25 -0
  119. data/lib/spontaneous/generators/site/db/sqlite3.yml.tt +18 -0
  120. data/lib/spontaneous/generators/site/public/humans.txt.tt +14 -0
  121. data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +51 -0
  122. data/lib/spontaneous/loader.rb +1 -1
  123. data/lib/spontaneous/logger.rb +1 -1
  124. data/lib/spontaneous/media/image/optimizer.rb +1 -1
  125. data/lib/spontaneous/media/image/processor.rb +11 -2
  126. data/lib/spontaneous/media/image/renderable.rb +2 -0
  127. data/lib/spontaneous/model.rb +3 -0
  128. data/lib/spontaneous/model/box/allowed_types.rb +17 -4
  129. data/lib/spontaneous/model/core.rb +36 -3
  130. data/lib/spontaneous/model/core/aliases.rb +5 -2
  131. data/lib/spontaneous/model/core/boxes.rb +6 -0
  132. data/lib/spontaneous/model/core/cascading_change.rb +38 -0
  133. data/lib/spontaneous/model/core/content_hash.rb +171 -0
  134. data/lib/spontaneous/model/core/entries.rb +0 -19
  135. data/lib/spontaneous/model/core/fields.rb +11 -0
  136. data/lib/spontaneous/model/core/modifications.rb +22 -21
  137. data/lib/spontaneous/model/core/render.rb +3 -0
  138. data/lib/spontaneous/model/core/serialisation.rb +18 -17
  139. data/lib/spontaneous/model/page.rb +35 -8
  140. data/lib/spontaneous/model/page/page_tree.rb +20 -8
  141. data/lib/spontaneous/model/page/paths.rb +79 -50
  142. data/lib/spontaneous/model/page/singleton.rb +71 -0
  143. data/lib/spontaneous/model/page/site_map.rb +2 -1
  144. data/lib/spontaneous/model/page/site_timestamps.rb +2 -2
  145. data/lib/spontaneous/model/piece.rb +10 -0
  146. data/lib/spontaneous/output/context.rb +13 -6
  147. data/lib/spontaneous/output/format.rb +30 -5
  148. data/lib/spontaneous/output/helpers/script_helper.rb +8 -0
  149. data/lib/spontaneous/output/helpers/stylesheet_helper.rb +7 -0
  150. data/lib/spontaneous/output/renderable.rb +16 -0
  151. data/lib/spontaneous/output/store.rb +1 -1
  152. data/lib/spontaneous/output/template/renderer.rb +2 -2
  153. data/lib/spontaneous/page_piece.rb +25 -1
  154. data/lib/spontaneous/prototypes/box_prototype.rb +13 -0
  155. data/lib/spontaneous/prototypes/field_prototype.rb +7 -4
  156. data/lib/spontaneous/publishing.rb +10 -5
  157. data/lib/spontaneous/publishing/immediate.rb +32 -349
  158. data/lib/spontaneous/publishing/pipeline.rb +43 -0
  159. data/lib/spontaneous/publishing/progress.rb +186 -0
  160. data/lib/spontaneous/publishing/publish.rb +107 -0
  161. data/lib/spontaneous/publishing/rerender.rb +17 -0
  162. data/lib/spontaneous/publishing/revision.rb +53 -18
  163. data/lib/spontaneous/publishing/simultaneous.rb +1 -1
  164. data/lib/spontaneous/publishing/steps.rb +154 -0
  165. data/lib/spontaneous/publishing/steps/activate_revision.rb +45 -0
  166. data/lib/spontaneous/publishing/steps/archive_old_revisions.rb +22 -0
  167. data/lib/spontaneous/publishing/steps/base_step.rb +49 -0
  168. data/lib/spontaneous/publishing/steps/copy_static_files.rb +74 -0
  169. data/lib/spontaneous/publishing/steps/create_revision_directory.rb +24 -0
  170. data/lib/spontaneous/publishing/steps/generate_rackup_file.rb +51 -0
  171. data/lib/spontaneous/publishing/steps/generate_search_indexes.rb +24 -0
  172. data/lib/spontaneous/publishing/steps/render_revision.rb +69 -0
  173. data/lib/spontaneous/publishing/steps/write_revision_file.rb +43 -0
  174. data/lib/spontaneous/rack/back.rb +3 -1
  175. data/lib/spontaneous/rack/back/alias.rb +9 -8
  176. data/lib/spontaneous/rack/front.rb +1 -1
  177. data/lib/spontaneous/rack/middleware.rb +7 -4
  178. data/lib/spontaneous/rack/middleware/transaction.rb +14 -0
  179. data/lib/spontaneous/rack/page_controller.rb +23 -8
  180. data/lib/spontaneous/revision.rb +5 -10
  181. data/lib/spontaneous/schema.rb +5 -0
  182. data/lib/spontaneous/server.rb +3 -1
  183. data/lib/spontaneous/site.rb +17 -10
  184. data/lib/spontaneous/site/publishing.rb +25 -3
  185. data/lib/spontaneous/site/state.rb +7 -3
  186. data/lib/spontaneous/tasks/database.rake +5 -10
  187. data/lib/spontaneous/utils/database/mysql_dumper.rb +5 -1
  188. data/lib/spontaneous/version.rb +1 -1
  189. data/spontaneous.gemspec +4 -3
  190. data/test/fixtures/example_application/config/initializers/initializer1.rb +1 -0
  191. data/test/fixtures/example_application/config/initializers/initializer2.rb +1 -0
  192. data/test/fixtures/example_application/config/initializers/publishing.rb +13 -0
  193. data/test/fixtures/search/config/{indexes.rb → initializers/indexes.rb} +0 -0
  194. data/test/fixtures/serialisation/root_hash.yaml.erb +10 -4
  195. data/test/functional/test_application.rb +10 -0
  196. data/test/functional/test_back.rb +23 -5
  197. data/test/functional/test_cli.rb +98 -34
  198. data/test/functional/test_front.rb +7 -3
  199. data/test/test_helper.rb +35 -28
  200. data/test/unit/test_alias.rb +20 -3
  201. data/test/unit/test_assets.rb +58 -30
  202. data/test/unit/test_changesets.rb +20 -12
  203. data/test/unit/test_content_hash.rb +496 -0
  204. data/test/unit/test_context.rb +28 -1
  205. data/test/unit/test_controllers.rb +96 -61
  206. data/test/unit/test_crypt.rb +1 -8
  207. data/test/unit/test_datamapper.rb +95 -19
  208. data/test/unit/test_features.rb +1 -4
  209. data/test/unit/test_fields.rb +61 -12
  210. data/test/unit/test_generators.rb +39 -2
  211. data/test/unit/test_images.rb +3 -1
  212. data/test/unit/test_modifications.rb +224 -219
  213. data/test/unit/test_output_store.rb +10 -0
  214. data/test/unit/{test_formats.rb → test_outputs.rb} +75 -6
  215. data/test/unit/test_page.rb +61 -15
  216. data/test/unit/test_plugins.rb +2 -42
  217. data/test/unit/test_publishing_pipeline.rb +1050 -0
  218. data/test/unit/test_render.rb +30 -0
  219. data/test/unit/test_revisions.rb +110 -2
  220. data/test/unit/test_schema.rb +4 -0
  221. data/test/unit/test_search.rb +1 -1
  222. data/test/unit/test_serialisation.rb +6 -1
  223. data/test/unit/test_singletons.rb +159 -0
  224. data/test/unit/test_site.rb +71 -44
  225. metadata +140 -86
  226. data/application/static/font/fontawesome-webfont-1c66a4738b40ef0f6b1abca0ba9a796d.ttf +0 -0
  227. data/test/unit/test_publishing.rb +0 -330
@@ -2,8 +2,8 @@
2
2
 
3
3
  Spontaneous.Types = (function($, S) {
4
4
  var ajax = S.Ajax
5
- , user = S.User
6
- , type_map = {};
5
+ , user = S.User
6
+ , type_map = {};
7
7
 
8
8
  var BoxPrototype = new JS.Class({
9
9
  initialize: function(type_data) {
@@ -47,12 +47,15 @@ Spontaneous.Types = (function($, S) {
47
47
  this.field_names.push(f.name);
48
48
  this.field_prototypes[f.name] = f;
49
49
  }
50
- for (var i = 0, ii = boxes.length; i < ii; i++) {
50
+ for (i = 0, ii = boxes.length; i < ii; i++) {
51
51
  var b = boxes[i];
52
52
  this.box_ids.push(b.id);
53
53
  this.box_prototypes[b.id] = new BoxPrototype(b);
54
54
  }
55
55
  },
56
+ isWritable: function() {
57
+ return this.data.writable;
58
+ },
56
59
  box_prototype: function(box_id) {
57
60
  return this.box_prototypes[box_id];
58
61
  },
@@ -63,12 +66,12 @@ Spontaneous.Types = (function($, S) {
63
66
  return this.data.is_alias;
64
67
  },
65
68
  edit_url: function() {
66
- return S.editor_protocol + "://open?url=file://"+this.data.source;
69
+ return S.editor_protocol + '://open?url=file://'+this.data.source;
67
70
  },
68
71
  display_title: function(content) {
69
72
  var t = this.title;
70
73
  if (user.is_developer()) {
71
- t += "/" + content.id();
74
+ t += '/' + content.id();
72
75
  }
73
76
  return t;
74
77
  }
@@ -77,7 +80,7 @@ Spontaneous.Types = (function($, S) {
77
80
  include: Spontaneous.Properties,
78
81
  loaded: function(typeData) {
79
82
  var types = {};
80
- for (id in typeData) {
83
+ for (var id in typeData) {
81
84
  if (typeData.hasOwnProperty(id)) {
82
85
  types[id] = new Type(typeData[id]);
83
86
  }
@@ -34,14 +34,14 @@ Spontaneous.Upload = (function($, S) {
34
34
  if (this.target_version) {
35
35
  form.append('version', this.target_version);
36
36
  }
37
- this.put("/file/"+this.target_id, form);
37
+ this.put('/file/'+this.target_id, form);
38
38
  },
39
39
 
40
40
  post: function(url, form_data) {
41
- this.request("POST", url, form_data)
41
+ this.request('POST', url, form_data);
42
42
  },
43
43
  put: function(url, form_data) {
44
- this.request("PUT", url, form_data)
44
+ this.request('PUT', url, form_data);
45
45
  },
46
46
  request: function(verb, url, form_data) {
47
47
  this.xhr = S.Ajax.authenticatedRequest();
@@ -78,7 +78,7 @@ Spontaneous.Upload = (function($, S) {
78
78
  if (xhr.readyState == 4) {
79
79
  if (xhr.status === 200) {
80
80
  if (!this.complete) {
81
- console.log(xhr)
81
+ console.log(xhr);
82
82
  var result = JSON.parse(xhr.responseText);
83
83
  this.manager.upload_complete(this, result);
84
84
  this.complete = true;
@@ -8,21 +8,21 @@ Spontaneous.UploadManager = (function($, S) {
8
8
  start: function() {
9
9
  var form = new FormData();
10
10
  form.append('file', this.file);
11
- this.post(["/file", this.target_id].join('/'), form);
11
+ this.post(['/file', this.target_id].join('/'), form);
12
12
  }
13
13
  });
14
14
  var ShardedWrapUpload = new JS.Class(S.ShardedUpload, {
15
15
  path: function() {
16
- return ["/shard", this.target_id].join('/');
16
+ return ['/shard', this.target_id].join('/');
17
17
  },
18
- method: "POST"
18
+ method: 'POST'
19
19
  });
20
20
  var FormUpload = new JS.Class(Upload, {
21
21
  initialize: function(manager, target, form_data, size) {
22
- this.callSuper(manager, target, form_data)
22
+ this.callSuper(manager, target, form_data);
23
23
  this.form_data = this.file;
24
24
  this._total = size;
25
- this.name = "Saving...";
25
+ this.name = 'Saving...';
26
26
  },
27
27
  start: function() {
28
28
  this.put(this.target.save_path(), this.form_data);
@@ -54,10 +54,10 @@ Spontaneous.UploadManager = (function($, S) {
54
54
  replace: function(field, file) {
55
55
  var uploader_class = Upload;
56
56
  if (S.ShardedUpload.supported()) {
57
- console.log('Using sharded uploader')
57
+ console.log('Using sharded uploader');
58
58
  uploader_class = S.ShardedUpload;
59
59
  }
60
- this.add(field, new uploader_class(this, field, file))
60
+ this.add(field, new uploader_class(this, field, file));
61
61
  if (!this.current) {
62
62
  this.next();
63
63
  }
@@ -67,11 +67,11 @@ Spontaneous.UploadManager = (function($, S) {
67
67
  for (var i = 0, ii = files.length; i < ii; i++) {
68
68
  var file = files[i], upload, upload_class = WrapUpload;
69
69
  if (S.ShardedUpload.supported()) {
70
- console.log('Using sharded uploader')
70
+ console.log('Using sharded uploader');
71
71
  upload_class = ShardedWrapUpload;
72
72
  }
73
73
  upload = new upload_class(this, slot, file, position);
74
- this.add(slot, upload)
74
+ this.add(slot, upload);
75
75
  }
76
76
  if (!this.current) {
77
77
  this.next();
@@ -79,7 +79,7 @@ Spontaneous.UploadManager = (function($, S) {
79
79
  },
80
80
  form: function(content, form_data, file_size) {
81
81
  var upload = new FormUpload(this, content, form_data, file_size);
82
- this.add(content, upload)
82
+ this.add(content, upload);
83
83
  if (!this.current) {
84
84
  this.next();
85
85
  }
@@ -92,12 +92,12 @@ Spontaneous.UploadManager = (function($, S) {
92
92
  this.finished();
93
93
  } else {
94
94
  var upload = this.failed.pop(), delay = Math.pow(2, upload.failure_count);
95
- console.log("UploadManager.next", "scheduling re-try of failed upload after", delay, "seconds");
95
+ console.log('UploadManager.next', 'scheduling re-try of failed upload after', delay, 'seconds');
96
96
  this.pending.push(upload);
97
97
  window.setTimeout(function() {
98
- console.log("UploadManager.next", "re-trying failed upload");
98
+ console.log('UploadManager.next', 're-trying failed upload');
99
99
  this.next();
100
- }.bind(this), delay * 1000);
100
+ }.bind(this), delay * 1000);
101
101
  }
102
102
  return;
103
103
  }
@@ -137,7 +137,7 @@ Spontaneous.UploadManager = (function($, S) {
137
137
  for (var i = 0, ii = this.completed.length; i < ii; i++) {
138
138
  total += this.completed[i].total();
139
139
  }
140
- for (var i = 0, ii = this.pending.length; i < ii; i++) {
140
+ for (i = 0, ii = this.pending.length; i < ii; i++) {
141
141
  total += this.pending[i].total();
142
142
  }
143
143
  if (this.current) {
@@ -182,11 +182,11 @@ Spontaneous.UploadManager = (function($, S) {
182
182
  },
183
183
  set_bar_length: function(bar_name, position, total) {
184
184
  var bar = this.bars[bar_name], percent = (position/total) * 100;
185
- bar.css('width', percent+"%");
185
+ bar.css('width', percent+'%');
186
186
  },
187
187
  upload_progress: function(upload) {
188
188
  if (upload !== this.current) {
189
- console.warn("UploadManager#upload_progress", "completed upload does not match current")
189
+ console.warn('UploadManager#upload_progress', 'completed upload does not match current');
190
190
  }
191
191
  var target = this.targets[upload.uid];
192
192
  if (target) {
@@ -196,7 +196,7 @@ Spontaneous.UploadManager = (function($, S) {
196
196
  },
197
197
  upload_complete: function(upload, result) {
198
198
  if (upload !== this.current) {
199
- console.warn("UploadManager#upload_complete", "completed upload does not match current")
199
+ console.warn('UploadManager#upload_complete', 'completed upload does not match current');
200
200
  }
201
201
  this.completed.push(this.current);
202
202
  this.total_time += this.current.time;
@@ -210,7 +210,7 @@ Spontaneous.UploadManager = (function($, S) {
210
210
  },
211
211
  upload_failed: function(upload, event) {
212
212
  if (upload !== this.current) {
213
- console.warn("UploadManager#upload_complete", "completed upload does not match current")
213
+ console.warn('UploadManager#upload_complete', 'completed upload does not match current');
214
214
  }
215
215
  this.failed.push(this.current);
216
216
  var target = this.targets[upload.uid];
@@ -218,19 +218,19 @@ Spontaneous.UploadManager = (function($, S) {
218
218
  target.upload_failed(event);
219
219
  }
220
220
  this.current = null;
221
- console.error("UploadManager#upload_failed", upload, this.failed)
221
+ console.error('UploadManager#upload_failed', upload, this.failed);
222
222
  this.next();
223
223
  },
224
224
  upload_conflict: function(upload, event) {
225
225
  if (upload !== this.current) {
226
- console.warn("UploadManager#upload_complete", "completed upload does not match current")
226
+ console.warn('UploadManager#upload_complete', 'completed upload does not match current');
227
227
  }
228
228
  var target = this.targets[upload.uid];
229
229
  if (target) {
230
230
  target.upload_conflict($.parseJSON(event.currentTarget.response));
231
231
  }
232
232
  this.current = null;
233
- console.error("UploadManager#upload_conflict", upload, event)
233
+ console.error('UploadManager#upload_conflict', upload, event);
234
234
  this.next();
235
235
  },
236
236
  FormUpload: FormUpload,
@@ -35,7 +35,7 @@ Spontaneous.User = (function($, S) {
35
35
  this.set('user', this.user);
36
36
  },
37
37
  logout: function() {
38
- ajax.del("/logout", {}, function() {
38
+ ajax.del('/logout', {}, function() {
39
39
  // S.Ajax.unauthorized();
40
40
  });
41
41
  },
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Velocity.js: Accelerated JavaScript animation.
3
+ * @version 0.0.22
4
+ * @docs http://velocityjs.org
5
+ * @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
6
+ */
7
+ !function(a,b,c,d){function e(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function f(a){return"[object Function]"===Object.prototype.toString.call(a)}function g(a){var b=Object.prototype.toString.call(a);return"object"==typeof a&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(b)&&a.length!==d&&(0===a.length||"object"==typeof a[0]&&a[0].nodeType>0)}function h(a){return a&&(a.jquery||b.Zepto&&b.Zepto.zepto.isZ(a))}function i(a,b){var c=a;return q(a)?t.Easings[a]||(c=!1):c=r(a)&&2===a.length?v.apply(null,a.concat([b])):r(a)&&4===a.length?u.apply(null,a):!1,c===!1&&(c=t.Easings[t.defaults.easing]?t.defaults.easing:n),c}function j(a){if(a)for(var b=(new Date).getTime(),c=0,e=t.State.calls.length;e>c;c++)if(t.State.calls[c]){var f=t.State.calls[c],g=f[0],h=f[2],i=f[3];i||(i=t.State.calls[c][3]=b-16);for(var m=Math.min((b-i)/h.duration,1),n=0,o=g.length;o>n;n++){var r=g[n],u=r.element;if(s.data(u,l)){var v=!1;h.display&&"none"!==h.display&&w.setPropertyValue(u,"display",h.display);for(var x in r)if("element"!==x){var y,z=r[x],A=q(z.easing)?t.Easings[z.easing]:z.easing;if(y=1===m?z.endValue:z.startValue+(z.endValue-z.startValue)*A(m),z.currentValue=y,w.Hooks.registered[x]){var B=w.Hooks.getRoot(x),C=s.data(u,l).rootPropertyValueCache[B];C&&(z.rootPropertyValue=C)}var D=w.setPropertyValue(u,x,z.currentValue+(0===parseFloat(y)?"":z.unitType),z.rootPropertyValue,z.scrollData);w.Hooks.registered[x]&&(s.data(u,l).rootPropertyValueCache[B]=w.Normalizations.registered[B]?w.Normalizations.registered[B]("extract",null,D[1]):D[1]),"transform"===D[0]&&(v=!0)}h.mobileHA&&s.data(u,l).transformCache.translate3d===d&&(s.data(u,l).transformCache.translate3d="(0px, 0px, 0px)",v=!0),v&&w.flushTransformCache(u)}}h.display&&"none"!==h.display&&(t.State.calls[c][2].display=!1),h.progress&&h.progress.call(f[1],f[1],m,Math.max(0,i+h.duration-b),i),1===m&&k(c)}t.State.isTicking&&p(j)}function k(a){for(var b=t.State.calls[a][0],c=t.State.calls[a][1],e=t.State.calls[a][2],f=!1,g=0,h=b.length;h>g;g++){var i=b[g].element;if("none"!==e.display||e.loop||w.setPropertyValue(i,"display",e.display),(s.queue(i)[1]===d||!/\.velocityQueueEntryFlag/i.test(s.queue(i)[1]))&&s.data(i,l)){s.data(i,l).isAnimating=!1,s.data(i,l).rootPropertyValueCache={};var j,k=["transformPerspective","translateZ","rotateX","rotateY"],m=!1;for(var n in k)j=k[n],/^\(0[^.]/.test(s.data(i,l).transformCache[j])&&(m=!0,delete s.data(i,l).transformCache[j]);e.mobileHA&&(m=!0,delete s.data(i,l).transformCache.translate3d),m&&w.flushTransformCache(i)}e.complete&&!e.loop&&g===h-1&&e.complete.call(c,c),e.queue!==!1&&s.dequeue(i,e.queue)}t.State.calls[a]=!1;for(var o=0,p=t.State.calls.length;p>o;o++)if(t.State.calls[o]!==!1){f=!0;break}f===!1&&(t.State.isTicking=!1,delete t.State.calls,t.State.calls=[])}var l="velocity",m=400,n="swing",o=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>4;a--){var b=c.createElement("div");if(b.innerHTML="<!--[if IE "+a+"]><span></span><![endif]-->",b.getElementsByTagName("span").length)return b=null,a}return d}(),p=b.requestAnimationFrame||function(){var a=0;return b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||function(b){var c,d=(new Date).getTime();return c=Math.max(0,16-(d-a)),a=d+c,setTimeout(function(){b(d+c)},c)}}(),q=function(a){return"string"==typeof a},r=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},s=b.jQuery||a.Velocity&&a.Velocity.Utilities;if(!s)throw new Error("Velocity: Either jQuery or Velocity's jQuery shim must first be loaded.");if(a.Velocity!==d&&!a.Velocity.Utilities)throw new Error("Velocity: Namespace is occupied.");if(7>=o){if(b.jQuery)return void(b.jQuery.fn.velocity=b.jQuery.fn.animate);throw new Error("Velocity: For IE<=7, Velocity falls back to jQuery, which must first be loaded.")}if(8===o&&!b.jQuery)throw new Error("Velocity: For IE8, Velocity requires jQuery to be loaded. (Velocity's jQuery shim does not work with IE8.)");var t=a.Velocity=a.velocity={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),prefixElement:c.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:b.jQuery?{}:s,Sequences:{},Easings:{},defaults:{queue:"",duration:m,easing:n,begin:null,complete:null,progress:null,display:null,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},animate:function(){},debug:!1};b.pageYOffset!==d?(t.State.scrollAnchor=b,t.State.scrollPropertyLeft="pageXOffset",t.State.scrollPropertyTop="pageYOffset"):(t.State.scrollAnchor=c.documentElement||c.body.parentNode||c.body,t.State.scrollPropertyLeft="scrollLeft",t.State.scrollPropertyTop="scrollTop");var u=function(){function a(a,b){return 1-3*b+3*a}function b(a,b){return 3*b-6*a}function c(a){return 3*a}function d(d,e,f){return((a(e,f)*d+b(e,f))*d+c(e))*d}function e(d,e,f){return 3*a(e,f)*d*d+2*b(e,f)*d+c(e)}return function(a,b,c,f){function g(b){for(var f=b,g=0;8>g;++g){var h=e(f,a,c);if(0===h)return f;var i=d(f,a,c)-b;f-=i/h}return f}if(4!==arguments.length)return!1;for(var h=0;4>h;++h)if("number"!=typeof arguments[h]||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;return a=Math.min(a,1),c=Math.min(c,1),a=Math.max(a,0),c=Math.max(c,0),function(e){return a===b&&c===f?e:d(g(e),b,f)}}}(),v=function(){function a(a){return-a.tension*a.x-a.friction*a.v}function b(b,c,d){var e={x:b.x+d.dx*c,v:b.v+d.dv*c,tension:b.tension,friction:b.friction};return{dx:e.v,dv:a(e)}}function c(c,d){var e={dx:c.v,dv:a(c)},f=b(c,.5*d,e),g=b(c,.5*d,f),h=b(c,d,g),i=1/6*(e.dx+2*(f.dx+g.dx)+h.dx),j=1/6*(e.dv+2*(f.dv+g.dv)+h.dv);return c.x=c.x+i*d,c.v=c.v+j*d,c}return function d(a,b,e){var f,g,h,i={x:-1,v:0,tension:null,friction:null},j=[0],k=0,l=1e-4,m=.016;for(a=parseFloat(a)||600,b=parseFloat(b)||20,e=e||null,i.tension=a,i.friction=b,f=null!==e,f?(k=d(a,b),g=k/e*m):g=m;;)if(h=c(h||i,g),j.push(1+h.x),k+=16,!(Math.abs(h.x)>l&&Math.abs(h.v)>l))break;return f?function(a){return j[a*(j.length-1)|0]}:k}}();!function(){t.Easings.linear=function(a){return a},t.Easings.swing=function(a){return.5-Math.cos(a*Math.PI)/2},t.Easings.ease=u(.25,.1,.25,1),t.Easings["ease-in"]=u(.42,0,1,1),t.Easings["ease-out"]=u(0,0,.58,1),t.Easings["ease-in-out"]=u(.42,0,.58,1);var a={};s.each(["Quad","Cubic","Quart","Quint","Expo"],function(b,c){a[c]=function(a){return Math.pow(a,b+2)}}),s.extend(a,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return 0===a||1===a?a:-Math.pow(2,8*(a-1))*Math.sin((80*(a-1)-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){for(var b,c=4;a<((b=Math.pow(2,--c))-1)/11;);return 1/Math.pow(4,3-c)-7.5625*Math.pow((3*b-2)/22-a,2)}}),s.each(a,function(a,b){t.Easings["easeIn"+a]=b,t.Easings["easeOut"+a]=function(a){return 1-b(1-a)},t.Easings["easeInOut"+a]=function(a){return.5>a?b(2*a)/2:1-b(-2*a+2)/2}}),t.Easings.spring=function(a){return 1-Math.cos(4.5*a*Math.PI)*Math.exp(6*-a)}}();var w=t.CSS={RegEx:{valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Hooks:{templates:{color:["Red Green Blue Alpha","255 255 255 1"],backgroundColor:["Red Green Blue Alpha","255 255 255 1"],borderColor:["Red Green Blue Alpha","255 255 255 1"],borderTopColor:["Red Green Blue Alpha","255 255 255 1"],borderRightColor:["Red Green Blue Alpha","255 255 255 1"],borderBottomColor:["Red Green Blue Alpha","255 255 255 1"],borderLeftColor:["Red Green Blue Alpha","255 255 255 1"],outlineColor:["Red Green Blue Alpha","255 255 255 1"],textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0%"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){var a,b,c;if(o)for(a in w.Hooks.templates){b=w.Hooks.templates[a],c=b[0].split(" ");var d=b[1].match(w.RegEx.valueSplit);"Color"===c[0]&&(c.push(c.shift()),d.push(d.shift()),w.Hooks.templates[a]=[c.join(" "),d.join(" ")])}for(a in w.Hooks.templates){b=w.Hooks.templates[a],c=b[0].split(" ");for(var e in c){var f=a+c[e],g=e;w.Hooks.registered[f]=[a,g]}}},getRoot:function(a){var b=w.Hooks.registered[a];return b?b[0]:a},cleanRootPropertyValue:function(a,b){return w.RegEx.valueUnwrap.test(b)&&(b=b.match(w.Hooks.RegEx.valueUnwrap)[1]),w.Values.isCSSNullValue(b)&&(b=w.Hooks.templates[a][1]),b},extractValue:function(a,b){var c=w.Hooks.registered[a];if(c){var d=c[0],e=c[1];return b=w.Hooks.cleanRootPropertyValue(d,b),b.toString().match(w.RegEx.valueSplit)[e]}return b},injectValue:function(a,b,c){var d=w.Hooks.registered[a];if(d){var e,f,g=d[0],h=d[1];return c=w.Hooks.cleanRootPropertyValue(g,c),e=c.toString().match(w.RegEx.valueSplit),e[h]=b,f=e.join(" ")}return c}},Normalizations:{registered:{clip:function(a,b,c){switch(a){case"name":return"clip";case"extract":var d;return w.RegEx.wrappedValueAlreadyExtracted.test(c)?d=c:(d=c.toString().match(w.RegEx.valueUnwrap),d=d?d[1].replace(/,(\s+)?/g," "):c),d;case"inject":return"rect("+c+")"}},opacity:function(a,b,c){if(8>=o)switch(a){case"name":return"filter";case"extract":var d=c.toString().match(/alpha\(opacity=(.*)\)/i);return c=d?d[1]/100:1;case"inject":return b.style.zoom=1,parseFloat(c)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(c),10)+")"}else switch(a){case"name":return"opacity";case"extract":return c;case"inject":return c}}},register:function(){function a(a){var b,c=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return a=a.replace(c,function(a,b,c,d){return b+b+c+c+d+d}),b=d.exec(a),b?"rgb("+(parseInt(b[1],16)+" "+parseInt(b[2],16)+" "+parseInt(b[3],16))+")":"rgb(0 0 0)"}var b=["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"];9>=o||t.State.isGingerbread||(b=b.concat(["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]));for(var c=0,e=b.length;e>c;c++)!function(){var a=b[c];w.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return"transform";case"extract":return s.data(c,l).transformCache[a]===d?/^scale/i.test(a)?1:0:s.data(c,l).transformCache[a].replace(/[()]/g,"");case"inject":var f=!1;switch(a.substr(0,a.length-1)){case"translate":f=!/(%|px|em|rem|\d)$/i.test(e);break;case"scal":case"scale":t.State.isAndroid&&s.data(c,l).transformCache[a]===d&&(e=1),f=!/(\d)$/i.test(e);break;case"skew":f=!/(deg|\d)$/i.test(e);break;case"rotate":f=!/(deg|\d)$/i.test(e)}return f||(s.data(c,l).transformCache[a]="("+e+")"),s.data(c,l).transformCache[a]}}}();for(var f=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],c=0,g=f.length;g>c;c++)!function(){var b=f[c];w.Normalizations.registered[b]=function(c,e,f){switch(c){case"name":return b;case"extract":var g;if(w.RegEx.wrappedValueAlreadyExtracted.test(f))g=f;else{var h,i={aqua:"rgb(0, 255, 255);",black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",fuchsia:"rgb(255, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",lime:"rgb(0, 255, 0)",maroon:"rgb(128, 0, 0)",navy:"rgb(0, 0, 128)",olive:"rgb(128, 128, 0)",purple:"rgb(128, 0, 128)",red:"rgb(255, 0, 0)",silver:"rgb(192, 192, 192)",teal:"rgb(0, 128, 128)",white:"rgb(255, 255, 255)",yellow:"rgb(255, 255, 0)"};/^[A-z]+$/i.test(f)?h=i[f]!==d?i[f]:i.black:/^#([A-f\d]{3}){1,2}$/i.test(f)?h=a(f):/^rgba?\(/i.test(f)||(h=i.black),g=(h||f).toString().match(w.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return 8>=o||3!==g.split(" ").length||(g+=" 1"),g;case"inject":return 8>=o?4===f.split(" ").length&&(f=f.split(/\s+/).slice(0,3).join(" ")):3===f.split(" ").length&&(f+=" 1"),(8>=o?"rgb":"rgba")+"("+f.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})},prefixCheck:function(a){if(t.State.prefixMatches[a])return[t.State.prefixMatches[a],!0];for(var b=["","Webkit","Moz","ms","O"],c=0,d=b.length;d>c;c++){var e;if(e=0===c?a:b[c]+a.replace(/^\w/,function(a){return a.toUpperCase()}),q(t.State.prefixElement.style[e]))return t.State.prefixMatches[a]=e,[e,!0]}return[a,!1]}},Values:{isCSSNullValue:function(a){return 0==a||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(a)},getUnitType:function(a){return/^(rotate|skew)/i.test(a)?"deg":/(^(scale|scaleX|scaleY|scaleZ|opacity|alpha|fillOpacity|flexGrow|flexHeight|zIndex|fontWeight)$)|color/i.test(a)?"":"px"},getDisplayType:function(a){var b=a.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(b)?"inline":/^(li)$/i.test(b)?"list-item":/^(tr)$/i.test(b)?"table-row":"block"}},getPropertyValue:function(a,c,e,f){function g(a,c){var e=0;if(8>=o)e=s.css(a,c);else{if(!f){if("height"===c&&"border-box"!==w.getPropertyValue(a,"boxSizing").toString().toLowerCase())return a.offsetHeight-(parseFloat(w.getPropertyValue(a,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(a,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(a,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(a,"paddingBottom"))||0);if("width"===c&&"border-box"!==w.getPropertyValue(a,"boxSizing").toString().toLowerCase())return a.offsetWidth-(parseFloat(w.getPropertyValue(a,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(a,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(a,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(a,"paddingRight"))||0)}var h;h=s.data(a,l)===d?b.getComputedStyle(a,null):s.data(a,l).computedStyle?s.data(a,l).computedStyle:s.data(a,l).computedStyle=b.getComputedStyle(a,null),o&&"borderColor"===c&&(c="borderTopColor"),e=9===o&&"filter"===c?h.getPropertyValue(c):h[c],(""===e||null===e)&&(e=a.style[c])}if("auto"===e&&/^(top|right|bottom|left)$/i.test(c)){var i=g(a,"position");("fixed"===i||"absolute"===i&&/top|left/i.test(c))&&(e=s(a).position()[c]+"px")}return e}var h;if(w.Hooks.registered[c]){var i=c,j=w.Hooks.getRoot(i);e===d&&(e=w.getPropertyValue(a,w.Names.prefixCheck(j)[0])),w.Normalizations.registered[j]&&(e=w.Normalizations.registered[j]("extract",a,e)),h=w.Hooks.extractValue(i,e)}else if(w.Normalizations.registered[c]){var k,m;k=w.Normalizations.registered[c]("name",a),"transform"!==k&&(m=g(a,w.Names.prefixCheck(k)[0]),w.Values.isCSSNullValue(m)&&w.Hooks.templates[c]&&(m=w.Hooks.templates[c][1])),h=w.Normalizations.registered[c]("extract",a,m)}return/^[\d-]/.test(h)||(h=g(a,w.Names.prefixCheck(c)[0])),w.Values.isCSSNullValue(h)&&(h=0),t.debug>=2&&console.log("Get "+c+": "+h),h},setPropertyValue:function(a,c,d,e,f){var g=c;if("scroll"===c)f.container?f.container["scroll"+f.direction]=d:"Left"===f.direction?b.scrollTo(d,f.alternateValue):b.scrollTo(f.alternateValue,d);else if(w.Normalizations.registered[c]&&"transform"===w.Normalizations.registered[c]("name",a))w.Normalizations.registered[c]("inject",a,d),g="transform",d=s.data(a,l).transformCache[c];else{if(w.Hooks.registered[c]){var h=c,i=w.Hooks.getRoot(c);e=e||w.getPropertyValue(a,i),d=w.Hooks.injectValue(h,d,e),c=i}if(w.Normalizations.registered[c]&&(d=w.Normalizations.registered[c]("inject",a,d),c=w.Normalizations.registered[c]("name",a)),g=w.Names.prefixCheck(c)[0],8>=o)try{a.style[g]=d}catch(j){console.log("Error setting ["+g+"] to ["+d+"]")}else a.style[g]=d;t.debug>=2&&console.log("Set "+c+" ("+g+"): "+d)}return[g,d]},flushTransformCache:function(a){var b,c,d,e="";for(b in s.data(a,l).transformCache)c=s.data(a,l).transformCache[b],"transformPerspective"!==b?(9===o&&"rotateZ"===b&&(b="rotate"),e+=b+c+" "):d=c;d&&(e="perspective"+d+" "+e),w.setPropertyValue(a,"transform",e)}};w.Hooks.register(),w.Normalizations.register(),t.animate=function(){function a(){function a(){function a(a){var c=d,e=d,h=d;return r(a)?(c=a[0],!r(a[1])&&/^[\d-]/.test(a[1])||f(a[1])?h=a[1]:(q(a[1])||r(a[1]))&&(e=i(a[1],g.duration),a[2]&&(h=a[2]))):c=a,e=e||g.easing,f(c)&&(c=c.call(b,y,x)),f(h)&&(h=h.call(b,y,x)),[c||0,e,h]}function k(a,b){var c,d;return d=(b||0).toString().toLowerCase().replace(/[%A-z]+$/,function(a){return c=a,""}),c||(c=w.Values.getUnitType(a)),[d,c]}function m(){var a={parent:b.parentNode,position:w.getPropertyValue(b,"position"),fontSize:w.getPropertyValue(b,"fontSize")},d=a.position===E.lastPosition&&a.parent===E.lastParent,e=a.fontSize===E.lastFontSize&&a.parent===E.lastParent;E.lastParent=a.parent,E.lastPosition=a.position,E.lastFontSize=a.fontSize,null===E.remToPxRatio&&(E.remToPxRatio=parseFloat(w.getPropertyValue(c.body,"fontSize"))||16);var f={overflowX:null,overflowY:null,boxSizing:null,width:null,minWidth:null,maxWidth:null,height:null,minHeight:null,maxHeight:null,paddingLeft:null},g={},h=10;if(g.remToPxRatio=E.remToPxRatio,o)var i=/^auto$/i.test(b.currentStyle.width),j=/^auto$/i.test(b.currentStyle.height);d&&e||(f.overflowX=w.getPropertyValue(b,"overflowX"),f.overflowY=w.getPropertyValue(b,"overflowY"),f.boxSizing=w.getPropertyValue(b,"boxSizing"),f.width=w.getPropertyValue(b,"width",null,!0),f.minWidth=w.getPropertyValue(b,"minWidth"),f.maxWidth=w.getPropertyValue(b,"maxWidth")||"none",f.height=w.getPropertyValue(b,"height",null,!0),f.minHeight=w.getPropertyValue(b,"minHeight"),f.maxHeight=w.getPropertyValue(b,"maxHeight")||"none",f.paddingLeft=w.getPropertyValue(b,"paddingLeft")),d?(g.percentToPxRatioWidth=E.lastPercentToPxWidth,g.percentToPxRatioHeight=E.lastPercentToPxHeight):(w.setPropertyValue(b,"overflowX","hidden"),w.setPropertyValue(b,"overflowY","hidden"),w.setPropertyValue(b,"boxSizing","content-box"),w.setPropertyValue(b,"width",h+"%"),w.setPropertyValue(b,"minWidth",h+"%"),w.setPropertyValue(b,"maxWidth",h+"%"),w.setPropertyValue(b,"height",h+"%"),w.setPropertyValue(b,"minHeight",h+"%"),w.setPropertyValue(b,"maxHeight",h+"%")),e?g.emToPxRatio=E.lastEmToPx:w.setPropertyValue(b,"paddingLeft",h+"em"),d||(g.percentToPxRatioWidth=E.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(b,"width",null,!0))||1)/h,g.percentToPxRatioHeight=E.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(b,"height",null,!0))||1)/h),e||(g.emToPxRatio=E.lastEmToPx=(parseFloat(w.getPropertyValue(b,"paddingLeft"))||1)/h);for(var k in f)null!==f[k]&&w.setPropertyValue(b,k,f[k]);return o?(i&&w.setPropertyValue(b,"width","auto"),j&&w.setPropertyValue(b,"height","auto")):(w.setPropertyValue(b,"height","auto"),f.height!==w.getPropertyValue(b,"height",null,!0)&&w.setPropertyValue(b,"height",f.height),w.setPropertyValue(b,"width","auto"),f.width!==w.getPropertyValue(b,"width",null,!0)&&w.setPropertyValue(b,"width",f.width)),t.debug>=1&&console.log("Unit ratios: "+JSON.stringify(g),b),g}if(g.begin&&0===y&&g.begin.call(n,n),"scroll"===B){var v,z,A,C=/^x$/i.test(g.axis)?"Left":"Top",D=parseFloat(g.offset)||0;g.container?g.container.jquery||g.container.nodeType?(g.container=g.container[0]||g.container,v=g.container["scroll"+C],A=v+s(b).position()[C.toLowerCase()]+D):g.container=null:(v=t.State.scrollAnchor[t.State["scrollProperty"+C]],z=t.State.scrollAnchor[t.State["scrollProperty"+("Left"===C?"Top":"Left")]],A=s(b).offset()[C.toLowerCase()]+D),h={scroll:{rootPropertyValue:!1,startValue:v,currentValue:v,endValue:A,unitType:"",easing:g.easing,scrollData:{container:g.container,direction:C,alternateValue:z}},element:b}}else if("reverse"===B){if(!s.data(b,l).tweensContainer)return void s.dequeue(b,g.queue);"none"===s.data(b,l).opts.display&&(s.data(b,l).opts.display="block"),s.data(b,l).opts.loop=!1,s.data(b,l).opts.begin=null,s.data(b,l).opts.complete=null,u.easing||delete g.easing,u.duration||delete g.duration,g=s.extend({},s.data(b,l).opts,g);var G=s.extend(!0,{},s.data(b,l).tweensContainer);for(var H in G)if("element"!==H){var I=G[H].startValue;G[H].startValue=G[H].currentValue=G[H].endValue,G[H].endValue=I,u&&(G[H].easing=g.easing)}h=G}else if("start"===B){var G;s.data(b,l).tweensContainer&&s.data(b,l).isAnimating===!0&&(G=s.data(b,l).tweensContainer);for(var J in p){var K=a(p[J]),L=K[0],M=K[1],N=K[2];J=w.Names.camelCase(J);var O=w.Hooks.getRoot(J),P=!1;if(w.Names.prefixCheck(O)[1]!==!1||w.Normalizations.registered[O]!==d){g.display&&"none"!==g.display&&/opacity|filter/.test(J)&&!N&&0!==L&&(N=0),g._cacheValues&&G&&G[J]?(N===d&&(N=G[J].endValue+G[J].unitType),P=s.data(b,l).rootPropertyValueCache[O]):w.Hooks.registered[J]?N===d?(P=w.getPropertyValue(b,O),N=w.getPropertyValue(b,J,P)):P=w.Hooks.templates[O][1]:N===d&&(N=w.getPropertyValue(b,J));var Q,R,S,T;Q=k(J,N),N=Q[0],S=Q[1],Q=k(J,L),L=Q[0].replace(/^([+-\/*])=/,function(a,b){return T=b,""}),R=Q[1],N=parseFloat(N)||0,L=parseFloat(L)||0;var U;if("%"===R&&(/^(fontSize|lineHeight)$/.test(J)?(L/=100,R="em"):/^scale/.test(J)?(L/=100,R=""):/(Red|Green|Blue)$/i.test(J)&&(L=L/100*255,R="")),/[\/*]/.test(T))R=S;else if(S!==R&&0!==N)if(0===L)R=S;else{U=U||m();var V=/margin|padding|left|right|width|text|word|letter/i.test(J)||/X$/.test(J)?"x":"y";switch(S){case"%":N*="x"===V?U.percentToPxRatioWidth:U.percentToPxRatioHeight;break;case"em":N*=U.emToPxRatio;break;case"rem":N*=U.remToPxRatio;break;case"px":}switch(R){case"%":N*=1/("x"===V?U.percentToPxRatioWidth:U.percentToPxRatioHeight);break;case"em":N*=1/U.emToPxRatio;break;case"rem":N*=1/U.remToPxRatio;break;case"px":}}switch(T){case"+":L=N+L;break;case"-":L=N-L;break;case"*":L=N*L;break;case"/":L=N/L}h[J]={rootPropertyValue:P,startValue:N,currentValue:N,endValue:L,unitType:R,easing:M},t.debug&&console.log("tweensContainer ("+J+"): "+JSON.stringify(h[J]),b)}else t.debug&&console.log("Skipping ["+O+"] due to a lack of browser support.")}h.element=b}h.element&&(F.push(h),s.data(b,l).tweensContainer=h,s.data(b,l).opts=g,s.data(b,l).isAnimating=!0,y===x-1?(t.State.calls.length>1e4&&(t.State.calls=e(t.State.calls)),t.State.calls.push([F,n,g]),t.State.isTicking===!1&&(t.State.isTicking=!0,j())):y++)}var b=this,g=s.extend({},t.defaults,u),h={};if("stop"===B)return s.queue(b,q(u)?u:"",[]),!0;switch(s.data(b,l)===d&&s.data(b,l,{isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}}),/^\d/.test(g.delay)&&g.queue!==!1&&s.queue(b,g.queue,function(a){t.velocityQueueEntryFlag=!0,setTimeout(a,parseFloat(g.delay))}),g.duration.toString().toLowerCase()){case"fast":g.duration=200;break;case"normal":g.duration=m;break;case"slow":g.duration=600;break;default:g.duration=parseFloat(g.duration)||1}g.easing=i(g.easing,g.duration),g.begin&&!f(g.begin)&&(g.begin=null),g.progress&&!f(g.progress)&&(g.progress=null),g.complete&&!f(g.complete)&&(g.complete=null),g.display&&(g.display=g.display.toString().toLowerCase()),g.mobileHA=g.mobileHA&&t.State.isMobile&&!t.State.isGingerbread,g.queue===!1?g.delay?setTimeout(a,g.delay):a():s.queue(b,g.queue,function(b){t.velocityQueueEntryFlag=!0,a(b)}),""!==g.queue&&"fx"!==g.queue||"inprogress"===s.queue(b)[0]||s.dequeue(b)}var b,k,n,p,u,v=arguments[0]&&(s.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||q(arguments[0].properties));if(h(this)?(k=0,n=this,b=this):(k=1,n=v?arguments[0].elements:arguments[0]),n=h(n)?[].slice.call(n):n){v?(p=arguments[0].properties,u=arguments[0].options):(p=arguments[k],u=arguments[k+1]);var x=g(n)||r(n)?n.length:1,y=0;if("stop"!==p&&!s.isPlainObject(u)){var z=k+1;u={};for(var A=z;A<arguments.length;A++)!r(arguments[A])&&/^\d/.test(arguments[A])?u.duration=parseFloat(arguments[A]):q(arguments[A])?u.easing=arguments[A]:!r(arguments[A])||2!==arguments[A].length&&4!==arguments[A].length?f(arguments[A])&&(u.complete=arguments[A]):u.easing=arguments[A]}var B;switch(p){case"scroll":B="scroll";break;case"reverse":B="reverse";break;case"stop":B="stop";break;default:if(!s.isPlainObject(p)||s.isEmptyObject(p)){if(q(p)&&t.Sequences[p]){var C=n,D=u.duration;return u.backwards===!0&&(n=(n.jquery?[].slice.call(n):n).reverse()),s.each(n,function(a,b){parseFloat(u.stagger)&&(u.delay=parseFloat(u.stagger)*a),u.drag&&(u.duration=parseFloat(D)||(/^(callout|transition)/.test(p)?1e3:m),u.duration=Math.max(u.duration*(u.backwards?1-a/x:(a+1)/x),.75*u.duration,200)),t.Sequences[p].call(b,b,u||{},a,x)}),b||C}return console.log("First argument was not a property map, a known action, or a registered sequence. Aborting."),b||n}B="start"}var E={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPxRatio:null},F=[];n.nodeType?a.call(n):s.each(n,function(b,c){c.nodeType&&a.call(c)});var G,H=s.extend({},t.defaults,u);if(H.loop=parseInt(H.loop),G=2*H.loop-1,H.loop)for(var I=0;G>I;I++){var J={delay:H.delay};H.complete&&I===G-1&&(J.complete=H.complete),t.animate(n,"reverse",J)}return b||n}};var x=b.jQuery||b.Zepto;x&&(x.fn.velocity=t.animate,x.fn.velocity.defaults=t.defaults),"undefined"!=typeof define&&define.amd?define(function(){return t}):"undefined"!=typeof module&&module.exports&&(module.exports=t),s.each(["Down","Up"],function(a,b){t.Sequences["slide"+b]=function(a,c){var d=s.extend({},c),e={height:null,marginTop:null,marginBottom:null,paddingTop:null,paddingBottom:null,overflow:null,overflowX:null,overflowY:null},f=d.begin,g=d.complete,h=!1;null!==d.display&&(d.display="Down"===b?d.display||t.CSS.Values.getDisplayType(a):d.display||"none"),d.begin=function(){function c(){a.style.display="block",e.height=t.CSS.getPropertyValue(a,"height"),a.style.height="auto",t.CSS.getPropertyValue(a,"height")===e.height&&(h=!0),t.CSS.setPropertyValue(a,"height",e.height+"px")}if("Down"===b){e.overflow=[t.CSS.getPropertyValue(a,"overflow"),0],e.overflowX=[t.CSS.getPropertyValue(a,"overflowX"),0],e.overflowY=[t.CSS.getPropertyValue(a,"overflowY"),0],a.style.overflow="hidden",a.style.overflowX="visible",a.style.overflowY="hidden",c();for(var d in e)/^overflow/.test(d)||(e[d]=[t.CSS.getPropertyValue(a,d),0]);a.style.display="none"}else{c();for(var d in e)e[d]=[0,t.CSS.getPropertyValue(a,d)];a.style.overflow="hidden",a.style.overflowX="visible",a.style.overflowY="hidden"}f&&f.call(a,a)},d.complete=function(a){var c="Down"===b?0:1;h===!0?e.height[c]="auto":e.height[c]+="px";for(var d in e)a.style[d]=e[d][c];g&&g.call(a,a)},t.animate(a,e,d)}}),s.each(["In","Out"],function(a,b){t.Sequences["fade"+b]=function(a,c,d,e){var f=s.extend({},c),g={opacity:"In"===b?1:0};d!==e-1&&(f.complete=f.begin=null),null!==f.display&&(f.display="In"===b?t.CSS.Values.getDisplayType(a):"none"),t.animate(this,g,f)}})}(window.jQuery||window.Zepto||window,window,document);
@@ -5,6 +5,24 @@ Spontaneous.Views = (function($, S) {
5
5
  include: Spontaneous.Properties,
6
6
  initialize: function(content) {
7
7
  this.content = content;
8
+ this._subviews = [];
9
+ },
10
+ unload: function() {
11
+ this.unwatchOthers();
12
+ this.unloadView();
13
+ this.unloadChildren();
14
+ },
15
+ unloadView: function() {
16
+ // cleanup
17
+ },
18
+ unloadChildren: function() {
19
+ for (var i = 0, c = this._subviews, ii = c.length; i < ii; i++) {
20
+ if (typeof c[i].unload === 'function') {
21
+ c[i].unload();
22
+ } else {
23
+ console.warn('unable to unload child view', c[i]);
24
+ }
25
+ }
8
26
  },
9
27
  id: function() {
10
28
  return this.content.id();
@@ -21,6 +39,12 @@ Spontaneous.Views = (function($, S) {
21
39
  visibility_class: function() {
22
40
  return this.content.hidden() ? 'hidden' : 'visible';
23
41
  },
42
+ alias_class: function() {
43
+ return this.content.type().is_alias() ? 'alias' : 'not-alias';
44
+ },
45
+ fields_class: function() {
46
+ return this.content.has_fields() ? 'fields' : 'no-fields';
47
+ },
24
48
  boxes_class: function() {
25
49
  return this.content.has_boxes() ? 'boxes' : 'no-boxes';
26
50
  },
@@ -51,9 +75,9 @@ Spontaneous.Views = (function($, S) {
51
75
  return this.content.save_path();
52
76
  },
53
77
  create_edit_wrapper: function(read_content) {
54
- var s = {'style':'position: relative; overflow: hidden;'}
55
- var outer = dom.div(s);
56
- var write = dom.div({'style':'position: absolute; height: 0; overflow: hidden;'})
78
+ var s = {'style':'position: relative; overflow: hidden;'};
79
+ var outer = dom.div('.edit-wrapper-outer', s);
80
+ var write = dom.div({'style':'position: absolute; height: 0; overflow: hidden;'});
57
81
  var write_inner = dom.div();
58
82
  var read = dom.div(s);
59
83
  var read_inner = dom.div();
@@ -82,8 +106,8 @@ Spontaneous.Views = (function($, S) {
82
106
  o.add(r).animate({'height':h}, { queue: false, duration: time_to_reveal });
83
107
  w.css({'position':'relative'});
84
108
  r.css({'position':'absolute', 'top':0, 'right':0, 'left':0}).animate({'top':h}, { queue: false, duration: time_to_reveal, complete:function() {
85
- w.css({'z-index': front, 'position':'relative', 'height':'auto'})
86
- r.css({'z-index': back, 'position':'absolute', 'display':'none'})
109
+ w.css({'z-index': front, 'position':'relative', 'height':'auto'});
110
+ r.css({'z-index': back, 'position':'absolute', 'display':'none'});
87
111
  o.css('height', 'auto');
88
112
  panel.on_show(focus_field);
89
113
  }});
@@ -97,8 +121,8 @@ Spontaneous.Views = (function($, S) {
97
121
  o.add(r).animate({'height':h}, { queue: false, duration: time_to_reveal });
98
122
  r.css({'z-index':front, 'height':h, 'top':wi.outerHeight()+'px'}).animate({'top':0}, { queue: true, duration: time_to_reveal, complete: function() {
99
123
  w.css({'position':'absolute', 'z-index':back});
100
- r.css({'position':'relative', 'height':'auto', 'z-index':front})
101
- o.css('height', 'auto')
124
+ r.css({'position':'relative', 'height':'auto', 'z-index':front});
125
+ o.css('height', 'auto');
102
126
  wi.empty();
103
127
  __content.edit_closing = false;
104
128
  }});
@@ -109,5 +133,5 @@ Spontaneous.Views = (function($, S) {
109
133
  });
110
134
  return {
111
135
  View: View
112
- }
136
+ };
113
137
  }(jQuery, Spontaneous));
@@ -1,6 +1,7 @@
1
1
  // console.log('Loading BoxView...')
2
2
 
3
3
  Spontaneous.Views.BoxView = (function($, S) {
4
+ 'use strict';
4
5
  var dom = S.Dom;
5
6
 
6
7
  var BoxView = new JS.Class(Spontaneous.Views.View, {
@@ -42,12 +43,13 @@ Spontaneous.Views.BoxView = (function($, S) {
42
43
  if (!this._panel) {
43
44
  // var panel = $(dom.div, {'class': 'slot-content'});
44
45
  var panel = dom.div('.slot-content');
45
- panel.addClass('empty')
46
+ panel.addClass('empty');
46
47
  if (this.box.has_fields()) {
47
48
  var w = dom.div('.box-fields');
48
49
  var fields = new Spontaneous.FieldPreview(this, '');
50
+ this._subviews.push(fields);
49
51
  var fields_preview = fields.panel();
50
- fields_preview.prepend(dom.div('.overlay'))
52
+ fields_preview.prepend(dom.div('.overlay'));
51
53
  var preview_area = this.create_edit_wrapper(fields_preview);
52
54
 
53
55
  w.append(preview_area);
@@ -56,12 +58,24 @@ Spontaneous.Views.BoxView = (function($, S) {
56
58
  }
57
59
 
58
60
  panel.append(this.add_allowed_types_bar('top', 0));
59
- // var entries = $(dom.div, {'class':'slot-entries'});
60
61
  var entries = dom.div('.slot-entries');
61
- var instructions = dom.div('.slot-instructions').text("Add items using the buttons above");
62
+ var instructions = dom.div('.slot-instructions').text('Add items using the buttons above');
62
63
  entries.append(instructions);
63
- // panel.append();
64
- for (var i = 0, ee = this.entries(), ii = ee.length;i < ii; i++) {
64
+ var entry_total = this.entries().length, preload = Math.min(entry_total, 6);
65
+ if (preload < entry_total) {
66
+ var scrollLoad = function(view, loadedCount, entries, container) {
67
+ var position = loadedCount, increment = 3, total = entries.length;
68
+ return function() {
69
+ if (position >= total) { return; }
70
+ for (var i = position, ii = Math.min(position + increment, total); i < ii; i++) {
71
+ container.append(view.claim_entry(entries[i]));
72
+ }
73
+ position += increment;
74
+ };
75
+ }(this, preload, this.entries(), entries);
76
+ this.watchOther(S.ContentArea, 'scroll_bottom', scrollLoad);
77
+ }
78
+ for (var i = 0, ee = this.entries(), ii = preload;i < ii; i++) {
65
79
  var entry = ee[i];
66
80
  entries.append(this.claim_entry(entry));
67
81
  }
@@ -71,6 +85,7 @@ Spontaneous.Views.BoxView = (function($, S) {
71
85
  axis:'y',
72
86
  distance: 5,
73
87
  tolerance: 'pointer',
88
+ helper: 'clone',
74
89
  // tolerance: 'intersect',
75
90
  scrollSpeed: 40,
76
91
  containment: 'parent',
@@ -78,13 +93,13 @@ Spontaneous.Views.BoxView = (function($, S) {
78
93
  stop: function(event, ui) {
79
94
  this.re_sort(ui.item);
80
95
  }.bind(this)
81
- })
96
+ });
82
97
  panel.append(entries);
83
98
  // this.floating_add_bar = this.add_allowed_types_bar('floating', -1).hide();
84
99
  // var _bottom_add_bar = this.add_allowed_types_bar('bottom', -1).hide();
85
100
  // panel.append(_bottom_add_bar);
86
101
  panel.hide();
87
- this.dom_container.append(panel)
102
+ this.dom_container.append(panel);
88
103
  this._panel = panel;
89
104
  this._entry_container = entries;
90
105
  // this._bottom_add_bar = _bottom_add_bar;
@@ -94,24 +109,24 @@ Spontaneous.Views.BoxView = (function($, S) {
94
109
  },
95
110
  check_if_empty: function() {
96
111
  var _view = this, _panel = this._panel;
97
- if (_view.box.entries().length == 0) {
112
+ if (_view.box.entries().length === 0) {
98
113
  _panel.addClass('empty');
99
- // _view._bottom_add_bar.fadeOut($.fn.appear.height_change_duration/2, function() {
114
+ // _view._bottom_add_bar.velocity('fadeOut', $.fn.appear.height_change_duration/2, function() {
100
115
  // })
101
116
  } else {
102
117
  _panel.removeClass('empty');
103
- // _view._bottom_add_bar.fadeIn(function() {
118
+ // _view._bottom_add_bar.velocity('fadeIn', function() {
104
119
  // })
105
120
  }
106
121
  },
107
122
  add_allowed_types_bar: function(position, insert_at) {
108
123
  var allowed = this.box.allowed_types();
109
- if (allowed.length === 0) { return ""; }
124
+ if (allowed.length === 0) { return ''; }
110
125
  var _box = this
111
- , allowed_bar = dom.div('.slot-addable')
112
- , inner = dom.div(".addable-inner")
126
+ , allowed_bar = dom.div('.slot-addable')
127
+ , inner = dom.div('.addable-inner')
113
128
  , dropper = allowed_bar
114
- , drop = function(event) {
129
+ , drop = function(event) {
115
130
  dropper.removeClass('drop-active').addClass('uploading');
116
131
  // var progress_outer = $(dom.div, {'class':'drop-upload-outer'});
117
132
  // var progress_inner = $(dom.div, {'class':'drop-upload-inner'}).css('width', 0);
@@ -156,7 +171,7 @@ Spontaneous.Views.BoxView = (function($, S) {
156
171
  var type = allow.type, as = allow.as || type.title;
157
172
  var a = dom.a().text(as), add_allowed;
158
173
  if (type.is_alias()) {
159
- a.addClass('alias')
174
+ a.addClass('alias');
160
175
  add_allowed = function(type) {
161
176
  var d = new Spontaneous.AddAliasDialogue(_box, type, insert_at);
162
177
  d.open();
@@ -167,9 +182,9 @@ Spontaneous.Views.BoxView = (function($, S) {
167
182
  }.bind(_box, type);
168
183
  }
169
184
  a.click(add_allowed);
170
- inner.append(a)
185
+ inner.append(a);
171
186
  });
172
- allowed_bar.data("allowed-count", allowed.length);
187
+ allowed_bar.data('allowed-count', allowed.length);
173
188
  allowed_bar.append(inner, dom.span('.down'));
174
189
 
175
190
  return allowed_bar;
@@ -181,7 +196,7 @@ Spontaneous.Views.BoxView = (function($, S) {
181
196
  }
182
197
  var id = css_id.split('-')[1], entry, old_position = 0;
183
198
 
184
- for (var i = 0, ii = entries.length; i < ii; i++) {
199
+ for (i = 0, ii = entries.length; i < ii; i++) {
185
200
  if (entries[i].id() == id) {
186
201
  old_position = i;
187
202
  entry = entries[i];
@@ -192,7 +207,7 @@ Spontaneous.Views.BoxView = (function($, S) {
192
207
  entries.splice(old_position, 1);
193
208
  entries.splice(new_position, 0, entry);
194
209
  entry.reposition(new_position, function(entry) {
195
- this.sorted(entry)
210
+ this.sorted(entry);
196
211
  }.bind(this));
197
212
  },
198
213
  sorted: function(entry) {
@@ -216,17 +231,18 @@ Spontaneous.Views.BoxView = (function($, S) {
216
231
  if (entry.is_page()) {
217
232
  view_class = S.Views.PagePieceView;
218
233
  }
219
- view = new view_class(entry, this);
234
+ view = new view_class(entry, this); // jshint ignore:line
220
235
  return view;
221
236
  },
222
237
  claim_entry: function(entry) {
238
+ this._subviews.push(entry);
223
239
  var div = entry.panel();
224
240
  entry.bind('removed', this.entry_removed.bind(this));
225
241
  return div.attr('id', this.entry_id(entry)).addClass(this.entry_class());
226
242
  },
227
243
 
228
244
  entry_id: function(entry) {
229
- return "entry-" + entry.content.id();
245
+ return 'entry-' + entry.content.id();
230
246
  },
231
247
 
232
248
  entry_class: function() {
@@ -241,8 +257,8 @@ Spontaneous.Views.BoxView = (function($, S) {
241
257
  this.box.add_entry(content_type, position);
242
258
  },
243
259
 
244
- add_alias: function(target_id, type, position) {
245
- this.box.add_alias(target_id, type, position);
260
+ add_alias: function(target_ids, type, position) {
261
+ this.box.add_alias(target_ids, type, position);
246
262
  },
247
263
 
248
264
  insert_entry: function(entry, position) {
@@ -287,7 +303,7 @@ Spontaneous.Views.BoxView = (function($, S) {
287
303
  this.check_if_empty();
288
304
  },
289
305
  entry_wrappers: function() {
290
- return this._entry_container.find('> .'+this.entry_class())
306
+ return this._entry_container.find('> .'+this.entry_class());
291
307
  },
292
308
  show_add_after: function(entry, entry_spacer) {
293
309
  var bar, position = 0;
@@ -298,17 +314,21 @@ Spontaneous.Views.BoxView = (function($, S) {
298
314
  }
299
315
  }
300
316
  bar = this.add_allowed_types_bar('floating', position + 1);
301
- if (bar && bar.data("allowed-count") > 0) {
317
+ if (bar && bar.data('allowed-count') > 0) {
302
318
  entry_spacer.addClass('add-entry').append(bar.show());
303
- if (!entry_spacer.data("auto-height")) {
304
- entry_spacer.data("auto-height", entry_spacer.height());
319
+ if (!entry_spacer.data('auto-height')) {
320
+ entry_spacer.data('auto-height', entry_spacer.height());
305
321
  }
306
- entry_spacer.animate({height:bar.find('.addable-inner').outerHeight() + 12}, 200)
322
+ var newHeight = bar.find('.addable-inner').outerHeight() + 11, currentHeight = entry_spacer.outerHeight();
323
+ newHeight = Math.max(newHeight, currentHeight);
324
+ entry_spacer.velocity({height:newHeight}, 200);
307
325
  }
308
326
  },
309
327
  hide_add_after: function(entry, entry_spacer) {
310
- entry_spacer.empty();
311
- entry_spacer.removeClass('add-entry').animate({height: entry_spacer.data("auto-height")}, 200);
328
+ if (entry_spacer.data('auto-height')) {
329
+ entry_spacer.empty();
330
+ entry_spacer.removeClass('add-entry').velocity({height: entry_spacer.data('auto-height')}, 200);
331
+ }
312
332
  }
313
333
  });
314
334