mercury-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README.rdoc +81 -50
  2. data/VERSION +1 -1
  3. data/app/assets/javascripts/mercury/dialog.js.coffee +4 -4
  4. data/app/assets/javascripts/mercury/dialogs/backcolor.js.coffee +3 -3
  5. data/app/assets/javascripts/mercury/dialogs/forecolor.js.coffee +3 -3
  6. data/app/assets/javascripts/mercury/dialogs/formatblock.js.coffee +1 -1
  7. data/app/assets/javascripts/mercury/dialogs/objectspanel.js.coffee +3 -3
  8. data/app/assets/javascripts/mercury/dialogs/style.js.coffee +1 -1
  9. data/app/assets/javascripts/mercury/history_buffer.js.coffee +2 -2
  10. data/app/assets/javascripts/mercury/mercury.js.coffee +47 -54
  11. data/app/assets/javascripts/mercury/modal.js.coffee +13 -13
  12. data/app/assets/javascripts/mercury/modals/htmleditor.js.coffee +2 -2
  13. data/app/assets/javascripts/mercury/modals/insertcharacter.js.coffee +2 -2
  14. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +7 -7
  15. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +5 -5
  16. data/app/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -2
  17. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +14 -15
  18. data/app/assets/javascripts/mercury/native_extensions.js.coffee +2 -1
  19. data/app/assets/javascripts/mercury/page_editor.js.coffee +27 -27
  20. data/app/assets/javascripts/mercury/palette.js.coffee +6 -6
  21. data/app/assets/javascripts/mercury/panel.js.coffee +4 -4
  22. data/app/assets/javascripts/mercury/region.js.coffee +9 -9
  23. data/app/assets/javascripts/mercury/regions/editable.js.coffee +71 -71
  24. data/app/assets/javascripts/mercury/regions/markupable.js.coffee +51 -42
  25. data/app/assets/javascripts/mercury/regions/snippetable.js.coffee +7 -8
  26. data/app/assets/javascripts/mercury/select.js.coffee +8 -8
  27. data/app/assets/javascripts/mercury/snippet.js.coffee +6 -6
  28. data/app/assets/javascripts/mercury/snippet_toolbar.js.coffee +7 -7
  29. data/app/assets/javascripts/mercury/statusbar.js.coffee +7 -3
  30. data/app/assets/javascripts/mercury/table_editor.js.coffee +24 -24
  31. data/app/assets/javascripts/mercury/toolbar.button.js.coffee +20 -21
  32. data/app/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
  33. data/app/assets/javascripts/mercury/toolbar.expander.js.coffee +9 -9
  34. data/app/assets/javascripts/mercury/toolbar.js.coffee +12 -13
  35. data/app/assets/javascripts/mercury/tooltip.js.coffee +7 -7
  36. data/app/assets/javascripts/mercury/uploader.js.coffee +12 -13
  37. data/app/assets/javascripts/mercury_loader.js +98 -0
  38. data/app/assets/stylesheets/mercury/modal.scss +5 -5
  39. data/app/assets/stylesheets/mercury/toolbar.scss +62 -64
  40. data/app/views/layouts/mercury.html.haml +0 -4
  41. data/app/views/mercury/modals/character.html.haml +1 -1
  42. data/app/views/mercury/modals/htmleditor.html.haml +1 -1
  43. data/app/views/mercury/modals/table.html.haml +10 -10
  44. data/config/routes.rb +2 -2
  45. data/mercury-rails.gemspec +17 -20
  46. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +3 -3
  47. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -3
  48. data/spec/javascripts/mercury/dialogs/objectspanel_spec.js.coffee +3 -3
  49. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -4
  50. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -2
  51. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +10 -10
  52. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +7 -7
  53. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +4 -4
  54. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +17 -17
  55. data/spec/javascripts/mercury/page_editor_spec.js.coffee +5 -6
  56. data/spec/javascripts/mercury/region_spec.js.coffee +5 -5
  57. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +398 -0
  58. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +18 -14
  59. data/spec/javascripts/mercury/snippet_spec.js.coffee +1 -1
  60. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +16 -16
  61. data/spec/javascripts/templates/mercury/modals/inserttable.html +11 -11
  62. data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
  63. data/spec/javascripts/templates/mercury/toolbar.button.html +8 -8
  64. data/vendor/assets/javascripts/{jquery-ui-1.8.13.sortable.custom.js → jquery-ui-1.8.13.custom.js} +250 -0
  65. data/vendor/assets/javascripts/jquery.additions.js +151 -0
  66. data/vendor/assets/javascripts/showdown.js +1254 -1276
  67. metadata +26 -29
  68. data/app/assets/javascripts/mercury/websocket.js.coffee +0 -34
  69. data/spec/javascripts/mercury/regions/_editable_.js.coffee +0 -0
  70. data/vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js +0 -249
  71. data/vendor/assets/javascripts/jquery.easing.js +0 -173
  72. data/vendor/assets/javascripts/jquery.json2.js +0 -178
  73. data/vendor/assets/javascripts/jquery.serialize_object.js +0 -16
  74. data/vendor/assets/javascripts/jquery.ujs.js +0 -289
