kit_cms 2.3.9 → 2.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. data/app/assets/images/mercury/dashboard.png +0 -0
  2. data/app/assets/images/mercury/info.png +0 -0
  3. data/app/assets/images/mercury/insertsPanel.png +0 -0
  4. data/app/assets/images/mercury/related.png +0 -0
  5. data/app/assets/images/mercury/view.png +0 -0
  6. data/app/assets/javascripts/{kit/best_in_place.js → best_in_place.js} +0 -0
  7. data/app/assets/javascripts/codemirror/editor.js +1 -1
  8. data/app/assets/javascripts/codemirror/sass.js +349 -0
  9. data/app/assets/javascripts/{kit/fancybox → fancybox}/ajax.txt +0 -0
  10. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/blank.gif +0 -0
  11. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_close.png +0 -0
  12. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_loading.png +0 -0
  13. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_nav_left.png +0 -0
  14. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_nav_right.png +0 -0
  15. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_e.png +0 -0
  16. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_n.png +0 -0
  17. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_ne.png +0 -0
  18. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_nw.png +0 -0
  19. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_s.png +0 -0
  20. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_se.png +0 -0
  21. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_sw.png +0 -0
  22. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_w.png +0 -0
  23. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_left.png +0 -0
  24. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_main.png +0 -0
  25. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_over.png +0 -0
  26. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_right.png +0 -0
  27. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox-x.png +0 -0
  28. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox-y.png +0 -0
  29. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.css +0 -0
  30. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.js +0 -0
  31. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.png +0 -0
  32. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -0
  33. data/app/assets/javascripts/{kit/fancybox → fancybox}/index.html +0 -0
  34. data/app/assets/javascripts/{kit/fancybox → fancybox}/style.css +0 -0
  35. data/app/assets/javascripts/{kit/gadash-1.0.js → gadash-1.0.js} +0 -0
  36. data/app/assets/javascripts/{kit/jquery-ui.js → jquery-ui.js} +0 -0
  37. data/app/assets/javascripts/{kit/jquery.contextmenu.js → jquery.contextmenu.js} +0 -0
  38. data/app/assets/javascripts/{kit/jquery.fileupload-ui.js → jquery.fileupload-ui.js} +0 -0
  39. data/app/assets/javascripts/{kit/jquery.fileupload.js → jquery.fileupload.js} +0 -0
  40. data/app/assets/javascripts/{kit/jquery.js → jquery.js} +0 -0
  41. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/bg.jpg +0 -0
  42. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/d.png +0 -0
  43. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/doc.png +0 -0
  44. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/dot_for_ie.gif +0 -0
  45. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/gear.png +0 -0
  46. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/style.css +0 -0
  47. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/throbber.gif +0 -0
  48. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/bg.jpg +0 -0
  49. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/d.png +0 -0
  50. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/doc.png +0 -0
  51. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/dot_for_ie.gif +0 -0
  52. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/gear.png +0 -0
  53. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/style.css +0 -0
  54. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/throbber.gif +0 -0
  55. data/app/assets/javascripts/{kit/jquery.validate.js → jquery.validate.js} +0 -0
  56. data/app/assets/javascripts/jqueryui.js +4 -0
  57. data/app/assets/javascripts/{kit/jsplumb-min.js → jsplumb-min.js} +0 -0
  58. data/app/assets/javascripts/{kit_admin.js → kit/cms.js} +5 -4
  59. data/app/assets/javascripts/kit/{mercury-editor.js.erb → editor.js} +5 -4
  60. data/app/assets/javascripts/kit/kit.js +12 -0
  61. data/app/assets/javascripts/kit/utilities.js +0 -15
  62. data/app/assets/javascripts/{kit/underscore.js → underscore.js} +0 -0
  63. data/app/assets/javascripts/{kit/waypoint.js → waypoint.js} +0 -0
  64. data/app/assets/stylesheets/codemirror/editor.css +6 -0
  65. data/app/assets/stylesheets/codemirror/style.css +2 -2
  66. data/app/assets/stylesheets/codemirror/theme.css +26 -1
  67. data/app/assets/stylesheets/{kit_admin.css → kit/admin.css} +0 -0
  68. data/app/assets/stylesheets/kit/cms.css +35 -0
  69. data/app/assets/stylesheets/{mercury_editor.css → kit/editor.css} +9 -0
  70. data/app/assets/stylesheets/{kit.css → kit/kit.css} +4 -4
  71. data/app/controllers/admin/ad_units_controller.rb +1 -1
  72. data/app/controllers/admin/block_controller.rb +1 -1
  73. data/app/controllers/admin/block_instance_controller.rb +1 -1
  74. data/app/controllers/admin/blocks_controller.rb +1 -1
  75. data/app/controllers/admin/calendar_entries_controller.rb +1 -1
  76. data/app/controllers/admin/calendars_controller.rb +1 -1
  77. data/app/controllers/admin/content_controller.rb +1 -1
  78. data/app/controllers/admin/dashboard_controller.rb +15 -6
  79. data/app/controllers/admin/forum_controller.rb +1 -1
  80. data/app/controllers/admin/help_controller.rb +1 -1
  81. data/app/controllers/admin/mapping_controller.rb +1 -1
  82. data/app/controllers/admin/newsletter_controller.rb +1 -1
  83. data/app/controllers/admin/page_template_terms_controller.rb +1 -1
  84. data/app/controllers/admin/page_templates_controller.rb +1 -1
  85. data/app/controllers/admin/preference_controller.rb +1 -1
  86. data/app/controllers/admin/snippet_controller.rb +1 -1
  87. data/app/controllers/admin/todo_controller.rb +2 -2
  88. data/app/controllers/admin/user_controller.rb +1 -1
  89. data/app/controllers/admin/views_controller.rb +1 -1
  90. data/app/controllers/admin_controller.rb +1 -1
  91. data/app/controllers/asset_controller.rb +1 -1
  92. data/app/controllers/calendar_controller.rb +1 -1
  93. data/app/controllers/category_controller.rb +2 -2
  94. data/app/controllers/menu_controller.rb +1 -1
  95. data/app/controllers/pages_controller.rb +5 -5
  96. data/app/controllers/utility_controller.rb +1 -1
  97. data/app/helpers/kit_helper.rb +5 -17
  98. data/app/helpers/kit_modules_helper.rb +1 -1
  99. data/app/models/asset.rb +2 -0
  100. data/app/models/block.rb +1 -0
  101. data/app/models/block_instance.rb +8 -3
  102. data/app/models/html_asset.rb +1 -0
  103. data/app/models/layout.rb +1 -0
  104. data/app/models/page.rb +2 -3
  105. data/app/models/page_template.rb +2 -0
  106. data/app/views/admin/blocks/_form.html.haml +1 -1
  107. data/app/views/admin/dashboard/system.html.haml +1 -0
  108. data/app/views/admin/help/edit.html.haml +1 -1
  109. data/app/views/admin/html_asset/show.html.haml +1 -1
  110. data/app/views/admin/layouts/show.html.haml +2 -2
  111. data/app/views/admin/page_templates/_form.html.haml +1 -1
  112. data/app/views/admin/snippet/edit.html.erb +1 -1
  113. data/app/views/admin/snippet/new.html.erb +1 -1
  114. data/app/views/admin/stylesheet/show.html.haml +1 -1
  115. data/app/views/asset/index.html.haml +0 -3
  116. data/app/views/layouts/_cms-common.html.erb +1 -1
  117. data/app/views/layouts/_kit_header.html.haml +2 -2
  118. data/app/views/layouts/{cms-boxed.html.haml → cms.html.haml} +1 -1
  119. data/app/views/layouts/mercury-editor.html.erb +2 -8
  120. data/app/views/pages/content_edit.html.haml +1 -1
  121. data/app/views/utility/_cm_editor.html.erb +19 -0
  122. data/app/views/utility/mercury_html.html.haml +0 -3
  123. data/lib/kit_cms.rb +2 -0
  124. metadata +66 -196
  125. data/app/assets/javascripts/admin/advertisments.js +0 -2
  126. data/app/assets/javascripts/admin/kit_engagement.js +0 -2
  127. data/app/assets/javascripts/admin/order.js +0 -2
  128. data/app/assets/javascripts/kit.js +0 -14
  129. data/app/assets/javascripts/kit/ace/ace.js +0 -11
  130. data/app/assets/javascripts/kit/ace/ext-static_highlight.js +0 -1
  131. data/app/assets/javascripts/kit/ace/ext-textarea.js +0 -1
  132. data/app/assets/javascripts/kit/ace/keybinding-emacs.js +0 -1
  133. data/app/assets/javascripts/kit/ace/keybinding-vim.js +0 -1
  134. data/app/assets/javascripts/kit/ace/mode-abap.js +0 -1
  135. data/app/assets/javascripts/kit/ace/mode-asciidoc.js +0 -1
  136. data/app/assets/javascripts/kit/ace/mode-c9search.js +0 -1
  137. data/app/assets/javascripts/kit/ace/mode-c_cpp.js +0 -1
  138. data/app/assets/javascripts/kit/ace/mode-clojure.js +0 -1
  139. data/app/assets/javascripts/kit/ace/mode-coffee.js +0 -1
  140. data/app/assets/javascripts/kit/ace/mode-coldfusion.js +0 -1
  141. data/app/assets/javascripts/kit/ace/mode-csharp.js +0 -1
  142. data/app/assets/javascripts/kit/ace/mode-css.js +0 -1
  143. data/app/assets/javascripts/kit/ace/mode-dart.js +0 -1
  144. data/app/assets/javascripts/kit/ace/mode-diff.js +0 -1
  145. data/app/assets/javascripts/kit/ace/mode-dot.js +0 -1
  146. data/app/assets/javascripts/kit/ace/mode-glsl.js +0 -1
  147. data/app/assets/javascripts/kit/ace/mode-golang.js +0 -1
  148. data/app/assets/javascripts/kit/ace/mode-groovy.js +0 -1
  149. data/app/assets/javascripts/kit/ace/mode-haml.js +0 -1
  150. data/app/assets/javascripts/kit/ace/mode-haxe.js +0 -1
  151. data/app/assets/javascripts/kit/ace/mode-html.js +0 -1
  152. data/app/assets/javascripts/kit/ace/mode-jade.js +0 -1
  153. data/app/assets/javascripts/kit/ace/mode-java.js +0 -1
  154. data/app/assets/javascripts/kit/ace/mode-javascript.js +0 -1
  155. data/app/assets/javascripts/kit/ace/mode-json.js +0 -1
  156. data/app/assets/javascripts/kit/ace/mode-jsp.js +0 -1
  157. data/app/assets/javascripts/kit/ace/mode-jsx.js +0 -1
  158. data/app/assets/javascripts/kit/ace/mode-latex.js +0 -1
  159. data/app/assets/javascripts/kit/ace/mode-less.js +0 -1
  160. data/app/assets/javascripts/kit/ace/mode-liquid.js +0 -1
  161. data/app/assets/javascripts/kit/ace/mode-lisp.js +0 -1
  162. data/app/assets/javascripts/kit/ace/mode-lua.js +0 -1
  163. data/app/assets/javascripts/kit/ace/mode-luapage.js +0 -1
  164. data/app/assets/javascripts/kit/ace/mode-lucene.js +0 -1
  165. data/app/assets/javascripts/kit/ace/mode-makefile.js +0 -1
  166. data/app/assets/javascripts/kit/ace/mode-markdown.js +0 -1
  167. data/app/assets/javascripts/kit/ace/mode-objectivec.js +0 -1
  168. data/app/assets/javascripts/kit/ace/mode-ocaml.js +0 -1
  169. data/app/assets/javascripts/kit/ace/mode-perl.js +0 -1
  170. data/app/assets/javascripts/kit/ace/mode-pgsql.js +0 -1
  171. data/app/assets/javascripts/kit/ace/mode-php.js +0 -1
  172. data/app/assets/javascripts/kit/ace/mode-powershell.js +0 -1
  173. data/app/assets/javascripts/kit/ace/mode-python.js +0 -1
  174. data/app/assets/javascripts/kit/ace/mode-r.js +0 -1
  175. data/app/assets/javascripts/kit/ace/mode-rdoc.js +0 -1
  176. data/app/assets/javascripts/kit/ace/mode-rhtml.js +0 -1
  177. data/app/assets/javascripts/kit/ace/mode-ruby.js +0 -1
  178. data/app/assets/javascripts/kit/ace/mode-sass.js +0 -0
  179. data/app/assets/javascripts/kit/ace/mode-scad.js +0 -1
  180. data/app/assets/javascripts/kit/ace/mode-scala.js +0 -1
  181. data/app/assets/javascripts/kit/ace/mode-scss.js +0 -1
  182. data/app/assets/javascripts/kit/ace/mode-sh.js +0 -1
  183. data/app/assets/javascripts/kit/ace/mode-sql.js +0 -1
  184. data/app/assets/javascripts/kit/ace/mode-stylus.js +0 -1
  185. data/app/assets/javascripts/kit/ace/mode-svg.js +0 -1
  186. data/app/assets/javascripts/kit/ace/mode-tcl.js +0 -1
  187. data/app/assets/javascripts/kit/ace/mode-text.js +0 -0
  188. data/app/assets/javascripts/kit/ace/mode-textile.js +0 -1
  189. data/app/assets/javascripts/kit/ace/mode-typescript.js +0 -1
  190. data/app/assets/javascripts/kit/ace/mode-xml.js +0 -1
  191. data/app/assets/javascripts/kit/ace/mode-xquery.js +0 -1
  192. data/app/assets/javascripts/kit/ace/mode-yaml.js +0 -1
  193. data/app/assets/javascripts/kit/ace/theme-ambiance.js +0 -1
  194. data/app/assets/javascripts/kit/ace/theme-chaos.js +0 -1
  195. data/app/assets/javascripts/kit/ace/theme-chrome.js +0 -1
  196. data/app/assets/javascripts/kit/ace/theme-clouds.js +0 -1
  197. data/app/assets/javascripts/kit/ace/theme-clouds_midnight.js +0 -1
  198. data/app/assets/javascripts/kit/ace/theme-cobalt.js +0 -1
  199. data/app/assets/javascripts/kit/ace/theme-crimson_editor.js +0 -1
  200. data/app/assets/javascripts/kit/ace/theme-dawn.js +0 -1
  201. data/app/assets/javascripts/kit/ace/theme-dreamweaver.js +0 -1
  202. data/app/assets/javascripts/kit/ace/theme-eclipse.js +0 -1
  203. data/app/assets/javascripts/kit/ace/theme-github.js +0 -1
  204. data/app/assets/javascripts/kit/ace/theme-idle_fingers.js +0 -1
  205. data/app/assets/javascripts/kit/ace/theme-kr.js +0 -1
  206. data/app/assets/javascripts/kit/ace/theme-merbivore.js +0 -1
  207. data/app/assets/javascripts/kit/ace/theme-merbivore_soft.js +0 -1
  208. data/app/assets/javascripts/kit/ace/theme-mono_industrial.js +0 -1
  209. data/app/assets/javascripts/kit/ace/theme-monokai.js +0 -1
  210. data/app/assets/javascripts/kit/ace/theme-pastel_on_dark.js +0 -1
  211. data/app/assets/javascripts/kit/ace/theme-solarized_dark.js +0 -1
  212. data/app/assets/javascripts/kit/ace/theme-solarized_light.js +0 -1
  213. data/app/assets/javascripts/kit/ace/theme-textmate.js +0 -1
  214. data/app/assets/javascripts/kit/ace/theme-tomorrow.js +0 -1
  215. data/app/assets/javascripts/kit/ace/theme-tomorrow_night.js +0 -1
  216. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_blue.js +0 -1
  217. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_bright.js +0 -1
  218. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_eighties.js +0 -1
  219. data/app/assets/javascripts/kit/ace/theme-twilight.js +0 -1
  220. data/app/assets/javascripts/kit/ace/theme-vibrant_ink.js +0 -1
  221. data/app/assets/javascripts/kit/ace/theme-xcode.js +0 -1
  222. data/app/assets/javascripts/kit/ace/worker-coffee.js +0 -1
  223. data/app/assets/javascripts/kit/ace/worker-css.js +0 -1
  224. data/app/assets/javascripts/kit/ace/worker-javascript.js +0 -1
  225. data/app/assets/javascripts/kit/ace/worker-json.js +0 -1
  226. data/app/assets/javascripts/kit/ace/worker-xquery.js +0 -1
  227. data/app/assets/javascripts/kit/jquery-ui.min.js +0 -126
  228. data/app/assets/javascripts/kit/jquery.markitup.js +0 -635
  229. data/app/assets/javascripts/kit/jquery.min.js +0 -3
  230. data/app/assets/javascripts/kit/rails_admin/application.js +0 -7
  231. data/app/assets/javascripts/kit/rails_admin/jquery-1.5.1.min.js +0 -16
  232. data/app/assets/javascripts/kit/rails_admin/jquery-ui-1.8.10.min.js +0 -405
  233. data/app/assets/javascripts/kit/rails_admin/jquery.colorpicker.js +0 -484
  234. data/app/assets/javascripts/kit/rails_admin/jquery.ui.timepicker.js +0 -915
  235. data/app/assets/javascripts/kit/rails_admin/ra.datetimepicker.js +0 -67
  236. data/app/assets/javascripts/kit/rails_admin/ra.filtering-multiselect.js +0 -274
  237. data/app/assets/javascripts/kit/rails_admin/ra.filtering-select.js +0 -179
  238. data/app/assets/javascripts/kit/rails_admin/ra.remote-form.js +0 -111
  239. data/app/assets/javascripts/kit/rails_admin/ra.timeline.js +0 -206
  240. data/app/assets/javascripts/kit/rails_admin/rails.js +0 -289
  241. data/app/assets/stylesheets/application.css +0 -5
  242. data/app/assets/stylesheets/kit/rails_admin/aristo/images/bg_fallback.png +0 -0
  243. data/app/assets/stylesheets/kit/rails_admin/aristo/images/icon_sprite.png +0 -0
  244. data/app/assets/stylesheets/kit/rails_admin/aristo/images/progress_bar.gif +0 -0
  245. data/app/assets/stylesheets/kit/rails_admin/aristo/images/slider_handles.png +0 -0
  246. data/app/assets/stylesheets/kit/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  247. data/app/assets/stylesheets/kit/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  248. data/app/assets/stylesheets/kit/rails_admin/aristo/jquery-ui-1.8.7.custom.css +0 -703
  249. data/app/assets/stylesheets/kit/rails_admin/base.css +0 -349
  250. data/app/assets/stylesheets/kit/rails_admin/dashboard.css +0 -88
  251. data/app/assets/stylesheets/kit/rails_admin/form.css +0 -147
  252. data/app/assets/stylesheets/kit/rails_admin/jquery.colorpicker.css +0 -179
  253. data/app/assets/stylesheets/kit/rails_admin/jquery.ui.timepicker.css +0 -39
  254. data/app/assets/stylesheets/kit/rails_admin/list.css +0 -127
  255. data/app/assets/stylesheets/kit/rails_admin/ra.filtering-multiselect.css +0 -113
  256. data/app/assets/stylesheets/kit/rails_admin/ra.filtering-select.css +0 -7
  257. data/app/assets/stylesheets/kit/rails_admin/ra.timeline.css +0 -77
  258. data/app/assets/stylesheets/kit/ui.tar.gz +0 -0
  259. data/app/assets/stylesheets/mercury_overrides.css +0 -23
  260. data/app/views/layouts/cms.html.erb +0 -66
  261. data/app/views/utility/_ace_editor.html.erb +0 -10
