copy_no_dependency 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +5 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +20 -0
  5. data/README.md +66 -0
  6. data/Rakefile +10 -0
  7. data/bin/copy +27 -0
  8. data/copy.gemspec +28 -0
  9. data/lib/copy/admin/copy.css +66 -0
  10. data/lib/copy/admin/edit.html.erb +12 -0
  11. data/lib/copy/admin/index.html.erb +44 -0
  12. data/lib/copy/admin/index.js.erb +105 -0
  13. data/lib/copy/admin/jquery-ui.js +100 -0
  14. data/lib/copy/admin/jquery.js +18 -0
  15. data/lib/copy/generators/site/Gemfile +20 -0
  16. data/lib/copy/generators/site/config.ru +27 -0
  17. data/lib/copy/generators/site/public/favicon.ico +0 -0
  18. data/lib/copy/generators/site/public/images/.gitkeep +0 -0
  19. data/lib/copy/generators/site/public/javascripts/.gitkeep +0 -0
  20. data/lib/copy/generators/site/public/javascripts/main.js +0 -0
  21. data/lib/copy/generators/site/public/robots.txt +5 -0
  22. data/lib/copy/generators/site/public/stylesheets/.gitkeep +0 -0
  23. data/lib/copy/generators/site/public/stylesheets/main.css +0 -0
  24. data/lib/copy/generators/site/views/index.html.erb +1 -0
  25. data/lib/copy/generators/site/views/layout.html.erb +14 -0
  26. data/lib/copy/router.rb +62 -0
  27. data/lib/copy/server.rb +132 -0
  28. data/lib/copy/storage.rb +30 -0
  29. data/lib/copy/storage/mongodb.rb +38 -0
  30. data/lib/copy/storage/redis.rb +17 -0
  31. data/lib/copy/storage/relational.rb +35 -0
  32. data/lib/copy/version.rb +3 -0
  33. data/lib/copy_no_dependency.rb +6 -0
  34. data/test/router_test.rb +108 -0
  35. data/test/server_test.rb +183 -0
  36. data/test/storage_test.rb +50 -0
  37. data/test/test_app/views/_one.html.erb +1 -0
  38. data/test/test_app/views/_three.html.erb +1 -0
  39. data/test/test_app/views/about/_two.html.erb +2 -0
  40. data/test/test_app/views/about/index.html.erb +1 -0
  41. data/test/test_app/views/about/us.html.erb +1 -0
  42. data/test/test_app/views/data/people.csv.erb +1 -0
  43. data/test/test_app/views/data/people.xml.erb +1 -0
  44. data/test/test_app/views/indented.html.erb +9 -0
  45. data/test/test_app/views/index.html.erb +1 -0
  46. data/test/test_app/views/layout.html.erb +8 -0
  47. data/test/test_app/views/renders_partials.html.erb +4 -0
  48. data/test/test_app/views/with_copy_helper.html.erb +3 -0
  49. data/test/test_app/views/with_copy_helper_one_line.html.erb +1 -0
  50. data/test/test_helper.rb +49 -0
  51. metadata +181 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjVmNTBiNWUwMTZkMGFhODA2MGE3YzI2Zjk0MmQ2ODFlM2Y2MDczOA==
