somatics3-generators 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +60 -0
  6. data/VERSION +1 -0
  7. data/bin/somatics +21 -0
  8. data/bin/somatify +21 -0
  9. data/lib/generators/somatics/authenticated/authenticated_generator.rb +220 -0
  10. data/lib/generators/somatics/authenticated/templates/mailer.rb +25 -0
  11. data/lib/generators/somatics/authenticated/templates/migration.rb +26 -0
  12. data/lib/generators/somatics/authenticated/templates/model.rb +83 -0
  13. data/lib/generators/somatics/authenticated/templates/observer.rb +11 -0
  14. data/lib/generators/somatics/authenticated/templates/test/mailer_test.rb +31 -0
  15. data/lib/generators/somatics/authenticated/templates/test/model_functional_test.rb +93 -0
  16. data/lib/generators/somatics/authenticated/templates/test/sessions_functional_test.rb +82 -0
  17. data/lib/generators/somatics/authenticated/templates/test/unit_test.rb +164 -0
  18. data/lib/generators/somatics/authenticated/templates/test/users.yml +60 -0
  19. data/lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb +323 -0
  20. data/lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb +8 -0
  21. data/lib/generators/somatics/authenticated_controller/templates/activation.erb +3 -0
  22. data/lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb +189 -0
  23. data/lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb +10 -0
  24. data/lib/generators/somatics/authenticated_controller/templates/config/initializers/site_keys.rb +38 -0
  25. data/lib/generators/somatics/authenticated_controller/templates/controller.rb +55 -0
  26. data/lib/generators/somatics/authenticated_controller/templates/helper.rb +91 -0
  27. data/lib/generators/somatics/authenticated_controller/templates/login.html.erb +29 -0
  28. data/lib/generators/somatics/authenticated_controller/templates/mailer.rb +25 -0
  29. data/lib/generators/somatics/authenticated_controller/templates/migration.rb +26 -0
  30. data/lib/generators/somatics/authenticated_controller/templates/model.rb +83 -0
  31. data/lib/generators/somatics/authenticated_controller/templates/observer.rb +11 -0
  32. data/lib/generators/somatics/authenticated_controller/templates/session_helper.rb +2 -0
  33. data/lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb +43 -0
  34. data/lib/generators/somatics/authenticated_controller/templates/signup.html.erb +19 -0
  35. data/lib/generators/somatics/authenticated_controller/templates/signup_notification.erb +8 -0
  36. data/lib/generators/somatics/authenticated_controller/templates/test/mailer_test.rb +31 -0
  37. data/lib/generators/somatics/authenticated_controller/templates/test/model_functional_test.rb +93 -0
  38. data/lib/generators/somatics/authenticated_controller/templates/test/sessions_functional_test.rb +82 -0
  39. data/lib/generators/somatics/authenticated_controller/templates/test/unit_test.rb +164 -0
  40. data/lib/generators/somatics/authenticated_controller/templates/test/users.yml +60 -0
  41. data/lib/generators/somatics/helper/helper_generator.rb +16 -0
  42. data/lib/generators/somatics/install/install_generator.rb +65 -0
  43. data/lib/generators/somatics/install/templates/config/locales/somatics_en.yml +33 -0
  44. data/lib/generators/somatics/install/templates/config/locales/somatics_zh-TW.yml +33 -0
  45. data/lib/generators/somatics/install/templates/controller_admin.rb +16 -0
  46. data/lib/generators/somatics/install/templates/controller_home.rb +4 -0
  47. data/lib/generators/somatics/install/templates/helper_admin.rb +68 -0
  48. data/lib/generators/somatics/install/templates/layout_admin.html.erb +88 -0
  49. data/lib/generators/somatics/install/templates/lib/somatic_link_renderer.rb +42 -0
  50. data/lib/generators/somatics/install/templates/partial_menu.html.erb +1 -0
  51. data/lib/generators/somatics/install/templates/public/images/somatics/add.png +0 -0
  52. data/lib/generators/somatics/install/templates/public/images/somatics/arrow_collapsed.png +0 -0
  53. data/lib/generators/somatics/install/templates/public/images/somatics/arrow_expanded.png +0 -0
  54. data/lib/generators/somatics/install/templates/public/images/somatics/attachment.png +0 -0
  55. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_arrow_left.png +0 -0
  56. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_arrow_right.png +0 -0
  57. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_diamond.png +0 -0
  58. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_end.png +0 -0
  59. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_go.png +0 -0
  60. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_toggle_minus.png +0 -0
  61. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_toggle_plus.png +0 -0
  62. data/lib/generators/somatics/install/templates/public/images/somatics/c.png +0 -0
  63. data/lib/generators/somatics/install/templates/public/images/somatics/cancel.png +0 -0
  64. data/lib/generators/somatics/install/templates/public/images/somatics/changeset.png +0 -0
  65. data/lib/generators/somatics/install/templates/public/images/somatics/comment.png +0 -0
  66. data/lib/generators/somatics/install/templates/public/images/somatics/comments.png +0 -0
  67. data/lib/generators/somatics/install/templates/public/images/somatics/content-left.png +0 -0
  68. data/lib/generators/somatics/install/templates/public/images/somatics/content-right.png +0 -0
  69. data/lib/generators/somatics/install/templates/public/images/somatics/copy.png +0 -0
  70. data/lib/generators/somatics/install/templates/public/images/somatics/csharp.png +0 -0
  71. data/lib/generators/somatics/install/templates/public/images/somatics/database_key.png +0 -0
  72. data/lib/generators/somatics/install/templates/public/images/somatics/default.png +0 -0
  73. data/lib/generators/somatics/install/templates/public/images/somatics/delete.png +0 -0
  74. data/lib/generators/somatics/install/templates/public/images/somatics/document.png +0 -0
  75. data/lib/generators/somatics/install/templates/public/images/somatics/draft.png +0 -0
  76. data/lib/generators/somatics/install/templates/public/images/somatics/duplicate.png +0 -0
  77. data/lib/generators/somatics/install/templates/public/images/somatics/edit.png +0 -0
  78. data/lib/generators/somatics/install/templates/public/images/somatics/exclamation.png +0 -0
  79. data/lib/generators/somatics/install/templates/public/images/somatics/external.png +0 -0
  80. data/lib/generators/somatics/install/templates/public/images/somatics/fav.png +0 -0
  81. data/lib/generators/somatics/install/templates/public/images/somatics/fav_off.png +0 -0
  82. data/lib/generators/somatics/install/templates/public/images/somatics/feed.png +0 -0
  83. data/lib/generators/somatics/install/templates/public/images/somatics/folder.png +0 -0
  84. data/lib/generators/somatics/install/templates/public/images/somatics/folder_open.png +0 -0
  85. data/lib/generators/somatics/install/templates/public/images/somatics/footer-bg.png +0 -0
  86. data/lib/generators/somatics/install/templates/public/images/somatics/footer-left.png +0 -0
  87. data/lib/generators/somatics/install/templates/public/images/somatics/footer-right.png +0 -0
  88. data/lib/generators/somatics/install/templates/public/images/somatics/group.png +0 -0
  89. data/lib/generators/somatics/install/templates/public/images/somatics/help.png +0 -0
  90. data/lib/generators/somatics/install/templates/public/images/somatics/history.png +0 -0
  91. data/lib/generators/somatics/install/templates/public/images/somatics/image.png +0 -0
  92. data/lib/generators/somatics/install/templates/public/images/somatics/lightning.png +0 -0
  93. data/lib/generators/somatics/install/templates/public/images/somatics/link.png +0 -0
  94. data/lib/generators/somatics/install/templates/public/images/somatics/loading.gif +0 -0
  95. data/lib/generators/somatics/install/templates/public/images/somatics/locked.png +0 -0
  96. data/lib/generators/somatics/install/templates/public/images/somatics/message.png +0 -0
  97. data/lib/generators/somatics/install/templates/public/images/somatics/milestone.png +0 -0
  98. data/lib/generators/somatics/install/templates/public/images/somatics/move.png +0 -0
  99. data/lib/generators/somatics/install/templates/public/images/somatics/news.png +0 -0
  100. data/lib/generators/somatics/install/templates/public/images/somatics/openid-bg.gif +0 -0
  101. data/lib/generators/somatics/install/templates/public/images/somatics/package.png +0 -0
  102. data/lib/generators/somatics/install/templates/public/images/somatics/pdf.png +0 -0
  103. data/lib/generators/somatics/install/templates/public/images/somatics/php.png +0 -0
  104. data/lib/generators/somatics/install/templates/public/images/somatics/plugin.png +0 -0
  105. data/lib/generators/somatics/install/templates/public/images/somatics/projects.png +0 -0
  106. data/lib/generators/somatics/install/templates/public/images/somatics/rails.png +0 -0
  107. data/lib/generators/somatics/install/templates/public/images/somatics/reload.png +0 -0
  108. data/lib/generators/somatics/install/templates/public/images/somatics/report.png +0 -0
  109. data/lib/generators/somatics/install/templates/public/images/somatics/ruby.png +0 -0
  110. data/lib/generators/somatics/install/templates/public/images/somatics/save.png +0 -0
  111. data/lib/generators/somatics/install/templates/public/images/somatics/sort_asc.png +0 -0
  112. data/lib/generators/somatics/install/templates/public/images/somatics/sort_desc.png +0 -0
  113. data/lib/generators/somatics/install/templates/public/images/somatics/stats.png +0 -0
  114. data/lib/generators/somatics/install/templates/public/images/somatics/table_multiple.png +0 -0
  115. data/lib/generators/somatics/install/templates/public/images/somatics/task_done.png +0 -0
  116. data/lib/generators/somatics/install/templates/public/images/somatics/task_late.png +0 -0
  117. data/lib/generators/somatics/install/templates/public/images/somatics/task_parent_end.png +0 -0
  118. data/lib/generators/somatics/install/templates/public/images/somatics/task_todo.png +0 -0
  119. data/lib/generators/somatics/install/templates/public/images/somatics/text.png +0 -0
  120. data/lib/generators/somatics/install/templates/public/images/somatics/text_list_bullets.png +0 -0
  121. data/lib/generators/somatics/install/templates/public/images/somatics/textfield.png +0 -0
  122. data/lib/generators/somatics/install/templates/public/images/somatics/ticket.png +0 -0
  123. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_checked.png +0 -0
  124. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_edit.png +0 -0
  125. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_go.png +0 -0
  126. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_note.png +0 -0
  127. data/lib/generators/somatics/install/templates/public/images/somatics/time.png +0 -0
  128. data/lib/generators/somatics/install/templates/public/images/somatics/time_add.png +0 -0
  129. data/lib/generators/somatics/install/templates/public/images/somatics/toggle_check.png +0 -0
  130. data/lib/generators/somatics/install/templates/public/images/somatics/true.png +0 -0
  131. data/lib/generators/somatics/install/templates/public/images/somatics/unlock.png +0 -0
  132. data/lib/generators/somatics/install/templates/public/images/somatics/user.png +0 -0
  133. data/lib/generators/somatics/install/templates/public/images/somatics/warning.png +0 -0
  134. data/lib/generators/somatics/install/templates/public/images/somatics/wiki_edit.png +0 -0
  135. data/lib/generators/somatics/install/templates/public/images/somatics/xml.png +0 -0
  136. data/lib/generators/somatics/install/templates/public/images/somatics/zip.png +0 -0
  137. data/lib/generators/somatics/install/templates/public/images/somatics/zoom_in.png +0 -0
  138. data/lib/generators/somatics/install/templates/public/javascripts/somatics/base.js +231 -0
  139. data/lib/generators/somatics/install/templates/public/javascripts/somatics/context_menu.js +237 -0
  140. data/lib/generators/somatics/install/templates/public/javascripts/somatics/controls.js +965 -0
  141. data/lib/generators/somatics/install/templates/public/javascripts/somatics/dragdrop.js +974 -0
  142. data/lib/generators/somatics/install/templates/public/javascripts/somatics/effects.js +1123 -0
  143. data/lib/generators/somatics/install/templates/public/javascripts/somatics/prototype.js +6001 -0
  144. data/lib/generators/somatics/install/templates/public/javascripts/somatics/rails.js +175 -0
  145. data/lib/generators/somatics/install/templates/public/javascripts/somatics/select_list_move.js +82 -0
  146. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/base.css +948 -0
  147. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/context_menu.css +52 -0
  148. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/csshover.htc +122 -0
  149. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/jstoolbar.css +95 -0
  150. data/lib/generators/somatics/install/templates/view_index.html.erb +1 -0
  151. data/lib/generators/somatics/scaffold/scaffold_generator.rb +25 -0
  152. data/lib/generators/somatics/scaffold/templates/_form.html.erb +23 -0
  153. data/lib/generators/somatics/scaffold/templates/edit.html.erb +6 -0
  154. data/lib/generators/somatics/scaffold/templates/index.html.erb +27 -0
  155. data/lib/generators/somatics/scaffold/templates/new.html.erb +5 -0
  156. data/lib/generators/somatics/scaffold/templates/show.html.erb +12 -0
  157. data/lib/generators/somatics/scaffold_controller/USAGE +20 -0
  158. data/lib/generators/somatics/scaffold_controller/scaffold_controller_generator.rb +137 -0
  159. data/lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn +25 -0
  160. data/lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder +24 -0
  161. data/lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder +10 -0
  162. data/lib/generators/somatics/scaffold_controller/templates/controller.rb +140 -0
  163. data/lib/generators/somatics/scaffold_controller/templates/locales_en.yml +17 -0
  164. data/lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml +20 -0
  165. data/lib/generators/somatics/scaffold_controller/templates/partial_bulk.html.erb +12 -0
  166. data/lib/generators/somatics/scaffold_controller/templates/partial_edit.html.erb +7 -0
  167. data/lib/generators/somatics/scaffold_controller/templates/partial_form.html.erb +13 -0
  168. data/lib/generators/somatics/scaffold_controller/templates/partial_list.html.erb +42 -0
  169. data/lib/generators/somatics/scaffold_controller/templates/partial_menu.html.erb +1 -0
  170. data/lib/generators/somatics/scaffold_controller/templates/partial_show.html.erb +31 -0
  171. data/lib/generators/somatics/scaffold_controller/templates/view_edit.html.erb +24 -0
  172. data/lib/generators/somatics/scaffold_controller/templates/view_index.html.erb +28 -0
  173. data/lib/generators/somatics/scaffold_controller/templates/view_new.html.erb +14 -0
  174. data/lib/generators/somatics/scaffold_controller/templates/view_show.html.erb +24 -0
  175. data/lib/generators/somatics.rb +95 -0
  176. data/lib/somatics3-generators.rb +19 -0
  177. data/somatics3-generators.gemspec +223 -0
  178. data/templates/somatics.rb +128 -0
  179. data/test/helper.rb +10 -0
  180. data/test/test_somatics3-generators.rb +7 -0
  181. metadata +301 -0
