olelo 0.9.0
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/.gitignore +10 -0
- data/.gitmodules +3 -0
- data/Gemfile +3 -0
- data/README.markdown +104 -0
- data/Rakefile +92 -0
- data/bin/olelo +5 -0
- data/config.ru +86 -0
- data/config/aspects.rb +256 -0
- data/config/config.yml.default +154 -0
- data/config/initializers/00-mime_types.rb +29 -0
- data/config/initializers/01-slim.rb +2 -0
- data/config/interwiki.yml +11 -0
- data/doc/AUTHORS +7 -0
- data/doc/LICENSE +22 -0
- data/lib/olelo.rb +39 -0
- data/lib/olelo/application.rb +294 -0
- data/lib/olelo/attributes.rb +285 -0
- data/lib/olelo/config.rb +88 -0
- data/lib/olelo/extensions.rb +252 -0
- data/lib/olelo/helper.rb +290 -0
- data/lib/olelo/hooks.rb +142 -0
- data/lib/olelo/html_safe.rb +29 -0
- data/lib/olelo/initializer.rb +76 -0
- data/lib/olelo/locale.rb +63 -0
- data/lib/olelo/locale.yml +284 -0
- data/lib/olelo/menu.rb +101 -0
- data/lib/olelo/middleware/blacklist.rb +25 -0
- data/lib/olelo/middleware/degrade_mime_type.rb +19 -0
- data/lib/olelo/middleware/flash.rb +97 -0
- data/lib/olelo/middleware/force_encoding.rb +41 -0
- data/lib/olelo/page.rb +266 -0
- data/lib/olelo/patch.rb +311 -0
- data/lib/olelo/plugin.rb +188 -0
- data/lib/olelo/repository.rb +225 -0
- data/lib/olelo/routing.rb +223 -0
- data/lib/olelo/templates.rb +30 -0
- data/lib/olelo/user.rb +132 -0
- data/lib/olelo/util.rb +233 -0
- data/lib/olelo/version.rb +3 -0
- data/lib/olelo/virtualfs.rb +161 -0
- data/lib/rack/olelo_patches.rb +33 -0
- data/lib/rack/relative_redirect.rb +44 -0
- data/lib/rack/static_cache.rb +93 -0
- data/lib/yard/addons.rb +1 -0
- data/lib/yard/addons/hook_handler.rb +25 -0
- data/lib/yard/addons/override_tag.rb +14 -0
- data/lib/yard/addons/route_handler.rb +33 -0
- data/lib/yard/addons/sanitize_anchor.rb +16 -0
- data/olelo.gemspec +31 -0
- data/plugins/aspects/changelog.rb +45 -0
- data/plugins/aspects/documentbrowser.rb +57 -0
- data/plugins/aspects/download.rb +11 -0
- data/plugins/aspects/highlight.rb +8 -0
- data/plugins/aspects/image.rb +41 -0
- data/plugins/aspects/imageinfo.rb +64 -0
- data/plugins/aspects/locale.yml +60 -0
- data/plugins/aspects/main.rb +199 -0
- data/plugins/aspects/pageinfo.rb +37 -0
- data/plugins/aspects/source.rb +6 -0
- data/plugins/aspects/subpages.rb +44 -0
- data/plugins/aspects/text.rb +9 -0
- data/plugins/blog/blog.css +1 -0
- data/plugins/blog/blog.scss +37 -0
- data/plugins/blog/locale.yml +12 -0
- data/plugins/blog/main.rb +85 -0
- data/plugins/editor/locale.yml +18 -0
- data/plugins/editor/markup/main.rb +3 -0
- data/plugins/editor/markup/script.js +10 -0
- data/plugins/editor/markup/script/00-jquery.textselection.js +267 -0
- data/plugins/editor/markup/script/01-olelo.markupeditor.js +116 -0
- data/plugins/editor/markup/script/init.js +10 -0
- data/plugins/editor/preview.rb +52 -0
- data/plugins/editor/recaptcha.rb +56 -0
- data/plugins/filters/creole.rb +37 -0
- data/plugins/filters/disposition.rb +9 -0
- data/plugins/filters/editsection.rb +67 -0
- data/plugins/filters/fix_img_tag.rb +16 -0
- data/plugins/filters/html_wrapper.rb +12 -0
- data/plugins/filters/interwiki.rb +19 -0
- data/plugins/filters/link_classifier.rb +26 -0
- data/plugins/filters/locale.yml +15 -0
- data/plugins/filters/main.rb +202 -0
- data/plugins/filters/markdown_nowiki.rb +15 -0
- data/plugins/filters/numbering.xsl +93 -0
- data/plugins/filters/orgmode.rb +6 -0
- data/plugins/filters/rubypants.rb +6 -0
- data/plugins/filters/s5/main.rb +32 -0
- data/plugins/filters/s5/s5.xsl +118 -0
- data/plugins/filters/tilt.rb +17 -0
- data/plugins/filters/toc.rb +50 -0
- data/plugins/filters/xhtml2latex.xsl +232 -0
- data/plugins/filters/xslt.rb +22 -0
- data/plugins/gallery/gallery.css +1 -0
- data/plugins/gallery/gallery.scss +28 -0
- data/plugins/gallery/main.rb +34 -0
- data/plugins/misc/fancybox/images/blank.gif +0 -0
- data/plugins/misc/fancybox/images/fancy_close.png +0 -0
- data/plugins/misc/fancybox/images/fancy_loading.png +0 -0
- data/plugins/misc/fancybox/images/fancy_nav_left.png +0 -0
- data/plugins/misc/fancybox/images/fancy_nav_right.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_e.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_n.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_ne.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_nw.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_s.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_se.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_sw.png +0 -0
- data/plugins/misc/fancybox/images/fancy_shadow_w.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_left.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_main.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_over.png +0 -0
- data/plugins/misc/fancybox/images/fancy_title_right.png +0 -0
- data/plugins/misc/fancybox/images/fancybox-x.png +0 -0
- data/plugins/misc/fancybox/images/fancybox-y.png +0 -0
- data/plugins/misc/fancybox/images/fancybox.png +0 -0
- data/plugins/misc/fancybox/jquery.fancybox.css +1 -0
- data/plugins/misc/fancybox/jquery.fancybox.scss +323 -0
- data/plugins/misc/fancybox/main.rb +4 -0
- data/plugins/misc/fancybox/script.js +37 -0
- data/plugins/misc/fancybox/script/00-jquery.mousewheel.js +84 -0
- data/plugins/misc/fancybox/script/01-jquery.easing.js +205 -0
- data/plugins/misc/fancybox/script/02-jquery.fancybox.js +1156 -0
- data/plugins/misc/fancybox/script/init.js +18 -0
- data/plugins/misc/system.rb +192 -0
- data/plugins/misc/variables.rb +29 -0
- data/plugins/misc/webdav.rb +45 -0
- data/plugins/repositories/git_grep.rb +69 -0
- data/plugins/repositories/gitrb_repository.rb +204 -0
- data/plugins/repositories/locale.yml +12 -0
- data/plugins/repositories/rugged_repository.rb +454 -0
- data/plugins/security/acl.rb +57 -0
- data/plugins/security/basic_auth.rb +21 -0
- data/plugins/security/locale.yml +21 -0
- data/plugins/security/persistent_login.rb +32 -0
- data/plugins/security/portal.rb +28 -0
- data/plugins/security/private_wiki.rb +24 -0
- data/plugins/security/readonly_wiki.rb +25 -0
- data/plugins/security/stack.rb +20 -0
- data/plugins/security/yamlfile.rb +66 -0
- data/plugins/tags/code.rb +6 -0
- data/plugins/tags/footnotes.rb +35 -0
- data/plugins/tags/gist-embed.css +123 -0
- data/plugins/tags/gist.rb +13 -0
- data/plugins/tags/html.rb +57 -0
- data/plugins/tags/include.rb +20 -0
- data/plugins/tags/main.rb +353 -0
- data/plugins/tags/math.rb +117 -0
- data/plugins/tags/scripting.rb +64 -0
- data/plugins/tags/sort.rb +7 -0
- data/plugins/tags/tabs.rb +20 -0
- data/plugins/treeview/images/collapsed.png +0 -0
- data/plugins/treeview/images/expanded.png +0 -0
- data/plugins/treeview/images/menu.png +0 -0
- data/plugins/treeview/images/tree.png +0 -0
- data/plugins/treeview/images/wait.gif +0 -0
- data/plugins/treeview/main.rb +16 -0
- data/plugins/treeview/script.js +5 -0
- data/plugins/treeview/script/00-jquery.treeview.js +164 -0
- data/plugins/treeview/script/init.js +25 -0
- data/plugins/treeview/treeview.css +1 -0
- data/plugins/treeview/treeview.scss +113 -0
- data/plugins/utils/assets.rb +74 -0
- data/plugins/utils/cache.rb +53 -0
- data/plugins/utils/image_magick.rb +34 -0
- data/plugins/utils/pygments.css +1 -0
- data/plugins/utils/pygments.rb +50 -0
- data/plugins/utils/pygments.scss +83 -0
- data/plugins/utils/semaphore.rb +50 -0
- data/plugins/utils/shell.rb +45 -0
- data/plugins/utils/store.rb +315 -0
- data/plugins/utils/worker.rb +36 -0
- data/plugins/utils/xml.rb +29 -0
- data/static/images/favicon.png +0 -0
- data/static/script.js +267 -0
- data/static/script/00-json2.js +486 -0
- data/static/script/01-jstorage.js +217 -0
- data/static/script/02-jquery.js +9440 -0
- data/static/script/03-jquery.ui.core.js +337 -0
- data/static/script/04-jquery.ui.widget.js +502 -0
- data/static/script/05-jquery.ui.position.js +517 -0
- data/static/script/06-jquery.ui.menu.js +609 -0
- data/static/script/07-jquery.ui.autocomplete.js +601 -0
- data/static/script/08-olelo.i18n.js +37 -0
- data/static/script/09-olelo.unsaved.js +68 -0
- data/static/script/10-olelo.historytable.js +40 -0
- data/static/script/11-olelo.pagination.js +18 -0
- data/static/script/13-olelo.tabwidget.js +57 -0
- data/static/script/14-olelo.timeago.js +70 -0
- data/static/script/15-olelo.underliner.js +31 -0
- data/static/script/16-olelo.ui.combobox.js +32 -0
- data/static/script/init.js +48 -0
- data/static/themes/atlantis/constants.scss +15 -0
- data/static/themes/atlantis/iehacks.scss +38 -0
- data/static/themes/atlantis/images/actions/delete.png +0 -0
- data/static/themes/atlantis/images/actions/edit.png +0 -0
- data/static/themes/atlantis/images/actions/history.png +0 -0
- data/static/themes/atlantis/images/actions/home.png +0 -0
- data/static/themes/atlantis/images/actions/move.png +0 -0
- data/static/themes/atlantis/images/actions/new.png +0 -0
- data/static/themes/atlantis/images/actions/page.png +0 -0
- data/static/themes/atlantis/images/bg/button.png +0 -0
- data/static/themes/atlantis/images/bg/container.png +0 -0
- data/static/themes/atlantis/images/bg/content.png +0 -0
- data/static/themes/atlantis/images/bg/footer.png +0 -0
- data/static/themes/atlantis/images/bg/header.jpg +0 -0
- data/static/themes/atlantis/images/bg/header.orig.jpg +0 -0
- data/static/themes/atlantis/images/bg/header_gray.jpg +0 -0
- data/static/themes/atlantis/images/bug.png +0 -0
- data/static/themes/atlantis/images/filetypes/7z.png +0 -0
- data/static/themes/atlantis/images/filetypes/_archive.png +0 -0
- data/static/themes/atlantis/images/filetypes/_audio.png +0 -0
- data/static/themes/atlantis/images/filetypes/_code.png +0 -0
- data/static/themes/atlantis/images/filetypes/_linux.png +0 -0
- data/static/themes/atlantis/images/filetypes/_picture.png +0 -0
- data/static/themes/atlantis/images/filetypes/_video.png +0 -0
- data/static/themes/atlantis/images/filetypes/bz2.png +0 -0
- data/static/themes/atlantis/images/filetypes/doc.png +0 -0
- data/static/themes/atlantis/images/filetypes/flac.png +0 -0
- data/static/themes/atlantis/images/filetypes/gz.png +0 -0
- data/static/themes/atlantis/images/filetypes/html.png +0 -0
- data/static/themes/atlantis/images/filetypes/java.png +0 -0
- data/static/themes/atlantis/images/filetypes/jpg.png +0 -0
- data/static/themes/atlantis/images/filetypes/midi.png +0 -0
- data/static/themes/atlantis/images/filetypes/mp3.png +0 -0
- data/static/themes/atlantis/images/filetypes/ogg.png +0 -0
- data/static/themes/atlantis/images/filetypes/pdf.png +0 -0
- data/static/themes/atlantis/images/filetypes/php.png +0 -0
- data/static/themes/atlantis/images/filetypes/png.png +0 -0
- data/static/themes/atlantis/images/filetypes/ppt.png +0 -0
- data/static/themes/atlantis/images/filetypes/psd.png +0 -0
- data/static/themes/atlantis/images/filetypes/rar.png +0 -0
- data/static/themes/atlantis/images/filetypes/rb.png +0 -0
- data/static/themes/atlantis/images/filetypes/sh.png +0 -0
- data/static/themes/atlantis/images/filetypes/tar.png +0 -0
- data/static/themes/atlantis/images/filetypes/txt.png +0 -0
- data/static/themes/atlantis/images/filetypes/wma.png +0 -0
- data/static/themes/atlantis/images/filetypes/xls.png +0 -0
- data/static/themes/atlantis/images/filetypes/zip.png +0 -0
- data/static/themes/atlantis/images/folder.png +0 -0
- data/static/themes/atlantis/images/folder_open.png +0 -0
- data/static/themes/atlantis/images/loading.gif +0 -0
- data/static/themes/atlantis/images/loading.xcf +0 -0
- data/static/themes/atlantis/images/not_found.png +0 -0
- data/static/themes/atlantis/images/page.png +0 -0
- data/static/themes/atlantis/images/search.png +0 -0
- data/static/themes/atlantis/layout.scss +115 -0
- data/static/themes/atlantis/menu.scss +99 -0
- data/static/themes/atlantis/print.scss +129 -0
- data/static/themes/atlantis/screen.scss +495 -0
- data/static/themes/atlantis/style.css +3 -0
- data/static/themes/lib/autocomplete.scss +39 -0
- data/static/themes/lib/headlines.scss +10 -0
- data/static/themes/lib/horizontal-list.scss +31 -0
- data/static/themes/lib/patch.scss +88 -0
- data/static/themes/lib/reset.scss +114 -0
- data/static/themes/lib/rounded.scss +46 -0
- data/static/themes/lib/shadow.scss +14 -0
- data/test/config_test.rb +28 -0
- data/test/factory_test.rb +29 -0
- data/test/hash_extensions_test.rb +16 -0
- data/test/helper.rb +38 -0
- data/test/hooks_test.rb +85 -0
- data/test/object_extensions_test.rb +20 -0
- data/test/page_test.rb +168 -0
- data/test/request_test.rb +166 -0
- data/test/string_extensions_test.rb +32 -0
- data/test/templates_test.rb +39 -0
- data/test/util_test.rb +71 -0
- data/views/changes.slim +22 -0
- data/views/compare.slim +8 -0
- data/views/delete.slim +9 -0
- data/views/deleted.slim +2 -0
- data/views/edit.slim +65 -0
- data/views/error.slim +6 -0
- data/views/history.slim +20 -0
- data/views/layout.slim +38 -0
- data/views/login.slim +37 -0
- data/views/move.slim +10 -0
- data/views/not_found.slim +6 -0
- data/views/profile.slim +26 -0
- data/views/show.slim +9 -0
- metadata +488 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jQuery UI Core 1.9.0
|
|
3
|
+
* http://jqueryui.com
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2012 jQuery Foundation and other contributors
|
|
6
|
+
* Released under the MIT license.
|
|
7
|
+
* http://jquery.org/license
|
|
8
|
+
*
|
|
9
|
+
* http://api.jqueryui.com/category/ui-core/
|
|
10
|
+
*/
|
|
11
|
+
(function( $, undefined ) {
|
|
12
|
+
|
|
13
|
+
var uuid = 0,
|
|
14
|
+
runiqueId = /^ui-id-\d+$/;
|
|
15
|
+
|
|
16
|
+
// prevent duplicate loading
|
|
17
|
+
// this is only a problem because we proxy existing functions
|
|
18
|
+
// and we don't want to double proxy them
|
|
19
|
+
$.ui = $.ui || {};
|
|
20
|
+
if ( $.ui.version ) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
$.extend( $.ui, {
|
|
25
|
+
version: "1.9.0",
|
|
26
|
+
|
|
27
|
+
keyCode: {
|
|
28
|
+
BACKSPACE: 8,
|
|
29
|
+
COMMA: 188,
|
|
30
|
+
DELETE: 46,
|
|
31
|
+
DOWN: 40,
|
|
32
|
+
END: 35,
|
|
33
|
+
ENTER: 13,
|
|
34
|
+
ESCAPE: 27,
|
|
35
|
+
HOME: 36,
|
|
36
|
+
LEFT: 37,
|
|
37
|
+
NUMPAD_ADD: 107,
|
|
38
|
+
NUMPAD_DECIMAL: 110,
|
|
39
|
+
NUMPAD_DIVIDE: 111,
|
|
40
|
+
NUMPAD_ENTER: 108,
|
|
41
|
+
NUMPAD_MULTIPLY: 106,
|
|
42
|
+
NUMPAD_SUBTRACT: 109,
|
|
43
|
+
PAGE_DOWN: 34,
|
|
44
|
+
PAGE_UP: 33,
|
|
45
|
+
PERIOD: 190,
|
|
46
|
+
RIGHT: 39,
|
|
47
|
+
SPACE: 32,
|
|
48
|
+
TAB: 9,
|
|
49
|
+
UP: 38
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// plugins
|
|
54
|
+
$.fn.extend({
|
|
55
|
+
_focus: $.fn.focus,
|
|
56
|
+
focus: function( delay, fn ) {
|
|
57
|
+
return typeof delay === "number" ?
|
|
58
|
+
this.each(function() {
|
|
59
|
+
var elem = this;
|
|
60
|
+
setTimeout(function() {
|
|
61
|
+
$( elem ).focus();
|
|
62
|
+
if ( fn ) {
|
|
63
|
+
fn.call( elem );
|
|
64
|
+
}
|
|
65
|
+
}, delay );
|
|
66
|
+
}) :
|
|
67
|
+
this._focus.apply( this, arguments );
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
scrollParent: function() {
|
|
71
|
+
var scrollParent;
|
|
72
|
+
if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
|
73
|
+
scrollParent = this.parents().filter(function() {
|
|
74
|
+
return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
|
|
75
|
+
}).eq(0);
|
|
76
|
+
} else {
|
|
77
|
+
scrollParent = this.parents().filter(function() {
|
|
78
|
+
return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
|
|
79
|
+
}).eq(0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
zIndex: function( zIndex ) {
|
|
86
|
+
if ( zIndex !== undefined ) {
|
|
87
|
+
return this.css( "zIndex", zIndex );
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if ( this.length ) {
|
|
91
|
+
var elem = $( this[ 0 ] ), position, value;
|
|
92
|
+
while ( elem.length && elem[ 0 ] !== document ) {
|
|
93
|
+
// Ignore z-index if position is set to a value where z-index is ignored by the browser
|
|
94
|
+
// This makes behavior of this function consistent across browsers
|
|
95
|
+
// WebKit always returns auto if the element is positioned
|
|
96
|
+
position = elem.css( "position" );
|
|
97
|
+
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
|
|
98
|
+
// IE returns 0 when zIndex is not specified
|
|
99
|
+
// other browsers return a string
|
|
100
|
+
// we ignore the case of nested elements with an explicit value of 0
|
|
101
|
+
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
|
|
102
|
+
value = parseInt( elem.css( "zIndex" ), 10 );
|
|
103
|
+
if ( !isNaN( value ) && value !== 0 ) {
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
elem = elem.parent();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return 0;
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
uniqueId: function() {
|
|
115
|
+
return this.each(function() {
|
|
116
|
+
if ( !this.id ) {
|
|
117
|
+
this.id = "ui-id-" + (++uuid);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
removeUniqueId: function() {
|
|
123
|
+
return this.each(function() {
|
|
124
|
+
if ( runiqueId.test( this.id ) ) {
|
|
125
|
+
$( this ).removeAttr( "id" );
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// support: jQuery <1.8
|
|
132
|
+
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
|
|
133
|
+
$.each( [ "Width", "Height" ], function( i, name ) {
|
|
134
|
+
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
|
|
135
|
+
type = name.toLowerCase(),
|
|
136
|
+
orig = {
|
|
137
|
+
innerWidth: $.fn.innerWidth,
|
|
138
|
+
innerHeight: $.fn.innerHeight,
|
|
139
|
+
outerWidth: $.fn.outerWidth,
|
|
140
|
+
outerHeight: $.fn.outerHeight
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
function reduce( elem, size, border, margin ) {
|
|
144
|
+
$.each( side, function() {
|
|
145
|
+
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
|
|
146
|
+
if ( border ) {
|
|
147
|
+
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
|
|
148
|
+
}
|
|
149
|
+
if ( margin ) {
|
|
150
|
+
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return size;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
$.fn[ "inner" + name ] = function( size ) {
|
|
157
|
+
if ( size === undefined ) {
|
|
158
|
+
return orig[ "inner" + name ].call( this );
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return this.each(function() {
|
|
162
|
+
$( this ).css( type, reduce( this, size ) + "px" );
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
$.fn[ "outer" + name] = function( size, margin ) {
|
|
167
|
+
if ( typeof size !== "number" ) {
|
|
168
|
+
return orig[ "outer" + name ].call( this, size );
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return this.each(function() {
|
|
172
|
+
$( this).css( type, reduce( this, size, true, margin ) + "px" );
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// selectors
|
|
179
|
+
function focusable( element, isTabIndexNotNaN ) {
|
|
180
|
+
var map, mapName, img,
|
|
181
|
+
nodeName = element.nodeName.toLowerCase();
|
|
182
|
+
if ( "area" === nodeName ) {
|
|
183
|
+
map = element.parentNode;
|
|
184
|
+
mapName = map.name;
|
|
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 $.css( this, "visibility" ) === "hidden" ||
|
|
203
|
+
$.expr.filters.hidden( this );
|
|
204
|
+
}).length;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
$.extend( $.expr[ ":" ], {
|
|
208
|
+
data: $.expr.createPseudo ?
|
|
209
|
+
$.expr.createPseudo(function( dataName ) {
|
|
210
|
+
return function( elem ) {
|
|
211
|
+
return !!$.data( elem, dataName );
|
|
212
|
+
};
|
|
213
|
+
}) :
|
|
214
|
+
// support: jQuery <1.8
|
|
215
|
+
function( elem, i, match ) {
|
|
216
|
+
return !!$.data( elem, match[ 3 ] );
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
focusable: function( element ) {
|
|
220
|
+
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
tabbable: function( element ) {
|
|
224
|
+
var tabIndex = $.attr( element, "tabindex" ),
|
|
225
|
+
isTabIndexNaN = isNaN( tabIndex );
|
|
226
|
+
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// support
|
|
231
|
+
$(function() {
|
|
232
|
+
var body = document.body,
|
|
233
|
+
div = body.appendChild( div = document.createElement( "div" ) );
|
|
234
|
+
|
|
235
|
+
// access offsetHeight before setting the style to prevent a layout bug
|
|
236
|
+
// in IE 9 which causes the element to continue to take up space even
|
|
237
|
+
// after it is removed from the DOM (#8026)
|
|
238
|
+
div.offsetHeight;
|
|
239
|
+
|
|
240
|
+
$.extend( div.style, {
|
|
241
|
+
minHeight: "100px",
|
|
242
|
+
height: "auto",
|
|
243
|
+
padding: 0,
|
|
244
|
+
borderWidth: 0
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
$.support.minHeight = div.offsetHeight === 100;
|
|
248
|
+
$.support.selectstart = "onselectstart" in div;
|
|
249
|
+
|
|
250
|
+
// set display to none to avoid a layout bug in IE
|
|
251
|
+
// http://dev.jquery.com/ticket/4014
|
|
252
|
+
body.removeChild( div ).style.display = "none";
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
// deprecated
|
|
260
|
+
|
|
261
|
+
$.fn.extend({
|
|
262
|
+
disableSelection: function() {
|
|
263
|
+
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
|
|
264
|
+
".ui-disableSelection", function( event ) {
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
enableSelection: function() {
|
|
270
|
+
return this.unbind( ".ui-disableSelection" );
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
$.extend( $.ui, {
|
|
275
|
+
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
|
276
|
+
plugin: {
|
|
277
|
+
add: function( module, option, set ) {
|
|
278
|
+
var i,
|
|
279
|
+
proto = $.ui[ module ].prototype;
|
|
280
|
+
for ( i in set ) {
|
|
281
|
+
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
|
282
|
+
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
call: function( instance, name, args ) {
|
|
286
|
+
var i,
|
|
287
|
+
set = instance.plugins[ name ];
|
|
288
|
+
if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
for ( i = 0; i < set.length; i++ ) {
|
|
293
|
+
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
|
294
|
+
set[ i ][ 1 ].apply( instance.element, args );
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
contains: $.contains,
|
|
301
|
+
|
|
302
|
+
// only used by resizable
|
|
303
|
+
hasScroll: function( el, a ) {
|
|
304
|
+
|
|
305
|
+
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
|
306
|
+
if ( $( el ).css( "overflow" ) === "hidden") {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
|
311
|
+
has = false;
|
|
312
|
+
|
|
313
|
+
if ( el[ scroll ] > 0 ) {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// TODO: determine which cases actually cause this to happen
|
|
318
|
+
// if the element doesn't have the scroll set, see if it's possible to
|
|
319
|
+
// set the scroll
|
|
320
|
+
el[ scroll ] = 1;
|
|
321
|
+
has = ( el[ scroll ] > 0 );
|
|
322
|
+
el[ scroll ] = 0;
|
|
323
|
+
return has;
|
|
324
|
+
},
|
|
325
|
+
|
|
326
|
+
// these are odd functions, fix the API or move into individual plugins
|
|
327
|
+
isOverAxis: function( x, reference, size ) {
|
|
328
|
+
//Determines when x coordinate is over "b" element axis
|
|
329
|
+
return ( x > reference ) && ( x < ( reference + size ) );
|
|
330
|
+
},
|
|
331
|
+
isOver: function( y, x, top, left, height, width ) {
|
|
332
|
+
//Determines when x, y coordinates is over "b" element
|
|
333
|
+
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
})( jQuery );
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jQuery UI Widget 1.9.0
|
|
3
|
+
* http://jqueryui.com
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2012 jQuery Foundation and other contributors
|
|
6
|
+
* Released under the MIT license.
|
|
7
|
+
* http://jquery.org/license
|
|
8
|
+
*
|
|
9
|
+
* http://api.jqueryui.com/jQuery.widget/
|
|
10
|
+
*/
|
|
11
|
+
(function( $, undefined ) {
|
|
12
|
+
|
|
13
|
+
var uuid = 0,
|
|
14
|
+
slice = Array.prototype.slice,
|
|
15
|
+
_cleanData = $.cleanData;
|
|
16
|
+
$.cleanData = function( elems ) {
|
|
17
|
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
|
18
|
+
try {
|
|
19
|
+
$( elem ).triggerHandler( "remove" );
|
|
20
|
+
// http://bugs.jquery.com/ticket/8235
|
|
21
|
+
} catch( e ) {}
|
|
22
|
+
}
|
|
23
|
+
_cleanData( elems );
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
$.widget = function( name, base, prototype ) {
|
|
27
|
+
var fullName, existingConstructor, constructor, basePrototype,
|
|
28
|
+
namespace = name.split( "." )[ 0 ];
|
|
29
|
+
|
|
30
|
+
name = name.split( "." )[ 1 ];
|
|
31
|
+
fullName = namespace + "-" + name;
|
|
32
|
+
|
|
33
|
+
if ( !prototype ) {
|
|
34
|
+
prototype = base;
|
|
35
|
+
base = $.Widget;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// create selector for plugin
|
|
39
|
+
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
|
40
|
+
return !!$.data( elem, fullName );
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
$[ namespace ] = $[ namespace ] || {};
|
|
44
|
+
existingConstructor = $[ namespace ][ name ];
|
|
45
|
+
constructor = $[ namespace ][ name ] = function( options, element ) {
|
|
46
|
+
// allow instantiation without "new" keyword
|
|
47
|
+
if ( !this._createWidget ) {
|
|
48
|
+
return new constructor( options, element );
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// allow instantiation without initializing for simple inheritance
|
|
52
|
+
// must use "new" keyword (the code above always passes args)
|
|
53
|
+
if ( arguments.length ) {
|
|
54
|
+
this._createWidget( options, element );
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// extend with the existing constructor to carry over any static properties
|
|
58
|
+
$.extend( constructor, existingConstructor, {
|
|
59
|
+
version: prototype.version,
|
|
60
|
+
// copy the object used to create the prototype in case we need to
|
|
61
|
+
// redefine the widget later
|
|
62
|
+
_proto: $.extend( {}, prototype ),
|
|
63
|
+
// track widgets that inherit from this widget in case this widget is
|
|
64
|
+
// redefined after a widget inherits from it
|
|
65
|
+
_childConstructors: []
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
basePrototype = new base();
|
|
69
|
+
// we need to make the options hash a property directly on the new instance
|
|
70
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
|
71
|
+
// inheriting from
|
|
72
|
+
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
|
73
|
+
$.each( prototype, function( prop, value ) {
|
|
74
|
+
if ( $.isFunction( value ) ) {
|
|
75
|
+
prototype[ prop ] = (function() {
|
|
76
|
+
var _super = function() {
|
|
77
|
+
return base.prototype[ prop ].apply( this, arguments );
|
|
78
|
+
},
|
|
79
|
+
_superApply = function( args ) {
|
|
80
|
+
return base.prototype[ prop ].apply( this, args );
|
|
81
|
+
};
|
|
82
|
+
return function() {
|
|
83
|
+
var __super = this._super,
|
|
84
|
+
__superApply = this._superApply,
|
|
85
|
+
returnValue;
|
|
86
|
+
|
|
87
|
+
this._super = _super;
|
|
88
|
+
this._superApply = _superApply;
|
|
89
|
+
|
|
90
|
+
returnValue = value.apply( this, arguments );
|
|
91
|
+
|
|
92
|
+
this._super = __super;
|
|
93
|
+
this._superApply = __superApply;
|
|
94
|
+
|
|
95
|
+
return returnValue;
|
|
96
|
+
};
|
|
97
|
+
})();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
constructor.prototype = $.widget.extend( basePrototype, {
|
|
101
|
+
// TODO: remove support for widgetEventPrefix
|
|
102
|
+
// always use the name + a colon as the prefix, e.g., draggable:start
|
|
103
|
+
// don't prefix for widgets that aren't DOM-based
|
|
104
|
+
widgetEventPrefix: name
|
|
105
|
+
}, prototype, {
|
|
106
|
+
constructor: constructor,
|
|
107
|
+
namespace: namespace,
|
|
108
|
+
widgetName: name,
|
|
109
|
+
// TODO remove widgetBaseClass, see #8155
|
|
110
|
+
widgetBaseClass: fullName,
|
|
111
|
+
widgetFullName: fullName
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// If this widget is being redefined then we need to find all widgets that
|
|
115
|
+
// are inheriting from it and redefine all of them so that they inherit from
|
|
116
|
+
// the new version of this widget. We're essentially trying to replace one
|
|
117
|
+
// level in the prototype chain.
|
|
118
|
+
if ( existingConstructor ) {
|
|
119
|
+
$.each( existingConstructor._childConstructors, function( i, child ) {
|
|
120
|
+
var childPrototype = child.prototype;
|
|
121
|
+
|
|
122
|
+
// redefine the child widget using the same prototype that was
|
|
123
|
+
// originally used, but inherit from the new version of the base
|
|
124
|
+
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
|
125
|
+
});
|
|
126
|
+
// remove the list of existing child constructors from the old constructor
|
|
127
|
+
// so the old child constructors can be garbage collected
|
|
128
|
+
delete existingConstructor._childConstructors;
|
|
129
|
+
} else {
|
|
130
|
+
base._childConstructors.push( constructor );
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
$.widget.bridge( name, constructor );
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
$.widget.extend = function( target ) {
|
|
137
|
+
var input = slice.call( arguments, 1 ),
|
|
138
|
+
inputIndex = 0,
|
|
139
|
+
inputLength = input.length,
|
|
140
|
+
key,
|
|
141
|
+
value;
|
|
142
|
+
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
|
143
|
+
for ( key in input[ inputIndex ] ) {
|
|
144
|
+
value = input[ inputIndex ][ key ];
|
|
145
|
+
if (input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
|
146
|
+
target[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return target;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
$.widget.bridge = function( name, object ) {
|
|
154
|
+
var fullName = object.prototype.widgetFullName;
|
|
155
|
+
$.fn[ name ] = function( options ) {
|
|
156
|
+
var isMethodCall = typeof options === "string",
|
|
157
|
+
args = slice.call( arguments, 1 ),
|
|
158
|
+
returnValue = this;
|
|
159
|
+
|
|
160
|
+
// allow multiple hashes to be passed on init
|
|
161
|
+
options = !isMethodCall && args.length ?
|
|
162
|
+
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
|
163
|
+
options;
|
|
164
|
+
|
|
165
|
+
if ( isMethodCall ) {
|
|
166
|
+
this.each(function() {
|
|
167
|
+
var methodValue,
|
|
168
|
+
instance = $.data( this, fullName );
|
|
169
|
+
if ( !instance ) {
|
|
170
|
+
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
|
171
|
+
"attempted to call method '" + options + "'" );
|
|
172
|
+
}
|
|
173
|
+
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
|
174
|
+
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
|
175
|
+
}
|
|
176
|
+
methodValue = instance[ options ].apply( instance, args );
|
|
177
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
|
178
|
+
returnValue = methodValue && methodValue.jquery ?
|
|
179
|
+
returnValue.pushStack( methodValue.get() ) :
|
|
180
|
+
methodValue;
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
this.each(function() {
|
|
186
|
+
var instance = $.data( this, fullName );
|
|
187
|
+
if ( instance ) {
|
|
188
|
+
instance.option( options || {} )._init();
|
|
189
|
+
} else {
|
|
190
|
+
new object( options, this );
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return returnValue;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
$.Widget = function( options, element ) {};
|
|
200
|
+
$.Widget._childConstructors = [];
|
|
201
|
+
|
|
202
|
+
$.Widget.prototype = {
|
|
203
|
+
widgetName: "widget",
|
|
204
|
+
widgetEventPrefix: "",
|
|
205
|
+
defaultElement: "<div>",
|
|
206
|
+
options: {
|
|
207
|
+
disabled: false,
|
|
208
|
+
|
|
209
|
+
// callbacks
|
|
210
|
+
create: null
|
|
211
|
+
},
|
|
212
|
+
_createWidget: function( options, element ) {
|
|
213
|
+
element = $( element || this.defaultElement || this )[ 0 ];
|
|
214
|
+
this.element = $( element );
|
|
215
|
+
this.uuid = uuid++;
|
|
216
|
+
this.eventNamespace = "." + this.widgetName + this.uuid;
|
|
217
|
+
this.options = $.widget.extend( {},
|
|
218
|
+
this.options,
|
|
219
|
+
this._getCreateOptions(),
|
|
220
|
+
options );
|
|
221
|
+
|
|
222
|
+
this.bindings = $();
|
|
223
|
+
this.hoverable = $();
|
|
224
|
+
this.focusable = $();
|
|
225
|
+
|
|
226
|
+
if ( element !== this ) {
|
|
227
|
+
// 1.9 BC for #7810
|
|
228
|
+
// TODO remove dual storage
|
|
229
|
+
$.data( element, this.widgetName, this );
|
|
230
|
+
$.data( element, this.widgetFullName, this );
|
|
231
|
+
this._on({ remove: "destroy" });
|
|
232
|
+
this.document = $( element.style ?
|
|
233
|
+
// element within the document
|
|
234
|
+
element.ownerDocument :
|
|
235
|
+
// element is window or document
|
|
236
|
+
element.document || element );
|
|
237
|
+
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
this._create();
|
|
241
|
+
this._trigger( "create", null, this._getCreateEventData() );
|
|
242
|
+
this._init();
|
|
243
|
+
},
|
|
244
|
+
_getCreateOptions: $.noop,
|
|
245
|
+
_getCreateEventData: $.noop,
|
|
246
|
+
_create: $.noop,
|
|
247
|
+
_init: $.noop,
|
|
248
|
+
|
|
249
|
+
destroy: function() {
|
|
250
|
+
this._destroy();
|
|
251
|
+
// we can probably remove the unbind calls in 2.0
|
|
252
|
+
// all event bindings should go through this._on()
|
|
253
|
+
this.element
|
|
254
|
+
.unbind( this.eventNamespace )
|
|
255
|
+
// 1.9 BC for #7810
|
|
256
|
+
// TODO remove dual storage
|
|
257
|
+
.removeData( this.widgetName )
|
|
258
|
+
.removeData( this.widgetFullName )
|
|
259
|
+
// support: jquery <1.6.3
|
|
260
|
+
// http://bugs.jquery.com/ticket/9413
|
|
261
|
+
.removeData( $.camelCase( this.widgetFullName ) );
|
|
262
|
+
this.widget()
|
|
263
|
+
.unbind( this.eventNamespace )
|
|
264
|
+
.removeAttr( "aria-disabled" )
|
|
265
|
+
.removeClass(
|
|
266
|
+
this.widgetFullName + "-disabled " +
|
|
267
|
+
"ui-state-disabled" );
|
|
268
|
+
|
|
269
|
+
// clean up events and states
|
|
270
|
+
this.bindings.unbind( this.eventNamespace );
|
|
271
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
|
272
|
+
this.focusable.removeClass( "ui-state-focus" );
|
|
273
|
+
},
|
|
274
|
+
_destroy: $.noop,
|
|
275
|
+
|
|
276
|
+
widget: function() {
|
|
277
|
+
return this.element;
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
option: function( key, value ) {
|
|
281
|
+
var options = key,
|
|
282
|
+
parts,
|
|
283
|
+
curOption,
|
|
284
|
+
i;
|
|
285
|
+
|
|
286
|
+
if ( arguments.length === 0 ) {
|
|
287
|
+
// don't return a reference to the internal hash
|
|
288
|
+
return $.widget.extend( {}, this.options );
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if ( typeof key === "string" ) {
|
|
292
|
+
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
|
293
|
+
options = {};
|
|
294
|
+
parts = key.split( "." );
|
|
295
|
+
key = parts.shift();
|
|
296
|
+
if ( parts.length ) {
|
|
297
|
+
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
|
298
|
+
for ( i = 0; i < parts.length - 1; i++ ) {
|
|
299
|
+
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
|
300
|
+
curOption = curOption[ parts[ i ] ];
|
|
301
|
+
}
|
|
302
|
+
key = parts.pop();
|
|
303
|
+
if ( value === undefined ) {
|
|
304
|
+
return curOption[ key ] === undefined ? null : curOption[ key ];
|
|
305
|
+
}
|
|
306
|
+
curOption[ key ] = value;
|
|
307
|
+
} else {
|
|
308
|
+
if ( value === undefined ) {
|
|
309
|
+
return this.options[ key ] === undefined ? null : this.options[ key ];
|
|
310
|
+
}
|
|
311
|
+
options[ key ] = value;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
this._setOptions( options );
|
|
316
|
+
|
|
317
|
+
return this;
|
|
318
|
+
},
|
|
319
|
+
_setOptions: function( options ) {
|
|
320
|
+
var key;
|
|
321
|
+
|
|
322
|
+
for ( key in options ) {
|
|
323
|
+
this._setOption( key, options[ key ] );
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return this;
|
|
327
|
+
},
|
|
328
|
+
_setOption: function( key, value ) {
|
|
329
|
+
this.options[ key ] = value;
|
|
330
|
+
|
|
331
|
+
if ( key === "disabled" ) {
|
|
332
|
+
this.widget()
|
|
333
|
+
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
|
|
334
|
+
.attr( "aria-disabled", value );
|
|
335
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
|
336
|
+
this.focusable.removeClass( "ui-state-focus" );
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return this;
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
enable: function() {
|
|
343
|
+
return this._setOption( "disabled", false );
|
|
344
|
+
},
|
|
345
|
+
disable: function() {
|
|
346
|
+
return this._setOption( "disabled", true );
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
_on: function( element, handlers ) {
|
|
350
|
+
// no element argument, shuffle and use this.element
|
|
351
|
+
if ( !handlers ) {
|
|
352
|
+
handlers = element;
|
|
353
|
+
element = this.element;
|
|
354
|
+
} else {
|
|
355
|
+
// accept selectors, DOM elements
|
|
356
|
+
element = $( element );
|
|
357
|
+
this.bindings = this.bindings.add( element );
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
var instance = this;
|
|
361
|
+
$.each( handlers, function( event, handler ) {
|
|
362
|
+
function handlerProxy() {
|
|
363
|
+
// allow widgets to customize the disabled handling
|
|
364
|
+
// - disabled as an array instead of boolean
|
|
365
|
+
// - disabled class as method for disabling individual parts
|
|
366
|
+
if ( instance.options.disabled === true ||
|
|
367
|
+
$( this ).hasClass( "ui-state-disabled" ) ) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
|
371
|
+
.apply( instance, arguments );
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// copy the guid so direct unbinding works
|
|
375
|
+
if ( typeof handler !== "string" ) {
|
|
376
|
+
handlerProxy.guid = handler.guid =
|
|
377
|
+
handler.guid || handlerProxy.guid || $.guid++;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
var match = event.match( /^(\w+)\s*(.*)$/ ),
|
|
381
|
+
eventName = match[1] + instance.eventNamespace,
|
|
382
|
+
selector = match[2];
|
|
383
|
+
if ( selector ) {
|
|
384
|
+
instance.widget().delegate( selector, eventName, handlerProxy );
|
|
385
|
+
} else {
|
|
386
|
+
element.bind( eventName, handlerProxy );
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
_off: function( element, eventName ) {
|
|
392
|
+
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
|
393
|
+
element.unbind( eventName ).undelegate( eventName );
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
_delay: function( handler, delay ) {
|
|
397
|
+
function handlerProxy() {
|
|
398
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
|
399
|
+
.apply( instance, arguments );
|
|
400
|
+
}
|
|
401
|
+
var instance = this;
|
|
402
|
+
return setTimeout( handlerProxy, delay || 0 );
|
|
403
|
+
},
|
|
404
|
+
|
|
405
|
+
_hoverable: function( element ) {
|
|
406
|
+
this.hoverable = this.hoverable.add( element );
|
|
407
|
+
this._on( element, {
|
|
408
|
+
mouseenter: function( event ) {
|
|
409
|
+
$( event.currentTarget ).addClass( "ui-state-hover" );
|
|
410
|
+
},
|
|
411
|
+
mouseleave: function( event ) {
|
|
412
|
+
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
|
|
417
|
+
_focusable: function( element ) {
|
|
418
|
+
this.focusable = this.focusable.add( element );
|
|
419
|
+
this._on( element, {
|
|
420
|
+
focusin: function( event ) {
|
|
421
|
+
$( event.currentTarget ).addClass( "ui-state-focus" );
|
|
422
|
+
},
|
|
423
|
+
focusout: function( event ) {
|
|
424
|
+
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
|
|
429
|
+
_trigger: function( type, event, data ) {
|
|
430
|
+
var prop, orig,
|
|
431
|
+
callback = this.options[ type ];
|
|
432
|
+
|
|
433
|
+
data = data || {};
|
|
434
|
+
event = $.Event( event );
|
|
435
|
+
event.type = ( type === this.widgetEventPrefix ?
|
|
436
|
+
type :
|
|
437
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
|
438
|
+
// the original event may come from any element
|
|
439
|
+
// so we need to reset the target on the new event
|
|
440
|
+
event.target = this.element[ 0 ];
|
|
441
|
+
|
|
442
|
+
// copy original event properties over to the new event
|
|
443
|
+
orig = event.originalEvent;
|
|
444
|
+
if ( orig ) {
|
|
445
|
+
for ( prop in orig ) {
|
|
446
|
+
if ( !( prop in event ) ) {
|
|
447
|
+
event[ prop ] = orig[ prop ];
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this.element.trigger( event, data );
|
|
453
|
+
return !( $.isFunction( callback ) &&
|
|
454
|
+
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
|
455
|
+
event.isDefaultPrevented() );
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
|
460
|
+
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
|
461
|
+
if ( typeof options === "string" ) {
|
|
462
|
+
options = { effect: options };
|
|
463
|
+
}
|
|
464
|
+
var hasOptions,
|
|
465
|
+
effectName = !options ?
|
|
466
|
+
method :
|
|
467
|
+
options === true || typeof options === "number" ?
|
|
468
|
+
defaultEffect :
|
|
469
|
+
options.effect || defaultEffect;
|
|
470
|
+
options = options || {};
|
|
471
|
+
if ( typeof options === "number" ) {
|
|
472
|
+
options = { duration: options };
|
|
473
|
+
}
|
|
474
|
+
hasOptions = !$.isEmptyObject( options );
|
|
475
|
+
options.complete = callback;
|
|
476
|
+
if ( options.delay ) {
|
|
477
|
+
element.delay( options.delay );
|
|
478
|
+
}
|
|
479
|
+
if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
|
|
480
|
+
element[ method ]( options );
|
|
481
|
+
} else if ( effectName !== method && element[ effectName ] ) {
|
|
482
|
+
element[ effectName ]( options.duration, options.easing, callback );
|
|
483
|
+
} else {
|
|
484
|
+
element.queue(function( next ) {
|
|
485
|
+
$( this )[ method ]();
|
|
486
|
+
if ( callback ) {
|
|
487
|
+
callback.call( element[ 0 ] );
|
|
488
|
+
}
|
|
489
|
+
next();
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// DEPRECATED
|
|
496
|
+
if ( $.uiBackCompat !== false ) {
|
|
497
|
+
$.Widget.prototype._getCreateOptions = function() {
|
|
498
|
+
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
})( jQuery );
|