@@ -18,7 +18,7 @@ describe "Mercury.Regions.Snippetable", ->
18
18
  @bindEventsSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'bindEvents').andCallFake(=>)
19
19
  @makeSortableSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable').andCallFake(=>)
20
20
 
21
- it "expects an element, window", ->
21
+ it "expects an element and window", ->
22
22
  @region = new Mercury.Regions.Snippetable(@regionElement, window)
23
23
  expect(@region.element.get(0)).toEqual($('#snippetable_region1').get(0))
24
24
  expect(@region.window).toEqual(window)
@@ -27,6 +27,10 @@ describe "Mercury.Regions.Snippetable", ->
27
27
  @region = new Mercury.Regions.Snippetable(@regionElement, window, {foo: 'something'})
28
28
  expect(@region.options).toEqual({foo: 'something'})
29
29
 
30
+ it "sets it's type", ->
31
+ @region = new Mercury.Regions.Snippetable(@regionElement, window)
32
+ expect(@region.type).toEqual('snippetable')
33
+
30
34
  it "calls build", ->
31
35
  @region = new Mercury.Regions.Snippetable(@regionElement, window)
32
36
  expect(@buildSpy.callCount).toEqual(1)
@@ -278,7 +282,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
278
282
  describe ".undo", ->
279
283
 
280
284
  it "calls undo on the history buffer and sets the content", ->
281
- htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'html').andCallFake(=>)
285
+ htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
282
286
  historySpy = spyOn(@region.history, 'undo').andCallFake(=> 'history -1')
283
287
  @actions['undo'].call(@region)
284
288
  expect(historySpy.callCount).toEqual(1)
@@ -289,7 +293,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
289
293
  describe ".redo", ->
290
294
 
291
295
  it "calls redo on the history buffer and sets the content", ->
292
- htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'html').andCallFake(=>)
296
+ htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
293
297
  historySpy = spyOn(@region.history, 'redo').andCallFake(=> 'history +1')
294
298
  @actions['redo'].call(@region)
295
299
  expect(historySpy.callCount).toEqual(1)
@@ -297,7 +301,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
297
301
  expect(htmlSpy.argsForCall[0]).toEqual(['history +1'])
298
302
 
299
303
 
300
- describe ".insertsnippet", ->
304
+ describe ".insertSnippet", ->
301
305
 
302
306
  beforeEach ->