@@ -0,0 +1,237 @@
1
+ /* redMine - project management software
2
+ Copyright (C) 2006-2008 Jean-Philippe Lang */
3
+
4
+ var observingContextMenuClick;
5
+
6
+ ContextMenu = Class.create();
7
+ ContextMenu.prototype = {
8
+ initialize: function (url) {
9
+ this.url = url;
10
+ this.createMenu();
11
+
12
+ if (!observingContextMenuClick) {
13
+ Event.observe(document, 'click', this.Click.bindAsEventListener(this));
14
+ Event.observe(document, (window.opera ? 'click' : 'contextmenu'), this.RightClick.bindAsEventListener(this));
15
+ observingContextMenuClick = true;
16
+ }
17
+
18
+ this.unselectAll();
19
+ this.lastSelected = null;
20
+ },
21
+
22
+ RightClick: function(e) {
23
+ this.hideMenu();
24
+ // do not show the context menu on links
25
+ if (Event.element(e).tagName == 'A') { return; }
26
+ // right-click simulated by Alt+Click with Opera
27
+ if (window.opera && !e.altKey) { return; }
28
+ var tr = Event.findElement(e, 'tr');
29
+ if (tr == document || tr == undefined || !tr.hasClassName('hascontextmenu')) { return; }
30
+ Event.stop(e);
31
+ if (!this.isSelected(tr)) {
32
+ this.unselectAll();
33
+ this.addSelection(tr);
34
+ this.lastSelected = tr;
35
+ }
36
+ this.showMenu(e);
37
+ },
38
+
39
+ Click: function(e) {
40
+ this.hideMenu();
41
+ if (Event.element(e).tagName == 'A') { return; }
42
+ if (window.opera && e.altKey) { return; }
43
+ if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) {
44
+ var tr = Event.findElement(e, 'tr');
45
+ if (tr!=null && tr!=document && tr.hasClassName('hascontextmenu')) {
46
+ // a row was clicked, check if the click was on checkbox
47
+ var box = Event.findElement(e, 'input');
48
+ if (box!=document && box!=undefined) {
49
+ // a checkbox may be clicked
50
+ if (box.checked) {
51
+ tr.addClassName('context-menu-selection');
52
+ } else {
53
+ tr.removeClassName('context-menu-selection');
54
+ }
55
+ } else {
56
+ if (e.ctrlKey) {
57
+ this.toggleSelection(tr);
58
+ } else if (e.shiftKey) {
59
+ if (this.lastSelected != null) {
60
+ var toggling = false;
61
+ var rows = $$('.hascontextmenu');
62
+ for (i=0; i<rows.length; i++) {
63
+ if (toggling || rows[i]==tr) {
64
+ this.addSelection(rows[i]);
65
+ }
66
+ if (rows[i]==tr || rows[i]==this.lastSelected) {
67
+ toggling = !toggling;
68
+ }
69
+ }
70
+ } else {
71
+ this.addSelection(tr);
72
+ }
73
+ } else {
74
+ this.unselectAll();
75
+ this.addSelection(tr);
76
+ }
77
+ this.lastSelected = tr;
78
+ }
79
+ } else {
80
+ // click is outside the rows
81
+ var t = Event.findElement(e, 'a');
82
+ if (t == document || t == undefined) {
83
+ this.unselectAll();
84
+ } else {
85
+ if (Element.hasClassName(t, 'disabled') || Element.hasClassName(t, 'submenu')) {
86
+ Event.stop(e);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ else{
92
+ this.RightClick(e);
93
+ }
94
+ },
95
+
96
+ createMenu: function() {
97
+ if (!$('context-menu')) {
98
+ var menu = document.createElement("div");
99
+ menu.setAttribute("id", "context-menu");
100
+ menu.setAttribute("style", "display:none;");
101
+ document.getElementById("content").appendChild(menu);
102
+ }
103
+ },
104
+
105
+ showMenu: function(e) {
106
+ var mouse_x = Event.pointerX(e);
107
+ var mouse_y = Event.pointerY(e);
108
+ var render_x = mouse_x;
109
+ var render_y = mouse_y;
110
+ var dims;
111
+ var menu_width;
112
+ var menu_height;
113
+ var window_width;
114
+ var window_height;
115
+ var max_width;
116
+ var max_height;
117
+
118
+ $('context-menu').style['left'] = (render_x + 'px');
119
+ $('context-menu').style['top'] = (render_y + 'px');
120
+ Element.update('context-menu', '');
121
+
122
+ new Ajax.Updater({success:'context-menu'}, this.url,
123
+ {asynchronous:true,
124
+ evalScripts:true,
125
+ parameters:Form.serialize(Event.findElement(e, 'form')),
126
+ onComplete:function(request){
127
+ dims = $('context-menu').getDimensions();
128
+ menu_width = dims.width;
129
+ menu_height = dims.height;
130
+ max_width = mouse_x + 2*menu_width;
131
+ max_height = mouse_y + menu_height;
132
+
133
+ var ws = window_size();
134
+ window_width = ws.width;
135
+ window_height = ws.height;
136
+
137
+ /* display the menu above and/or to the left of the click if needed */
138
+ if (max_width > window_width) {
139
+ render_x -= menu_width;
140
+ $('context-menu').addClassName('reverse-x');
141
+ } else {
142
+ $('context-menu').removeClassName('reverse-x');
143
+ }
144
+ if (max_height > window_height) {
145
+ render_y -= menu_height;
146
+ $('context-menu').addClassName('reverse-y');
147
+ } else {
148
+ $('context-menu').removeClassName('reverse-y');
149
+ }
150
+ if (render_x <= 0) render_x = 1;
151
+ if (render_y <= 0) render_y = 1;
152
+ $('context-menu').style['left'] = (render_x + 'px');
153
+ $('context-menu').style['top'] = (render_y + 'px');
154
+
155
+ Effect.Appear('context-menu', {duration: 0.20});
156
+ if (window.parseStylesheets) { window.parseStylesheets(); } // IE
157
+ }})
158
+ },
159
+
160
+ hideMenu: function() {
161
+ Element.hide('context-menu');
162
+ },
163
+
164
+ addSelection: function(tr) {
165
+ tr.addClassName('context-menu-selection');
166
+ this.checkSelectionBox(tr, true);
167
+ this.clearDocumentSelection();
168
+ },
169
+
170
+ toggleSelection: function(tr) {
171
+ if (this.isSelected(tr)) {
172
+ this.removeSelection(tr);
173
+ } else {
174
+ this.addSelection(tr);
175
+ }
176
+ },
177
+
178
+ removeSelection: function(tr) {
179
+ tr.removeClassName('context-menu-selection');
180
+ this.checkSelectionBox(tr, false);
181
+ },
182
+
183
+ unselectAll: function() {
184
+ var rows = $$('.hascontextmenu');
185
+ for (i=0; i<rows.length; i++) {
186
+ this.removeSelection(rows[i]);
187
+ }
188
+ },
189
+
190
+ checkSelectionBox: function(tr, checked) {
191
+ var inputs = Element.getElementsBySelector(tr, 'input');
192
+ if (inputs.length > 0) { inputs[0].checked = checked; }
193
+ },
194
+
195
+ isSelected: function(tr) {
196
+ return Element.hasClassName(tr, 'context-menu-selection');
197
+ },
198
+
199
+ clearDocumentSelection: function() {
200
+ if (document.selection) {
201
+ document.selection.clear(); // IE
202
+ } else {
203
+ window.getSelection().removeAllRanges();
204
+ }
205
+ }
206
+ }
207
+
208
+ function toggleIssuesSelection(el) {
209
+ var boxes = el.getElementsBySelector('input[type=checkbox]');
210
+ var all_checked = true;
211
+ for (i = 0; i < boxes.length; i++) { if (boxes[i].checked == false) { all_checked = false; } }
212
+ for (i = 0; i < boxes.length; i++) {
213
+ if (all_checked) {
214
+ boxes[i].checked = false;
215
+ boxes[i].up('tr').removeClassName('context-menu-selection');
216
+ } else if (boxes[i].checked == false) {
217
+ boxes[i].checked = true;
218
+ boxes[i].up('tr').addClassName('context-menu-selection');
219
+ }
220
+ }
221
+ }
222
+
223
+ function window_size() {
224
+ var w;
225
+ var h;
226
+ if (window.innerWidth) {
227
+ w = window.innerWidth;
228
+ h = window.innerHeight;
229
+ } else if (document.documentElement) {
230
+ w = document.documentElement.clientWidth;
231
+ h = document.documentElement.clientHeight;
232
+ } else {
233
+ w = document.body.clientWidth;
234
+ h = document.body.clientHeight;
235
+ }
236
+ return {width: w, height: h};
237
+ }