epuber 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/bin/epuber +10 -0
- data/epuber.gemspec +51 -0
- data/lib/epuber.rb +14 -0
- data/lib/epuber/book.rb +267 -0
- data/lib/epuber/book/contributor.rb +90 -0
- data/lib/epuber/book/file_request.rb +68 -0
- data/lib/epuber/book/target.rb +284 -0
- data/lib/epuber/book/toc_item.rb +130 -0
- data/lib/epuber/checker.rb +19 -0
- data/lib/epuber/checker/text_checker.rb +129 -0
- data/lib/epuber/checker_transformer_base.rb +71 -0
- data/lib/epuber/command.rb +65 -0
- data/lib/epuber/command/compile.rb +142 -0
- data/lib/epuber/command/init.rb +145 -0
- data/lib/epuber/command/server.rb +59 -0
- data/lib/epuber/compiler.rb +255 -0
- data/lib/epuber/compiler/compilation_context.rb +86 -0
- data/lib/epuber/compiler/file_finders/abstract.rb +270 -0
- data/lib/epuber/compiler/file_finders/imaginary.rb +167 -0
- data/lib/epuber/compiler/file_finders/normal.rb +22 -0
- data/lib/epuber/compiler/file_resolver.rb +316 -0
- data/lib/epuber/compiler/file_types/abstract_file.rb +119 -0
- data/lib/epuber/compiler/file_types/bade_file.rb +39 -0
- data/lib/epuber/compiler/file_types/container_xml_file.rb +26 -0
- data/lib/epuber/compiler/file_types/generated_file.rb +29 -0
- data/lib/epuber/compiler/file_types/ibooks_display_options_file.rb +31 -0
- data/lib/epuber/compiler/file_types/image_file.rb +42 -0
- data/lib/epuber/compiler/file_types/mime_type_file.rb +20 -0
- data/lib/epuber/compiler/file_types/nav_file.rb +42 -0
- data/lib/epuber/compiler/file_types/opf_file.rb +27 -0
- data/lib/epuber/compiler/file_types/source_file.rb +52 -0
- data/lib/epuber/compiler/file_types/static_file.rb +18 -0
- data/lib/epuber/compiler/file_types/stylus_file.rb +20 -0
- data/lib/epuber/compiler/file_types/xhtml_file.rb +102 -0
- data/lib/epuber/compiler/generator.rb +67 -0
- data/lib/epuber/compiler/meta_inf_generator.rb +41 -0
- data/lib/epuber/compiler/nav_generator.rb +201 -0
- data/lib/epuber/compiler/opf_generator.rb +284 -0
- data/lib/epuber/compiler/xhtml_processor.rb +254 -0
- data/lib/epuber/config.rb +133 -0
- data/lib/epuber/dsl/attribute.rb +248 -0
- data/lib/epuber/dsl/attribute_support.rb +130 -0
- data/lib/epuber/dsl/object.rb +145 -0
- data/lib/epuber/dsl/tree_object.rb +101 -0
- data/lib/epuber/helper.rb +19 -0
- data/lib/epuber/lockfile.rb +55 -0
- data/lib/epuber/plugin.rb +108 -0
- data/lib/epuber/ruby_extensions/match_data.rb +40 -0
- data/lib/epuber/ruby_extensions/thread.rb +13 -0
- data/lib/epuber/server.rb +614 -0
- data/lib/epuber/server/auto_refresh/auto_refresh.coffee +97 -0
- data/lib/epuber/server/auto_refresh/connector.coffee +125 -0
- data/lib/epuber/server/auto_refresh/protocol.coffee +41 -0
- data/lib/epuber/server/auto_refresh/reloader.coffee +261 -0
- data/lib/epuber/server/base.styl +3 -0
- data/lib/epuber/server/basic.styl +211 -0
- data/lib/epuber/server/book_content.styl +39 -0
- data/lib/epuber/server/default_cover.png +0 -0
- data/lib/epuber/server/fonts/AvenirNext/AvenirNext-Bold.ttf +0 -0
- data/lib/epuber/server/fonts/AvenirNext/AvenirNext-BoldItalic.ttf +0 -0
- data/lib/epuber/server/fonts/AvenirNext/AvenirNext-Italic.ttf +0 -0
- data/lib/epuber/server/fonts/AvenirNext/AvenirNext-Regular.ttf +0 -0
- data/lib/epuber/server/handlers.rb +67 -0
- data/lib/epuber/server/keyboard_control.coffee +6 -0
- data/lib/epuber/server/pages/book.bade +75 -0
- data/lib/epuber/server/pages/common.bade +59 -0
- data/lib/epuber/server/pages/files.bade +17 -0
- data/lib/epuber/server/pages/toc.bade +29 -0
- data/lib/epuber/server/support.coffee +10 -0
- data/lib/epuber/templates/template.bookspec +143 -0
- data/lib/epuber/third_party/bower.rb +22 -0
- data/lib/epuber/third_party/bower/bower.json +10 -0
- data/lib/epuber/third_party/bower/bower_components/cookies-js/bower.json +10 -0
- data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.d.ts +33 -0
- data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.js +173 -0
- data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.min.js +6 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/MIT-LICENSE.txt +21 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/bower.json +28 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.js +9210 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.min.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.min.map +1 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax.js +786 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/jsonp.js +89 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/load.js +75 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/parseJSON.js +13 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/parseXML.js +28 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/script.js +64 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/nonce.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/rquery.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/xhr.js +136 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes.js +11 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/attr.js +141 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/classes.js +158 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/prop.js +94 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/support.js +35 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/val.js +161 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/callbacks.js +205 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core.js +502 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/access.js +60 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/init.js +123 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/parseHTML.js +39 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/ready.js +97 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/var/rsingleTag.js +4 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css.js +450 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/addGetHookIf.js +22 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/curCSS.js +57 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/defaultDisplay.js +70 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/support.js +96 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/swap.js +28 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/cssExpand.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/getStyles.js +12 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/isHidden.js +13 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/rmargin.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data.js +178 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/Data.js +181 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/accepts.js +20 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/var/data_priv.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/var/data_user.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/deferred.js +149 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/deprecated.js +13 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/dimensions.js +50 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/effects.js +648 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/effects/Tween.js +114 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/effects/animatedSelector.js +13 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event.js +868 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/ajax.js +13 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/alias.js +39 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/support.js +9 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/exports/amd.js +24 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/exports/global.js +32 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/intro.js +44 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/jquery.js +37 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation.js +580 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/_evalUrl.js +18 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/support.js +32 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/offset.js +207 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/outro.js +1 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/queue.js +142 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/queue/delay.js +22 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/selector-native.js +172 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/selector-sizzle.js +14 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/selector.js +1 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/serialize.js +111 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.js +2067 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing.js +199 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/findFilter.js +100 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/arr.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/class2type.js +4 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/concat.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/hasOwn.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/indexOf.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/pnum.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/push.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/rnotwhite.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/slice.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/strundefined.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/support.js +4 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/toString.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js +79 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/MIT-LICENSE +20 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/Makefile +4 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/README.markdown +212 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/bower.json +27 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/keymaster.js +296 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/package.json +11 -0
- data/lib/epuber/third_party/bower/bower_components/keymaster/test.html +93 -0
- data/lib/epuber/third_party/bower/bower_components/spin.js/LICENSE.txt +21 -0
- data/lib/epuber/third_party/bower/bower_components/spin.js/README.md +21 -0
- data/lib/epuber/third_party/bower/bower_components/spin.js/bower.json +18 -0
- data/lib/epuber/third_party/bower/bower_components/spin.js/jquery.spin.js +80 -0
- data/lib/epuber/third_party/bower/bower_components/spin.js/spin.js +337 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/LICENSE.txt +21 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/README.md +534 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/bower.json +16 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/contributing.md +19 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/IPv6.js +188 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/SecondLevelDomains.js +241 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.fragmentQuery.js +104 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.fragmentURI.js +97 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.js +2115 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.min.js +86 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URITemplate.js +499 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/jquery.URI.js +235 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/jquery.URI.min.js +7 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/punycode.js +508 -0
- data/lib/epuber/transformer.rb +19 -0
- data/lib/epuber/transformer/text_transformer.rb +60 -0
- data/lib/epuber/user_interface.rb +186 -0
- data/lib/epuber/vendor/globals_context.rb +26 -0
- data/lib/epuber/vendor/hash_binding.rb +26 -0
- data/lib/epuber/vendor/nokogiri_extensions.rb +30 -0
- data/lib/epuber/vendor/ruby_templater.rb +71 -0
- data/lib/epuber/vendor/size.rb +20 -0
- data/lib/epuber/vendor/version.rb +83 -0
- data/lib/epuber/version.rb +4 -0
- metadata +556 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
define(function() {
|
2
|
+
|
3
|
+
function addGetHookIf( conditionFn, hookFn ) {
|
4
|
+
// Define the hook, we'll check on the first run if it's really needed.
|
5
|
+
return {
|
6
|
+
get: function() {
|
7
|
+
if ( conditionFn() ) {
|
8
|
+
// Hook not needed (or it's not possible to use it due
|
9
|
+
// to missing dependency), remove it.
|
10
|
+
delete this.get;
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
|
14
|
+
// Hook needed; redefine it so that the support test is not executed again.
|
15
|
+
return (this.get = hookFn).apply( this, arguments );
|
16
|
+
}
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
return addGetHookIf;
|
21
|
+
|
22
|
+
});
|
@@ -0,0 +1,57 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"./var/rnumnonpx",
|
4
|
+
"./var/rmargin",
|
5
|
+
"./var/getStyles",
|
6
|
+
"../selector" // contains
|
7
|
+
], function( jQuery, rnumnonpx, rmargin, getStyles ) {
|
8
|
+
|
9
|
+
function curCSS( elem, name, computed ) {
|
10
|
+
var width, minWidth, maxWidth, ret,
|
11
|
+
style = elem.style;
|
12
|
+
|
13
|
+
computed = computed || getStyles( elem );
|
14
|
+
|
15
|
+
// Support: IE9
|
16
|
+
// getPropertyValue is only needed for .css('filter') (#12537)
|
17
|
+
if ( computed ) {
|
18
|
+
ret = computed.getPropertyValue( name ) || computed[ name ];
|
19
|
+
}
|
20
|
+
|
21
|
+
if ( computed ) {
|
22
|
+
|
23
|
+
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
24
|
+
ret = jQuery.style( elem, name );
|
25
|
+
}
|
26
|
+
|
27
|
+
// Support: iOS < 6
|
28
|
+
// A tribute to the "awesome hack by Dean Edwards"
|
29
|
+
// iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
|
30
|
+
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
|
31
|
+
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
|
32
|
+
|
33
|
+
// Remember the original values
|
34
|
+
width = style.width;
|
35
|
+
minWidth = style.minWidth;
|
36
|
+
maxWidth = style.maxWidth;
|
37
|
+
|
38
|
+
// Put in the new values to get a computed value out
|
39
|
+
style.minWidth = style.maxWidth = style.width = ret;
|
40
|
+
ret = computed.width;
|
41
|
+
|
42
|
+
// Revert the changed values
|
43
|
+
style.width = width;
|
44
|
+
style.minWidth = minWidth;
|
45
|
+
style.maxWidth = maxWidth;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
return ret !== undefined ?
|
50
|
+
// Support: IE
|
51
|
+
// IE returns zIndex value as an integer.
|
52
|
+
ret + "" :
|
53
|
+
ret;
|
54
|
+
}
|
55
|
+
|
56
|
+
return curCSS;
|
57
|
+
});
|
@@ -0,0 +1,70 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"../manipulation" // appendTo
|
4
|
+
], function( jQuery ) {
|
5
|
+
|
6
|
+
var iframe,
|
7
|
+
elemdisplay = {};
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Retrieve the actual display of a element
|
11
|
+
* @param {String} name nodeName of the element
|
12
|
+
* @param {Object} doc Document object
|
13
|
+
*/
|
14
|
+
// Called only from within defaultDisplay
|
15
|
+
function actualDisplay( name, doc ) {
|
16
|
+
var style,
|
17
|
+
elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
|
18
|
+
|
19
|
+
// getDefaultComputedStyle might be reliably used only on attached element
|
20
|
+
display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
|
21
|
+
|
22
|
+
// Use of this method is a temporary fix (more like optimization) until something better comes along,
|
23
|
+
// since it was removed from specification and supported only in FF
|
24
|
+
style.display : jQuery.css( elem[ 0 ], "display" );
|
25
|
+
|
26
|
+
// We don't have any data stored on the element,
|
27
|
+
// so use "detach" method as fast way to get rid of the element
|
28
|
+
elem.detach();
|
29
|
+
|
30
|
+
return display;
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Try to determine the default display value of an element
|
35
|
+
* @param {String} nodeName
|
36
|
+
*/
|
37
|
+
function defaultDisplay( nodeName ) {
|
38
|
+
var doc = document,
|
39
|
+
display = elemdisplay[ nodeName ];
|
40
|
+
|
41
|
+
if ( !display ) {
|
42
|
+
display = actualDisplay( nodeName, doc );
|
43
|
+
|
44
|
+
// If the simple way fails, read from inside an iframe
|
45
|
+
if ( display === "none" || !display ) {
|
46
|
+
|
47
|
+
// Use the already-created iframe if possible
|
48
|
+
iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
|
49
|
+
|
50
|
+
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
51
|
+
doc = iframe[ 0 ].contentDocument;
|
52
|
+
|
53
|
+
// Support: IE
|
54
|
+
doc.write();
|
55
|
+
doc.close();
|
56
|
+
|
57
|
+
display = actualDisplay( nodeName, doc );
|
58
|
+
iframe.detach();
|
59
|
+
}
|
60
|
+
|
61
|
+
// Store the correct default display
|
62
|
+
elemdisplay[ nodeName ] = display;
|
63
|
+
}
|
64
|
+
|
65
|
+
return display;
|
66
|
+
}
|
67
|
+
|
68
|
+
return defaultDisplay;
|
69
|
+
|
70
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"../selector"
|
4
|
+
], function( jQuery ) {
|
5
|
+
|
6
|
+
jQuery.expr.filters.hidden = function( elem ) {
|
7
|
+
// Support: Opera <= 12.12
|
8
|
+
// Opera reports offsetWidths and offsetHeights less than zero on some elements
|
9
|
+
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
|
10
|
+
};
|
11
|
+
jQuery.expr.filters.visible = function( elem ) {
|
12
|
+
return !jQuery.expr.filters.hidden( elem );
|
13
|
+
};
|
14
|
+
|
15
|
+
});
|
@@ -0,0 +1,96 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"../var/support"
|
4
|
+
], function( jQuery, support ) {
|
5
|
+
|
6
|
+
(function() {
|
7
|
+
var pixelPositionVal, boxSizingReliableVal,
|
8
|
+
docElem = document.documentElement,
|
9
|
+
container = document.createElement( "div" ),
|
10
|
+
div = document.createElement( "div" );
|
11
|
+
|
12
|
+
if ( !div.style ) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
|
16
|
+
// Support: IE9-11+
|
17
|
+
// Style of cloned element affects source element cloned (#8908)
|
18
|
+
div.style.backgroundClip = "content-box";
|
19
|
+
div.cloneNode( true ).style.backgroundClip = "";
|
20
|
+
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
21
|
+
|
22
|
+
container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
|
23
|
+
"position:absolute";
|
24
|
+
container.appendChild( div );
|
25
|
+
|
26
|
+
// Executing both pixelPosition & boxSizingReliable tests require only one layout
|
27
|
+
// so they're executed at the same time to save the second computation.
|
28
|
+
function computePixelPositionAndBoxSizingReliable() {
|
29
|
+
div.style.cssText =
|
30
|
+
// Support: Firefox<29, Android 2.3
|
31
|
+
// Vendor-prefix box-sizing
|
32
|
+
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
|
33
|
+
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
|
34
|
+
"border:1px;padding:1px;width:4px;position:absolute";
|
35
|
+
div.innerHTML = "";
|
36
|
+
docElem.appendChild( container );
|
37
|
+
|
38
|
+
var divStyle = window.getComputedStyle( div, null );
|
39
|
+
pixelPositionVal = divStyle.top !== "1%";
|
40
|
+
boxSizingReliableVal = divStyle.width === "4px";
|
41
|
+
|
42
|
+
docElem.removeChild( container );
|
43
|
+
}
|
44
|
+
|
45
|
+
// Support: node.js jsdom
|
46
|
+
// Don't assume that getComputedStyle is a property of the global object
|
47
|
+
if ( window.getComputedStyle ) {
|
48
|
+
jQuery.extend( support, {
|
49
|
+
pixelPosition: function() {
|
50
|
+
|
51
|
+
// This test is executed only once but we still do memoizing
|
52
|
+
// since we can use the boxSizingReliable pre-computing.
|
53
|
+
// No need to check if the test was already performed, though.
|
54
|
+
computePixelPositionAndBoxSizingReliable();
|
55
|
+
return pixelPositionVal;
|
56
|
+
},
|
57
|
+
boxSizingReliable: function() {
|
58
|
+
if ( boxSizingReliableVal == null ) {
|
59
|
+
computePixelPositionAndBoxSizingReliable();
|
60
|
+
}
|
61
|
+
return boxSizingReliableVal;
|
62
|
+
},
|
63
|
+
reliableMarginRight: function() {
|
64
|
+
|
65
|
+
// Support: Android 2.3
|
66
|
+
// Check if div with explicit width and no margin-right incorrectly
|
67
|
+
// gets computed margin-right based on width of container. (#3333)
|
68
|
+
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
69
|
+
// This support function is only executed once so no memoizing is needed.
|
70
|
+
var ret,
|
71
|
+
marginDiv = div.appendChild( document.createElement( "div" ) );
|
72
|
+
|
73
|
+
// Reset CSS: box-sizing; display; margin; border; padding
|
74
|
+
marginDiv.style.cssText = div.style.cssText =
|
75
|
+
// Support: Firefox<29, Android 2.3
|
76
|
+
// Vendor-prefix box-sizing
|
77
|
+
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
|
78
|
+
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
|
79
|
+
marginDiv.style.marginRight = marginDiv.style.width = "0";
|
80
|
+
div.style.width = "1px";
|
81
|
+
docElem.appendChild( container );
|
82
|
+
|
83
|
+
ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
|
84
|
+
|
85
|
+
docElem.removeChild( container );
|
86
|
+
div.removeChild( marginDiv );
|
87
|
+
|
88
|
+
return ret;
|
89
|
+
}
|
90
|
+
});
|
91
|
+
}
|
92
|
+
})();
|
93
|
+
|
94
|
+
return support;
|
95
|
+
|
96
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
define([
|
2
|
+
"../core"
|
3
|
+
], function( jQuery ) {
|
4
|
+
|
5
|
+
// A method for quickly swapping in/out CSS properties to get correct calculations.
|
6
|
+
jQuery.swap = function( elem, options, callback, args ) {
|
7
|
+
var ret, name,
|
8
|
+
old = {};
|
9
|
+
|
10
|
+
// Remember the old values, and insert the new ones
|
11
|
+
for ( name in options ) {
|
12
|
+
old[ name ] = elem.style[ name ];
|
13
|
+
elem.style[ name ] = options[ name ];
|
14
|
+
}
|
15
|
+
|
16
|
+
ret = callback.apply( elem, args || [] );
|
17
|
+
|
18
|
+
// Revert the old values
|
19
|
+
for ( name in options ) {
|
20
|
+
elem.style[ name ] = old[ name ];
|
21
|
+
}
|
22
|
+
|
23
|
+
return ret;
|
24
|
+
};
|
25
|
+
|
26
|
+
return jQuery.swap;
|
27
|
+
|
28
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
define(function() {
|
2
|
+
return function( elem ) {
|
3
|
+
// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
|
4
|
+
// IE throws on elements created in popups
|
5
|
+
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
|
6
|
+
if ( elem.ownerDocument.defaultView.opener ) {
|
7
|
+
return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
|
8
|
+
}
|
9
|
+
|
10
|
+
return window.getComputedStyle( elem, null );
|
11
|
+
};
|
12
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
define([
|
2
|
+
"../../core",
|
3
|
+
"../../selector"
|
4
|
+
// css is assumed
|
5
|
+
], function( jQuery ) {
|
6
|
+
|
7
|
+
return function( elem, el ) {
|
8
|
+
// isHidden might be called from jQuery#filter function;
|
9
|
+
// in that case, element will be second argument
|
10
|
+
elem = el || elem;
|
11
|
+
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
|
12
|
+
};
|
13
|
+
});
|
@@ -0,0 +1,178 @@
|
|
1
|
+
define([
|
2
|
+
"./core",
|
3
|
+
"./var/rnotwhite",
|
4
|
+
"./core/access",
|
5
|
+
"./data/var/data_priv",
|
6
|
+
"./data/var/data_user"
|
7
|
+
], function( jQuery, rnotwhite, access, data_priv, data_user ) {
|
8
|
+
|
9
|
+
// Implementation Summary
|
10
|
+
//
|
11
|
+
// 1. Enforce API surface and semantic compatibility with 1.9.x branch
|
12
|
+
// 2. Improve the module's maintainability by reducing the storage
|
13
|
+
// paths to a single mechanism.
|
14
|
+
// 3. Use the same single mechanism to support "private" and "user" data.
|
15
|
+
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
|
16
|
+
// 5. Avoid exposing implementation details on user objects (eg. expando properties)
|
17
|
+
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
|
18
|
+
|
19
|
+
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
|
20
|
+
rmultiDash = /([A-Z])/g;
|
21
|
+
|
22
|
+
function dataAttr( elem, key, data ) {
|
23
|
+
var name;
|
24
|
+
|
25
|
+
// If nothing was found internally, try to fetch any
|
26
|
+
// data from the HTML5 data-* attribute
|
27
|
+
if ( data === undefined && elem.nodeType === 1 ) {
|
28
|
+
name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
|
29
|
+
data = elem.getAttribute( name );
|
30
|
+
|
31
|
+
if ( typeof data === "string" ) {
|
32
|
+
try {
|
33
|
+
data = data === "true" ? true :
|
34
|
+
data === "false" ? false :
|
35
|
+
data === "null" ? null :
|
36
|
+
// Only convert to a number if it doesn't change the string
|
37
|
+
+data + "" === data ? +data :
|
38
|
+
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
39
|
+
data;
|
40
|
+
} catch( e ) {}
|
41
|
+
|
42
|
+
// Make sure we set the data so it isn't changed later
|
43
|
+
data_user.set( elem, key, data );
|
44
|
+
} else {
|
45
|
+
data = undefined;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return data;
|
49
|
+
}
|
50
|
+
|
51
|
+
jQuery.extend({
|
52
|
+
hasData: function( elem ) {
|
53
|
+
return data_user.hasData( elem ) || data_priv.hasData( elem );
|
54
|
+
},
|
55
|
+
|
56
|
+
data: function( elem, name, data ) {
|
57
|
+
return data_user.access( elem, name, data );
|
58
|
+
},
|
59
|
+
|
60
|
+
removeData: function( elem, name ) {
|
61
|
+
data_user.remove( elem, name );
|
62
|
+
},
|
63
|
+
|
64
|
+
// TODO: Now that all calls to _data and _removeData have been replaced
|
65
|
+
// with direct calls to data_priv methods, these can be deprecated.
|
66
|
+
_data: function( elem, name, data ) {
|
67
|
+
return data_priv.access( elem, name, data );
|
68
|
+
},
|
69
|
+
|
70
|
+
_removeData: function( elem, name ) {
|
71
|
+
data_priv.remove( elem, name );
|
72
|
+
}
|
73
|
+
});
|
74
|
+
|
75
|
+
jQuery.fn.extend({
|
76
|
+
data: function( key, value ) {
|
77
|
+
var i, name, data,
|
78
|
+
elem = this[ 0 ],
|
79
|
+
attrs = elem && elem.attributes;
|
80
|
+
|
81
|
+
// Gets all values
|
82
|
+
if ( key === undefined ) {
|
83
|
+
if ( this.length ) {
|
84
|
+
data = data_user.get( elem );
|
85
|
+
|
86
|
+
if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
|
87
|
+
i = attrs.length;
|
88
|
+
while ( i-- ) {
|
89
|
+
|
90
|
+
// Support: IE11+
|
91
|
+
// The attrs elements can be null (#14894)
|
92
|
+
if ( attrs[ i ] ) {
|
93
|
+
name = attrs[ i ].name;
|
94
|
+
if ( name.indexOf( "data-" ) === 0 ) {
|
95
|
+
name = jQuery.camelCase( name.slice(5) );
|
96
|
+
dataAttr( elem, name, data[ name ] );
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
data_priv.set( elem, "hasDataAttrs", true );
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
return data;
|
105
|
+
}
|
106
|
+
|
107
|
+
// Sets multiple values
|
108
|
+
if ( typeof key === "object" ) {
|
109
|
+
return this.each(function() {
|
110
|
+
data_user.set( this, key );
|
111
|
+
});
|
112
|
+
}
|
113
|
+
|
114
|
+
return access( this, function( value ) {
|
115
|
+
var data,
|
116
|
+
camelKey = jQuery.camelCase( key );
|
117
|
+
|
118
|
+
// The calling jQuery object (element matches) is not empty
|
119
|
+
// (and therefore has an element appears at this[ 0 ]) and the
|
120
|
+
// `value` parameter was not undefined. An empty jQuery object
|
121
|
+
// will result in `undefined` for elem = this[ 0 ] which will
|
122
|
+
// throw an exception if an attempt to read a data cache is made.
|
123
|
+
if ( elem && value === undefined ) {
|
124
|
+
// Attempt to get data from the cache
|
125
|
+
// with the key as-is
|
126
|
+
data = data_user.get( elem, key );
|
127
|
+
if ( data !== undefined ) {
|
128
|
+
return data;
|
129
|
+
}
|
130
|
+
|
131
|
+
// Attempt to get data from the cache
|
132
|
+
// with the key camelized
|
133
|
+
data = data_user.get( elem, camelKey );
|
134
|
+
if ( data !== undefined ) {
|
135
|
+
return data;
|
136
|
+
}
|
137
|
+
|
138
|
+
// Attempt to "discover" the data in
|
139
|
+
// HTML5 custom data-* attrs
|
140
|
+
data = dataAttr( elem, camelKey, undefined );
|
141
|
+
if ( data !== undefined ) {
|
142
|
+
return data;
|
143
|
+
}
|
144
|
+
|
145
|
+
// We tried really hard, but the data doesn't exist.
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
|
149
|
+
// Set the data...
|
150
|
+
this.each(function() {
|
151
|
+
// First, attempt to store a copy or reference of any
|
152
|
+
// data that might've been store with a camelCased key.
|
153
|
+
var data = data_user.get( this, camelKey );
|
154
|
+
|
155
|
+
// For HTML5 data-* attribute interop, we have to
|
156
|
+
// store property names with dashes in a camelCase form.
|
157
|
+
// This might not apply to all properties...*
|
158
|
+
data_user.set( this, camelKey, value );
|
159
|
+
|
160
|
+
// *... In the case of properties that might _actually_
|
161
|
+
// have dashes, we need to also store a copy of that
|
162
|
+
// unchanged property.
|
163
|
+
if ( key.indexOf("-") !== -1 && data !== undefined ) {
|
164
|
+
data_user.set( this, key, value );
|
165
|
+
}
|
166
|
+
});
|
167
|
+
}, null, value, arguments.length > 1, null, true );
|
168
|
+
},
|
169
|
+
|
170
|
+
removeData: function( key ) {
|
171
|
+
return this.each(function() {
|
172
|
+
data_user.remove( this, key );
|
173
|
+
});
|
174
|
+
}
|
175
|
+
});
|
176
|
+
|
177
|
+
return jQuery;
|
178
|
+
});
|