5
+ data.tar.gz: !binary |-
6
+ M2M4ZjM1MDVmMWQxZWUyZjRhMDU4MWE1OGRkMzIzOTYwZmFmN2U4OQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTk5ZWQwOTJjYzg3ZDUyYzRlZmUyYWMxNGQ4Yzg3OGU2MDEyMDIxZjZmNTRj
10
+ NDUyODg5NDlhMjM4ZWY2ZjljMGI3MDIxMzgxYzFhOTI2OGE0YmFmMWM0MTJk
11
+ ODdiYzY3MDEyZDI2OGNlNmUyOWY1YzU2MzY1ZTViYTNkNDI4Yjc=
12
+ data.tar.gz: !binary |-
13
+ YTkwMDk2ZWU3YjcyOTRjOThhOTJkODM3MDUyOGJkMWRkYTYxOWY1MDUzY2I1
14
+ ZTBjZDhlMmE2ZmYxZjUxNWYxZTU5NTI1MGE2MTNlZTY5NjhlNDBkZDlkOTdk
15
+ OTJmMDY1Zjk3YzhlYzIwNTc3ZDM4Mzg1NjEyNmJkMDY1NGViYWM=
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ .DS_Store
4
+ Gemfile.lock
5
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in copy.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Javan Makhmali
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,66 @@
1
+ # Copy is a simple, Sinatra-based CMS (Copy Management System).
2
+
3
+ `$ gem install copy` and then generate a new site `$ copy -n mynewsite`
4
+
5
+ mynewsite/
6
+ ├── Gemfile <- Uncomment the gems you need for storage.
7
+ ├── config.ru <- Configure storage, user, and password here.
8
+ ├── public <- The public root of your new site.
9
+ │   ├── favicon.ico <- A blank favicon, replace with your own.
10
+ │   ├── images
11
+ │   ├── javascripts
12
+ │   │   └── main.js <- A good place for your basic scripts.
13
+ │   ├── robots.txt <- Read file for details.
14
+ │   └── stylesheets
15
+ │   └── main.css <- Toss some CSS styles in here.
16
+ └── views <- Your views, layouts, and partials live here.
17
+ ├── index.html.erb
18
+ └── layout.html.erb <- Optional global layout file.
19
+
20
+ Copy automatically maps URLs to files in your `views` directory.
21
+
22
+ * `/` &rarr; `index.html.erb`
23
+ * `/about` &rarr; `about.html.erb` or `about/index.html.erb`
24
+ * `/about/us` &rarr; `about/us.html.erb`
25
+
26
+ Copy lets you define blocks of editable text in your views.
27
+
28
+ <% copy :contact do %>
29
+ 1 _Infinite_ Loop
30
+ Cupertino, CA 95014
31
+ 408.996.1010
32
+ <% end %>
33
+
34
+ The text provided in the block will be saved and can then be edited live on the site. All content is formatted with Markdown. [See demo](http://copy-demo.heroku.com) for a live example or [view the source](https://github.com/javan/copy-demo).
35
+
36
+ Single line blocks will be rendered in a span (by default). Perfect for headlines.
37
+
38
+ <h1><% copy :title do %>Like a boss!<% end %></h1>
39
+
40
+ **Partials** can be rendered from any view with the `partial` helper. Their filenames are always prefixed with an underscore.
41
+
42
+ * `<%= partial 'nav' %>` renders `_nav.html.erb`
43
+ * `<%= partial 'shared/details' %>` renders `shared/_details.html.erb`
44
+
45
+ ----
46
+
47
+ ### Storage
48
+
49
+ Copy supports multiple backends for storage: redis, mongodb, mysql, postgres, and sqlite.
50
+
51
+ Choosing and configuring your storage option is done in one line in your `config.ru` file by providing a connection URI.
52
+
53
+ Examples:
54
+
55
+ * `set :storage, 'mongodb://user:pass@host:port/database'`
56
+ * `set :storage, 'postgres://user:pass@host/database'`
57
+
58
+ ----
59
+
60
+ ### Editing copy on your live site
61
+
62
+ Browse to `/_copy` and drag the "Edit Copy" link to your bookmarks bar. Return to your site, click the bookmark (you'll be prompted for your username and password) and then click on the highlighted text to edit it. That's it!
63
+
64
+ ----
65
+
66
+ [![Build Status](http://travis-ci.org/javan/copy.png)](http://travis-ci.org/javan/copy) &mdash; &copy; 2013 Javan Makhmali
@@ -0,0 +1,10 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new do |test|
6
+ test.libs << "test"
7
+ test.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'copy'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'copy'
8
+ end
9
+
10
+ require 'copy/version'
11
+ require 'optparse'
12
+
13
+ OptionParser.new do |opts|
14
+ opts.banner = "Usage: copy [options]"
15
+ opts.on('-n', '--new [DIR]', 'Create a new Copy site in DIR') do |dir|
16
+ dir ||= '.'
17
+ site = File.dirname(File.expand_path(__FILE__)) + '/../lib/copy/generators/site/'
18
+ puts `mkdir -p #{dir} && cp -Riv #{site} #{dir}`
19
+ puts "Done!"
20
+ exit(0)
21
+ end
22
+ opts.on('-v', '--version') { puts "Copy v#{Copy::VERSION}"; exit(0) }
23
+ end.parse!
24
+
25
+ puts "Run `copy -n DIR' to generate a new Copy site in DIR."
26
+ puts "Run `copy --help' for all options."
27
+ exit(0)
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "copy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "copy_no_dependency"
7
+ s.version = Copy::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Javan Makhmali"]
10
+ s.email = ["javan@javan.us"]
11
+ s.homepage = "https://github.com/javan/copy"
12
+ s.summary = %q{Simple, Sinatra-based CMS.}
13
+ s.description = %q{Serves mostly static pages with blocks of editable copy.}
14
+
15
+ s.rubyforge_project = "copy"
16
+
17
+ s.add_dependency "sinatra"
18
+ s.add_dependency "redcarpet", "~> 2.2.2"
19
+
20
+ s.add_development_dependency "mocha"
21
+ s.add_development_dependency "rake"
22
+ s.add_development_dependency "rack-test"
23
+
24
+ s.files = `git ls-files`.split("\n")
25
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
+ s.require_paths = ["lib"]
28
+ end
@@ -0,0 +1,66 @@
1
+ ._copy_clickable {
2
+ background-color: #fcfc56;
3
+ cursor: pointer;
4
+ }
5
+
6
+ #_copy {
7
+ background-color: #ccc;
8
+ border: 1px solid #a3a3a3;
9
+ border-radius: 5px;
10
+ -webkit-box-shadow: 0px 0px 14px #474747;
11
+ -moz-box-shadow: 0px 0px 14px #474747;
12
+ box-shadow: 0px 0px 14px #474747;
13
+ width: 500px;
14
+ padding: 10px;
15
+ position: absolute;
16
+ z-index: 99999;
17
+ top: 50%;
18
+ left: 50%;
19
+ }
20
+
21
+ #_copy {
22
+ font-size: 11px;
23
+ overflow: hidden;
24
+ }
25
+
26
+ #_copy,
27
+ #_copy input,
28
+ #_copy textarea,
29
+ #_copy a {
30
+ color: #333;
31
+ font-family: monaco, menlo, monospace;
32
+ }
33
+
34
+ #_copy p {
35
+ margin: 10px 0;
36
+ padding: 0;
37
+ }
38
+
39
+ #_copy a._copy_cancel {
40
+ text-decoration: underline;
41
+ }
42
+
43
+ #_copy textarea {
44
+ display: none;
45
+ font-size: 13px;
46
+ width: 490px;
47
+ padding: 5px;
48
+ -webkit-transition: height 0.2s ease-out;
49
+ -moz-transition: height 0.2s ease-out;
50
+ -o-transition: height 0.2s ease-out;
51
+ transition: height 0.2s ease-out;
52
+ }
53
+
54
+ #_copy textarea._copy_small {
55
+ resize: none;
56
+ overflow: hidden;
57
+ height: 18px;
58
+ }
59
+
60
+ #_copy textarea._copy_medium {
61
+ height: 150px;
62
+ }
63
+
64
+ #_copy textarea._copy_large {
65
+ height: 300px;
66
+ }
@@ -0,0 +1,12 @@
1
+ <div id="_copy">
2
+ <form class="_copy_edit_form" data-content-name="<%= @name %>" action="/_copy/<%= @name %>">
3
+ <p>
4
+ Format text with <a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">markdown</a>.
5
+ </p>
6
+ <textarea name="content"><%=h @doc %></textarea>
7
+ <p>
8
+ <input class="_copy_submit" type="submit" value="Save" />
9
+ or <a class="_copy_cancel" href="#">cancel</a>
10
+ </p>
11
+ </form>
12
+ </div>
@@ -0,0 +1,44 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Copy bookmarklet</title>
6
+ <style>
7
+ body {
8
+ font-family: monaco, menlo, monospace;
9
+ font-size: 12px;
10
+ color: #333;
11
+ padding: 40px;
12
+ margin: 0;
13
+ }
14
+
15
+ p {
16
+ padding: 0;
17
+ margin: 0 0 40px 0;
18
+ }
19
+
20
+ a {
21
+ color: #333;
22
+ }
23
+
24
+ p.bookmarklet {
25
+ font-size: 16px;
26
+ }
27
+
28
+ p.bookmarklet a {
29
+ background-color: #fcfc56;
30
+ text-decoration: none;
31
+ padding: 3px 6px;
32
+ margin: 0 3px;
33
+ border: 1px solid #eee;
34
+ border-radius: 3px;
35
+ }
36
+ </style>
37
+ </head>
38
+ <body>
39
+ <p class="bookmarklet">Drag this &rarr; <a href="javascript:void((function(){var%20cjs=document.createElement('script');cjs.setAttribute('src','/_copy.js?'+new%20Date().getTime());cjs.setAttribute('type','text/javascript');document.getElementsByTagName('head')[0].appendChild(cjs);})());">Edit Copy</a> to your bookmarks bar &uarr;</p>
40
+
41
+ <p>After, <a href="/">return to your site</a> and click on that bookmark to make edits.</p>
42
+ </body>
43
+ </html>
44
+
@@ -0,0 +1,105 @@
1
+ <%= File.read(settings.root + '/admin/jquery.js') %>
2
+ <%= File.read(settings.root + '/admin/jquery-ui.js') %>
3
+
4
+ jQuery.noConflict();
5
+
6
+ (function($) {
7
+ $(function() {
8
+ // Short-circuit if this has run already (bookmarklet clicked twice).
9
+ if (window._copy_initialized) {
10
+ // Make the blocks clickable unless the Copy dialog is present.
11
+ if ($('#_copy').length == 0) {
12
+ clickable();
13
+ }
14
+ return true;
15
+ }
16
+
17
+ function clickable() {
18
+ $('._copy_editable').addClass('_copy_clickable');
19
+ $('._copy_clickable:empty').text('(add copy)');
20
+ }
21
+
22
+ function unclickable() {
23
+ $('._copy_editable').removeClass('_copy_clickable');
24
+ }
25
+
26
+ // Apply sizing rules (css classes) to the textarea based
27
+ // on the length of the content and presence of newlines.
28
+ function resizeTextarea() {
29
+ var textarea = $('#_copy textarea');
30
+ var content = textarea.val();
31
+
32
+ textarea.removeClass('_copy_small _copy_medium _copy_large');
33
+
34
+ if (/\n/.test(content) || content.length > 55) {
35
+ if (content.length > 300) {
36
+ textarea.addClass('_copy_large');
37
+ } else {
38
+ textarea.addClass('_copy_medium');
39
+ }
40
+ } else {
41
+ textarea.addClass('_copy_small');
42
+ }
43
+
44
+ textarea.show();
45
+ }
46
+ $('#_copy textarea').live('keydown keyup keypress change paste focus', resizeTextarea);
47
+
48
+ // Apply the styles.
49
+ $('head').append('<style><%= File.read(settings.root + '/admin/copy.css').gsub(/\n/, " \\\n") %></style>');
50
+
51
+ // When a clickable region is clicked, load the content into the editor.
52
+ $('._copy_clickable').live('click', function() {
53
+ var copy = $(this);
54
+ unclickable();
55
+ $.ajax({
56
+ url: '/_copy/'+copy.attr('data-name'),
57
+ success: function(html) {
58
+ // Attach the editor and resize the text area.
59
+ $('body').prepend(html);
60
+ resizeTextarea();
61
+ // Center the editor on the screen.
62
+ // Make it draggable so you can move it around.
63
+ // Focus on the texarea for convenience.
64
+ $('#_copy').css({ margin:'-'+($('#_copy').height() / 2)+'px 0 0 -'+($('#_copy').width() / 2)+'px' })
65
+ .draggable()
66
+ .find('textarea').focus();
67
+ }
68
+ });
69
+ });
70
+
71
+ // Prevent navigating away if a link is clicked in an editable region
72
+ // and generally prevent interfering with launching the copy editer.
73
+ $('._copy_clickable *').live('click', function(event) {
74
+ event.preventDefault();
75
+ });
76
+
77
+ // Hide the editor and make everything clickable if cancel is pressed.
78
+ $('._copy_cancel').live('click', function(event) {
79
+ event.preventDefault();
80
+ $('#_copy').remove();
81
+ clickable();
82
+ });
83
+
84
+ // Save the content when the submit button is pressed.
85
+ $('._copy_edit_form').live('submit', function() {
86
+ var form = $(this);
87
+ var original = $('[data-name="'+form.attr('data-content-name')+'"]');
88
+ form.find(':submit').attr('disabled', 'disabled');
89
+ $.ajax({
90
+ type: 'PUT',
91
+ url: form.attr('action'),
92
+ data: { content: form.find('textarea').val(), wrap_tag: original.get(0).tagName.toLowerCase() },
93
+ success: function(html) {
94
+ $('#_copy').remove();
95
+ original.replaceWith(html);
96
+ }
97
+ })
98
+ return false;
99
+ })
100
+
101
+ // Make the editable regions clickable.
102
+ clickable();
103
+ window._copy_initialized = true;
104
+ });
105
+ })(jQuery);
@@ -0,0 +1,100 @@
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
+ * jQuery UI Mouse 1.8.13
35
+ *
36
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
37
+ * Dual licensed under the MIT or GPL Version 2 licenses.
38
+ * http://jquery.org/license
39
+ *
40
+ * http://docs.jquery.com/UI/Mouse
41
+ *
42
+ * Depends:
43
+ * jquery.ui.widget.js
44
+ */
45
+ (function(b){var d=false;b(document).mousedown(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
46
+ this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
47
+ this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
48
+ !(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
49
+ false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
50
+ ;/*
51
+ * jQuery UI Draggable 1.8.13
52
+ *
53
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
54
+ * Dual licensed under the MIT or GPL Version 2 licenses.
55
+ * http://jquery.org/license
56
+ *
57
+ * http://docs.jquery.com/UI/Draggables
58
+ *
59
+ * Depends:
60
+ * jquery.ui.core.js
61
+ * jquery.ui.mouse.js
62
+ * jquery.ui.widget.js
63
+ */
64
+ (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==
65
+ "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=
66
+ 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=
67
+ 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()});
68
+ 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);
69
+ 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=
70
+ 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",
71
+ 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==
72
+ 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=
73
+ {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&&
74
+ 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=
75
+ 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=
76
+ {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())+
77
+ 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"),
78
+ 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-
79
+ 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&&
80
+ 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],
81
+ 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;
82
+ 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<
83
+ 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");
84
+ 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"});
85
+ 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=
86
+ 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=
87
+ 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,
88
+ 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=
89
+ 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=
90
+ 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");
91
+ 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=
92
+ 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);
93
+ 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,
94
+ 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,
95
+ 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;
96
+ 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=
97
+ 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&&
98
+ 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}}});
99
+ 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);
100
+ ;