@@ -1,915 +0,0 @@
1
- /*
2
- */
3
-
4
- (function ($, undefined) {
5
-
6
- $.extend($.ui, { timepicker: { version: "0.0.8"} });
7
-
8
- var PROP_NAME = 'timepicker';
9
- var tpuuid = new Date().getTime();
10
-
11
- /* Time picker manager.
12
- Use the singleton instance of this class, $.timepicker, to interact with the time picker.
13
- Settings for (groups of) time pickers are maintained in an instance object,
14
- allowing multiple different settings on the same page. */
15
-
16
- function Timepicker() {
17
- this.debug = true; // Change this to true to start debugging
18
- this._curInst = null; // The current instance in use
19
- this._isInline = false; // true if the instance is displayed inline
20
- this._disabledInputs = []; // List of time picker inputs that have been disabled
21
- this._timepickerShowing = false; // True if the popup picker is showing , false if not
22
- this._inDialog = false; // True if showing within a "dialog", false if not
23
- this._dialogClass = 'ui-timepicker-dialog'; // The name of the dialog marker class
24
- this._mainDivId = 'ui-timepicker-div'; // The ID of the main timepicker division
25
- this._inlineClass = 'ui-timepicker-inline'; // The name of the inline marker class
26
- this._currentClass = 'ui-timepicker-current'; // The name of the current hour / minutes marker class
27
- this._dayOverClass = 'ui-timepicker-days-cell-over'; // The name of the day hover marker class
28
-
29
- this.regional = []; // Available regional settings, indexed by language code
30
- this.regional[''] = { // Default regional settings
31
- hourText: 'Hour', // Display text for hours section
32
- minuteText: 'Minute', // Display text for minutes link
33
- amPmText: ['AM', 'PM'] // Display text for AM PM
34
- };
35
- this._defaults = { // Global defaults for all the time picker instances
36
- showOn: 'focus', // 'focus' for popup on focus,
37
- // 'button' for trigger button, or 'both' for either (not yet implemented)
38
- showAnim: 'fadeIn', // Name of jQuery animation for popup
39
- showOptions: {}, // Options for enhanced animations
40
- appendText: '', // Display text following the input box, e.g. showing the format
41
- onSelect: null, // Define a callback function when a hour / minutes is selected
42
- onClose: null, // Define a callback function when the timepicker is closed
43
- timeSeparator: ':', // The caracter to use to separate hours and minutes.
44
- showPeriod: false, // Define whether or not to show AM/PM with selected time
45
- showLeadingZero: true, // Define whether or not to show a leading zero for hours < 10. [true/false]
46
- showMinutesLeadingZero: true, // Define whether or not to show a leading zero for minutes < 10.
47
- altField: '', // Selector for an alternate field to store selected time into
48
- defaultTime: '', // Used as default time when input field is empty or for inline timePicker
49
-
50
- //NEW: 2011-02-03
51
- onHourShow: null, // callback for enabling / disabling on selectable hours ex : function(hour) { return true; }
52
- onMinuteShow: null // callback for enabling / disabling on time selection ex : function(hour,minute) { return true; }
53
- };
54
- $.extend(this._defaults, this.regional['']);
55
-
56
- this.tpDiv = $('<div id="' + this._mainDivId + '" class="ui-timepicker ui-widget ui-helper-clearfix ui-corner-all " style="display: none"></div>');
57
- }
58
-
59
- $.extend(Timepicker.prototype, {
60
- /* Class name added to elements to indicate already configured with a time picker. */
61
- markerClassName: 'hasTimepicker',
62
-
63
- /* Debug logging (if enabled). */
64
- log: function () {
65
- if (this.debug)
66
- console.log.apply('', arguments);
67
- },
68
-
69
- // TODO rename to "widget" when switching to widget factory
70
- _widgetTimepicker: function () {
71
- return this.tpDiv;
72
- },
73
-
74
- /* Override the default settings for all instances of the time picker.
75
- @param settings object - the new settings to use as defaults (anonymous object)
76
- @return the manager object */
77
- setDefaults: function (settings) {
78
- extendRemove(this._defaults, settings || {});
79
- return this;
80
- },
81
-
82
- /* Attach the time picker to a jQuery selection.
83
- @param target element - the target input field or division or span
84
- @param settings object - the new settings to use for this time picker instance (anonymous) */
85
- _attachTimepicker: function (target, settings) {
86
- // check for settings on the control itself - in namespace 'time:'
87
- var inlineSettings = null;
88
- for (var attrName in this._defaults) {
89
- var attrValue = target.getAttribute('time:' + attrName);
90
- if (attrValue) {
91
- inlineSettings = inlineSettings || {};
92
- try {
93
- inlineSettings[attrName] = eval(attrValue);
94
- } catch (err) {
95
- inlineSettings[attrName] = attrValue;
96
- }
97
- }
98
- }
99
- var nodeName = target.nodeName.toLowerCase();
100
- var inline = (nodeName == 'div' || nodeName == 'span');
101
-
102
- if (!target.id) {
103
- this.uuid += 1;
104
- target.id = 'tp' + this.uuid;
105
- }
106
- var inst = this._newInst($(target), inline);
107
- inst.settings = $.extend({}, settings || {}, inlineSettings || {});
108
- if (nodeName == 'input') {
109
- this._connectTimepicker(target, inst);
110
- } else if (inline) {
111
- this._inlineTimepicker(target, inst);
112
- }
113
- },
114
-
115
- /* Create a new instance object. */
116
- _newInst: function (target, inline) {
117
- var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
118
- return { id: id, input: target, // associated target
119
- selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
120
- drawMonth: 0, drawYear: 0, // month being drawn
121
- inline: inline, // is timepicker inline or not :
122
- tpDiv: (!inline ? this.tpDiv : // presentation div
123
- $('<div class="' + this._inlineClass + ' ui-timepicker ui-widget ui-helper-clearfix"></div>'))
124
- };
125
- },
126
-
127
- /* Attach the time picker to an input field. */
128
- _connectTimepicker: function (target, inst) {
129
- var input = $(target);
130
- inst.append = $([]);
131
- inst.trigger = $([]);
132
- if (input.hasClass(this.markerClassName)) { return; }
133
- this._attachments(input, inst);
134
- input.addClass(this.markerClassName).
135
- keydown(this._doKeyDown).
136
- keyup(this._doKeyUp).
137
- bind("setData.timepicker", function (event, key, value) {
138
- inst.settings[key] = value;
139
- }).
140
- bind("getData.timepicker", function (event, key) {
141
- return this._get(inst, key);
142
- });
143
- //this._autoSize(inst);
144
- $.data(target, PROP_NAME, inst);
145
- },
146
-
147
- /* Handle keystrokes. */
148
- _doKeyDown: function (event) {
149
- var inst = $.timepicker._getInst(event.target);
150
- var handled = true;
151
- inst._keyEvent = true;
152
- if ($.timepicker._timepickerShowing) {
153
- switch (event.keyCode) {
154
- case 9: $.timepicker._hideTimepicker();
155
- handled = false;
156
- break; // hide on tab out
157
- case 27: $.timepicker._hideTimepicker();
158
- break; // hide on escape
159
- default: handled = false;
160
- }
161
- }
162
- else if (event.keyCode == 36 && event.ctrlKey) { // display the time picker on ctrl+home
163
- $.timepicker._showTimepicker(this);
164
- }
165
- else {
166
- handled = false;
167
- }
168
- if (handled) {
169
- event.preventDefault();
170
- event.stopPropagation();
171
- }
172
- },
173
-
174
- /* Update selected time on keyUp */
175
- /* Added verion 0.0.5 */
176
- _doKeyUp: function (event) {
177
- var inst = $.timepicker._getInst(event.target);
178
- $.timepicker._setTimeFromField(inst);
179
- $.timepicker._updateTimepicker(inst);
180
- },
181
-
182
- /* Make attachments based on settings. */
183
- _attachments: function (input, inst) {
184
- var appendText = this._get(inst, 'appendText');
185
- var isRTL = this._get(inst, 'isRTL');
186
- if (inst.append) { inst.append.remove(); }
187
- if (appendText) {
188
- inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
189
- input[isRTL ? 'before' : 'after'](inst.append);
190
- }
191
- input.unbind('focus', this._showTimepicker);
192
- if (inst.trigger) { inst.trigger.remove(); }
193
- var showOn = this._get(inst, 'showOn');
194
- if (showOn == 'focus' || showOn == 'both') { // pop-up time picker when in the marked field
195
- input.focus(this._showTimepicker);
196
- }
197
- if (showOn == 'button' || showOn == 'both') { // pop-up time picker when button clicked
198
- var buttonText = this._get(inst, 'buttonText');
199
- var buttonImage = this._get(inst, 'buttonImage');
200
- inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
201
- $('<img/>').addClass(this._triggerClass).
202
- attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
203
- $('<button type="button"></button>').addClass(this._triggerClass).
204
- html(buttonImage == '' ? buttonText : $('<img/>').attr(
205
- { src: buttonImage, alt: buttonText, title: buttonText })));
206
- input[isRTL ? 'before' : 'after'](inst.trigger);
207
- inst.trigger.click(function () {
208
- if ($.timepicker._timepickerShowing && $.timepicker._lastInput == input[0]) { $.timepicker._hideTimepicker(); }
209
- else { $.timepicker._showTimepicker(input[0]); }
210
- return false;
211
- });
212
- }
213
- },
214
-
215
-
216
- /* Attach an inline time picker to a div. */
217
- _inlineTimepicker: function(target, inst) {
218
- var divSpan = $(target);
219
- if (divSpan.hasClass(this.markerClassName))
220
- return;
221
- divSpan.addClass(this.markerClassName).append(inst.tpDiv).
222
- bind("setData.timepicker", function(event, key, value){
223
- inst.settings[key] = value;
224
- }).bind("getData.timepicker", function(event, key){
225
- return this._get(inst, key);
226
- });
227
- $.data(target, PROP_NAME, inst);
228
-
229
- this._setTimeFromField(inst);
230
- this._updateTimepicker(inst);
231
- inst.tpDiv.show();
232
- },
233
-
234
- /* Pop-up the time picker for a given input field.
235
- @param input element - the input field attached to the time picker or
236
- event - if triggered by focus */
237
- _showTimepicker: function (input) {
238
-
239
-
240
- input = input.target || input;
241
- if (input.nodeName.toLowerCase() != 'input') { input = $('input', input.parentNode)[0]; } // find from button/image trigger
242
- if ($.timepicker._isDisabledTimepicker(input) || $.timepicker._lastInput == input) { return; } // already here
243
-
244
- // fix v 0.0.8 - close current timepicker before showing another one
245
- $.timepicker._hideTimepicker();
246
-
247
- var inst = $.timepicker._getInst(input);
248
- if ($.timepicker._curInst && $.timepicker._curInst != inst) {
249
- $.timepicker._curInst.tpDiv.stop(true, true);
250
- }
251
- var beforeShow = $.timepicker._get(inst, 'beforeShow');
252
- extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
253
- inst.lastVal = null;
254
- $.timepicker._lastInput = input;
255
-
256
- $.timepicker._setTimeFromField(inst);
257
- if ($.timepicker._inDialog) { input.value = ''; } // hide cursor
258
- if (!$.timepicker._pos) { // position below input
259
- $.timepicker._pos = $.timepicker._findPos(input);
260
- $.timepicker._pos[1] += input.offsetHeight; // add the height
261
- }
262
- var isFixed = false;
263
- $(input).parents().each(function () {
264
- isFixed |= $(this).css('position') == 'fixed';
265
- return !isFixed;
266
- });
267
- if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
268
- $.timepicker._pos[0] -= document.documentElement.scrollLeft;
269
- $.timepicker._pos[1] -= document.documentElement.scrollTop;
270
- }
271
- var offset = { left: $.timepicker._pos[0], top: $.timepicker._pos[1] };
272
- $.timepicker._pos = null;
273
- // determine sizing offscreen
274
- inst.tpDiv.css({ position: 'absolute', display: 'block', top: '-1000px' });
275
- $.timepicker._updateTimepicker(inst);
276
-
277
- // reset clicked state
278
- inst._hoursClicked = false;
279
- inst._minutesClicked = false;
280
-
281
- // fix width for dynamic number of time pickers
282
- // and adjust position before showing
283
- offset = $.timepicker._checkOffset(inst, offset, isFixed);
284
- inst.tpDiv.css({ position: ($.timepicker._inDialog && $.blockUI ?
285
- 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
286
- left: offset.left + 'px', top: offset.top + 'px'
287
- });
288
- if (!inst.inline) {
289
- var showAnim = $.timepicker._get(inst, 'showAnim');
290
- var duration = $.timepicker._get(inst, 'duration');
291
- var postProcess = function () {
292
- $.timepicker._timepickerShowing = true;
293
- var borders = $.timepicker._getBorders(inst.tpDiv);
294
- inst.tpDiv.find('iframe.ui-timepicker-cover'). // IE6- only
295
- css({ left: -borders[0], top: -borders[1],
296
- width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight()
297
- });
298
- };
299
- inst.tpDiv.zIndex($(input).zIndex() + 1);
300
- if ($.effects && $.effects[showAnim]) {
301
- inst.tpDiv.show(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess);
302
- }
303
- else {
304
- inst.tpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
305
- }
306
- if (!showAnim || !duration) { postProcess(); }
307
- if (inst.input.is(':visible') && !inst.input.is(':disabled')) { inst.input.focus(); }
308
- $.timepicker._curInst = inst;
309
- }
310
- },
311
-
312
- /* Generate the time picker content. */
313
- _updateTimepicker: function (inst) {
314
- var self = this;
315
- var borders = $.timepicker._getBorders(inst.tpDiv);
316
- inst.tpDiv.empty().append(this._generateHTML(inst))
317
- .find('iframe.ui-timepicker-cover') // IE6- only
318
- .css({ left: -borders[0], top: -borders[1],
319
- width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight()
320
- })
321
- .end()
322
- .find('.ui-timepicker td a')
323
- .bind('mouseout', function () {
324
- $(this).removeClass('ui-state-hover');
325
- if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).removeClass('ui-timepicker-prev-hover');
326
- if (this.className.indexOf('ui-timepicker-next') != -1) $(this).removeClass('ui-timepicker-next-hover');
327
- })
328
- .bind('mouseover', function () {
329
- if (!self._isDisabledTimepicker(inst.inline ? inst.tpDiv.parent()[0] : inst.input[0])) {
330
- $(this).parents('.ui-timepicker-calendar').find('a').removeClass('ui-state-hover');
331
- $(this).addClass('ui-state-hover');
332
- if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).addClass('ui-timepicker-prev-hover');
333
- if (this.className.indexOf('ui-timepicker-next') != -1) $(this).addClass('ui-timepicker-next-hover');
334
- }
335
- })
336
- .end()
337
- .find('.' + this._dayOverClass + ' a')
338
- .trigger('mouseover')
339
- .end();
340
- },
341
-
342
- /* Generate the HTML for the current state of the date picker. */
343
- _generateHTML: function (inst) {
344
- var h, m, html = '';
345
- var showPeriod = (this._get(inst, 'showPeriod') == true);
346
- var showLeadingZero = (this._get(inst, 'showLeadingZero') == true);
347
-
348
- var amPmText = this._get(inst, 'amPmText');
349
-
350
-
351
- html = '<table class="ui-timepicker-table ui-widget-content ui-corner-all"><tr>' +
352
- '<td class="ui-timepicker-hours">' +
353
- '<div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">' +
354
- this._get(inst, 'hourText') +
355
- '</div>' +
356
- '<table class="ui-timepicker">';
357
-
358
- // AM
359
- html += '<tr><th rowspan="2" class="periods">' + amPmText[0] + '</th>';
360
- for (h = 0; h <= 5; h++) {
361
- html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero);
362
- }
363
-
364
- html += '</tr><tr>';
365
- for (h = 6; h <= 11; h++) {
366
- html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero);
367
- }
368
-
369
- // PM
370
- html += '</tr><tr><th rowspan="2" class="periods">' + amPmText[1] + '</th>';
371
- for (h = 12; h <= 17; h++) {
372
- html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero);
373
- }
374
-
375
- html += '</tr><tr>';
376
- for (h = 18; h <= 23; h++) {
377
- html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero);
378
- }
379
- html += '</tr></table>' + // Close the hours cells table
380
- '</td>' + // Close the Hour td
381
- '<td class="ui-timepicker-minutes">';
382
-
383
- html += this._generateHTMLMinutes(inst);
384
-
385
- html += '</td></tr></table>';
386
-
387
- return html;
388
- },
389
-
390
- /* Special function that update the minutes selection in currently visible timepicker
391
- * called on hour selection when onMinuteShow is defined */
392
- _updateMinuteDisplay: function (inst) {
393
- var newHtml = this._generateHTMLMinutes(inst);
394
- inst.tpDiv.find('td.ui-timepicker-minutes').html(newHtml);
395
- },
396
-
397
- /* Generate the minutes table */
398
- _generateHTMLMinutes: function (inst) {
399
-
400
- var m;
401
- var showMinutesLeadingZero = (this._get(inst, 'showMinutesLeadingZero') == true);
402
- var onMinuteShow = this._get(inst, 'onMinuteShow');
403
- // if currently selected minute is not enabled, we have a problem and need to select a new minute.
404
- if ( (onMinuteShow) ) {
405
-
406
- if (onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours , inst.minutes]) == false) {
407
- // loop minutes and select first available
408
- for (m = 0; m < 60; m += 5) {
409
- if (onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours, m])) {
410
- inst.minutes = m;
411
- break;
412
- }
413
- }
414
- }
415
- }
416
-
417
- var html = '' + // open minutes td
418
- /* Add the minutes */
419
- '<div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">' +
420
- this._get(inst, 'minuteText') +
421
- '</div>' +
422
- '<table class="ui-timepicker">' +
423
- '<tr>';
424
- ;
425
-
426
- for (m = 0; m < 15; m += 5) {
427
- html += this._generateHTMLMinuteCell(inst, m, (m < 10) && showMinutesLeadingZero ? "0" + m.toString() : m.toString());
428
- }
429
- html += '</tr><tr>';
430
- for (m = 15; m < 30; m += 5) {
431
- html += this._generateHTMLMinuteCell(inst, m, m.toString());
432
- }
433
- html += '</tr><tr>';
434
- for (m = 30; m < 45; m += 5) {
435
- html += this._generateHTMLMinuteCell(inst, m, m.toString());
436
- }
437
- html += '</tr><tr>';
438
- for (m = 45; m < 60; m += 5) {
439
- html += this._generateHTMLMinuteCell(inst, m, m.toString());
440
- }
441
-
442
- html += '</tr></table>';
443
-
444
- return html;
445
- },
446
-
447
- /* Generate the content of a "Hour" cell */
448
- _generateHTMLHourCell: function (inst, hour, showPeriod, showLeadingZero) {
449
-
450
- var displayHour = hour;
451
- if ((hour > 12) && showPeriod) {
452
- displayHour = hour - 12;
453
- }
454
- if ((displayHour == 0) && showPeriod) {
455
- displayHour = 12;
456
- }
457
- if ((displayHour < 10) && showLeadingZero) {
458
- displayHour = '0' + displayHour;
459
- }
460
-
461
- var html = "";
462
- var enabled = true;
463
- var onHourShow = this._get(inst, 'onHourShow'); //custom callback
464
- if (onHourShow) {
465
- enabled = onHourShow.apply((inst.input ? inst.input[0] : null), [hour]);
466
- }
467
-
468
- if (enabled) {
469
- html = '<td ' +
470
- 'onclick="TP_jQuery_' + tpuuid + '.timepicker.selectHours(\'#' + inst.id + '\', ' + hour.toString() + ', this ); return false;" ' +
471
- 'ondblclick="TP_jQuery_' + tpuuid + '.timepicker.selectHours(\'#' + inst.id + '\', ' + hour.toString() + ', this, true ); return false;" ' +
472
- '>' +
473
- '<a href="#" class="ui-state-default ' +
474
- (hour == inst.hours ? 'ui-state-active' : '') +
475
- '">' +
476
- displayHour.toString() +
477
- '</a></td>';
478
- }
479
- else {
480
- html =
481
- '<td>' +
482
- '<span class="ui-state-default ui-state-disabled' +
483
- (hour == inst.hours ? 'ui-state-active' : '') +
484
- '">' +
485
- displayHour.toString() +
486
- '</span>' +
487
- '</td>';
488
- }
489
- return html;
490
- },
491
-
492
- /* Generate the content of a "Hour" cell */
493
- _generateHTMLMinuteCell: function (inst, minute, displayText) {
494
- var html = "";
495
- var enabled = true;
496
- var onMinuteShow = this._get(inst, 'onMinuteShow'); //custom callback
497
- if (onMinuteShow) {
498
- //NEW: 2011-02-03 we should give the hour as a parameter as well!
499
- enabled = onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours,minute]); //trigger callback
500
- }
501
-
502
- if (enabled) {
503
- html = '<td ' +
504
- 'onclick="TP_jQuery_' + tpuuid + '.timepicker.selectMinutes(\'#' + inst.id + '\', ' + minute.toString() + ', this ); return false;" ' +
505
- 'ondblclick="TP_jQuery_' + tpuuid + '.timepicker.selectMinutes(\'#' + inst.id + '\', ' + minute.toString() + ', this, true ); return false;" ' +
506
- '>' +
507
- '<a href="#" class="ui-state-default ' +
508
- (minute == inst.minutes ? 'ui-state-active' : '') +
509
- '" >' +
510
- displayText +
511
- '</a></td>';
512
- }
513
- else {
514
-
515
- html = '<td>' +
516
- '<span class="ui-state-default ui-state-disabled" >' +
517
- displayText +
518
- '</span>' +
519
- '</td>';
520
- }
521
- return html;
522
- },
523
-
524
- /* Is the first field in a jQuery collection disabled as a timepicker?
525
- @param target element - the target input field or division or span
526
- @return boolean - true if disabled, false if enabled */
527
- _isDisabledTimepicker: function (target) {
528
- if (!target) { return false; }
529
- for (var i = 0; i < this._disabledInputs.length; i++) {
530
- if (this._disabledInputs[i] == target) { return true; }
531
- }
532
- return false;
533
- },
534
-
535
- /* Check positioning to remain on screen. */
536
- _checkOffset: function (inst, offset, isFixed) {
537
- var tpWidth = inst.tpDiv.outerWidth();
538
- var tpHeight = inst.tpDiv.outerHeight();
539
- var inputWidth = inst.input ? inst.input.outerWidth() : 0;
540
- var inputHeight = inst.input ? inst.input.outerHeight() : 0;
541
- var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
542
- var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
543
-
544
- offset.left -= (this._get(inst, 'isRTL') ? (tpWidth - inputWidth) : 0);
545
- offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
546
- offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
547
-
548
- // now check if datepicker is showing outside window viewport - move to a better place if so.
549
- offset.left -= Math.min(offset.left, (offset.left + tpWidth > viewWidth && viewWidth > tpWidth) ?
550
- Math.abs(offset.left + tpWidth - viewWidth) : 0);
551
- offset.top -= Math.min(offset.top, (offset.top + tpHeight > viewHeight && viewHeight > tpHeight) ?
552
- Math.abs(tpHeight + inputHeight) : 0);
553
-
554
- return offset;
555
- },
556
-
557
- /* Find an object's position on the screen. */
558
- _findPos: function (obj) {
559
- var inst = this._getInst(obj);
560
- var isRTL = this._get(inst, 'isRTL');
561
- while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
562
- obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
563
- }
564
- var position = $(obj).offset();
565
- return [position.left, position.top];
566
- },
567
-
568
- /* Retrieve the size of left and top borders for an element.
569
- @param elem (jQuery object) the element of interest
570
- @return (number[2]) the left and top borders */
571
- _getBorders: function (elem) {
572
- var convert = function (value) {
573
- return { thin: 1, medium: 2, thick: 3}[value] || value;
574
- };
575
- return [parseFloat(convert(elem.css('border-left-width'))),
576
- parseFloat(convert(elem.css('border-top-width')))];
577
- },
578
-
579
-
580
- /* Close time picker if clicked elsewhere. */
581
- _checkExternalClick: function (event) {
582
- if (!$.timepicker._curInst) { return; }
583
- var $target = $(event.target);
584
- if ($target[0].id != $.timepicker._mainDivId &&
585
- $target.parents('#' + $.timepicker._mainDivId).length == 0 &&
586
- !$target.hasClass($.timepicker.markerClassName) &&
587
- !$target.hasClass($.timepicker._triggerClass) &&
588
- $.timepicker._timepickerShowing && !($.timepicker._inDialog && $.blockUI))
589
- $.timepicker._hideTimepicker();
590
- },
591
-
592
- /* Hide the time picker from view.
593
- @param input element - the input field attached to the time picker */
594
- _hideTimepicker: function (input) {
595
- var inst = this._curInst;
596
- if (!inst || (input && inst != $.data(input, PROP_NAME))) { return; }
597
- if (this._timepickerShowing) {
598
- var showAnim = this._get(inst, 'showAnim');
599
- var duration = this._get(inst, 'duration');
600
- var postProcess = function () {
601
- $.timepicker._tidyDialog(inst);
602
- this._curInst = null;
603
- };
604
- if ($.effects && $.effects[showAnim]) {
605
- inst.tpDiv.hide(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess);
606
- }
607
- else {
608
- inst.tpDiv[(showAnim == 'slideDown' ? 'slideUp' :
609
- (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
610
- }
611
- if (!showAnim) { postProcess(); }
612
- var onClose = this._get(inst, 'onClose');
613
- if (onClose) {
614
- onClose.apply(
615
- (inst.input ? inst.input[0] : null),
616
- [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
617
- }
618
- this._timepickerShowing = false;
619
- this._lastInput = null;
620
- if (this._inDialog) {
621
- this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
622
- if ($.blockUI) {
623
- $.unblockUI();
624
- $('body').append(this.tpDiv);
625
- }
626
- }
627
- this._inDialog = false;
628
- }
629
- },
630
-
631
- /* Tidy up after a dialog display. */
632
- _tidyDialog: function (inst) {
633
- inst.tpDiv.removeClass(this._dialogClass).unbind('.ui-timepicker');
634
- },
635
-
636
- /* Retrieve the instance data for the target control.
637
- @param target element - the target input field or division or span
638
- @return object - the associated instance data
639
- @throws error if a jQuery problem getting data */
640
- _getInst: function (target) {
641
- try {
642
- return $.data(target, PROP_NAME);
643
- }
644
- catch (err) {
645
- throw 'Missing instance data for this timepicker';
646
- }
647
- },
648
-
649
- /* Get a setting value, defaulting if necessary. */
650
- _get: function (inst, name) {
651
- return inst.settings[name] !== undefined ?
652
- inst.settings[name] : this._defaults[name];
653
- },
654
-
655
- /* Parse existing time and initialise time picker. */
656
- _setTimeFromField: function (inst) {
657
- if (inst.input.val() == inst.lastVal) { return; }
658
- var defaultTime = this._get(inst, 'defaultTime');
659
-
660
-
661
- var timeToParse = this._getCurrentTimeRounded(inst);
662
- if (defaultTime != '') { timeToParse = defaultTime }
663
- if ((inst.inline == false) && (inst.input.val() != '')) { timeToParse = inst.input.val() }
664
-
665
- var timeVal = inst.lastVal = timeToParse;
666
-
667
- var time = this.parseTime(inst, timeVal);
668
- inst.hours = time.hours;
669
- inst.minutes = time.minutes;
670
-
671
- $.timepicker._updateTimepicker(inst);
672
- },
673
- /* Set the dates for a jQuery selection.
674
- @param target element - the target input field or division or span
675
- @param date Date - the new date */
676
- _setTimeTimepicker: function(target, time) {
677
- var inst = this._getInst(target);
678
- if (inst) {
679
- this._setTime(inst, time);
680
- this._updateTimepicker(inst);
681
- this._updateAlternate(inst);
682
- }
683
- },
684
-
685
- /* Set the tm directly. */
686
- _setTime: function(inst, time, noChange) {
687
- var clear = !time;
688
- var origHours = inst.hours;
689
- var origMinutes = inst.minutes;
690
- var time = this.parseTime(inst, time);
691
- inst.hours = time.hours;
692
- inst.minutes = time.minutes;
693
-
694
- if ((origHours != inst.hours || origMinutes != inst.minuts) && !noChange) {
695
- inst.input.trigger('change');
696
- }
697
- this._updateTimepicker(inst);
698
- this._updateSelectedValue(inst);
699
- },
700
-
701
- /* Return the current time, ready to be parsed, rounded to the closest 5 minute */
702
- _getCurrentTimeRounded: function (inst) {
703
- var currentTime = new Date();
704
- var timeSeparator = this._get(inst, 'timeSeparator');
705
- // setting selected time , least priority first
706
- var currentMinutes = currentTime.getMinutes()
707
- // round to closest 5
708
- currentMinutes = Math.round( currentMinutes / 5 ) * 5;
709
-
710
- return currentTime.getHours().toString() + timeSeparator + currentMinutes.toString();
711
- },
712
-
713
- /*
714
- * Pase a time string into hours and minutes
715
- */
716
- parseTime: function (inst, timeVal) {
717
- var retVal = new Object();
718
- retVal.hours = -1;
719
- retVal.minutes = -1;
720
-
721
- var timeSeparator = this._get(inst, 'timeSeparator');
722
- var amPmText = this._get(inst, 'amPmText');
723
- var p = timeVal.indexOf(timeSeparator);
724
- if (p == -1) { return retVal; }
725
-
726
- retVal.hours = parseInt(timeVal.substr(0, p), 10);
727
- retVal.minutes = parseInt(timeVal.substr(p + 1), 10);
728
-
729
- var showPeriod = (this._get(inst, 'showPeriod') == true);
730
- var timeValUpper = timeVal.toUpperCase();
731
- if ((retVal.hours < 12) && (showPeriod) && (timeValUpper.indexOf(amPmText[1].toUpperCase()) != -1)) {
732
- retVal.hours += 12;
733
- }
734
- // fix for 12 AM
735
- if ((retVal.hours == 12) && (showPeriod) && (timeValUpper.indexOf(amPmText[0].toUpperCase()) != -1)) {
736
- retVal.hours = 0;
737
- }
738
-
739
- return retVal;
740
- },
741
-
742
-
743
-
744
- selectHours: function (id, newHours, td, fromDoubleClick) {
745
- var target = $(id);
746
- var inst = this._getInst(target[0]);
747
- $(td).parents('.ui-timepicker-hours:first').find('a').removeClass('ui-state-active');
748
- //inst.tpDiv.children('.ui-timepicker-hours a').removeClass('ui-state-active');
749
- $(td).children('a').addClass('ui-state-active');
750
-
751
- inst.hours = newHours;
752
- this._updateSelectedValue(inst);
753
-
754
- inst._hoursClicked = true;
755
- if ((inst._minutesClicked) || (fromDoubleClick)) {
756
- $.timepicker._hideTimepicker();
757
- return;
758
- }
759
- // added for onMinuteShow callback
760
- var onMinuteShow = this._get(inst, 'onMinuteShow');
761
- if (onMinuteShow) { this._updateMinuteDisplay(inst); }
762
- },
763
-
764
- selectMinutes: function (id, newMinutes, td, fromDoubleClick) {
765
- var target = $(id);
766
- var inst = this._getInst(target[0]);
767
- $(td).parents('.ui-timepicker-minutes:first').find('a').removeClass('ui-state-active');
768
- $(td).children('a').addClass('ui-state-active');
769
-
770
- inst.minutes = newMinutes;
771
- this._updateSelectedValue(inst);
772
-
773
- inst._minutesClicked = true;
774
- if ((inst._hoursClicked) || (fromDoubleClick)) { $.timepicker._hideTimepicker(); }
775
- },
776
-
777
- _updateSelectedValue: function (inst) {
778
- if ((inst.hours < 0) || (inst.hours > 23)) { inst.hours = 12; }
779
- if ((inst.minutes < 0) || (inst.minutes > 59)) { inst.minutes = 0; }
780
-
781
- var period = "";
782
- var showPeriod = (this._get(inst, 'showPeriod') == true);
783
- var showLeadingZero = (this._get(inst, 'showLeadingZero') == true);
784
- var amPmText = this._get(inst, 'amPmText');
785
- var selectedHours = inst.hours ? inst.hours : 0;
786
- var selectedMinutes = inst.minutes ? inst.minutes : 0;
787
-
788
- var displayHours = selectedHours;
789
- if ( ! displayHours) {
790
- displayHoyrs = 0;
791
- }
792
-
793
-
794
- if (showPeriod) {
795
- if (inst.hours == 0) {
796
- displayHours = 12;
797
- }
798
- if (inst.hours < 12) {
799
- period = amPmText[0];
800
- }
801
- else {
802
- period = amPmText[1];
803
- if (displayHours > 12) {
804
- displayHours -= 12;
805
- }
806
- }
807
- }
808
-
809
- var h = displayHours.toString();
810
- if (showLeadingZero && (displayHours < 10)) { h = '0' + h; }
811
-
812
-
813
- var m = selectedMinutes.toString();
814
- if (selectedMinutes < 10) { m = '0' + m; }
815
-
816
- var newTime = h + this._get(inst, 'timeSeparator') + m;
817
- if (period.length > 0) { newTime += " " + period; }
818
-
819
- if (inst.input) {
820
- inst.input.val(newTime);
821
- inst.input.trigger('change');
822
- }
823
-
824
- var onSelect = this._get(inst, 'onSelect');
825
- if (onSelect) { onSelect.apply((inst.input ? inst.input[0] : null), [newTime, inst]); } // trigger custom callback
826
-
827
- this._updateAlternate(inst, newTime);
828
-
829
- return newTime;
830
- },
831
-
832
- /* Update any alternate field to synchronise with the main field. */
833
- _updateAlternate: function(inst, newTime) {
834
- var altField = this._get(inst, 'altField');
835
- if (altField) { // update alternate field too
836
- $(altField).each(function() { $(this).val(newTime); });
837
- }
838
- }
839
- });
840
-
841
-
842
-
843
- /* Invoke the timepicker functionality.
844
- @param options string - a command, optionally followed by additional parameters or
845
- Object - settings for attaching new datepicker functionality
846
- @return jQuery object */
847
- $.fn.timepicker = function (options) {
848
-
849
- /* Initialise the date picker. */
850
- if (!$.timepicker.initialized) {
851
- $(document).mousedown($.timepicker._checkExternalClick).
852
- find('body').append($.timepicker.tpDiv);
853
- $.timepicker.initialized = true;
854
- }
855
-
856
- var otherArgs = Array.prototype.slice.call(arguments, 1);
857
- if (typeof options == 'string' && (options == 'isDisabled' || options == 'getTime' || options == 'widget'))
858
- return $.timepicker['_' + options + 'Datepicker'].
859
- apply($.timepicker, [this[0]].concat(otherArgs));
860
- if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
861
- return $.timepicker['_' + options + 'Datepicker'].
862
- apply($.timepicker, [this[0]].concat(otherArgs));
863
- return this.each(function () {
864
- typeof options == 'string' ?
865
- $.timepicker['_' + options + 'Timepicker'].
866
- apply($.timepicker, [this].concat(otherArgs)) :
867
- $.timepicker._attachTimepicker(this, options);
868
- });
869
- };
870
-
871
- /* jQuery extend now ignores nulls! */
872
- function extendRemove(target, props) {
873
- $.extend(target, props);
874
- for (var name in props)
875
- if (props[name] == null || props[name] == undefined)
876
- target[name] = props[name];
877
- return target;
878
- };
879
-
880
- $.timepicker = new Timepicker(); // singleton instance
881
- $.timepicker.initialized = false;
882
- $.timepicker.uuid = new Date().getTime();
883
- $.timepicker.version = "1.8.6";
884
-
885
- // Workaround for #4055
886
- // Add another global to avoid noConflict issues with inline event handlers
887
- window['TP_jQuery_' + tpuuid] = $;
888
-
889
- })(jQuery);
890
-
891
- /*
892
- ____
893
- ___ .-~. /_"-._
894
- `-._~-. / /_ "~o\ :Y
895
- \ \ / : \~x. ` ')
896
- ] Y / | Y< ~-.__j
897
- / ! _.--~T : l l< /.-~
898
- / / ____.--~ . ` l /~\ \<|Y
899
- / / .-~~" /| . ',-~\ \L|
900
- / / / .^ \ Y~Y \.^>/l_ "--'
901
- / Y .-"( . l__ j_j l_/ /~_.-~ .
902
- Y l / \ ) ~~~." / `/"~ / \.__/l_
903
- | \ _.-" ~-{__ l : l._Z~-.___.--~
904
- | ~---~ / ~~"---\_ ' __[>
905
- l . _.^ ___ _>-y~
906
- \ \ . .-~ .-~ ~>--" /
907
- \ ~---" / ./ _.-'
908
- "-.,_____.,_ _.--~\ _.-~
909
- ~~ ( _} -Row
910
- `. ~(
911
- ) \
912
- /,`--'~\--'~\
913
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
914
- ->T-Rex<-
915
- */