303
307
  Mercury.Snippet.load({
@@ -309,7 +313,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
309
313
  describe "updating a snippet", ->
310
314
 
311
315
  it "finds the snippet by it's identity and replaces it with the new snippet", ->
312
- @actions['insertsnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
316
+ @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
313
317
  expect($('#snippetable_region2').html()).toContain('class="mercury-snippet"')
314
318
  expect($('#snippetable_region2').html()).toContain('contenteditable="false"')
315
319
  expect($('#snippetable_region2').html()).toContain('data-version="1"')
@@ -319,50 +323,50 @@ describe "Mercury.Regions.Snippetable.actions", ->
319
323
  it "pushes to the history after it's been rendered", ->
320
324
  spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
321
325
  spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
322
- @actions['insertsnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
326
+ @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
323
327
  expect(spy.callCount).toEqual(1)
324
328
 
325
329
  describe "inserting a snippet", ->
326
330
 
327
331
  it "appends the new snippet html to the element", ->
328
- @actions['insertsnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
332
+ @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
329
333
  expect($('#snippetable_region2 .mercury-snippet').length).toEqual(2)
330
334
 
331
335
  it "pushes to the history after it's been rendered", ->
332
336
  spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
333
337
  spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
334
- @actions['insertsnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
338
+ @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
335
339
  expect(spy.callCount).toEqual(1)
336
340
 
337
341
 
338
- describe ".editsnippet", ->
342
+ describe ".editSnippet", ->
339
343
 
340
344
  beforeEach ->
341
345
  @region.snippet = $('#snippetable_region2 .mercury-snippet')
342
346
 
343
347
  it "finds and displays the options for the given snippet", ->
344
348
  spy = spyOn(Mercury.Snippet.prototype, 'displayOptions')
345
- @actions['editsnippet'].call(@region)
349
+ @actions['editSnippet'].call(@region)
346
350
  expect(spy.callCount).toEqual(1)
347
351
 
348
352
  it "does nothing if there's no active snippet (eg. hovered over)", ->
349
353
  @region.snippet = null
350
354
  spy = spyOn(Mercury.Snippet.prototype, 'displayOptions')
351
- @actions['editsnippet'].call(@region)
355
+ @actions['editSnippet'].call(@region)
352
356
  expect(spy.callCount).toEqual(0)
353
357
 
354
358
 
355
- describe ".removesnippet", ->
359
+ describe ".removeSnippet", ->
356
360
 
357
361
  beforeEach ->
358
362
  @region.snippet = $('#snippetable_region2 .mercury-snippet')
359
363
 
360
364
  it "removes the snippet if there's an active one", ->
361
- @actions['removesnippet'].call(@region)
365
+ @actions['removeSnippet'].call(@region)
362
366
  expect($('#snippetable_region2 .mercury-snippet').length).toEqual(0)
363
367
 
364
368
  it "triggers the hide:toolbar event", ->
365
369
  spy = spyOn(Mercury, 'trigger').andCallFake(=>)
366
- @actions['removesnippet'].call(@region)
370
+ @actions['removeSnippet'].call(@region)
367
371
  expect(spy.callCount).toEqual(1)
368
372
  expect(spy.argsForCall[0]).toEqual(['hide:toolbar', {type: 'snippet', immediately: true}])
@@ -195,7 +195,7 @@ describe "Mercury.Snippet class methods", ->
195
195
  it "opens a modal with the name in the url", ->
196
196
  Mercury.Snippet.displayOptionsFor('foo')
197
197
  expect(@modalSpy.callCount).toEqual(1)
198
- expect(@modalSpy.argsForCall[0]).toEqual(["/mercury/snippets/foo/options", {title: 'Snippet Options', handler: 'insertsnippet', snippetName: 'foo'}])
198
+ expect(@modalSpy.argsForCall[0]).toEqual(["/mercury/snippets/foo/options", {title: 'Snippet Options', handler: 'insertSnippet', snippetName: 'foo'}])
199
199
 
200
200
  it "sets the snippet back to nothing", ->
201
201
  Mercury.snippet = 'foo'
@@ -260,20 +260,20 @@ describe "Mercury.Toolbar.Button.contexts", ->
260
260
  @element = $('#context_button')
261
261
 
262
262
  it "handles background color", ->
263
- @contexts.backcolor.call(@, $('#context_backcolor'), @region)
263
+ @contexts.backColor.call(@, $('#context_backcolor'), @region)
264
264
  expect(@element.css('background-color')).toEqual('rgb(255, 0, 0)')
265
265
 
266
- @contexts.backcolor.call(@, $('#context_none'), @region)
266
+ @contexts.backColor.call(@, $('#context_none'), @region)
267
267
  if $.browser.mozilla
268
268
  expect(@element.css('background-color')).toEqual('transparent')
269
269
  else
270
270
  expect(@element.css('background-color')).toEqual('rgba(0, 0, 0, 0)')
271
271
 
272
272
  it "handles foreground color", ->
273
- @contexts.forecolor.call(@, $('#context_forecolor'), @region)
273
+ @contexts.foreColor.call(@, $('#context_forecolor'), @region)
274
274
  expect(@element.css('background-color')).toEqual('rgb(0, 255, 0)')
275
275
 
276
- @contexts.forecolor.call(@, $('#context_none'), @region)
276
+ @contexts.foreColor.call(@, $('#context_none'), @region)
277
277
  expect(@element.css('background-color')).toEqual('rgb(0, 0, 0)')
278
278
 
279
279
  it "knows when something is bold", ->
@@ -313,28 +313,28 @@ describe "Mercury.Toolbar.Button.contexts", ->
313
313
  expect(@contexts.superscript.call(@, $('#context_none'), @region)).toEqual(false)
314
314
 
315
315
  it "knows when something is justified left", ->
316
- expect(@contexts.justifyleft.call(@, $('#context_justifyleft span'), @region)).toEqual(true)
317
- expect(@contexts.justifyleft.call(@, $('#context_none'), @region)).toEqual(false)
316
+ expect(@contexts.justifyLeft.call(@, $('#context_justifyLeft span'), @region)).toEqual(true)
317
+ expect(@contexts.justifyLeft.call(@, $('#context_none'), @region)).toEqual(false)
318
318
 
319
319
  it "knows when something is justified center", ->
320
- expect(@contexts.justifycenter.call(@, $('#context_justifycenter span'), @region)).toEqual(true)
321
- expect(@contexts.justifycenter.call(@, $('#context_none'), @region)).toEqual(false)
320
+ expect(@contexts.justifyCenter.call(@, $('#context_justifyCenter span'), @region)).toEqual(true)
321
+ expect(@contexts.justifyCenter.call(@, $('#context_none'), @region)).toEqual(false)
322
322
 
323
323
  it "knows when something is justified right", ->
324
- expect(@contexts.justifyright.call(@, $('#context_justifyright span'), @region)).toEqual(true)
325
- expect(@contexts.justifyright.call(@, $('#context_none'), @region)).toEqual(false)
324
+ expect(@contexts.justifyRight.call(@, $('#context_justifyRight span'), @region)).toEqual(true)
325
+ expect(@contexts.justifyRight.call(@, $('#context_none'), @region)).toEqual(false)
326
326
 
327
327
  it "knows when something is justified fully", ->
328
- expect(@contexts.justifyfull.call(@, $('#context_justifyfull span'), @region)).toEqual(true)
329
- expect(@contexts.justifyfull.call(@, $('#context_none'), @region)).toEqual(false)
328
+ expect(@contexts.justifyFull.call(@, $('#context_justifyFull span'), @region)).toEqual(true)
329
+ expect(@contexts.justifyFull.call(@, $('#context_none'), @region)).toEqual(false)
330
330
 
331
331
  it "knows when something is inside an ordered list", ->
332
- expect(@contexts.insertorderedlist.call(@, $('#context_orderedlist span'), @region)).toEqual(true)
333
- expect(@contexts.insertorderedlist.call(@, $('#context_none'), @region)).toEqual(false)
332
+ expect(@contexts.insertOrderedList.call(@, $('#context_orderedlist span'), @region)).toEqual(true)
333
+ expect(@contexts.insertOrderedList.call(@, $('#context_none'), @region)).toEqual(false)
334
334
 
335
335
  it "knows when something is inside an unordered list", ->
336
- expect(@contexts.insertunorderedlist.call(@, $('#context_unorderedlist span'), @region)).toEqual(true)
337
- expect(@contexts.insertunorderedlist.call(@, $('#context_none'), @region)).toEqual(false)
336
+ expect(@contexts.insertUnorderedList.call(@, $('#context_unorderedlist span'), @region)).toEqual(true)
337
+ expect(@contexts.insertUnorderedList.call(@, $('#context_none'), @region)).toEqual(false)
338
338
 
339
339
  # todo: fix in jquery
340
340
  # it "understands nested text-decoration styles", ->
@@ -3,16 +3,16 @@
3
3
  <table id="table" border="1" cellspacing="0"><tr><td id="cell1"></td></tr><tr><td id="cell2"></td></tr></table>
4
4
  </div>
5
5
 
6
- <input class="action" name="insertrowbefore" type="button" value="Add Before">
7
- <input class="action" name="insertrowafter" type="button" value="Add After">
8
- <input class="action" name="deleterow" type="button" value="Remove">
9
- <input class="action" name="insertcolumnbefore" type="button" value="Add Before">
10
- <input class="action" name="insertcolumnafter" type="button" value="Add After">
11
- <input class="action" name="deletecolumn" type="button" value="Remove">
12
- <input class="action" name="increaserowspan" type="button" value="+">
13
- <input class="action" name="decreaserowspan" type="button" value="-">
14
- <input class="action" name="increasecolspan" type="button" value="+">
15
- <input class="action" name="decreasecolspan" type="button" value="-">
6
+ <input class="action" name="insertRowBefore" type="button" value="Add Before">
7
+ <input class="action" name="insertRowAfter" type="button" value="Add After">
8
+ <input class="action" name="deleteRow" type="button" value="Remove">
9
+ <input class="action" name="insertColumnBefore" type="button" value="Add Before">
10
+ <input class="action" name="insertColumnAfter" type="button" value="Add After">
11
+ <input class="action" name="deleteColumn" type="button" value="Remove">
12
+ <input class="action" name="increaseRowspan" type="button" value="+">
13
+ <input class="action" name="decreaseRowspan" type="button" value="-">
14
+ <input class="action" name="increaseColspan" type="button" value="+">
15
+ <input class="action" name="decreaseColspan" type="button" value="-">
16
16
 
17
17
  <select id="table_alignment" name="table[alignment]">
18
18
  <option value="">None</option>
@@ -24,4 +24,4 @@
24
24
  <input id="table_spacing" type="text" value="0"/>
25
25
 
26
26
  <input id="submit" type="submit"/>
27
- </form>
27
+ </form>
@@ -0,0 +1,3 @@
1
+ <div id="editable_region1">
2
+
3
+ </div>
@@ -8,10 +8,10 @@
8
8
  #context_strikethrough2 { text-decoration: line-through }
9
9
  #context_overline { text-decoration: overline }
10
10
  #context_underline2 { text-decoration: underline }
11
- #context_justifyleft { text-align: left }
12
- #context_justifycenter { text-align: center }
13
- #context_justifyright { text-align: right }
14
- #context_justifyfull { text-align: justify }
11
+ #context_justifyLeft { text-align: left }
12
+ #context_justifyCenter { text-align: center }
13
+ #context_justifyRight { text-align: right }
14
+ #context_justifyFull { text-align: justify }
15
15
  </style>
16
16
 
17
17
  <div id="context_button">button</div>
@@ -43,10 +43,10 @@
43
43
  <sub id="context_subscript">sub<span>script</span></sub>
44
44
  <sup id="context_superscript">super<span>script</span></sup>
45
45
  <div>
46
- <div id="context_justifyleft">justify <span>left</span></div>
47
- <div id="context_justifycenter">justify <span>center</span></div>
48
- <div id="context_justifyright">justify <span>right</span></div>
49
- <div id="context_justifyfull">justify <span>full</span></div>
46
+ <div id="context_justifyLeft">justify <span>left</span></div>
47
+ <div id="context_justifyCenter">justify <span>center</span></div>
48
+ <div id="context_justifyRight">justify <span>right</span></div>
49
+ <div id="context_justifyFull">justify <span>full</span></div>
50
50
  </div>
51
51
  <ol id="context_orderedlist">
52
52
  <li>ordered <span>list</span></li>
@@ -1,3 +1,253 @@
1
+ /*!
2
+ * jQuery UI 1.8.13
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ (function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.13",
11
+ keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();
12
+ b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,
13
+ "overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
14
+ function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,
15
+ outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b);
16
+ return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=
17
+ 0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
18
+ ;/*!
19
+ * jQuery UI Widget 1.8.13
20
+ *
21
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
22
+ * Dual licensed under the MIT or GPL Version 2 licenses.
23
+ * http://jquery.org/license
24
+ *
25
+ * http://docs.jquery.com/UI/Widget
26
+ */
27
+ (function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
28
+ a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
29
+ e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
30
+ this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
31
+ widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
32
+ enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
33
+ ;
34
+
35
+ /*!
36
+ * jQuery UI Mouse 1.8.13
37
+ *
38
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
39
+ * Dual licensed under the MIT or GPL Version 2 licenses.
40
+ * http://jquery.org/license
41
+ *
42
+ * http://docs.jquery.com/UI/Mouse
43
+ *
44
+ * Depends:
45
+ * jquery.ui.widget.js
46
+ */
47
+ (function( $, undefined ) {
48
+
49
+ var mouseHandled = false;
50
+ $(document).mousedown(function(e) {
51
+ mouseHandled = false;
52
+ });
53
+
54
+ $.widget("ui.mouse", {
55
+ options: {
56
+ cancel: ':input,option',
57
+ distance: 1,
58
+ delay: 0
59
+ },
60
+ _mouseInit: function() {
61
+ var self = this;
62
+
63
+ this.element
64
+ .bind('mousedown.'+this.widgetName, function(event) {
65
+ return self._mouseDown(event);
66
+ })
67
+ .bind('click.'+this.widgetName, function(event) {
68
+ if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
69
+ $.removeData(event.target, self.widgetName + '.preventClickEvent');
70
+ event.stopImmediatePropagation();
71
+ return false;
72
+ }
73
+ });
74
+
75
+ this.started = false;
76
+ },
77
+
78
+ // TODO: make sure destroying one instance of mouse doesn't mess with
79
+ // other instances of mouse
80
+ _mouseDestroy: function() {
81
+ this.element.unbind('.'+this.widgetName);
82
+ },
83
+
84
+ _mouseDown: function(event) {
85
+ // don't let more than one widget handle mouseStart
86
+ $(this.document || document).mousedown(function(e) {
87
+ mouseHandled = false;
88
+ });
89
+ if(mouseHandled) {return};
90
+
91
+ // we may have missed mouseup (out of window)
92
+ (this._mouseStarted && this._mouseUp(event));
93
+
94
+ this._mouseDownEvent = event;
95
+
96
+ var self = this,
97
+ btnIsLeft = (event.which == 1),
98
+ elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
99
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
100
+ return true;
101
+ }
102
+
103
+ this.mouseDelayMet = !this.options.delay;
104
+ if (!this.mouseDelayMet) {
105
+ this._mouseDelayTimer = setTimeout(function() {
106
+ self.mouseDelayMet = true;
107
+ }, this.options.delay);
108
+ }
109
+
110
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
111
+ this._mouseStarted = (this._mouseStart(event) !== false);
112
+ if (!this._mouseStarted) {
113
+ event.preventDefault();
114
+ return true;
115
+ }
116
+ }
117
+
118
+ // Click event may never have fired (Gecko & Opera)
119
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
120
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
121
+ }
122
+
123
+ // these delegates are required to keep context
124
+ this._mouseMoveDelegate = function(event) {
125
+ return self._mouseMove(event);
126
+ };
127
+ this._mouseUpDelegate = function(event) {
128
+ return self._mouseUp(event);
129
+ };
130
+ $(this.document || document)
131
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
132
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
133
+
134
+ event.preventDefault();
135
+
136
+ mouseHandled = true;
137
+ return true;
138
+ },
139
+
140
+ _mouseMove: function(event) {
141
+ // IE mouseup check - mouseup happened when mouse was out of window
142
+ if ($.browser.msie && !((this.document || document).documentMode >= 9) && !event.button) {
143
+ return this._mouseUp(event);
144
+ }
145
+
146
+ if (this._mouseStarted) {
147
+ this._mouseDrag(event);
148
+ return event.preventDefault();
149
+ }
150
+
151
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
152
+ this._mouseStarted =
153
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
154
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
155
+ }
156
+
157
+ return !this._mouseStarted;
158
+ },
159
+
160
+ _mouseUp: function(event) {
161
+ $(this.document || document)
162
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
163
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
164
+
165
+ if (this._mouseStarted) {
166
+ this._mouseStarted = false;
167
+
168
+ if (event.target == this._mouseDownEvent.target) {
169
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
170
+ }
171
+
172
+ this._mouseStop(event);
173
+ }
174
+
175
+ return false;
176
+ },
177
+
178
+ _mouseDistanceMet: function(event) {
179
+ return (Math.max(
180
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
181
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
182
+ ) >= this.options.distance
183
+ );
184
+ },
185
+
186
+ _mouseDelayMet: function(event) {
187
+ return this.mouseDelayMet;
188
+ },
189
+
190
+ // These are placeholder methods, to be overriden by extending plugin
191
+ _mouseStart: function(event) {},
192
+ _mouseDrag: function(event) {},
193
+ _mouseStop: function(event) {},
194
+ _mouseCapture: function(event) { return true; }
195
+ });
196
+
197
+ })(jQuery);
198
+
199
+ /*
200
+ * jQuery UI Draggable 1.8.13
201
+ *
202
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
203
+ * Dual licensed under the MIT or GPL Version 2 licenses.
204
+ * http://jquery.org/license
205
+ *
206
+ * http://docs.jquery.com/UI/Draggables
207
+ *
208
+ * Depends:
209
+ * jquery.ui.core.js
210
+ * jquery.ui.mouse.js
211
+ * jquery.ui.widget.js
212
+ */
213
+ (function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
214
+ "original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
215
+ this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;this.helper=
216
+ this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
217
+ this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);
218
+ this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=
219
+ d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",
220
+ a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
221
+ a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a=
222
+ {left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&
223
+ d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=
224
+ this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions=
225
+ {width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+
226
+ d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!="hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),
227
+ 10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-
228
+ this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&
229
+ d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
230
+ this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.left<g[0])e=g[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<g[1])h=g[1]+this.offset.click.top;
231
+ if(a.pageX-this.offset.click.left>g[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1];h=g?!(h-this.offset.click.top<g[1]||h-this.offset.click.top>g[3])?h:!(h-this.offset.click.top<g[1])?h-b.grid[1]:h+b.grid[1]:h;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=g?!(e-this.offset.click.left<g[0]||e-this.offset.click.left>g[2])?e:!(e-this.offset.click.left<
232
+ g[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");
233
+ this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.13"});
234
+ d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var h=d.data(this,"sortable");if(h&&!h.options.disabled){c.sortables.push({instance:h,shouldRevert:h.options.revert});h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=
235
+ 0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=
236
+ c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,
237
+ true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=
238
+ 0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=
239
+ a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");
240
+ if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=
241
+ f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);
242
+ else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,
243
+ a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,h=b.offset.left,g=h+c.helperProportions.width,n=b.offset.top,
244
+ o=n+c.helperProportions.height,i=c.snapElements.length-1;i>=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e<h&&h<l+e&&k-e<n&&n<m+e||j-e<h&&h<l+e&&k-e<o&&o<m+e||j-e<g&&g<l+e&&k-e<n&&n<m+e||j-e<g&&g<l+e&&k-e<o&&o<m+e){if(f.snapMode!="inner"){var p=Math.abs(k-o)<=e,q=Math.abs(m-n)<=e,r=Math.abs(j-g)<=e,s=Math.abs(l-h)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k-c.helperProportions.height,left:0}).top-c.margins.top;
245
+ if(q)b.position.top=c._convertPositionTo("relative",{top:m,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l}).left-c.margins.left}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math.abs(j-h)<=e;s=Math.abs(l-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k,left:0}).top-c.margins.top;if(q)b.position.top=
246
+ c._convertPositionTo("relative",{top:m-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[i].snapping&&(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=p||q||r||s||t}else{c.snapElements[i].snapping&&
247
+ c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});
248
+ d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
249
+ ;
250
+
1
251
  /*
2
252
  * jQuery UI Sortable 1.8.13
3
253
  *