cantango_editor 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +2 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +177 -0
- data/MIT-LICENSE +20 -0
- data/README.md +80 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/app/assets/images/cantango_editor/+.png +0 -0
- data/app/assets/images/cantango_editor/-.png +0 -0
- data/app/assets/images/cantango_editor/.gitkeep +0 -0
- data/app/assets/images/cantango_editor/bg-1.gif +0 -0
- data/app/assets/images/cantango_editor/bg-2.gif +0 -0
- data/app/assets/images/cantango_editor/bg-model.png +0 -0
- data/app/assets/images/cantango_editor/bg.gif +0 -0
- data/app/assets/images/cantango_editor/bg_action.gif +0 -0
- data/app/assets/images/cantango_editor/bg_action.png +0 -0
- data/app/assets/images/cantango_editor/bg_can.gif +0 -0
- data/app/assets/images/cantango_editor/bg_can.png +0 -0
- data/app/assets/images/cantango_editor/bg_cannot.gif +0 -0
- data/app/assets/images/cantango_editor/bg_cannot.png +0 -0
- data/app/assets/images/cantango_editor/button-top-r.png +0 -0
- data/app/assets/images/cantango_editor/button-top.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo_big.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo_big2.png +0 -0
- data/app/assets/images/cantango_editor/cantangologo_big3.png +0 -0
- data/app/assets/images/cantango_editor/ico-uc.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_diagonal-maze_20_6e4f1c_10x10.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_diagonal-maze_40_000000_10x10.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_10_eceadf_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_10_f8f7f6_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_15_eceadf_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_15_f7f3de_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_15_ffffff_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_65_654b24_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-bg_fine-grain_68_b83400_60x60.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_3572ac_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_8c291d_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_b83400_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_fbdb93_256x240.png +0 -0
- data/app/assets/images/cantango_editor/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/images/cantango_editor/line2.png +0 -0
- data/app/assets/images/cantango_editor/line3.png +0 -0
- data/app/assets/images/cantango_editor/panel-l.gif +0 -0
- data/app/assets/images/cantango_editor/panel-l.png +0 -0
- data/app/assets/images/cantango_editor/panel-r.gif +0 -0
- data/app/assets/images/cantango_editor/panel-r.png +0 -0
- data/app/assets/images/cantango_editor/panel.gif +0 -0
- data/app/assets/images/cantango_editor/panel.png +0 -0
- data/app/assets/images/cantango_editor/remember.png +0 -0
- data/app/assets/images/cantango_editor/sexy.png +0 -0
- data/app/assets/images/cantango_editor/x.png +0 -0
- data/app/assets/images/cantango_editor/xx.png +0 -0
- data/app/assets/javascripts/cantango_editor/application.js +59 -0
- data/app/assets/javascripts/cantango_editor/jquery.collapse.js +149 -0
- data/app/assets/javascripts/cantango_editor/jquery.cookie.js +96 -0
- data/app/assets/javascripts/cantango_editor/jquery.ui/jquery-ui-1.8.16.custom.js +996 -0
- data/app/assets/javascripts/cantango_editor/jquery.ui/jquery.ui.selectmenu.js +802 -0
- data/app/assets/stylesheets/cantango_editor/.main.css +157 -0
- data/app/assets/stylesheets/cantango_editor/application.css +7 -0
- data/app/assets/stylesheets/cantango_editor/areset.css +53 -0
- data/app/assets/stylesheets/cantango_editor/clearing.css +52 -0
- data/app/assets/stylesheets/cantango_editor/jquery-ui-1.8.16.custom.css +290 -0
- data/app/assets/stylesheets/cantango_editor/jquery.ui.selectmenu.css +30 -0
- data/app/assets/stylesheets/cantango_editor/main.css +294 -0
- data/app/assets/stylesheets/cantango_editor/text.css +97 -0
- data/app/controllers/cantango_editor/application_controller.rb +12 -0
- data/app/controllers/cantango_editor/permissions_controller.rb +47 -0
- data/app/helpers/cantango_editor/application_helper.rb +49 -0
- data/app/models/cantango_editor/categories.rb +52 -0
- data/app/models/cantango_editor/category.rb +21 -0
- data/app/models/cantango_editor/permissions.rb +119 -0
- data/app/views/cantango_editor/permissions/_footer.html.erb +4 -0
- data/app/views/cantango_editor/permissions/_header.html.erb +7 -0
- data/app/views/cantango_editor/permissions/_menu.html.erb +7 -0
- data/app/views/cantango_editor/permissions/_new_categories_select.html.erb +5 -0
- data/app/views/cantango_editor/permissions/_new_custom_targets.html.erb +5 -0
- data/app/views/cantango_editor/permissions/_new_targets_select.html.erb +5 -0
- data/app/views/cantango_editor/permissions/_permissions_form.html.erb +63 -0
- data/app/views/cantango_editor/permissions/index.html.erb +5 -0
- data/app/views/cantango_editor/permissions/index.js.erb +2 -0
- data/app/views/cantango_editor/permissions/new_category.js.erb +3 -0
- data/app/views/cantango_editor/permissions/new_custom_target.js.erb +2 -0
- data/app/views/cantango_editor/permissions/new_target.js.erb +4 -0
- data/app/views/cantango_editor/permissions/notes.html.erb +19 -0
- data/app/views/cantango_editor/permissions/preview_raw.html.erb +3 -0
- data/app/views/cantango_editor/permissions/temp _permissions_form.html.erb +55 -0
- data/app/views/layouts/cantango_editor/application.html.erb +14 -0
- data/cantango_editor.gemspec +258 -0
- data/config/routes.rb +15 -0
- data/lib/array.rb +11 -0
- data/lib/cantango_editor.rb +25 -0
- data/lib/cantango_editor/configuration.rb +34 -0
- data/lib/cantango_editor/engine.rb +11 -0
- data/lib/cantango_editor/version.rb +3 -0
- data/lib/permissions_hash.rb +80 -0
- data/lib/tasks/cantango-editor_tasks.rake +4 -0
- data/lib/time_precise.rb +7 -0
- data/script/rails +6 -0
- data/spec/cantango_editor/configuration/configuration_spec.rb +33 -0
- data/spec/cantango_editor/models/permissions_spec.rb +9 -0
- data/spec/cantango_editor_spec.rb +17 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/main.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/main_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/main_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/admin.rb +5 -0
- data/spec/dummy/app/models/article.rb +2 -0
- data/spec/dummy/app/models/comment.rb +2 -0
- data/spec/dummy/app/models/concerto.rb +2 -0
- data/spec/dummy/app/models/guest.rb +14 -0
- data/spec/dummy/app/models/improvisation.rb +2 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/models/song.rb +2 -0
- data/spec/dummy/app/models/tune.rb +2 -0
- data/spec/dummy/app/models/user.rb +11 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/main/index.html.erb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +53 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/categories.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cantango.rb +4 -0
- data/spec/dummy/config/initializers/cantango_editor.rb +4 -0
- data/spec/dummy/config/initializers/devise.rb +210 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +58 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/permissions.yml.save +59 -0
- data/spec/dummy/config/routes.rb +15 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20111018203622_create_posts.rb +9 -0
- data/spec/dummy/db/migrate/20111018203648_create_articles.rb +9 -0
- data/spec/dummy/db/migrate/20111018203800_create_comments.rb +9 -0
- data/spec/dummy/db/migrate/20111018203817_create_songs.rb +9 -0
- data/spec/dummy/db/migrate/20111018203827_create_tunes.rb +9 -0
- data/spec/dummy/db/migrate/20111018203859_create_concertos.rb +9 -0
- data/spec/dummy/db/migrate/20111018203917_create_improvisations.rb +9 -0
- data/spec/dummy/db/migrate/20111019122217_devise_create_users.rb +28 -0
- data/spec/dummy/db/schema.rb +58 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/navigation_spec.rb +18 -0
- data/spec/permissions_hash_spec.rb +63 -0
- data/spec/requests/requests_spec.rb +9 -0
- data/spec/spec_helper.rb +16 -0
- metadata +416 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
|
+
// the compiled file.
|
|
6
|
+
//
|
|
7
|
+
//= require jquery
|
|
8
|
+
//= require jquery_ujs
|
|
9
|
+
//= require_tree .
|
|
10
|
+
|
|
11
|
+
$(document).ready(function() {
|
|
12
|
+
|
|
13
|
+
// Fetch Models select dialog
|
|
14
|
+
$('.new_target_link:not([disabled=disabled])').live('click', function(event){
|
|
15
|
+
// event.preventDefault();
|
|
16
|
+
$(this).addClass("link_processing");
|
|
17
|
+
$('.models_select_close_link').trigger('click');
|
|
18
|
+
return false;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Delete one Model
|
|
22
|
+
$('.delete_target_link').live('click', function(event){
|
|
23
|
+
$(this).prev().removeAttr('disabled');
|
|
24
|
+
$('form').submit();
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Hovers events for table cells
|
|
29
|
+
$('.models_cell').live('mouseenter', function(){
|
|
30
|
+
timeou = setTimeout(function(target){
|
|
31
|
+
$(target).children('.sexy_buttons').css('opacity', '1');
|
|
32
|
+
//$(this).children('.sexy_buttons').css('visibility', 'visible')
|
|
33
|
+
}, 150, this);
|
|
34
|
+
}).live('mouseleave', function(){
|
|
35
|
+
clearTimeout(timeou);
|
|
36
|
+
$(this).children('.sexy_buttons').css('opacity', '0.3');
|
|
37
|
+
//$('.sexy_buttons').css('visibility', 'hidden');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Enable selectmenu() on <select>
|
|
41
|
+
$('.models_select').live('ajaxLoad', function(){
|
|
42
|
+
$(this).selectmenu({style:'popup', width: 220, maxHeight:200, change: function(e, object){$('form').submit();}});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Closes Models select dialog
|
|
46
|
+
$('.models_select_close_link').live('click', function(){
|
|
47
|
+
$('.new_target_link').removeAttr('disabled');
|
|
48
|
+
$('.models_select_block').remove();
|
|
49
|
+
return false;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
$('.permission_group_section').collapse();
|
|
53
|
+
|
|
54
|
+
$('.models_line').live('mouseenter', function(){
|
|
55
|
+
$(this).children('.delete_target_section').show();
|
|
56
|
+
}).live('mouseleave',function(){
|
|
57
|
+
$(this).children('.delete_target_section').hide();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Collapse plugin for jQuery
|
|
3
|
+
* http://github.com/danielstocks/jQuery-Collapse/
|
|
4
|
+
*
|
|
5
|
+
* @author Daniel Stocks (http://webcloud.se)
|
|
6
|
+
* Copyright 2010, Daniel Stocks
|
|
7
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(function($) {
|
|
11
|
+
|
|
12
|
+
// Use a cookie counter to allow multiple instances of the plugin
|
|
13
|
+
var cookieCounter = 0;
|
|
14
|
+
|
|
15
|
+
$.fn.extend({
|
|
16
|
+
collapse: function(options) {
|
|
17
|
+
|
|
18
|
+
var defaults = {
|
|
19
|
+
head : "h3",
|
|
20
|
+
group : "div, ul",
|
|
21
|
+
cookieName : "collapse",
|
|
22
|
+
// Default function for showing content
|
|
23
|
+
show: function() {
|
|
24
|
+
this.show();
|
|
25
|
+
},
|
|
26
|
+
// Default function for hiding content
|
|
27
|
+
hide: function() {
|
|
28
|
+
this.hide();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var op = $.extend(defaults, options);
|
|
32
|
+
|
|
33
|
+
// Default CSS classes
|
|
34
|
+
var active = "active",
|
|
35
|
+
inactive = "inactive";
|
|
36
|
+
|
|
37
|
+
return this.each(function() {
|
|
38
|
+
|
|
39
|
+
// Increment coookie counter to ensure cookie name integrity
|
|
40
|
+
cookieCounter++;
|
|
41
|
+
var obj = $(this),
|
|
42
|
+
// Find all headers and wrap them in <a> for accessibility.
|
|
43
|
+
sections = obj.find(op.head).wrapInner('<a href="#"></a>'),
|
|
44
|
+
l = sections.length,
|
|
45
|
+
cookie = op.cookieName + "_" + cookieCounter;
|
|
46
|
+
// Locate all panels directly following a header
|
|
47
|
+
var panel = obj.find(op.head).map(function() {
|
|
48
|
+
var head = $(this)
|
|
49
|
+
if(!head.hasClass(active)) {
|
|
50
|
+
return head.next(op.group).hide()[0];
|
|
51
|
+
}
|
|
52
|
+
return head.next(op.group)[0];
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Bind event for showing content
|
|
56
|
+
obj.bind("show", function(e, bypass) {
|
|
57
|
+
var obj = $(e.target);
|
|
58
|
+
// ARIA attribute
|
|
59
|
+
obj.attr('aria-hidden', false)
|
|
60
|
+
.prev()
|
|
61
|
+
.removeClass(inactive)
|
|
62
|
+
.addClass(active);
|
|
63
|
+
// Bypass method for instant display
|
|
64
|
+
if(bypass) {
|
|
65
|
+
obj.show();
|
|
66
|
+
} else {
|
|
67
|
+
op.show.call(obj);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Bind event for hiding content
|
|
72
|
+
obj.bind("hide", function(e, bypass) {
|
|
73
|
+
var obj = $(e.target);
|
|
74
|
+
obj.attr('aria-hidden', true)
|
|
75
|
+
.prev()
|
|
76
|
+
.removeClass(active)
|
|
77
|
+
.addClass(inactive);
|
|
78
|
+
if(bypass) {
|
|
79
|
+
obj.hide();
|
|
80
|
+
} else {
|
|
81
|
+
op.hide.call(obj);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Look for existing cookies
|
|
86
|
+
if(cookieSupport) {
|
|
87
|
+
for (var c=0;c<=l;c++) {
|
|
88
|
+
var val = $.cookie(cookie + c);
|
|
89
|
+
// Show content if associating cookie is found
|
|
90
|
+
if ( val == c + "open" ) {
|
|
91
|
+
panel.eq(c).trigger('show', [true]);
|
|
92
|
+
// Hide content
|
|
93
|
+
} else if ( val == c + "closed") {
|
|
94
|
+
panel.eq(c).trigger('hide', [true]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Delegate click event to show/hide content.
|
|
100
|
+
obj.bind("click", function(e) {
|
|
101
|
+
var t = $(e.target);
|
|
102
|
+
// Check if header was clicked
|
|
103
|
+
if(!t.is(op.head)) {
|
|
104
|
+
// What about link inside header.
|
|
105
|
+
if ( t.parent().is(op.head) ) {
|
|
106
|
+
t = t.parent();
|
|
107
|
+
} else {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
}
|
|
112
|
+
// Figure out what position the clicked header has.
|
|
113
|
+
var num = sections.index(t),
|
|
114
|
+
cookieName = cookie + num,
|
|
115
|
+
cookieVal = num,
|
|
116
|
+
content = t.next(op.group);
|
|
117
|
+
// If content is already active, hide it.
|
|
118
|
+
if(t.hasClass(active)) {
|
|
119
|
+
content.trigger('hide');
|
|
120
|
+
cookieVal += 'closed';
|
|
121
|
+
if(cookieSupport) {
|
|
122
|
+
$.cookie(cookieName, cookieVal, { path: '/', expires: 10 });
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
// Otherwise show it.
|
|
127
|
+
content.trigger('show');
|
|
128
|
+
cookieVal += 'open';
|
|
129
|
+
if(cookieSupport) {
|
|
130
|
+
$.cookie(cookieName, cookieVal, { path: '/', expires: 10 });
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Make sure can we eat cookies without getting into trouble.
|
|
138
|
+
var cookie = true;
|
|
139
|
+
$(function() {
|
|
140
|
+
try {
|
|
141
|
+
$.cookie('x', 'x', { path: '/', expires: 10 });
|
|
142
|
+
}
|
|
143
|
+
catch(e) {
|
|
144
|
+
cookie = false;
|
|
145
|
+
$.cookie('x', null);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
var cookieSupport = $.fn.collapse.cookieSupport = cookie;
|
|
149
|
+
})(jQuery);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie plugin
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
|
5
|
+
* Dual licensed under the MIT and GPL licenses:
|
|
6
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
7
|
+
* http://www.gnu.org/licenses/gpl.html
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create a cookie with the given name and value and other optional parameters.
|
|
13
|
+
*
|
|
14
|
+
* @example $.cookie('the_cookie', 'the_value');
|
|
15
|
+
* @desc Set the value of a cookie.
|
|
16
|
+
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
|
17
|
+
* @desc Create a cookie with all available options.
|
|
18
|
+
* @example $.cookie('the_cookie', 'the_value');
|
|
19
|
+
* @desc Create a session cookie.
|
|
20
|
+
* @example $.cookie('the_cookie', null);
|
|
21
|
+
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
|
22
|
+
* used when the cookie was set.
|
|
23
|
+
*
|
|
24
|
+
* @param String name The name of the cookie.
|
|
25
|
+
* @param String value The value of the cookie.
|
|
26
|
+
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
|
27
|
+
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
|
28
|
+
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
|
29
|
+
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
|
30
|
+
* when the the browser exits.
|
|
31
|
+
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
|
32
|
+
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
|
33
|
+
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
|
34
|
+
* require a secure protocol (like HTTPS).
|
|
35
|
+
* @type undefined
|
|
36
|
+
*
|
|
37
|
+
* @name $.cookie
|
|
38
|
+
* @cat Plugins/Cookie
|
|
39
|
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get the value of a cookie with the given name.
|
|
44
|
+
*
|
|
45
|
+
* @example $.cookie('the_cookie');
|
|
46
|
+
* @desc Get the value of a cookie.
|
|
47
|
+
*
|
|
48
|
+
* @param String name The name of the cookie.
|
|
49
|
+
* @return The value of the cookie.
|
|
50
|
+
* @type String
|
|
51
|
+
*
|
|
52
|
+
* @name $.cookie
|
|
53
|
+
* @cat Plugins/Cookie
|
|
54
|
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
|
55
|
+
*/
|
|
56
|
+
jQuery.cookie = function(name, value, options) {
|
|
57
|
+
if (typeof value != 'undefined') { // name and value given, set cookie
|
|
58
|
+
options = options || {};
|
|
59
|
+
if (value === null) {
|
|
60
|
+
value = '';
|
|
61
|
+
options.expires = -1;
|
|
62
|
+
}
|
|
63
|
+
var expires = '';
|
|
64
|
+
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
|
65
|
+
var date;
|
|
66
|
+
if (typeof options.expires == 'number') {
|
|
67
|
+
date = new Date();
|
|
68
|
+
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
|
69
|
+
} else {
|
|
70
|
+
date = options.expires;
|
|
71
|
+
}
|
|
72
|
+
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
|
73
|
+
}
|
|
74
|
+
// CAUTION: Needed to parenthesize options.path and options.domain
|
|
75
|
+
// in the following expressions, otherwise they evaluate to undefined
|
|
76
|
+
// in the packed version for some reason...
|
|
77
|
+
var path = options.path ? '; path=' + (options.path) : '';
|
|
78
|
+
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
|
79
|
+
var secure = options.secure ? '; secure' : '';
|
|
80
|
+
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
|
81
|
+
} else { // only name given, get cookie
|
|
82
|
+
var cookieValue = null;
|
|
83
|
+
if (document.cookie && document.cookie != '') {
|
|
84
|
+
var cookies = document.cookie.split(';');
|
|
85
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
86
|
+
var cookie = jQuery.trim(cookies[i]);
|
|
87
|
+
// Does this cookie string begin with the name we want?
|
|
88
|
+
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
|
89
|
+
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return cookieValue;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
@@ -0,0 +1,996 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jQuery UI 1.8.16
|
|
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( $, undefined ) {
|
|
11
|
+
|
|
12
|
+
// prevent duplicate loading
|
|
13
|
+
// this is only a problem because we proxy existing functions
|
|
14
|
+
// and we don't want to double proxy them
|
|
15
|
+
$.ui = $.ui || {};
|
|
16
|
+
if ( $.ui.version ) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
$.extend( $.ui, {
|
|
21
|
+
version: "1.8.16",
|
|
22
|
+
|
|
23
|
+
keyCode: {
|
|
24
|
+
ALT: 18,
|
|
25
|
+
BACKSPACE: 8,
|
|
26
|
+
CAPS_LOCK: 20,
|
|
27
|
+
COMMA: 188,
|
|
28
|
+
COMMAND: 91,
|
|
29
|
+
COMMAND_LEFT: 91, // COMMAND
|
|
30
|
+
COMMAND_RIGHT: 93,
|
|
31
|
+
CONTROL: 17,
|
|
32
|
+
DELETE: 46,
|
|
33
|
+
DOWN: 40,
|
|
34
|
+
END: 35,
|
|
35
|
+
ENTER: 13,
|
|
36
|
+
ESCAPE: 27,
|
|
37
|
+
HOME: 36,
|
|
38
|
+
INSERT: 45,
|
|
39
|
+
LEFT: 37,
|
|
40
|
+
MENU: 93, // COMMAND_RIGHT
|
|
41
|
+
NUMPAD_ADD: 107,
|
|
42
|
+
NUMPAD_DECIMAL: 110,
|
|
43
|
+
NUMPAD_DIVIDE: 111,
|
|
44
|
+
NUMPAD_ENTER: 108,
|
|
45
|
+
NUMPAD_MULTIPLY: 106,
|
|
46
|
+
NUMPAD_SUBTRACT: 109,
|
|
47
|
+
PAGE_DOWN: 34,
|
|
48
|
+
PAGE_UP: 33,
|
|
49
|
+
PERIOD: 190,
|
|
50
|
+
RIGHT: 39,
|
|
51
|
+
SHIFT: 16,
|
|
52
|
+
SPACE: 32,
|
|
53
|
+
TAB: 9,
|
|
54
|
+
UP: 38,
|
|
55
|
+
WINDOWS: 91 // COMMAND
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// plugins
|
|
60
|
+
$.fn.extend({
|
|
61
|
+
propAttr: $.fn.prop || $.fn.attr,
|
|
62
|
+
|
|
63
|
+
_focus: $.fn.focus,
|
|
64
|
+
focus: function( delay, fn ) {
|
|
65
|
+
return typeof delay === "number" ?
|
|
66
|
+
this.each(function() {
|
|
67
|
+
var elem = this;
|
|
68
|
+
setTimeout(function() {
|
|
69
|
+
$( elem ).focus();
|
|
70
|
+
if ( fn ) {
|
|
71
|
+
fn.call( elem );
|
|
72
|
+
}
|
|
73
|
+
}, delay );
|
|
74
|
+
}) :
|
|
75
|
+
this._focus.apply( this, arguments );
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
scrollParent: function() {
|
|
79
|
+
var scrollParent;
|
|
80
|
+
if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
|
81
|
+
scrollParent = this.parents().filter(function() {
|
|
82
|
+
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
|
83
|
+
}).eq(0);
|
|
84
|
+
} else {
|
|
85
|
+
scrollParent = this.parents().filter(function() {
|
|
86
|
+
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
|
87
|
+
}).eq(0);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
zIndex: function( zIndex ) {
|
|
94
|
+
if ( zIndex !== undefined ) {
|
|
95
|
+
return this.css( "zIndex", zIndex );
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if ( this.length ) {
|
|
99
|
+
var elem = $( this[ 0 ] ), position, value;
|
|
100
|
+
while ( elem.length && elem[ 0 ] !== document ) {
|
|
101
|
+
// Ignore z-index if position is set to a value where z-index is ignored by the browser
|
|
102
|
+
// This makes behavior of this function consistent across browsers
|
|
103
|
+
// WebKit always returns auto if the element is positioned
|
|
104
|
+
position = elem.css( "position" );
|
|
105
|
+
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
|
|
106
|
+
// IE returns 0 when zIndex is not specified
|
|
107
|
+
// other browsers return a string
|
|
108
|
+
// we ignore the case of nested elements with an explicit value of 0
|
|
109
|
+
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
|
|
110
|
+
value = parseInt( elem.css( "zIndex" ), 10 );
|
|
111
|
+
if ( !isNaN( value ) && value !== 0 ) {
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
elem = elem.parent();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return 0;
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
disableSelection: function() {
|
|
123
|
+
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
|
|
124
|
+
".ui-disableSelection", function( event ) {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
enableSelection: function() {
|
|
130
|
+
return this.unbind( ".ui-disableSelection" );
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
$.each( [ "Width", "Height" ], function( i, name ) {
|
|
135
|
+
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
|
|
136
|
+
type = name.toLowerCase(),
|
|
137
|
+
orig = {
|
|
138
|
+
innerWidth: $.fn.innerWidth,
|
|
139
|
+
innerHeight: $.fn.innerHeight,
|
|
140
|
+
outerWidth: $.fn.outerWidth,
|
|
141
|
+
outerHeight: $.fn.outerHeight
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
function reduce( elem, size, border, margin ) {
|
|
145
|
+
$.each( side, function() {
|
|
146
|
+
size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
|
|
147
|
+
if ( border ) {
|
|
148
|
+
size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
|
|
149
|
+
}
|
|
150
|
+
if ( margin ) {
|
|
151
|
+
size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return size;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
$.fn[ "inner" + name ] = function( size ) {
|
|
158
|
+
if ( size === undefined ) {
|
|
159
|
+
return orig[ "inner" + name ].call( this );
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return this.each(function() {
|
|
163
|
+
$( this ).css( type, reduce( this, size ) + "px" );
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
$.fn[ "outer" + name] = function( size, margin ) {
|
|
168
|
+
if ( typeof size !== "number" ) {
|
|
169
|
+
return orig[ "outer" + name ].call( this, size );
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return this.each(function() {
|
|
173
|
+
$( this).css( type, reduce( this, size, true, margin ) + "px" );
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// selectors
|
|
179
|
+
function focusable( element, isTabIndexNotNaN ) {
|
|
180
|
+
var nodeName = element.nodeName.toLowerCase();
|
|
181
|
+
if ( "area" === nodeName ) {
|
|
182
|
+
var map = element.parentNode,
|
|
183
|
+
mapName = map.name,
|
|
184
|
+
img;
|
|
185
|
+
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
img = $( "img[usemap=#" + mapName + "]" )[0];
|
|
189
|
+
return !!img && visible( img );
|
|
190
|
+
}
|
|
191
|
+
return ( /input|select|textarea|button|object/.test( nodeName )
|
|
192
|
+
? !element.disabled
|
|
193
|
+
: "a" == nodeName
|
|
194
|
+
? element.href || isTabIndexNotNaN
|
|
195
|
+
: isTabIndexNotNaN)
|
|
196
|
+
// the element and all of its ancestors must be visible
|
|
197
|
+
&& visible( element );
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function visible( element ) {
|
|
201
|
+
return !$( element ).parents().andSelf().filter(function() {
|
|
202
|
+
return $.curCSS( this, "visibility" ) === "hidden" ||
|
|
203
|
+
$.expr.filters.hidden( this );
|
|
204
|
+
}).length;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
$.extend( $.expr[ ":" ], {
|
|
208
|
+
data: function( elem, i, match ) {
|
|
209
|
+
return !!$.data( elem, match[ 3 ] );
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
focusable: function( element ) {
|
|
213
|
+
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
tabbable: function( element ) {
|
|
217
|
+
var tabIndex = $.attr( element, "tabindex" ),
|
|
218
|
+
isTabIndexNaN = isNaN( tabIndex );
|
|
219
|
+
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// support
|
|
224
|
+
$(function() {
|
|
225
|
+
var body = document.body,
|
|
226
|
+
div = body.appendChild( div = document.createElement( "div" ) );
|
|
227
|
+
|
|
228
|
+
$.extend( div.style, {
|
|
229
|
+
minHeight: "100px",
|
|
230
|
+
height: "auto",
|
|
231
|
+
padding: 0,
|
|
232
|
+
borderWidth: 0
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
$.support.minHeight = div.offsetHeight === 100;
|
|
236
|
+
$.support.selectstart = "onselectstart" in div;
|
|
237
|
+
|
|
238
|
+
// set display to none to avoid a layout bug in IE
|
|
239
|
+
// http://dev.jquery.com/ticket/4014
|
|
240
|
+
body.removeChild( div ).style.display = "none";
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
// deprecated
|
|
248
|
+
$.extend( $.ui, {
|
|
249
|
+
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
|
250
|
+
plugin: {
|
|
251
|
+
add: function( module, option, set ) {
|
|
252
|
+
var proto = $.ui[ module ].prototype;
|
|
253
|
+
for ( var i in set ) {
|
|
254
|
+
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
|
255
|
+
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
call: function( instance, name, args ) {
|
|
259
|
+
var set = instance.plugins[ name ];
|
|
260
|
+
if ( !set || !instance.element[ 0 ].parentNode ) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
for ( var i = 0; i < set.length; i++ ) {
|
|
265
|
+
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
|
266
|
+
set[ i ][ 1 ].apply( instance.element, args );
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
|
|
273
|
+
contains: function( a, b ) {
|
|
274
|
+
return document.compareDocumentPosition ?
|
|
275
|
+
a.compareDocumentPosition( b ) & 16 :
|
|
276
|
+
a !== b && a.contains( b );
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
// only used by resizable
|
|
280
|
+
hasScroll: function( el, a ) {
|
|
281
|
+
|
|
282
|
+
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
|
283
|
+
if ( $( el ).css( "overflow" ) === "hidden") {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
|
288
|
+
has = false;
|
|
289
|
+
|
|
290
|
+
if ( el[ scroll ] > 0 ) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// TODO: determine which cases actually cause this to happen
|
|
295
|
+
// if the element doesn't have the scroll set, see if it's possible to
|
|
296
|
+
// set the scroll
|
|
297
|
+
el[ scroll ] = 1;
|
|
298
|
+
has = ( el[ scroll ] > 0 );
|
|
299
|
+
el[ scroll ] = 0;
|
|
300
|
+
return has;
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
// these are odd functions, fix the API or move into individual plugins
|
|
304
|
+
isOverAxis: function( x, reference, size ) {
|
|
305
|
+
//Determines when x coordinate is over "b" element axis
|
|
306
|
+
return ( x > reference ) && ( x < ( reference + size ) );
|
|
307
|
+
},
|
|
308
|
+
isOver: function( y, x, top, left, height, width ) {
|
|
309
|
+
//Determines when x, y coordinates is over "b" element
|
|
310
|
+
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
})( jQuery );
|
|
315
|
+
/*!
|
|
316
|
+
* jQuery UI Widget 1.8.16
|
|
317
|
+
*
|
|
318
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
|
319
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
320
|
+
* http://jquery.org/license
|
|
321
|
+
*
|
|
322
|
+
* http://docs.jquery.com/UI/Widget
|
|
323
|
+
*/
|
|
324
|
+
(function( $, undefined ) {
|
|
325
|
+
|
|
326
|
+
// jQuery 1.4+
|
|
327
|
+
if ( $.cleanData ) {
|
|
328
|
+
var _cleanData = $.cleanData;
|
|
329
|
+
$.cleanData = function( elems ) {
|
|
330
|
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
|
331
|
+
try {
|
|
332
|
+
$( elem ).triggerHandler( "remove" );
|
|
333
|
+
// http://bugs.jquery.com/ticket/8235
|
|
334
|
+
} catch( e ) {}
|
|
335
|
+
}
|
|
336
|
+
_cleanData( elems );
|
|
337
|
+
};
|
|
338
|
+
} else {
|
|
339
|
+
var _remove = $.fn.remove;
|
|
340
|
+
$.fn.remove = function( selector, keepData ) {
|
|
341
|
+
return this.each(function() {
|
|
342
|
+
if ( !keepData ) {
|
|
343
|
+
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
|
344
|
+
$( "*", this ).add( [ this ] ).each(function() {
|
|
345
|
+
try {
|
|
346
|
+
$( this ).triggerHandler( "remove" );
|
|
347
|
+
// http://bugs.jquery.com/ticket/8235
|
|
348
|
+
} catch( e ) {}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return _remove.call( $(this), selector, keepData );
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
$.widget = function( name, base, prototype ) {
|
|
358
|
+
var namespace = name.split( "." )[ 0 ],
|
|
359
|
+
fullName;
|
|
360
|
+
name = name.split( "." )[ 1 ];
|
|
361
|
+
fullName = namespace + "-" + name;
|
|
362
|
+
|
|
363
|
+
if ( !prototype ) {
|
|
364
|
+
prototype = base;
|
|
365
|
+
base = $.Widget;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// create selector for plugin
|
|
369
|
+
$.expr[ ":" ][ fullName ] = function( elem ) {
|
|
370
|
+
return !!$.data( elem, name );
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
$[ namespace ] = $[ namespace ] || {};
|
|
374
|
+
$[ namespace ][ name ] = function( options, element ) {
|
|
375
|
+
// allow instantiation without initializing for simple inheritance
|
|
376
|
+
if ( arguments.length ) {
|
|
377
|
+
this._createWidget( options, element );
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
var basePrototype = new base();
|
|
382
|
+
// we need to make the options hash a property directly on the new instance
|
|
383
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
|
384
|
+
// inheriting from
|
|
385
|
+
// $.each( basePrototype, function( key, val ) {
|
|
386
|
+
// if ( $.isPlainObject(val) ) {
|
|
387
|
+
// basePrototype[ key ] = $.extend( {}, val );
|
|
388
|
+
// }
|
|
389
|
+
// });
|
|
390
|
+
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
|
391
|
+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
|
392
|
+
namespace: namespace,
|
|
393
|
+
widgetName: name,
|
|
394
|
+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
|
395
|
+
widgetBaseClass: fullName
|
|
396
|
+
}, prototype );
|
|
397
|
+
|
|
398
|
+
$.widget.bridge( name, $[ namespace ][ name ] );
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
$.widget.bridge = function( name, object ) {
|
|
402
|
+
$.fn[ name ] = function( options ) {
|
|
403
|
+
var isMethodCall = typeof options === "string",
|
|
404
|
+
args = Array.prototype.slice.call( arguments, 1 ),
|
|
405
|
+
returnValue = this;
|
|
406
|
+
|
|
407
|
+
// allow multiple hashes to be passed on init
|
|
408
|
+
options = !isMethodCall && args.length ?
|
|
409
|
+
$.extend.apply( null, [ true, options ].concat(args) ) :
|
|
410
|
+
options;
|
|
411
|
+
|
|
412
|
+
// prevent calls to internal methods
|
|
413
|
+
if ( isMethodCall && options.charAt( 0 ) === "_" ) {
|
|
414
|
+
return returnValue;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if ( isMethodCall ) {
|
|
418
|
+
this.each(function() {
|
|
419
|
+
var instance = $.data( this, name ),
|
|
420
|
+
methodValue = instance && $.isFunction( instance[options] ) ?
|
|
421
|
+
instance[ options ].apply( instance, args ) :
|
|
422
|
+
instance;
|
|
423
|
+
// TODO: add this back in 1.9 and use $.error() (see #5972)
|
|
424
|
+
// if ( !instance ) {
|
|
425
|
+
// throw "cannot call methods on " + name + " prior to initialization; " +
|
|
426
|
+
// "attempted to call method '" + options + "'";
|
|
427
|
+
// }
|
|
428
|
+
// if ( !$.isFunction( instance[options] ) ) {
|
|
429
|
+
// throw "no such method '" + options + "' for " + name + " widget instance";
|
|
430
|
+
// }
|
|
431
|
+
// var methodValue = instance[ options ].apply( instance, args );
|
|
432
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
|
433
|
+
returnValue = methodValue;
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
} else {
|
|
438
|
+
this.each(function() {
|
|
439
|
+
var instance = $.data( this, name );
|
|
440
|
+
if ( instance ) {
|
|
441
|
+
instance.option( options || {} )._init();
|
|
442
|
+
} else {
|
|
443
|
+
$.data( this, name, new object( options, this ) );
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return returnValue;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
$.Widget = function( options, element ) {
|
|
453
|
+
// allow instantiation without initializing for simple inheritance
|
|
454
|
+
if ( arguments.length ) {
|
|
455
|
+
this._createWidget( options, element );
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
$.Widget.prototype = {
|
|
460
|
+
widgetName: "widget",
|
|
461
|
+
widgetEventPrefix: "",
|
|
462
|
+
options: {
|
|
463
|
+
disabled: false
|
|
464
|
+
},
|
|
465
|
+
_createWidget: function( options, element ) {
|
|
466
|
+
// $.widget.bridge stores the plugin instance, but we do it anyway
|
|
467
|
+
// so that it's stored even before the _create function runs
|
|
468
|
+
$.data( element, this.widgetName, this );
|
|
469
|
+
this.element = $( element );
|
|
470
|
+
this.options = $.extend( true, {},
|
|
471
|
+
this.options,
|
|
472
|
+
this._getCreateOptions(),
|
|
473
|
+
options );
|
|
474
|
+
|
|
475
|
+
var self = this;
|
|
476
|
+
this.element.bind( "remove." + this.widgetName, function() {
|
|
477
|
+
self.destroy();
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
this._create();
|
|
481
|
+
this._trigger( "create" );
|
|
482
|
+
this._init();
|
|
483
|
+
},
|
|
484
|
+
_getCreateOptions: function() {
|
|
485
|
+
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
|
|
486
|
+
},
|
|
487
|
+
_create: function() {},
|
|
488
|
+
_init: function() {},
|
|
489
|
+
|
|
490
|
+
destroy: function() {
|
|
491
|
+
this.element
|
|
492
|
+
.unbind( "." + this.widgetName )
|
|
493
|
+
.removeData( this.widgetName );
|
|
494
|
+
this.widget()
|
|
495
|
+
.unbind( "." + this.widgetName )
|
|
496
|
+
.removeAttr( "aria-disabled" )
|
|
497
|
+
.removeClass(
|
|
498
|
+
this.widgetBaseClass + "-disabled " +
|
|
499
|
+
"ui-state-disabled" );
|
|
500
|
+
},
|
|
501
|
+
|
|
502
|
+
widget: function() {
|
|
503
|
+
return this.element;
|
|
504
|
+
},
|
|
505
|
+
|
|
506
|
+
option: function( key, value ) {
|
|
507
|
+
var options = key;
|
|
508
|
+
|
|
509
|
+
if ( arguments.length === 0 ) {
|
|
510
|
+
// don't return a reference to the internal hash
|
|
511
|
+
return $.extend( {}, this.options );
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (typeof key === "string" ) {
|
|
515
|
+
if ( value === undefined ) {
|
|
516
|
+
return this.options[ key ];
|
|
517
|
+
}
|
|
518
|
+
options = {};
|
|
519
|
+
options[ key ] = value;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
this._setOptions( options );
|
|
523
|
+
|
|
524
|
+
return this;
|
|
525
|
+
},
|
|
526
|
+
_setOptions: function( options ) {
|
|
527
|
+
var self = this;
|
|
528
|
+
$.each( options, function( key, value ) {
|
|
529
|
+
self._setOption( key, value );
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
return this;
|
|
533
|
+
},
|
|
534
|
+
_setOption: function( key, value ) {
|
|
535
|
+
this.options[ key ] = value;
|
|
536
|
+
|
|
537
|
+
if ( key === "disabled" ) {
|
|
538
|
+
this.widget()
|
|
539
|
+
[ value ? "addClass" : "removeClass"](
|
|
540
|
+
this.widgetBaseClass + "-disabled" + " " +
|
|
541
|
+
"ui-state-disabled" )
|
|
542
|
+
.attr( "aria-disabled", value );
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return this;
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
enable: function() {
|
|
549
|
+
return this._setOption( "disabled", false );
|
|
550
|
+
},
|
|
551
|
+
disable: function() {
|
|
552
|
+
return this._setOption( "disabled", true );
|
|
553
|
+
},
|
|
554
|
+
|
|
555
|
+
_trigger: function( type, event, data ) {
|
|
556
|
+
var callback = this.options[ type ];
|
|
557
|
+
|
|
558
|
+
event = $.Event( event );
|
|
559
|
+
event.type = ( type === this.widgetEventPrefix ?
|
|
560
|
+
type :
|
|
561
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
|
562
|
+
data = data || {};
|
|
563
|
+
|
|
564
|
+
// copy original event properties over to the new event
|
|
565
|
+
// this would happen if we could call $.event.fix instead of $.Event
|
|
566
|
+
// but we don't have a way to force an event to be fixed multiple times
|
|
567
|
+
if ( event.originalEvent ) {
|
|
568
|
+
for ( var i = $.event.props.length, prop; i; ) {
|
|
569
|
+
prop = $.event.props[ --i ];
|
|
570
|
+
event[ prop ] = event.originalEvent[ prop ];
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
this.element.trigger( event, data );
|
|
575
|
+
|
|
576
|
+
return !( $.isFunction(callback) &&
|
|
577
|
+
callback.call( this.element[0], event, data ) === false ||
|
|
578
|
+
event.isDefaultPrevented() );
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
})( jQuery );
|
|
583
|
+
/*!
|
|
584
|
+
* jQuery UI Mouse 1.8.16
|
|
585
|
+
*
|
|
586
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
|
587
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
588
|
+
* http://jquery.org/license
|
|
589
|
+
*
|
|
590
|
+
* http://docs.jquery.com/UI/Mouse
|
|
591
|
+
*
|
|
592
|
+
* Depends:
|
|
593
|
+
* jquery.ui.widget.js
|
|
594
|
+
*/
|
|
595
|
+
(function( $, undefined ) {
|
|
596
|
+
|
|
597
|
+
var mouseHandled = false;
|
|
598
|
+
$( document ).mouseup( function( e ) {
|
|
599
|
+
mouseHandled = false;
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
$.widget("ui.mouse", {
|
|
603
|
+
options: {
|
|
604
|
+
cancel: ':input,option',
|
|
605
|
+
distance: 1,
|
|
606
|
+
delay: 0
|
|
607
|
+
},
|
|
608
|
+
_mouseInit: function() {
|
|
609
|
+
var self = this;
|
|
610
|
+
|
|
611
|
+
this.element
|
|
612
|
+
.bind('mousedown.'+this.widgetName, function(event) {
|
|
613
|
+
return self._mouseDown(event);
|
|
614
|
+
})
|
|
615
|
+
.bind('click.'+this.widgetName, function(event) {
|
|
616
|
+
if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
|
|
617
|
+
$.removeData(event.target, self.widgetName + '.preventClickEvent');
|
|
618
|
+
event.stopImmediatePropagation();
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
this.started = false;
|
|
624
|
+
},
|
|
625
|
+
|
|
626
|
+
// TODO: make sure destroying one instance of mouse doesn't mess with
|
|
627
|
+
// other instances of mouse
|
|
628
|
+
_mouseDestroy: function() {
|
|
629
|
+
this.element.unbind('.'+this.widgetName);
|
|
630
|
+
},
|
|
631
|
+
|
|
632
|
+
_mouseDown: function(event) {
|
|
633
|
+
// don't let more than one widget handle mouseStart
|
|
634
|
+
if( mouseHandled ) { return };
|
|
635
|
+
|
|
636
|
+
// we may have missed mouseup (out of window)
|
|
637
|
+
(this._mouseStarted && this._mouseUp(event));
|
|
638
|
+
|
|
639
|
+
this._mouseDownEvent = event;
|
|
640
|
+
|
|
641
|
+
var self = this,
|
|
642
|
+
btnIsLeft = (event.which == 1),
|
|
643
|
+
// event.target.nodeName works around a bug in IE 8 with
|
|
644
|
+
// disabled inputs (#7620)
|
|
645
|
+
elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
|
|
646
|
+
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
|
647
|
+
return true;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
this.mouseDelayMet = !this.options.delay;
|
|
651
|
+
if (!this.mouseDelayMet) {
|
|
652
|
+
this._mouseDelayTimer = setTimeout(function() {
|
|
653
|
+
self.mouseDelayMet = true;
|
|
654
|
+
}, this.options.delay);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
|
658
|
+
this._mouseStarted = (this._mouseStart(event) !== false);
|
|
659
|
+
if (!this._mouseStarted) {
|
|
660
|
+
event.preventDefault();
|
|
661
|
+
return true;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// Click event may never have fired (Gecko & Opera)
|
|
666
|
+
if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
|
|
667
|
+
$.removeData(event.target, this.widgetName + '.preventClickEvent');
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// these delegates are required to keep context
|
|
671
|
+
this._mouseMoveDelegate = function(event) {
|
|
672
|
+
return self._mouseMove(event);
|
|
673
|
+
};
|
|
674
|
+
this._mouseUpDelegate = function(event) {
|
|
675
|
+
return self._mouseUp(event);
|
|
676
|
+
};
|
|
677
|
+
$(document)
|
|
678
|
+
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
|
679
|
+
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
|
680
|
+
|
|
681
|
+
event.preventDefault();
|
|
682
|
+
|
|
683
|
+
mouseHandled = true;
|
|
684
|
+
return true;
|
|
685
|
+
},
|
|
686
|
+
|
|
687
|
+
_mouseMove: function(event) {
|
|
688
|
+
// IE mouseup check - mouseup happened when mouse was out of window
|
|
689
|
+
if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
|
|
690
|
+
return this._mouseUp(event);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (this._mouseStarted) {
|
|
694
|
+
this._mouseDrag(event);
|
|
695
|
+
return event.preventDefault();
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
|
699
|
+
this._mouseStarted =
|
|
700
|
+
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
|
701
|
+
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return !this._mouseStarted;
|
|
705
|
+
},
|
|
706
|
+
|
|
707
|
+
_mouseUp: function(event) {
|
|
708
|
+
$(document)
|
|
709
|
+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
|
710
|
+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
|
711
|
+
|
|
712
|
+
if (this._mouseStarted) {
|
|
713
|
+
this._mouseStarted = false;
|
|
714
|
+
|
|
715
|
+
if (event.target == this._mouseDownEvent.target) {
|
|
716
|
+
$.data(event.target, this.widgetName + '.preventClickEvent', true);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
this._mouseStop(event);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
return false;
|
|
723
|
+
},
|
|
724
|
+
|
|
725
|
+
_mouseDistanceMet: function(event) {
|
|
726
|
+
return (Math.max(
|
|
727
|
+
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
|
728
|
+
Math.abs(this._mouseDownEvent.pageY - event.pageY)
|
|
729
|
+
) >= this.options.distance
|
|
730
|
+
);
|
|
731
|
+
},
|
|
732
|
+
|
|
733
|
+
_mouseDelayMet: function(event) {
|
|
734
|
+
return this.mouseDelayMet;
|
|
735
|
+
},
|
|
736
|
+
|
|
737
|
+
// These are placeholder methods, to be overriden by extending plugin
|
|
738
|
+
_mouseStart: function(event) {},
|
|
739
|
+
_mouseDrag: function(event) {},
|
|
740
|
+
_mouseStop: function(event) {},
|
|
741
|
+
_mouseCapture: function(event) { return true; }
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
})(jQuery);
|
|
745
|
+
/*
|
|
746
|
+
* jQuery UI Position 1.8.16
|
|
747
|
+
*
|
|
748
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
|
749
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
750
|
+
* http://jquery.org/license
|
|
751
|
+
*
|
|
752
|
+
* http://docs.jquery.com/UI/Position
|
|
753
|
+
*/
|
|
754
|
+
(function( $, undefined ) {
|
|
755
|
+
|
|
756
|
+
$.ui = $.ui || {};
|
|
757
|
+
|
|
758
|
+
var horizontalPositions = /left|center|right/,
|
|
759
|
+
verticalPositions = /top|center|bottom/,
|
|
760
|
+
center = "center",
|
|
761
|
+
_position = $.fn.position,
|
|
762
|
+
_offset = $.fn.offset;
|
|
763
|
+
|
|
764
|
+
$.fn.position = function( options ) {
|
|
765
|
+
if ( !options || !options.of ) {
|
|
766
|
+
return _position.apply( this, arguments );
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// make a copy, we don't want to modify arguments
|
|
770
|
+
options = $.extend( {}, options );
|
|
771
|
+
|
|
772
|
+
var target = $( options.of ),
|
|
773
|
+
targetElem = target[0],
|
|
774
|
+
collision = ( options.collision || "flip" ).split( " " ),
|
|
775
|
+
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
|
776
|
+
targetWidth,
|
|
777
|
+
targetHeight,
|
|
778
|
+
basePosition;
|
|
779
|
+
|
|
780
|
+
if ( targetElem.nodeType === 9 ) {
|
|
781
|
+
targetWidth = target.width();
|
|
782
|
+
targetHeight = target.height();
|
|
783
|
+
basePosition = { top: 0, left: 0 };
|
|
784
|
+
// TODO: use $.isWindow() in 1.9
|
|
785
|
+
} else if ( targetElem.setTimeout ) {
|
|
786
|
+
targetWidth = target.width();
|
|
787
|
+
targetHeight = target.height();
|
|
788
|
+
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
|
789
|
+
} else if ( targetElem.preventDefault ) {
|
|
790
|
+
// force left top to allow flipping
|
|
791
|
+
options.at = "left top";
|
|
792
|
+
targetWidth = targetHeight = 0;
|
|
793
|
+
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
|
794
|
+
} else {
|
|
795
|
+
targetWidth = target.outerWidth();
|
|
796
|
+
targetHeight = target.outerHeight();
|
|
797
|
+
basePosition = target.offset();
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// force my and at to have valid horizontal and veritcal positions
|
|
801
|
+
// if a value is missing or invalid, it will be converted to center
|
|
802
|
+
$.each( [ "my", "at" ], function() {
|
|
803
|
+
var pos = ( options[this] || "" ).split( " " );
|
|
804
|
+
if ( pos.length === 1) {
|
|
805
|
+
pos = horizontalPositions.test( pos[0] ) ?
|
|
806
|
+
pos.concat( [center] ) :
|
|
807
|
+
verticalPositions.test( pos[0] ) ?
|
|
808
|
+
[ center ].concat( pos ) :
|
|
809
|
+
[ center, center ];
|
|
810
|
+
}
|
|
811
|
+
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
|
|
812
|
+
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
|
|
813
|
+
options[ this ] = pos;
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
// normalize collision option
|
|
817
|
+
if ( collision.length === 1 ) {
|
|
818
|
+
collision[ 1 ] = collision[ 0 ];
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// normalize offset option
|
|
822
|
+
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
|
823
|
+
if ( offset.length === 1 ) {
|
|
824
|
+
offset[ 1 ] = offset[ 0 ];
|
|
825
|
+
}
|
|
826
|
+
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
|
827
|
+
|
|
828
|
+
if ( options.at[0] === "right" ) {
|
|
829
|
+
basePosition.left += targetWidth;
|
|
830
|
+
} else if ( options.at[0] === center ) {
|
|
831
|
+
basePosition.left += targetWidth / 2;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if ( options.at[1] === "bottom" ) {
|
|
835
|
+
basePosition.top += targetHeight;
|
|
836
|
+
} else if ( options.at[1] === center ) {
|
|
837
|
+
basePosition.top += targetHeight / 2;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
basePosition.left += offset[ 0 ];
|
|
841
|
+
basePosition.top += offset[ 1 ];
|
|
842
|
+
|
|
843
|
+
return this.each(function() {
|
|
844
|
+
var elem = $( this ),
|
|
845
|
+
elemWidth = elem.outerWidth(),
|
|
846
|
+
elemHeight = elem.outerHeight(),
|
|
847
|
+
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
|
|
848
|
+
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
|
|
849
|
+
collisionWidth = elemWidth + marginLeft +
|
|
850
|
+
( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
|
|
851
|
+
collisionHeight = elemHeight + marginTop +
|
|
852
|
+
( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
|
|
853
|
+
position = $.extend( {}, basePosition ),
|
|
854
|
+
collisionPosition;
|
|
855
|
+
|
|
856
|
+
if ( options.my[0] === "right" ) {
|
|
857
|
+
position.left -= elemWidth;
|
|
858
|
+
} else if ( options.my[0] === center ) {
|
|
859
|
+
position.left -= elemWidth / 2;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
if ( options.my[1] === "bottom" ) {
|
|
863
|
+
position.top -= elemHeight;
|
|
864
|
+
} else if ( options.my[1] === center ) {
|
|
865
|
+
position.top -= elemHeight / 2;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// prevent fractions (see #5280)
|
|
869
|
+
position.left = Math.round( position.left );
|
|
870
|
+
position.top = Math.round( position.top );
|
|
871
|
+
|
|
872
|
+
collisionPosition = {
|
|
873
|
+
left: position.left - marginLeft,
|
|
874
|
+
top: position.top - marginTop
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
$.each( [ "left", "top" ], function( i, dir ) {
|
|
878
|
+
if ( $.ui.position[ collision[i] ] ) {
|
|
879
|
+
$.ui.position[ collision[i] ][ dir ]( position, {
|
|
880
|
+
targetWidth: targetWidth,
|
|
881
|
+
targetHeight: targetHeight,
|
|
882
|
+
elemWidth: elemWidth,
|
|
883
|
+
elemHeight: elemHeight,
|
|
884
|
+
collisionPosition: collisionPosition,
|
|
885
|
+
collisionWidth: collisionWidth,
|
|
886
|
+
collisionHeight: collisionHeight,
|
|
887
|
+
offset: offset,
|
|
888
|
+
my: options.my,
|
|
889
|
+
at: options.at
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
if ( $.fn.bgiframe ) {
|
|
895
|
+
elem.bgiframe();
|
|
896
|
+
}
|
|
897
|
+
elem.offset( $.extend( position, { using: options.using } ) );
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
$.ui.position = {
|
|
902
|
+
fit: {
|
|
903
|
+
left: function( position, data ) {
|
|
904
|
+
var win = $( window ),
|
|
905
|
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
|
|
906
|
+
position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
|
|
907
|
+
},
|
|
908
|
+
top: function( position, data ) {
|
|
909
|
+
var win = $( window ),
|
|
910
|
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
|
|
911
|
+
position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
flip: {
|
|
916
|
+
left: function( position, data ) {
|
|
917
|
+
if ( data.at[0] === center ) {
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
var win = $( window ),
|
|
921
|
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
|
|
922
|
+
myOffset = data.my[ 0 ] === "left" ?
|
|
923
|
+
-data.elemWidth :
|
|
924
|
+
data.my[ 0 ] === "right" ?
|
|
925
|
+
data.elemWidth :
|
|
926
|
+
0,
|
|
927
|
+
atOffset = data.at[ 0 ] === "left" ?
|
|
928
|
+
data.targetWidth :
|
|
929
|
+
-data.targetWidth,
|
|
930
|
+
offset = -2 * data.offset[ 0 ];
|
|
931
|
+
position.left += data.collisionPosition.left < 0 ?
|
|
932
|
+
myOffset + atOffset + offset :
|
|
933
|
+
over > 0 ?
|
|
934
|
+
myOffset + atOffset + offset :
|
|
935
|
+
0;
|
|
936
|
+
},
|
|
937
|
+
top: function( position, data ) {
|
|
938
|
+
if ( data.at[1] === center ) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
var win = $( window ),
|
|
942
|
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
|
|
943
|
+
myOffset = data.my[ 1 ] === "top" ?
|
|
944
|
+
-data.elemHeight :
|
|
945
|
+
data.my[ 1 ] === "bottom" ?
|
|
946
|
+
data.elemHeight :
|
|
947
|
+
0,
|
|
948
|
+
atOffset = data.at[ 1 ] === "top" ?
|
|
949
|
+
data.targetHeight :
|
|
950
|
+
-data.targetHeight,
|
|
951
|
+
offset = -2 * data.offset[ 1 ];
|
|
952
|
+
position.top += data.collisionPosition.top < 0 ?
|
|
953
|
+
myOffset + atOffset + offset :
|
|
954
|
+
over > 0 ?
|
|
955
|
+
myOffset + atOffset + offset :
|
|
956
|
+
0;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
// offset setter from jQuery 1.4
|
|
962
|
+
if ( !$.offset.setOffset ) {
|
|
963
|
+
$.offset.setOffset = function( elem, options ) {
|
|
964
|
+
// set position first, in-case top/left are set even on static elem
|
|
965
|
+
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
|
966
|
+
elem.style.position = "relative";
|
|
967
|
+
}
|
|
968
|
+
var curElem = $( elem ),
|
|
969
|
+
curOffset = curElem.offset(),
|
|
970
|
+
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
|
971
|
+
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
|
972
|
+
props = {
|
|
973
|
+
top: (options.top - curOffset.top) + curTop,
|
|
974
|
+
left: (options.left - curOffset.left) + curLeft
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
if ( 'using' in options ) {
|
|
978
|
+
options.using.call( elem, props );
|
|
979
|
+
} else {
|
|
980
|
+
curElem.css( props );
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
$.fn.offset = function( options ) {
|
|
985
|
+
var elem = this[ 0 ];
|
|
986
|
+
if ( !elem || !elem.ownerDocument ) { return null; }
|
|
987
|
+
if ( options ) {
|
|
988
|
+
return this.each(function() {
|
|
989
|
+
$.offset.setOffset( this, options );
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
return _offset.call( this );
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
}( jQuery ));
|