Merge lp:~hrvojem/tcprstat/sphinx_doc into lp:tcprstat
- sphinx_doc
- Merge into trunk
Proposed by
Hrvoje Matijakovic
Status: | Needs review |
---|---|
Proposed branch: | lp:~hrvojem/tcprstat/sphinx_doc |
Merge into: | lp:tcprstat |
Diff against target: | 17878 lines |
To merge this branch: | bzr merge lp:~hrvojem/tcprstat/sphinx_doc |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ignacio Nin | Pending | ||
Review via email: mp+96529@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
- 74. By Hrvoje Matijakovic
-
ported documentation from wiki to sphinx doc
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'doc' | |||
2 | === added file 'doc/Makefile' | |||
3 | --- doc/Makefile 1970-01-01 00:00:00 +0000 | |||
4 | +++ doc/Makefile 2012-03-08 09:19:21 +0000 | |||
5 | @@ -0,0 +1,130 @@ | |||
6 | 1 | # Makefile for Sphinx documentation | ||
7 | 2 | # | ||
8 | 3 | |||
9 | 4 | # You can set these variables from the command line. | ||
10 | 5 | SPHINXOPTS = | ||
11 | 6 | SPHINXBUILD = sphinx-build | ||
12 | 7 | PAPER = | ||
13 | 8 | BUILDDIR = build | ||
14 | 9 | |||
15 | 10 | # Internal variables. | ||
16 | 11 | PAPEROPT_a4 = -D latex_paper_size=a4 | ||
17 | 12 | PAPEROPT_letter = -D latex_paper_size=letter | ||
18 | 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source | ||
19 | 14 | |||
20 | 15 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest | ||
21 | 16 | |||
22 | 17 | help: | ||
23 | 18 | @echo "Please use \`make <target>' where <target> is one of" | ||
24 | 19 | @echo " html to make standalone HTML files" | ||
25 | 20 | @echo " dirhtml to make HTML files named index.html in directories" | ||
26 | 21 | @echo " singlehtml to make a single large HTML file" | ||
27 | 22 | @echo " pickle to make pickle files" | ||
28 | 23 | @echo " json to make JSON files" | ||
29 | 24 | @echo " htmlhelp to make HTML files and a HTML help project" | ||
30 | 25 | @echo " qthelp to make HTML files and a qthelp project" | ||
31 | 26 | @echo " devhelp to make HTML files and a Devhelp project" | ||
32 | 27 | @echo " epub to make an epub" | ||
33 | 28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" | ||
34 | 29 | @echo " latexpdf to make LaTeX files and run them through pdflatex" | ||
35 | 30 | @echo " text to make text files" | ||
36 | 31 | @echo " man to make manual pages" | ||
37 | 32 | @echo " changes to make an overview of all changed/added/deprecated items" | ||
38 | 33 | @echo " linkcheck to check all external links for integrity" | ||
39 | 34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" | ||
40 | 35 | |||
41 | 36 | clean: | ||
42 | 37 | -rm -rf $(BUILDDIR)/* | ||
43 | 38 | |||
44 | 39 | html: | ||
45 | 40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html | ||
46 | 41 | @echo | ||
47 | 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." | ||
48 | 43 | |||
49 | 44 | dirhtml: | ||
50 | 45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml | ||
51 | 46 | @echo | ||
52 | 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." | ||
53 | 48 | |||
54 | 49 | singlehtml: | ||
55 | 50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml | ||
56 | 51 | @echo | ||
57 | 52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." | ||
58 | 53 | |||
59 | 54 | pickle: | ||
60 | 55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle | ||
61 | 56 | @echo | ||
62 | 57 | @echo "Build finished; now you can process the pickle files." | ||
63 | 58 | |||
64 | 59 | json: | ||
65 | 60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json | ||
66 | 61 | @echo | ||
67 | 62 | @echo "Build finished; now you can process the JSON files." | ||
68 | 63 | |||
69 | 64 | htmlhelp: | ||
70 | 65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp | ||
71 | 66 | @echo | ||
72 | 67 | @echo "Build finished; now you can run HTML Help Workshop with the" \ | ||
73 | 68 | ".hhp project file in $(BUILDDIR)/htmlhelp." | ||
74 | 69 | |||
75 | 70 | qthelp: | ||
76 | 71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp | ||
77 | 72 | @echo | ||
78 | 73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ | ||
79 | 74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" | ||
80 | 75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PerconaXtraBackup.qhcp" | ||
81 | 76 | @echo "To view the help file:" | ||
82 | 77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PerconaXtraBackup.qhc" | ||
83 | 78 | |||
84 | 79 | devhelp: | ||
85 | 80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp | ||
86 | 81 | @echo | ||
87 | 82 | @echo "Build finished." | ||
88 | 83 | @echo "To view the help file:" | ||
89 | 84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/PerconaXtraBackup" | ||
90 | 85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PerconaXtraBackup" | ||
91 | 86 | @echo "# devhelp" | ||
92 | 87 | |||
93 | 88 | epub: | ||
94 | 89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub | ||
95 | 90 | @echo | ||
96 | 91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." | ||
97 | 92 | |||
98 | 93 | latex: | ||
99 | 94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex | ||
100 | 95 | @echo | ||
101 | 96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." | ||
102 | 97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ | ||
103 | 98 | "(use \`make latexpdf' here to do that automatically)." | ||
104 | 99 | |||
105 | 100 | latexpdf: | ||
106 | 101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex | ||
107 | 102 | @echo "Running LaTeX files through pdflatex..." | ||
108 | 103 | make -C $(BUILDDIR)/latex all-pdf | ||
109 | 104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." | ||
110 | 105 | |||
111 | 106 | text: | ||
112 | 107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text | ||
113 | 108 | @echo | ||
114 | 109 | @echo "Build finished. The text files are in $(BUILDDIR)/text." | ||
115 | 110 | |||
116 | 111 | man: | ||
117 | 112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man | ||
118 | 113 | @echo | ||
119 | 114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." | ||
120 | 115 | |||
121 | 116 | changes: | ||
122 | 117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes | ||
123 | 118 | @echo | ||
124 | 119 | @echo "The overview file is in $(BUILDDIR)/changes." | ||
125 | 120 | |||
126 | 121 | linkcheck: | ||
127 | 122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | ||
128 | 123 | @echo | ||
129 | 124 | @echo "Link check complete; look for any errors in the above output " \ | ||
130 | 125 | "or in $(BUILDDIR)/linkcheck/output.txt." | ||
131 | 126 | |||
132 | 127 | doctest: | ||
133 | 128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest | ||
134 | 129 | @echo "Testing of doctests in the sources finished, look at the " \ | ||
135 | 130 | "results in $(BUILDDIR)/doctest/output.txt." | ||
136 | 0 | 131 | ||
137 | === added directory 'doc/build' | |||
138 | === added directory 'doc/build/doctrees' | |||
139 | === added file 'doc/build/doctrees/environment.pickle' | |||
140 | 1 | Binary files doc/build/doctrees/environment.pickle 1970-01-01 00:00:00 +0000 and doc/build/doctrees/environment.pickle 2012-03-08 09:19:21 +0000 differ | 132 | Binary files doc/build/doctrees/environment.pickle 1970-01-01 00:00:00 +0000 and doc/build/doctrees/environment.pickle 2012-03-08 09:19:21 +0000 differ |
141 | === added file 'doc/build/doctrees/index.doctree' | |||
142 | 2 | Binary files doc/build/doctrees/index.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/index.doctree 2012-03-08 09:19:21 +0000 differ | 133 | Binary files doc/build/doctrees/index.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/index.doctree 2012-03-08 09:19:21 +0000 differ |
143 | === added file 'doc/build/doctrees/installation.doctree' | |||
144 | 3 | Binary files doc/build/doctrees/installation.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/installation.doctree 2012-03-08 09:19:21 +0000 differ | 134 | Binary files doc/build/doctrees/installation.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/installation.doctree 2012-03-08 09:19:21 +0000 differ |
145 | === added file 'doc/build/doctrees/intro.doctree' | |||
146 | 4 | Binary files doc/build/doctrees/intro.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/intro.doctree 2012-03-08 09:19:21 +0000 differ | 135 | Binary files doc/build/doctrees/intro.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/intro.doctree 2012-03-08 09:19:21 +0000 differ |
147 | === added file 'doc/build/doctrees/manual.doctree' | |||
148 | 5 | Binary files doc/build/doctrees/manual.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/manual.doctree 2012-03-08 09:19:21 +0000 differ | 136 | Binary files doc/build/doctrees/manual.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/manual.doctree 2012-03-08 09:19:21 +0000 differ |
149 | === added file 'doc/build/doctrees/support.doctree' | |||
150 | 6 | Binary files doc/build/doctrees/support.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/support.doctree 2012-03-08 09:19:21 +0000 differ | 137 | Binary files doc/build/doctrees/support.doctree 1970-01-01 00:00:00 +0000 and doc/build/doctrees/support.doctree 2012-03-08 09:19:21 +0000 differ |
151 | === added directory 'doc/build/html' | |||
152 | === added file 'doc/build/html/.buildinfo' | |||
153 | --- doc/build/html/.buildinfo 1970-01-01 00:00:00 +0000 | |||
154 | +++ doc/build/html/.buildinfo 2012-03-08 09:19:21 +0000 | |||
155 | @@ -0,0 +1,4 @@ | |||
156 | 1 | # Sphinx build info version 1 | ||
157 | 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
158 | 3 | config: 157b3cb084d64187df07ef5c09529c53 | ||
159 | 4 | tags: fbb0d17656682115ca4d033fb2f83ba1 | ||
160 | 0 | 5 | ||
161 | === added directory 'doc/build/html/_sources' | |||
162 | === added file 'doc/build/html/_sources/index.txt' | |||
163 | --- doc/build/html/_sources/index.txt 1970-01-01 00:00:00 +0000 | |||
164 | +++ doc/build/html/_sources/index.txt 2012-03-08 09:19:21 +0000 | |||
165 | @@ -0,0 +1,47 @@ | |||
166 | 1 | ============================================================ | ||
167 | 2 | Tcprstat - Documentation | ||
168 | 3 | ============================================================ | ||
169 | 4 | |||
170 | 5 | Introduction | ||
171 | 6 | ============ | ||
172 | 7 | |||
173 | 8 | .. toctree:: | ||
174 | 9 | :maxdepth: 1 | ||
175 | 10 | :glob: | ||
176 | 11 | |||
177 | 12 | intro | ||
178 | 13 | |||
179 | 14 | Installation | ||
180 | 15 | ============ | ||
181 | 16 | |||
182 | 17 | .. toctree:: | ||
183 | 18 | :maxdepth: 2 | ||
184 | 19 | :glob: | ||
185 | 20 | |||
186 | 21 | installation | ||
187 | 22 | |||
188 | 23 | User's Manual | ||
189 | 24 | ============= | ||
190 | 25 | |||
191 | 26 | .. toctree:: | ||
192 | 27 | :maxdepth: 2 | ||
193 | 28 | :glob: | ||
194 | 29 | |||
195 | 30 | manual | ||
196 | 31 | |||
197 | 32 | Miscellaneous | ||
198 | 33 | ============= | ||
199 | 34 | |||
200 | 35 | .. toctree:: | ||
201 | 36 | :maxdepth: 1 | ||
202 | 37 | :glob: | ||
203 | 38 | |||
204 | 39 | support | ||
205 | 40 | |||
206 | 41 | Indices and tables | ||
207 | 42 | ================== | ||
208 | 43 | |||
209 | 44 | * :ref:`genindex` | ||
210 | 45 | |||
211 | 46 | * :ref:`search` | ||
212 | 47 | |||
213 | 0 | 48 | ||
214 | === added file 'doc/build/html/_sources/installation.txt' | |||
215 | --- doc/build/html/_sources/installation.txt 1970-01-01 00:00:00 +0000 | |||
216 | +++ doc/build/html/_sources/installation.txt 2012-03-08 09:19:21 +0000 | |||
217 | @@ -0,0 +1,12 @@ | |||
218 | 1 | ===================== | ||
219 | 2 | Installing tcprstat | ||
220 | 3 | ===================== | ||
221 | 4 | |||
222 | 5 | For portability and ease of use, we build a single statically linked binary, which can be downloaded and used as-is on 64-bit platforms. At present there is no installation mechanism, so to use tcprstat, you simply need to: | ||
223 | 6 | |||
224 | 7 | * Download the `statically linked 64-bit binary (version 0.3.1) <http://github.com/downloads/Lowercases/tcprstat/tcprstat-static.v0.3.1.x86_64>`_ | ||
225 | 8 | * Move it into a directory in your PATH, such as /usr/bin | ||
226 | 9 | * Rename it to tcprstat | ||
227 | 10 | * Make it executable with chmod +x | ||
228 | 11 | |||
229 | 12 | There are currently no operating-system-specific packages for tcprstat, although in the future we plan to include it in our APT and YUM repositories. If you need to run tcprstat on 32-bit systems, you will need to build it from source. | ||
230 | 0 | 13 | ||
231 | === added file 'doc/build/html/_sources/intro.txt' | |||
232 | --- doc/build/html/_sources/intro.txt 1970-01-01 00:00:00 +0000 | |||
233 | +++ doc/build/html/_sources/intro.txt 2012-03-08 09:19:21 +0000 | |||
234 | @@ -0,0 +1,27 @@ | |||
235 | 1 | ============== | ||
236 | 2 | About tcprstat | ||
237 | 3 | ============== | ||
238 | 4 | |||
239 | 5 | .. toctree:: | ||
240 | 6 | :hidden: | ||
241 | 7 | |||
242 | 8 | tcprstat is a free, open-source TCP analysis tool that watches network traffic and computes the delay between requests and responses. From this it derives response-time statistics and prints them out. The output is similar to other Unix -stat tools such as vmstat, iostat, and mpstat. The tool can optionally watch traffic to only a specified port, which makes it practical for timing requests and responses to a single daemon process such as mysqld, httpd, memcached, or any of a variety of other server processes. | ||
243 | 9 | |||
244 | 10 | The advantages of tcprstat are as follows: | ||
245 | 11 | |||
246 | 12 | * It is lightweight and unobtrusive. No bulky log files need be written and analyzed. | ||
247 | 13 | * Requests and responses are timed with microsecond resolution. | ||
248 | 14 | * The output is easy to import into spreadsheets, manipulate with command-line scripts, graph with gnuplot, and so on. | ||
249 | 15 | * It is protocol-agnostic, and works well for a large variety of client-server protocols that have a simple request-response model. | ||
250 | 16 | |||
251 | 17 | tcprstat is related to the `tcpstat <http://www.frenchfries.net/paul/tcpstat/>`_ tool, but it focuses on response time measurements, not on the amount and size of the network traffic. This makes it useful for response time analysis, which is needed for techniques such as `Goal-Driven Performance Optimization <http://www.percona.com/about-us/white-papers>`_. | ||
252 | 18 | |||
253 | 19 | tcprstat development is hosted on `Launchpad <https://launchpad.net/tcprstat>`_. We are currently moving downloads and bug tracking from GitHub to Launchpad, so some links in this document may refer to GitHub until that process is complete. | ||
254 | 20 | |||
255 | 21 | Development Status | ||
256 | 22 | ================== | ||
257 | 23 | tcprstat is currently in Beta, although we consider it ready for production testing. Several C++ experts have reviewed the code, and it has been observed in high-stress production environments for many weeks with no apparent problems. Please test and review the code, and report any issues or suggestions you have. Please also review our `roadmap <https://launchpad.net/tcprstat/+milestones>`_ and contribute your suggestions. | ||
258 | 24 | |||
259 | 25 | Authors | ||
260 | 26 | ======= | ||
261 | 27 | tcprstat was written by `Ignacio Nin <http://www.percona.com/about-us/our-team/ignacio-nin/>`_, based on ideas from `Baron Schwartz <http://www.percona.com/about-us/our-team/baron-schwartz/>`_ and other Percona consultants. The code was reviewed by Oleg Tsarev, Sasha Pachev, and other members of the Percona development team. | ||
262 | 0 | 28 | ||
263 | === added file 'doc/build/html/_sources/manual.txt' | |||
264 | --- doc/build/html/_sources/manual.txt 1970-01-01 00:00:00 +0000 | |||
265 | +++ doc/build/html/_sources/manual.txt 2012-03-08 09:19:21 +0000 | |||
266 | @@ -0,0 +1,126 @@ | |||
267 | 1 | .. _user-manual: | ||
268 | 2 | |||
269 | 3 | ====================== | ||
270 | 4 | tcprstat User's Manual | ||
271 | 5 | ====================== | ||
272 | 6 | |||
273 | 7 | .. toctree:: | ||
274 | 8 | :maxdepth: 1 | ||
275 | 9 | :hidden: | ||
276 | 10 | |||
277 | 11 | Running tcprstat | ||
278 | 12 | ================ | ||
279 | 13 | |||
280 | 14 | tcprstat requires root permissions to execute. If you are not root, you should either become root with su, or execute tcprstat with sudo. The following examples assume you are root, and do not show the use of sudo. | ||
281 | 15 | |||
282 | 16 | Default Usage | ||
283 | 17 | ------------- | ||
284 | 18 | The simplest functionality is to accept all defaults and simply execute the tool. By default, it will measure the TCP traffic for 10 seconds and print out a header, followed by a single line of statistics. :: | ||
285 | 19 | |||
286 | 20 | # timestamp count max min avg med stddev 95_max 95_avg 95_std 99_max 99_avg 99_std | ||
287 | 21 | 1283265068 23892 425546 30 505 161 6240 835 186 102 4179 261 429 | ||
288 | 22 | |||
289 | 23 | |||
290 | 24 | Basic, Useful Functionality | ||
291 | 25 | --------------------------- | ||
292 | 26 | |||
293 | 27 | In practice, you will usually select a specific port to measure, set the tool to iterate infinitely, and possibly change the default 10-second interval. To accomplish this, use the following options: | ||
294 | 28 | |||
295 | 29 | * -p <port> selects a port | ||
296 | 30 | * -i <secs> sets the measurement interval, in seconds | ||
297 | 31 | * -n <iter> specifies the number of iterations to run; 0 means to run forever | ||
298 | 32 | |||
299 | 33 | For example, to watch Sphinx traffic in one-second intervals forever, execute: :: | ||
300 | 34 | |||
301 | 35 | # tcprstat -p 3312 -i 1 -n 0. | ||
302 | 36 | |||
303 | 37 | Customizing The Output | ||
304 | 38 | ---------------------- | ||
305 | 39 | |||
306 | 40 | tcprstat's output can be changed to include or omit various types of statistics on the traffic it measures. The default output includes columns that are useful for many purposes. The output is specified with %C format codes, where C is a single character. The following table documents the available format codes and their meaning. | ||
307 | 41 | |||
308 | 42 | =========== ============= ======== ========================================================== | ||
309 | 43 | Format Code Header Default? Meaning | ||
310 | 44 | =========== ============= ======== ========================================================== | ||
311 | 45 | %n count y Count of requests that completed during this iteration | ||
312 | 46 | %a avg y Average response time | ||
313 | 47 | %s sum y Sum of response times | ||
314 | 48 | %x sqs n Sum of squares of response times | ||
315 | 49 | %m min y Minimum response time | ||
316 | 50 | %M max y Maximum response time | ||
317 | 51 | %h med y Median response time | ||
318 | 52 | %S stddev y Standard deviation of response times | ||
319 | 53 | %v var n Variance of response times | ||
320 | 54 | %I iter# n Iteration number | ||
321 | 55 | %t elapsed n Seconds elapsed since the first iteration | ||
322 | 56 | %T timestamp y Unix timestamp | ||
323 | 57 | %% A literal % | ||
324 | 58 | \t A tab character | ||
325 | 59 | \n A newline character | ||
326 | 60 | 95,99 Adds a prefix y A percentile indicator; see later in this section for more | ||
327 | 61 | =========== ============= ======== ========================================================== | ||
328 | 62 | |||
329 | 63 | You can change the tcprstat output format by customizing the -f option. For example, to print out the number of requests per second to a MySQL server on port 3306, execute the following: :: | ||
330 | 64 | |||
331 | 65 | # tcprstat -f '%n\n' -p 3306 -t 1 -n 0 | ||
332 | 66 | count | ||
333 | 67 | 2212 | ||
334 | 68 | 2070 | ||
335 | 69 | ... | ||
336 | 70 | |||
337 | 71 | You can also include a percentile indicator, to compute the statistics over the Nth percentile of the response times. The tool currently supports only the 95th and 99th percentiles. To print out statistics for a given percentile, include the percentile number between the % character and the format code. The default column header will then include the percentile value. The following example prints the maximum, 95th percentile maximum, and 99th percentile maximum response times in microseconds: :: | ||
338 | 72 | |||
339 | 73 | # tcprstat -f '%M\t%95M\t%99M\n' -p 3306 -t 1 -n 0 | ||
340 | 74 | max 95_max 99_max | ||
341 | 75 | 31221 411 3001 | ||
342 | 76 | 52721 495 2828 | ||
343 | 77 | 12173 507 1513 | ||
344 | 78 | ... | ||
345 | 79 | |||
346 | 80 | Analyzing a pcap File | ||
347 | 81 | --------------------- | ||
348 | 82 | |||
349 | 83 | tcprstat has the ability not only to analyze traffic live as it is captured, but also to analyze traffic from a file created by tcpdump. This makes it possible to gather traffic on one machine and analyze it elsewhere at a different time. To save traffic for later analysis, execute tcpdump with the -w option and specify the file in which to store the resulting traffic. Use the -r option to tcprstat to read traffic from that file and analyze it. | ||
350 | 84 | |||
351 | 85 | tcprstat normally decides what traffic is incoming (a request) and what traffic is outbound (a response) by finding a list of IP addresses bound to the local network interfaces. However, this will not work correctly when traffic is analyzed from a file that was gathered on a different host. You can use the -l option to specify a list of local IP addresses in this case. | ||
352 | 86 | |||
353 | 87 | Command-Line Options | ||
354 | 88 | ==================== | ||
355 | 89 | |||
356 | 90 | The following is a complete list of tcprstat's command-line options. You can always find a full list of the available command-line options and brief usage information by giving the --help option. | ||
357 | 91 | |||
358 | 92 | .. option:: --format -f | ||
359 | 93 | |||
360 | 94 | A format string. Detailed description of supported values can bee seen in the table above. | ||
361 | 95 | |||
362 | 96 | .. option:: --[no]header | ||
363 | 97 | |||
364 | 98 | If no argument is given, tcprstat auto-generates the header based on --format. If an argument is given, tcprstat uses that as the header instead. If --no-header is used, tcprstat will not print a header. | ||
365 | 99 | |||
366 | 100 | .. option:: --help | ||
367 | 101 | |||
368 | 102 | Shows program information and usage. | ||
369 | 103 | |||
370 | 104 | .. option:: --interval -t | ||
371 | 105 | |||
372 | 106 | The number of seconds tcprstat waits between each successive line of output. Default value is 10. | ||
373 | 107 | |||
374 | 108 | .. option:: --iterations -n | ||
375 | 109 | |||
376 | 110 | How many iterations tcprstat should execute before exiting; 0 means infinity. Default value is 1. | ||
377 | 111 | |||
378 | 112 | .. option:: --local -l | ||
379 | 113 | |||
380 | 114 | Accepts a comma-separated list of IP addresses to consider as local IP addresses, instead of getting a list from the operating system. | ||
381 | 115 | |||
382 | 116 | .. option:: --port -p | ||
383 | 117 | |||
384 | 118 | Capture traffic only for the specified TCP port; if none, capture all traffic. | ||
385 | 119 | |||
386 | 120 | .. option:: --read -r | ||
387 | 121 | |||
388 | 122 | Read the specified pcap file instead of capturing traffic from the network. | ||
389 | 123 | |||
390 | 124 | .. option:: --version | ||
391 | 125 | |||
392 | 126 | Shows tcprstat version. | ||
393 | 0 | 127 | ||
394 | === added file 'doc/build/html/_sources/support.txt' | |||
395 | --- doc/build/html/_sources/support.txt 1970-01-01 00:00:00 +0000 | |||
396 | +++ doc/build/html/_sources/support.txt 2012-03-08 09:19:21 +0000 | |||
397 | @@ -0,0 +1,7 @@ | |||
398 | 1 | ================ | ||
399 | 2 | Help and Support | ||
400 | 3 | ================ | ||
401 | 4 | |||
402 | 5 | Please use `Launchpad's issue tracking system <https://bugs.launchpad.net/tcprstat>`_ to report issues and request features. For general discussion, please use the `Percona-Discussion Google Group <http://groups.google.com/group/percona-discussion>`_. You can use the #percona IRC channel on FreeNode to chat with community members. | ||
403 | 6 | |||
404 | 7 | For commercial support, maintenance packages, or to sponsor features, please contact `Percona Sales <http://www.percona.com/contact/sales>`_. | ||
405 | 0 | 8 | ||
406 | === added directory 'doc/build/html/_static' | |||
407 | === added file 'doc/build/html/_static/basic.css' | |||
408 | --- doc/build/html/_static/basic.css 1970-01-01 00:00:00 +0000 | |||
409 | +++ doc/build/html/_static/basic.css 2012-03-08 09:19:21 +0000 | |||
410 | @@ -0,0 +1,528 @@ | |||
411 | 1 | /* | ||
412 | 2 | * basic.css | ||
413 | 3 | * ~~~~~~~~~ | ||
414 | 4 | * | ||
415 | 5 | * Sphinx stylesheet -- basic theme. | ||
416 | 6 | * | ||
417 | 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. | ||
418 | 8 | * :license: BSD, see LICENSE for details. | ||
419 | 9 | * | ||
420 | 10 | */ | ||
421 | 11 | |||
422 | 12 | /* -- main layout ----------------------------------------------------------- */ | ||
423 | 13 | |||
424 | 14 | div.clearer { | ||
425 | 15 | clear: both; | ||
426 | 16 | } | ||
427 | 17 | |||
428 | 18 | /* -- relbar ---------------------------------------------------------------- */ | ||
429 | 19 | |||
430 | 20 | div.related { | ||
431 | 21 | width: 100%; | ||
432 | 22 | font-size: 90%; | ||
433 | 23 | } | ||
434 | 24 | |||
435 | 25 | div.related h3 { | ||
436 | 26 | display: none; | ||
437 | 27 | } | ||
438 | 28 | |||
439 | 29 | div.related ul { | ||
440 | 30 | margin: 0; | ||
441 | 31 | padding: 0 0 0 10px; | ||
442 | 32 | list-style: none; | ||
443 | 33 | } | ||
444 | 34 | |||
445 | 35 | div.related li { | ||
446 | 36 | display: inline; | ||
447 | 37 | } | ||
448 | 38 | |||
449 | 39 | div.related li.right { | ||
450 | 40 | float: right; | ||
451 | 41 | margin-right: 5px; | ||
452 | 42 | } | ||
453 | 43 | |||
454 | 44 | /* -- sidebar --------------------------------------------------------------- */ | ||
455 | 45 | |||
456 | 46 | div.sphinxsidebarwrapper { | ||
457 | 47 | padding: 10px 5px 0 10px; | ||
458 | 48 | } | ||
459 | 49 | |||
460 | 50 | div.sphinxsidebar { | ||
461 | 51 | float: left; | ||
462 | 52 | width: 230px; | ||
463 | 53 | margin-left: -100%; | ||
464 | 54 | font-size: 90%; | ||
465 | 55 | } | ||
466 | 56 | |||
467 | 57 | div.sphinxsidebar ul { | ||
468 | 58 | list-style: none; | ||
469 | 59 | } | ||
470 | 60 | |||
471 | 61 | div.sphinxsidebar ul ul, | ||
472 | 62 | div.sphinxsidebar ul.want-points { | ||
473 | 63 | margin-left: 20px; | ||
474 | 64 | list-style: square; | ||
475 | 65 | } | ||
476 | 66 | |||
477 | 67 | div.sphinxsidebar ul ul { | ||
478 | 68 | margin-top: 0; | ||
479 | 69 | margin-bottom: 0; | ||
480 | 70 | } | ||
481 | 71 | |||
482 | 72 | div.sphinxsidebar form { | ||
483 | 73 | margin-top: 10px; | ||
484 | 74 | } | ||
485 | 75 | |||
486 | 76 | div.sphinxsidebar input { | ||
487 | 77 | border: 1px solid #98dbcc; | ||
488 | 78 | font-family: sans-serif; | ||
489 | 79 | font-size: 1em; | ||
490 | 80 | } | ||
491 | 81 | |||
492 | 82 | img { | ||
493 | 83 | border: 0; | ||
494 | 84 | } | ||
495 | 85 | |||
496 | 86 | /* -- search page ----------------------------------------------------------- */ | ||
497 | 87 | |||
498 | 88 | ul.search { | ||
499 | 89 | margin: 10px 0 0 20px; | ||
500 | 90 | padding: 0; | ||
501 | 91 | } | ||
502 | 92 | |||
503 | 93 | ul.search li { | ||
504 | 94 | padding: 5px 0 5px 20px; | ||
505 | 95 | background-image: url(file.png); | ||
506 | 96 | background-repeat: no-repeat; | ||
507 | 97 | background-position: 0 7px; | ||
508 | 98 | } | ||
509 | 99 | |||
510 | 100 | ul.search li a { | ||
511 | 101 | font-weight: bold; | ||
512 | 102 | } | ||
513 | 103 | |||
514 | 104 | ul.search li div.context { | ||
515 | 105 | color: #888; | ||
516 | 106 | margin: 2px 0 0 30px; | ||
517 | 107 | text-align: left; | ||
518 | 108 | } | ||
519 | 109 | |||
520 | 110 | ul.keywordmatches li.goodmatch a { | ||
521 | 111 | font-weight: bold; | ||
522 | 112 | } | ||
523 | 113 | |||
524 | 114 | /* -- index page ------------------------------------------------------------ */ | ||
525 | 115 | |||
526 | 116 | table.contentstable { | ||
527 | 117 | width: 90%; | ||
528 | 118 | } | ||
529 | 119 | |||
530 | 120 | table.contentstable p.biglink { | ||
531 | 121 | line-height: 150%; | ||
532 | 122 | } | ||
533 | 123 | |||
534 | 124 | a.biglink { | ||
535 | 125 | font-size: 1.3em; | ||
536 | 126 | } | ||
537 | 127 | |||
538 | 128 | span.linkdescr { | ||
539 | 129 | font-style: italic; | ||
540 | 130 | padding-top: 5px; | ||
541 | 131 | font-size: 90%; | ||
542 | 132 | } | ||
543 | 133 | |||
544 | 134 | /* -- general index --------------------------------------------------------- */ | ||
545 | 135 | |||
546 | 136 | table.indextable { | ||
547 | 137 | width: 100%; | ||
548 | 138 | } | ||
549 | 139 | |||
550 | 140 | table.indextable td { | ||
551 | 141 | text-align: left; | ||
552 | 142 | vertical-align: top; | ||
553 | 143 | } | ||
554 | 144 | |||
555 | 145 | table.indextable dl, table.indextable dd { | ||
556 | 146 | margin-top: 0; | ||
557 | 147 | margin-bottom: 0; | ||
558 | 148 | } | ||
559 | 149 | |||
560 | 150 | table.indextable tr.pcap { | ||
561 | 151 | height: 10px; | ||
562 | 152 | } | ||
563 | 153 | |||
564 | 154 | table.indextable tr.cap { | ||
565 | 155 | margin-top: 10px; | ||
566 | 156 | background-color: #f2f2f2; | ||
567 | 157 | } | ||
568 | 158 | |||
569 | 159 | img.toggler { | ||
570 | 160 | margin-right: 3px; | ||
571 | 161 | margin-top: 3px; | ||
572 | 162 | cursor: pointer; | ||
573 | 163 | } | ||
574 | 164 | |||
575 | 165 | div.modindex-jumpbox { | ||
576 | 166 | border-top: 1px solid #ddd; | ||
577 | 167 | border-bottom: 1px solid #ddd; | ||
578 | 168 | margin: 1em 0 1em 0; | ||
579 | 169 | padding: 0.4em; | ||
580 | 170 | } | ||
581 | 171 | |||
582 | 172 | div.genindex-jumpbox { | ||
583 | 173 | border-top: 1px solid #ddd; | ||
584 | 174 | border-bottom: 1px solid #ddd; | ||
585 | 175 | margin: 1em 0 1em 0; | ||
586 | 176 | padding: 0.4em; | ||
587 | 177 | } | ||
588 | 178 | |||
589 | 179 | /* -- general body styles --------------------------------------------------- */ | ||
590 | 180 | |||
591 | 181 | a.headerlink { | ||
592 | 182 | visibility: hidden; | ||
593 | 183 | } | ||
594 | 184 | |||
595 | 185 | h1:hover > a.headerlink, | ||
596 | 186 | h2:hover > a.headerlink, | ||
597 | 187 | h3:hover > a.headerlink, | ||
598 | 188 | h4:hover > a.headerlink, | ||
599 | 189 | h5:hover > a.headerlink, | ||
600 | 190 | h6:hover > a.headerlink, | ||
601 | 191 | dt:hover > a.headerlink { | ||
602 | 192 | visibility: visible; | ||
603 | 193 | } | ||
604 | 194 | |||
605 | 195 | div.body p.caption { | ||
606 | 196 | text-align: inherit; | ||
607 | 197 | } | ||
608 | 198 | |||
609 | 199 | div.body td { | ||
610 | 200 | text-align: left; | ||
611 | 201 | } | ||
612 | 202 | |||
613 | 203 | .field-list ul { | ||
614 | 204 | padding-left: 1em; | ||
615 | 205 | } | ||
616 | 206 | |||
617 | 207 | .first { | ||
618 | 208 | margin-top: 0 !important; | ||
619 | 209 | } | ||
620 | 210 | |||
621 | 211 | p.rubric { | ||
622 | 212 | margin-top: 30px; | ||
623 | 213 | font-weight: bold; | ||
624 | 214 | } | ||
625 | 215 | |||
626 | 216 | img.align-left, .figure.align-left, object.align-left { | ||
627 | 217 | clear: left; | ||
628 | 218 | float: left; | ||
629 | 219 | margin-right: 1em; | ||
630 | 220 | } | ||
631 | 221 | |||
632 | 222 | img.align-right, .figure.align-right, object.align-right { | ||
633 | 223 | clear: right; | ||
634 | 224 | float: right; | ||
635 | 225 | margin-left: 1em; | ||
636 | 226 | } | ||
637 | 227 | |||
638 | 228 | img.align-center, .figure.align-center, object.align-center { | ||
639 | 229 | display: block; | ||
640 | 230 | margin-left: auto; | ||
641 | 231 | margin-right: auto; | ||
642 | 232 | } | ||
643 | 233 | |||
644 | 234 | .align-left { | ||
645 | 235 | text-align: left; | ||
646 | 236 | } | ||
647 | 237 | |||
648 | 238 | .align-center { | ||
649 | 239 | clear: both; | ||
650 | 240 | text-align: center; | ||
651 | 241 | } | ||
652 | 242 | |||
653 | 243 | .align-right { | ||
654 | 244 | text-align: right; | ||
655 | 245 | } | ||
656 | 246 | |||
657 | 247 | /* -- sidebars -------------------------------------------------------------- */ | ||
658 | 248 | |||
659 | 249 | div.sidebar { | ||
660 | 250 | margin: 0 0 0.5em 1em; | ||
661 | 251 | border: 1px solid #ddb; | ||
662 | 252 | padding: 7px 7px 0 7px; | ||
663 | 253 | background-color: #ffe; | ||
664 | 254 | width: 40%; | ||
665 | 255 | float: right; | ||
666 | 256 | } | ||
667 | 257 | |||
668 | 258 | p.sidebar-title { | ||
669 | 259 | font-weight: bold; | ||
670 | 260 | } | ||
671 | 261 | |||
672 | 262 | /* -- topics ---------------------------------------------------------------- */ | ||
673 | 263 | |||
674 | 264 | div.topic { | ||
675 | 265 | border: 1px solid #ccc; | ||
676 | 266 | padding: 7px 7px 0 7px; | ||
677 | 267 | margin: 10px 0 10px 0; | ||
678 | 268 | } | ||
679 | 269 | |||
680 | 270 | p.topic-title { | ||
681 | 271 | font-size: 1.1em; | ||
682 | 272 | font-weight: bold; | ||
683 | 273 | margin-top: 10px; | ||
684 | 274 | } | ||
685 | 275 | |||
686 | 276 | /* -- admonitions ----------------------------------------------------------- */ | ||
687 | 277 | |||
688 | 278 | div.admonition { | ||
689 | 279 | margin-top: 10px; | ||
690 | 280 | margin-bottom: 10px; | ||
691 | 281 | padding: 7px; | ||
692 | 282 | } | ||
693 | 283 | |||
694 | 284 | div.admonition dt { | ||
695 | 285 | font-weight: bold; | ||
696 | 286 | } | ||
697 | 287 | |||
698 | 288 | div.admonition dl { | ||
699 | 289 | margin-bottom: 0; | ||
700 | 290 | } | ||
701 | 291 | |||
702 | 292 | p.admonition-title { | ||
703 | 293 | margin: 0px 10px 5px 0px; | ||
704 | 294 | font-weight: bold; | ||
705 | 295 | } | ||
706 | 296 | |||
707 | 297 | div.body p.centered { | ||
708 | 298 | text-align: center; | ||
709 | 299 | margin-top: 25px; | ||
710 | 300 | } | ||
711 | 301 | |||
712 | 302 | /* -- tables ---------------------------------------------------------------- */ | ||
713 | 303 | |||
714 | 304 | table.docutils { | ||
715 | 305 | border: 0; | ||
716 | 306 | border-collapse: collapse; | ||
717 | 307 | } | ||
718 | 308 | |||
719 | 309 | table.docutils td, table.docutils th { | ||
720 | 310 | padding: 1px 8px 1px 5px; | ||
721 | 311 | border-top: 0; | ||
722 | 312 | border-left: 0; | ||
723 | 313 | border-right: 0; | ||
724 | 314 | border-bottom: 1px solid #aaa; | ||
725 | 315 | } | ||
726 | 316 | |||
727 | 317 | table.field-list td, table.field-list th { | ||
728 | 318 | border: 0 !important; | ||
729 | 319 | } | ||
730 | 320 | |||
731 | 321 | table.footnote td, table.footnote th { | ||
732 | 322 | border: 0 !important; | ||
733 | 323 | } | ||
734 | 324 | |||
735 | 325 | th { | ||
736 | 326 | text-align: left; | ||
737 | 327 | padding-right: 5px; | ||
738 | 328 | } | ||
739 | 329 | |||
740 | 330 | table.citation { | ||
741 | 331 | border-left: solid 1px gray; | ||
742 | 332 | margin-left: 1px; | ||
743 | 333 | } | ||
744 | 334 | |||
745 | 335 | table.citation td { | ||
746 | 336 | border-bottom: none; | ||
747 | 337 | } | ||
748 | 338 | |||
749 | 339 | /* -- other body styles ----------------------------------------------------- */ | ||
750 | 340 | |||
751 | 341 | ol.arabic { | ||
752 | 342 | list-style: decimal; | ||
753 | 343 | } | ||
754 | 344 | |||
755 | 345 | ol.loweralpha { | ||
756 | 346 | list-style: lower-alpha; | ||
757 | 347 | } | ||
758 | 348 | |||
759 | 349 | ol.upperalpha { | ||
760 | 350 | list-style: upper-alpha; | ||
761 | 351 | } | ||
762 | 352 | |||
763 | 353 | ol.lowerroman { | ||
764 | 354 | list-style: lower-roman; | ||
765 | 355 | } | ||
766 | 356 | |||
767 | 357 | ol.upperroman { | ||
768 | 358 | list-style: upper-roman; | ||
769 | 359 | } | ||
770 | 360 | |||
771 | 361 | dl { | ||
772 | 362 | margin-bottom: 15px; | ||
773 | 363 | } | ||
774 | 364 | |||
775 | 365 | dd p { | ||
776 | 366 | margin-top: 0px; | ||
777 | 367 | } | ||
778 | 368 | |||
779 | 369 | dd ul, dd table { | ||
780 | 370 | margin-bottom: 10px; | ||
781 | 371 | } | ||
782 | 372 | |||
783 | 373 | dd { | ||
784 | 374 | margin-top: 3px; | ||
785 | 375 | margin-bottom: 10px; | ||
786 | 376 | margin-left: 30px; | ||
787 | 377 | } | ||
788 | 378 | |||
789 | 379 | dt:target, .highlighted { | ||
790 | 380 | background-color: #fbe54e; | ||
791 | 381 | } | ||
792 | 382 | |||
793 | 383 | dl.glossary dt { | ||
794 | 384 | font-weight: bold; | ||
795 | 385 | font-size: 1.1em; | ||
796 | 386 | } | ||
797 | 387 | |||
798 | 388 | .field-list ul { | ||
799 | 389 | margin: 0; | ||
800 | 390 | padding-left: 1em; | ||
801 | 391 | } | ||
802 | 392 | |||
803 | 393 | .field-list p { | ||
804 | 394 | margin: 0; | ||
805 | 395 | } | ||
806 | 396 | |||
807 | 397 | .refcount { | ||
808 | 398 | color: #060; | ||
809 | 399 | } | ||
810 | 400 | |||
811 | 401 | .optional { | ||
812 | 402 | font-size: 1.3em; | ||
813 | 403 | } | ||
814 | 404 | |||
815 | 405 | .versionmodified { | ||
816 | 406 | font-style: italic; | ||
817 | 407 | } | ||
818 | 408 | |||
819 | 409 | .system-message { | ||
820 | 410 | background-color: #fda; | ||
821 | 411 | padding: 5px; | ||
822 | 412 | border: 3px solid red; | ||
823 | 413 | } | ||
824 | 414 | |||
825 | 415 | .footnote:target { | ||
826 | 416 | background-color: #ffa; | ||
827 | 417 | } | ||
828 | 418 | |||
829 | 419 | .line-block { | ||
830 | 420 | display: block; | ||
831 | 421 | margin-top: 1em; | ||
832 | 422 | margin-bottom: 1em; | ||
833 | 423 | } | ||
834 | 424 | |||
835 | 425 | .line-block .line-block { | ||
836 | 426 | margin-top: 0; | ||
837 | 427 | margin-bottom: 0; | ||
838 | 428 | margin-left: 1.5em; | ||
839 | 429 | } | ||
840 | 430 | |||
841 | 431 | .guilabel, .menuselection { | ||
842 | 432 | font-family: sans-serif; | ||
843 | 433 | } | ||
844 | 434 | |||
845 | 435 | .accelerator { | ||
846 | 436 | text-decoration: underline; | ||
847 | 437 | } | ||
848 | 438 | |||
849 | 439 | .classifier { | ||
850 | 440 | font-style: oblique; | ||
851 | 441 | } | ||
852 | 442 | |||
853 | 443 | /* -- code displays --------------------------------------------------------- */ | ||
854 | 444 | |||
855 | 445 | pre { | ||
856 | 446 | overflow: auto; | ||
857 | 447 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ | ||
858 | 448 | } | ||
859 | 449 | |||
860 | 450 | td.linenos pre { | ||
861 | 451 | padding: 5px 0px; | ||
862 | 452 | border: 0; | ||
863 | 453 | background-color: transparent; | ||
864 | 454 | color: #aaa; | ||
865 | 455 | } | ||
866 | 456 | |||
867 | 457 | table.highlighttable { | ||
868 | 458 | margin-left: 0.5em; | ||
869 | 459 | } | ||
870 | 460 | |||
871 | 461 | table.highlighttable td { | ||
872 | 462 | padding: 0 0.5em 0 0.5em; | ||
873 | 463 | } | ||
874 | 464 | |||
875 | 465 | tt.descname { | ||
876 | 466 | background-color: transparent; | ||
877 | 467 | font-weight: bold; | ||
878 | 468 | font-size: 1.2em; | ||
879 | 469 | } | ||
880 | 470 | |||
881 | 471 | tt.descclassname { | ||
882 | 472 | background-color: transparent; | ||
883 | 473 | } | ||
884 | 474 | |||
885 | 475 | tt.xref, a tt { | ||
886 | 476 | background-color: transparent; | ||
887 | 477 | font-weight: bold; | ||
888 | 478 | } | ||
889 | 479 | |||
890 | 480 | h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { | ||
891 | 481 | background-color: transparent; | ||
892 | 482 | } | ||
893 | 483 | |||
894 | 484 | .viewcode-link { | ||
895 | 485 | float: right; | ||
896 | 486 | } | ||
897 | 487 | |||
898 | 488 | .viewcode-back { | ||
899 | 489 | float: right; | ||
900 | 490 | font-family: sans-serif; | ||
901 | 491 | } | ||
902 | 492 | |||
903 | 493 | div.viewcode-block:target { | ||
904 | 494 | margin: -1px -10px; | ||
905 | 495 | padding: 0 10px; | ||
906 | 496 | } | ||
907 | 497 | |||
908 | 498 | /* -- math display ---------------------------------------------------------- */ | ||
909 | 499 | |||
910 | 500 | img.math { | ||
911 | 501 | vertical-align: middle; | ||
912 | 502 | } | ||
913 | 503 | |||
914 | 504 | div.body div.math p { | ||
915 | 505 | text-align: center; | ||
916 | 506 | } | ||
917 | 507 | |||
918 | 508 | span.eqno { | ||
919 | 509 | float: right; | ||
920 | 510 | } | ||
921 | 511 | |||
922 | 512 | /* -- printout stylesheet --------------------------------------------------- */ | ||
923 | 513 | |||
924 | 514 | @media print { | ||
925 | 515 | div.document, | ||
926 | 516 | div.documentwrapper, | ||
927 | 517 | div.bodywrapper { | ||
928 | 518 | margin: 0 !important; | ||
929 | 519 | width: 100%; | ||
930 | 520 | } | ||
931 | 521 | |||
932 | 522 | div.sphinxsidebar, | ||
933 | 523 | div.related, | ||
934 | 524 | div.footer, | ||
935 | 525 | #top-link { | ||
936 | 526 | display: none; | ||
937 | 527 | } | ||
938 | 528 | } | ||
939 | 0 | 529 | ||
940 | === added file 'doc/build/html/_static/default.css' | |||
941 | --- doc/build/html/_static/default.css 1970-01-01 00:00:00 +0000 | |||
942 | +++ doc/build/html/_static/default.css 2012-03-08 09:19:21 +0000 | |||
943 | @@ -0,0 +1,414 @@ | |||
944 | 1 | /* | ||
945 | 2 | * default.css_t | ||
946 | 3 | * ~~~~~~~~~~~~~ | ||
947 | 4 | * | ||
948 | 5 | * Sphinx stylesheet -- default theme. | ||
949 | 6 | * | ||
950 | 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. | ||
951 | 8 | * :license: BSD, see LICENSE for details. | ||
952 | 9 | * | ||
953 | 10 | */ | ||
954 | 11 | |||
955 | 12 | @import url("basic.css"); | ||
956 | 13 | |||
957 | 14 | /* -- page layout ----------------------------------------------------------- */ | ||
958 | 15 | |||
959 | 16 | body { | ||
960 | 17 | font-family: Arial,Helvetica,sans-serif; | ||
961 | 18 | font-size: 14px; | ||
962 | 19 | background-color: #fff; | ||
963 | 20 | color: #333333; | ||
964 | 21 | line-height: 20px; | ||
965 | 22 | margin: 0; | ||
966 | 23 | padding: 0; | ||
967 | 24 | |||
968 | 25 | } | ||
969 | 26 | |||
970 | 27 | div.document { | ||
971 | 28 | background-color: #fff; | ||
972 | 29 | margin: 0 auto; | ||
973 | 30 | overflow: hidden; | ||
974 | 31 | padding: 30px 0; | ||
975 | 32 | width: 960px; | ||
976 | 33 | } | ||
977 | 34 | |||
978 | 35 | div.documentwrapper { | ||
979 | 36 | /* float: left; */ | ||
980 | 37 | /* width: 100%; */ | ||
981 | 38 | |||
982 | 39 | } | ||
983 | 40 | |||
984 | 41 | div.bodywrapper { | ||
985 | 42 | margin: 10 0 0 0px; | ||
986 | 43 | width: 660px; | ||
987 | 44 | float:right; | ||
988 | 45 | } | ||
989 | 46 | |||
990 | 47 | div.body { | ||
991 | 48 | background-color: #fff; | ||
992 | 49 | color: #333333; | ||
993 | 50 | padding: 0 0 20px; | ||
994 | 51 | } | ||
995 | 52 | |||
996 | 53 | div.footer { | ||
997 | 54 | /* color: #ffffff; */ | ||
998 | 55 | /* width: 100%; */ | ||
999 | 56 | /* padding: 9px 0 9px 0; */ | ||
1000 | 57 | /* text-align: center; */ | ||
1001 | 58 | /* font-size: 75%; */ | ||
1002 | 59 | font: 80% "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif; | ||
1003 | 60 | background: none repeat scroll 0 0 #333333; | ||
1004 | 61 | border-top: 2px solid #D95200; | ||
1005 | 62 | overflow: hidden; | ||
1006 | 63 | } | ||
1007 | 64 | |||
1008 | 65 | div.footer a { | ||
1009 | 66 | color: #ffffff; | ||
1010 | 67 | text-decoration: underline; | ||
1011 | 68 | } | ||
1012 | 69 | |||
1013 | 70 | div.related { | ||
1014 | 71 | background-color: #ccc; | ||
1015 | 72 | line-height: 30px; | ||
1016 | 73 | color: #333; | ||
1017 | 74 | background: none repeat scroll 0 0 #F8F8F8; | ||
1018 | 75 | border: 1px solid #E0E0E0; | ||
1019 | 76 | clear: both; | ||
1020 | 77 | padding: 10px; | ||
1021 | 78 | width: 635px; | ||
1022 | 79 | margin-bottom: 5px; | ||
1023 | 80 | } | ||
1024 | 81 | |||
1025 | 82 | div.related a { | ||
1026 | 83 | color: #999; | ||
1027 | 84 | } | ||
1028 | 85 | |||
1029 | 86 | div.sphinxsidebar { | ||
1030 | 87 | margin-left: 0px; | ||
1031 | 88 | margin-right: 30px; | ||
1032 | 89 | color: #eee; | ||
1033 | 90 | font-family: Arial,Helvetica,sans-serif; | ||
1034 | 91 | width: 260px; | ||
1035 | 92 | } | ||
1036 | 93 | |||
1037 | 94 | div.sphinxsidebar h3 { | ||
1038 | 95 | /* font-family: 'Arial', 'Helvetica' sans-serif; */ | ||
1039 | 96 | color: #999; | ||
1040 | 97 | font-size: 18px; | ||
1041 | 98 | line-height: 15px; | ||
1042 | 99 | font-weight: 400; | ||
1043 | 100 | margin-left: 5px; | ||
1044 | 101 | padding: 0; | ||
1045 | 102 | } | ||
1046 | 103 | |||
1047 | 104 | div.sphinxsidebar h3 a { | ||
1048 | 105 | color: #333; | ||
1049 | 106 | } | ||
1050 | 107 | |||
1051 | 108 | div.sphinxsidebar a:hover { | ||
1052 | 109 | /* color: #333; */ | ||
1053 | 110 | } | ||
1054 | 111 | |||
1055 | 112 | div.sphinxsidebar h4 { | ||
1056 | 113 | /* font-family: 'Arial', 'Helvetica' sans-serif; */ | ||
1057 | 114 | color: #666; | ||
1058 | 115 | font-size: 18px; | ||
1059 | 116 | font-weight: normal; | ||
1060 | 117 | margin: 5px 0 0 5px; | ||
1061 | 118 | padding: 0; | ||
1062 | 119 | } | ||
1063 | 120 | |||
1064 | 121 | div.sphinxsidebar p { | ||
1065 | 122 | color: #333; | ||
1066 | 123 | margin-bottom: 5px; | ||
1067 | 124 | margin-left: 5px; | ||
1068 | 125 | } | ||
1069 | 126 | |||
1070 | 127 | div.sphinxsidebar p.topless { | ||
1071 | 128 | margin: 5px 10px 10px 10px; | ||
1072 | 129 | } | ||
1073 | 130 | |||
1074 | 131 | div.sphinxsidebar ul { | ||
1075 | 132 | margin: 10px; | ||
1076 | 133 | padding-left: 5px; | ||
1077 | 134 | color: #333; | ||
1078 | 135 | } | ||
1079 | 136 | |||
1080 | 137 | div.sphinxsidebar a { | ||
1081 | 138 | color: #D12907; | ||
1082 | 139 | } | ||
1083 | 140 | |||
1084 | 141 | div.sphinxsidebar input { | ||
1085 | 142 | border: 1px solid #999; | ||
1086 | 143 | font-family: sans-serif; | ||
1087 | 144 | font-size: 1em; | ||
1088 | 145 | } | ||
1089 | 146 | |||
1090 | 147 | |||
1091 | 148 | |||
1092 | 149 | /* -- hyperlink styles ------------------------------------------------------ */ | ||
1093 | 150 | |||
1094 | 151 | a { | ||
1095 | 152 | color: #D12907; | ||
1096 | 153 | text-decoration: underline; | ||
1097 | 154 | border: medium none; | ||
1098 | 155 | cursor: pointer; | ||
1099 | 156 | } | ||
1100 | 157 | |||
1101 | 158 | a:visited { | ||
1102 | 159 | color: #D12907; | ||
1103 | 160 | text-decoration: underline; | ||
1104 | 161 | } | ||
1105 | 162 | |||
1106 | 163 | a:hover { | ||
1107 | 164 | color: #D12907; | ||
1108 | 165 | text-decoration: underline; | ||
1109 | 166 | } | ||
1110 | 167 | |||
1111 | 168 | |||
1112 | 169 | |||
1113 | 170 | /* -- body styles ----------------------------------------------------------- */ | ||
1114 | 171 | |||
1115 | 172 | div.body h1, | ||
1116 | 173 | div.body h2, | ||
1117 | 174 | div.body h3, | ||
1118 | 175 | div.body h4, | ||
1119 | 176 | div.body h5, | ||
1120 | 177 | div.body h6 { | ||
1121 | 178 | font-family: Arial,Helvetica,sans-serif; | ||
1122 | 179 | background-color: #fff; | ||
1123 | 180 | font-weight: 400; | ||
1124 | 181 | |||
1125 | 182 | /* border-bottom: 1px solid #ccc; */ | ||
1126 | 183 | /* margin: 20px -20px 10px -20px; */ | ||
1127 | 184 | /* padding: 0; */ | ||
1128 | 185 | /* padding: 3px 0 3px 10px; */ | ||
1129 | 186 | text-decoration: none !important; | ||
1130 | 187 | |||
1131 | 188 | border-bottom: 1px solid #E0E0E0; | ||
1132 | 189 | font-size: 20px; | ||
1133 | 190 | line-height: 20px; | ||
1134 | 191 | margin: 30px 0 15px; | ||
1135 | 192 | padding: 0 0 3px; | ||
1136 | 193 | color: #000; | ||
1137 | 194 | } | ||
1138 | 195 | |||
1139 | 196 | div.body h1 { | ||
1140 | 197 | font-size: 32px; | ||
1141 | 198 | color: #D12907; | ||
1142 | 199 | line-height: 40px; | ||
1143 | 200 | margin: 10px 0 20px 0; | ||
1144 | 201 | text-decoration: none !important; | ||
1145 | 202 | border-bottom: none; | ||
1146 | 203 | margin-top: 35px; | ||
1147 | 204 | } | ||
1148 | 205 | |||
1149 | 206 | div.body h2 { font-size: 150%; } | ||
1150 | 207 | div.body h3 { font-size: 140%; } | ||
1151 | 208 | div.body h4 { font-size: 120%; } | ||
1152 | 209 | div.body h5 { font-size: 110%; } | ||
1153 | 210 | div.body h6 { font-size: 100%; } | ||
1154 | 211 | |||
1155 | 212 | a.headerlink { | ||
1156 | 213 | color: #c60f0f; | ||
1157 | 214 | font-size: 0.8em; | ||
1158 | 215 | padding: 0 4px 0 4px; | ||
1159 | 216 | text-decoration: none; | ||
1160 | 217 | } | ||
1161 | 218 | |||
1162 | 219 | a.headerlink:hover { | ||
1163 | 220 | background-color: #c60f0f; | ||
1164 | 221 | color: white; | ||
1165 | 222 | } | ||
1166 | 223 | |||
1167 | 224 | div.body dd, div.body li { | ||
1168 | 225 | text-align: justify; | ||
1169 | 226 | } | ||
1170 | 227 | |||
1171 | 228 | div.body dt { | ||
1172 | 229 | list-style-type: square; | ||
1173 | 230 | /* margin: 8px 0 8px 30px; */ | ||
1174 | 231 | padding: 0 4px 0 5px; | ||
1175 | 232 | |||
1176 | 233 | } | ||
1177 | 234 | |||
1178 | 235 | div.body p { | ||
1179 | 236 | text-align: justify; | ||
1180 | 237 | /* line-height: 130%;*/ | ||
1181 | 238 | margin: 10px 0; | ||
1182 | 239 | } | ||
1183 | 240 | |||
1184 | 241 | /* div.body ul, */ | ||
1185 | 242 | div.body li { | ||
1186 | 243 | list-style-type: square; | ||
1187 | 244 | margin: 8px 0 8px 30px; | ||
1188 | 245 | padding: 0 4px 0 5px; | ||
1189 | 246 | } | ||
1190 | 247 | |||
1191 | 248 | .reference em { | ||
1192 | 249 | font-style: normal; | ||
1193 | 250 | } | ||
1194 | 251 | |||
1195 | 252 | .std-term { | ||
1196 | 253 | font-style: normal; | ||
1197 | 254 | font-weight: 400; | ||
1198 | 255 | color: #FF7400 | ||
1199 | 256 | } | ||
1200 | 257 | |||
1201 | 258 | div.admonition p.admonition-title + p { | ||
1202 | 259 | display: inline; | ||
1203 | 260 | } | ||
1204 | 261 | |||
1205 | 262 | div.admonition p { | ||
1206 | 263 | margin-bottom: 5px; | ||
1207 | 264 | } | ||
1208 | 265 | |||
1209 | 266 | div.admonition pre { | ||
1210 | 267 | margin-bottom: 5px; | ||
1211 | 268 | } | ||
1212 | 269 | |||
1213 | 270 | div.admonition ul, div.admonition ol { | ||
1214 | 271 | margin-bottom: 5px; | ||
1215 | 272 | } | ||
1216 | 273 | |||
1217 | 274 | div.note { | ||
1218 | 275 | background-color: #eee; | ||
1219 | 276 | border: 1px solid #ccc; | ||
1220 | 277 | } | ||
1221 | 278 | |||
1222 | 279 | div.seealso { | ||
1223 | 280 | background-color: #ffc; | ||
1224 | 281 | border: 1px solid #ff6; | ||
1225 | 282 | } | ||
1226 | 283 | |||
1227 | 284 | div.topic { | ||
1228 | 285 | background-color: #eee; | ||
1229 | 286 | } | ||
1230 | 287 | |||
1231 | 288 | div.warning { | ||
1232 | 289 | background-color: #ffe4e4; | ||
1233 | 290 | border: 1px solid #f66; | ||
1234 | 291 | } | ||
1235 | 292 | |||
1236 | 293 | p.admonition-title { | ||
1237 | 294 | display: inline; | ||
1238 | 295 | } | ||
1239 | 296 | |||
1240 | 297 | p.admonition-title:after { | ||
1241 | 298 | content: ":"; | ||
1242 | 299 | } | ||
1243 | 300 | |||
1244 | 301 | pre { | ||
1245 | 302 | padding: 10px; | ||
1246 | 303 | background-color: #F0E6D9/* #eeffcc */; | ||
1247 | 304 | color: #333333; | ||
1248 | 305 | line-height: 120%; | ||
1249 | 306 | border: 1px dashed #ED9821; | ||
1250 | 307 | font-size: 80%; | ||
1251 | 308 | overflow: auto; | ||
1252 | 309 | /* border-left: none; */ | ||
1253 | 310 | /* border-right: none; */ | ||
1254 | 311 | } | ||
1255 | 312 | |||
1256 | 313 | tt { | ||
1257 | 314 | /* background-color: #ecf0f3; | ||
1258 | 315 | padding: 0 1px 0 1px; | ||
1259 | 316 | font-size: 0.95em;*/ | ||
1260 | 317 | font-weight: 400; | ||
1261 | 318 | } | ||
1262 | 319 | |||
1263 | 320 | div.body td { | ||
1264 | 321 | text-align: none; | ||
1265 | 322 | } | ||
1266 | 323 | |||
1267 | 324 | table.docutils th { | ||
1268 | 325 | background-color: #DEE7EC; | ||
1269 | 326 | border: 1px solid #8CACBB; | ||
1270 | 327 | padding: 3px; | ||
1271 | 328 | text-align: center; | ||
1272 | 329 | font-style: normal; | ||
1273 | 330 | font-weight: 400; | ||
1274 | 331 | } | ||
1275 | 332 | |||
1276 | 333 | table.docutils td { | ||
1277 | 334 | border: 1px solid #8CACBB; | ||
1278 | 335 | padding: 3px; | ||
1279 | 336 | line-height: 16px; | ||
1280 | 337 | vertical-align: middle; | ||
1281 | 338 | } | ||
1282 | 339 | |||
1283 | 340 | .warning tt { | ||
1284 | 341 | background: #efc2c2; | ||
1285 | 342 | } | ||
1286 | 343 | |||
1287 | 344 | .note tt { | ||
1288 | 345 | background: #d6d6d6; | ||
1289 | 346 | } | ||
1290 | 347 | |||
1291 | 348 | .viewcode-back { | ||
1292 | 349 | font-family: sans-serif; | ||
1293 | 350 | } | ||
1294 | 351 | |||
1295 | 352 | div.viewcode-block:target { | ||
1296 | 353 | background-color: #f4debf; | ||
1297 | 354 | border-top: 1px solid #ac9; | ||
1298 | 355 | border-bottom: 1px solid #ac9; | ||
1299 | 356 | } | ||
1300 | 357 | |||
1301 | 358 | .file-bugs { | ||
1302 | 359 | background: none repeat scroll 0 0 #E8E8E8; | ||
1303 | 360 | border: 1px solid #E0E0E0; | ||
1304 | 361 | clear: both; | ||
1305 | 362 | color: #333333; | ||
1306 | 363 | padding: 10px; | ||
1307 | 364 | text-align: center; | ||
1308 | 365 | font-size: 90%; | ||
1309 | 366 | } | ||
1310 | 367 | |||
1311 | 368 | div.footer .footer { | ||
1312 | 369 | margin: 0 auto; | ||
1313 | 370 | overflow: hidden; | ||
1314 | 371 | padding: 10px 0; | ||
1315 | 372 | width: 960px; | ||
1316 | 373 | border-top: none; | ||
1317 | 374 | } | ||
1318 | 375 | |||
1319 | 376 | div.footer .footer .logo { | ||
1320 | 377 | float: left; | ||
1321 | 378 | overflow: hidden; | ||
1322 | 379 | padding: 17px 0 0; | ||
1323 | 380 | } | ||
1324 | 381 | |||
1325 | 382 | div.footer .footer .text { | ||
1326 | 383 | color: #E0E0E0; | ||
1327 | 384 | float: right; | ||
1328 | 385 | font-family: Arial,Helvetica,sans-serif; | ||
1329 | 386 | font-size: 11px; | ||
1330 | 387 | line-height: 15px; | ||
1331 | 388 | overflow: hidden; | ||
1332 | 389 | text-align: right; | ||
1333 | 390 | } | ||
1334 | 391 | |||
1335 | 392 | div.license { | ||
1336 | 393 | font-size: 80%; | ||
1337 | 394 | /* padding: 0.5em; */ | ||
1338 | 395 | text-align: center; | ||
1339 | 396 | margin: 13px 0 -15px; | ||
1340 | 397 | } | ||
1341 | 398 | |||
1342 | 399 | #sidenavi.noborder { | ||
1343 | 400 | border-right: medium none; | ||
1344 | 401 | border-top: medium none; | ||
1345 | 402 | margin: 0; | ||
1346 | 403 | } | ||
1347 | 404 | |||
1348 | 405 | #sidenavi { | ||
1349 | 406 | color: #333333; | ||
1350 | 407 | /* float: left; */ | ||
1351 | 408 | font-family: Arial,Helvetica,sans-serif; | ||
1352 | 409 | font-size: 18px; | ||
1353 | 410 | line-height: 25px; | ||
1354 | 411 | overflow: hidden; | ||
1355 | 412 | padding: 10px 0 8px 0px; | ||
1356 | 413 | width: 255px; | ||
1357 | 414 | } | ||
1358 | 0 | 415 | ||
1359 | === added file 'doc/build/html/_static/doctools.js' | |||
1360 | --- doc/build/html/_static/doctools.js 1970-01-01 00:00:00 +0000 | |||
1361 | +++ doc/build/html/_static/doctools.js 2012-03-08 09:19:21 +0000 | |||
1362 | @@ -0,0 +1,247 @@ | |||
1363 | 1 | /* | ||
1364 | 2 | * doctools.js | ||
1365 | 3 | * ~~~~~~~~~~~ | ||
1366 | 4 | * | ||
1367 | 5 | * Sphinx JavaScript utilties for all documentation. | ||
1368 | 6 | * | ||
1369 | 7 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. | ||
1370 | 8 | * :license: BSD, see LICENSE for details. | ||
1371 | 9 | * | ||
1372 | 10 | */ | ||
1373 | 11 | |||
1374 | 12 | /** | ||
1375 | 13 | * select a different prefix for underscore | ||
1376 | 14 | */ | ||
1377 | 15 | $u = _.noConflict(); | ||
1378 | 16 | |||
1379 | 17 | /** | ||
1380 | 18 | * make the code below compatible with browsers without | ||
1381 | 19 | * an installed firebug like debugger | ||
1382 | 20 | if (!window.console || !console.firebug) { | ||
1383 | 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", | ||
1384 | 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", | ||
1385 | 23 | "profile", "profileEnd"]; | ||
1386 | 24 | window.console = {}; | ||
1387 | 25 | for (var i = 0; i < names.length; ++i) | ||
1388 | 26 | window.console[names[i]] = function() {}; | ||
1389 | 27 | } | ||
1390 | 28 | */ | ||
1391 | 29 | |||
1392 | 30 | /** | ||
1393 | 31 | * small helper function to urldecode strings | ||
1394 | 32 | */ | ||
1395 | 33 | jQuery.urldecode = function(x) { | ||
1396 | 34 | return decodeURIComponent(x).replace(/\+/g, ' '); | ||
1397 | 35 | } | ||
1398 | 36 | |||
1399 | 37 | /** | ||
1400 | 38 | * small helper function to urlencode strings | ||
1401 | 39 | */ | ||
1402 | 40 | jQuery.urlencode = encodeURIComponent; | ||
1403 | 41 | |||
1404 | 42 | /** | ||
1405 | 43 | * This function returns the parsed url parameters of the | ||
1406 | 44 | * current request. Multiple values per key are supported, | ||
1407 | 45 | * it will always return arrays of strings for the value parts. | ||
1408 | 46 | */ | ||
1409 | 47 | jQuery.getQueryParameters = function(s) { | ||
1410 | 48 | if (typeof s == 'undefined') | ||
1411 | 49 | s = document.location.search; | ||
1412 | 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); | ||
1413 | 51 | var result = {}; | ||
1414 | 52 | for (var i = 0; i < parts.length; i++) { | ||
1415 | 53 | var tmp = parts[i].split('=', 2); | ||
1416 | 54 | var key = jQuery.urldecode(tmp[0]); | ||
1417 | 55 | var value = jQuery.urldecode(tmp[1]); | ||
1418 | 56 | if (key in result) | ||
1419 | 57 | result[key].push(value); | ||
1420 | 58 | else | ||
1421 | 59 | result[key] = [value]; | ||
1422 | 60 | } | ||
1423 | 61 | return result; | ||
1424 | 62 | }; | ||
1425 | 63 | |||
1426 | 64 | /** | ||
1427 | 65 | * small function to check if an array contains | ||
1428 | 66 | * a given item. | ||
1429 | 67 | */ | ||
1430 | 68 | jQuery.contains = function(arr, item) { | ||
1431 | 69 | for (var i = 0; i < arr.length; i++) { | ||
1432 | 70 | if (arr[i] == item) | ||
1433 | 71 | return true; | ||
1434 | 72 | } | ||
1435 | 73 | return false; | ||
1436 | 74 | }; | ||
1437 | 75 | |||
1438 | 76 | /** | ||
1439 | 77 | * highlight a given string on a jquery object by wrapping it in | ||
1440 | 78 | * span elements with the given class name. | ||
1441 | 79 | */ | ||
1442 | 80 | jQuery.fn.highlightText = function(text, className) { | ||
1443 | 81 | function highlight(node) { | ||
1444 | 82 | if (node.nodeType == 3) { | ||
1445 | 83 | var val = node.nodeValue; | ||
1446 | 84 | var pos = val.toLowerCase().indexOf(text); | ||
1447 | 85 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { | ||
1448 | 86 | var span = document.createElement("span"); | ||
1449 | 87 | span.className = className; | ||
1450 | 88 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); | ||
1451 | 89 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( | ||
1452 | 90 | document.createTextNode(val.substr(pos + text.length)), | ||
1453 | 91 | node.nextSibling)); | ||
1454 | 92 | node.nodeValue = val.substr(0, pos); | ||
1455 | 93 | } | ||
1456 | 94 | } | ||
1457 | 95 | else if (!jQuery(node).is("button, select, textarea")) { | ||
1458 | 96 | jQuery.each(node.childNodes, function() { | ||
1459 | 97 | highlight(this); | ||
1460 | 98 | }); | ||
1461 | 99 | } | ||
1462 | 100 | } | ||
1463 | 101 | return this.each(function() { | ||
1464 | 102 | highlight(this); | ||
1465 | 103 | }); | ||
1466 | 104 | }; | ||
1467 | 105 | |||
1468 | 106 | /** | ||
1469 | 107 | * Small JavaScript module for the documentation. | ||
1470 | 108 | */ | ||
1471 | 109 | var Documentation = { | ||
1472 | 110 | |||
1473 | 111 | init : function() { | ||
1474 | 112 | this.fixFirefoxAnchorBug(); | ||
1475 | 113 | this.highlightSearchWords(); | ||
1476 | 114 | this.initIndexTable(); | ||
1477 | 115 | }, | ||
1478 | 116 | |||
1479 | 117 | /** | ||
1480 | 118 | * i18n support | ||
1481 | 119 | */ | ||
1482 | 120 | TRANSLATIONS : {}, | ||
1483 | 121 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, | ||
1484 | 122 | LOCALE : 'unknown', | ||
1485 | 123 | |||
1486 | 124 | // gettext and ngettext don't access this so that the functions | ||
1487 | 125 | // can safely bound to a different name (_ = Documentation.gettext) | ||
1488 | 126 | gettext : function(string) { | ||
1489 | 127 | var translated = Documentation.TRANSLATIONS[string]; | ||
1490 | 128 | if (typeof translated == 'undefined') | ||
1491 | 129 | return string; | ||
1492 | 130 | return (typeof translated == 'string') ? translated : translated[0]; | ||
1493 | 131 | }, | ||
1494 | 132 | |||
1495 | 133 | ngettext : function(singular, plural, n) { | ||
1496 | 134 | var translated = Documentation.TRANSLATIONS[singular]; | ||
1497 | 135 | if (typeof translated == 'undefined') | ||
1498 | 136 | return (n == 1) ? singular : plural; | ||
1499 | 137 | return translated[Documentation.PLURALEXPR(n)]; | ||
1500 | 138 | }, | ||
1501 | 139 | |||
1502 | 140 | addTranslations : function(catalog) { | ||
1503 | 141 | for (var key in catalog.messages) | ||
1504 | 142 | this.TRANSLATIONS[key] = catalog.messages[key]; | ||
1505 | 143 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); | ||
1506 | 144 | this.LOCALE = catalog.locale; | ||
1507 | 145 | }, | ||
1508 | 146 | |||
1509 | 147 | /** | ||
1510 | 148 | * add context elements like header anchor links | ||
1511 | 149 | */ | ||
1512 | 150 | addContextElements : function() { | ||
1513 | 151 | $('div[id] > :header:first').each(function() { | ||
1514 | 152 | $('<a class="headerlink">\u00B6</a>'). | ||
1515 | 153 | attr('href', '#' + this.id). | ||
1516 | 154 | attr('title', _('Permalink to this headline')). | ||
1517 | 155 | appendTo(this); | ||
1518 | 156 | }); | ||
1519 | 157 | $('dt[id]').each(function() { | ||
1520 | 158 | $('<a class="headerlink">\u00B6</a>'). | ||
1521 | 159 | attr('href', '#' + this.id). | ||
1522 | 160 | attr('title', _('Permalink to this definition')). | ||
1523 | 161 | appendTo(this); | ||
1524 | 162 | }); | ||
1525 | 163 | }, | ||
1526 | 164 | |||
1527 | 165 | /** | ||
1528 | 166 | * workaround a firefox stupidity | ||
1529 | 167 | */ | ||
1530 | 168 | fixFirefoxAnchorBug : function() { | ||
1531 | 169 | if (document.location.hash && $.browser.mozilla) | ||
1532 | 170 | window.setTimeout(function() { | ||
1533 | 171 | document.location.href += ''; | ||
1534 | 172 | }, 10); | ||
1535 | 173 | }, | ||
1536 | 174 | |||
1537 | 175 | /** | ||
1538 | 176 | * highlight the search words provided in the url in the text | ||
1539 | 177 | */ | ||
1540 | 178 | highlightSearchWords : function() { | ||
1541 | 179 | var params = $.getQueryParameters(); | ||
1542 | 180 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; | ||
1543 | 181 | if (terms.length) { | ||
1544 | 182 | var body = $('div.body'); | ||
1545 | 183 | window.setTimeout(function() { | ||
1546 | 184 | $.each(terms, function() { | ||
1547 | 185 | body.highlightText(this.toLowerCase(), 'highlighted'); | ||
1548 | 186 | }); | ||
1549 | 187 | }, 10); | ||
1550 | 188 | $('<li class="highlight-link"><a href="javascript:Documentation.' + | ||
1551 | 189 | 'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>') | ||
1552 | 190 | .appendTo($('.sidebar .this-page-menu')); | ||
1553 | 191 | } | ||
1554 | 192 | }, | ||
1555 | 193 | |||
1556 | 194 | /** | ||
1557 | 195 | * init the domain index toggle buttons | ||
1558 | 196 | */ | ||
1559 | 197 | initIndexTable : function() { | ||
1560 | 198 | var togglers = $('img.toggler').click(function() { | ||
1561 | 199 | var src = $(this).attr('src'); | ||
1562 | 200 | var idnum = $(this).attr('id').substr(7); | ||
1563 | 201 | $('tr.cg-' + idnum).toggle(); | ||
1564 | 202 | if (src.substr(-9) == 'minus.png') | ||
1565 | 203 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); | ||
1566 | 204 | else | ||
1567 | 205 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); | ||
1568 | 206 | }).css('display', ''); | ||
1569 | 207 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { | ||
1570 | 208 | togglers.click(); | ||
1571 | 209 | } | ||
1572 | 210 | }, | ||
1573 | 211 | |||
1574 | 212 | /** | ||
1575 | 213 | * helper function to hide the search marks again | ||
1576 | 214 | */ | ||
1577 | 215 | hideSearchWords : function() { | ||
1578 | 216 | $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); | ||
1579 | 217 | $('span.highlighted').removeClass('highlighted'); | ||
1580 | 218 | }, | ||
1581 | 219 | |||
1582 | 220 | /** | ||
1583 | 221 | * make the url absolute | ||
1584 | 222 | */ | ||
1585 | 223 | makeURL : function(relativeURL) { | ||
1586 | 224 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; | ||
1587 | 225 | }, | ||
1588 | 226 | |||
1589 | 227 | /** | ||
1590 | 228 | * get the current relative url | ||
1591 | 229 | */ | ||
1592 | 230 | getCurrentURL : function() { | ||
1593 | 231 | var path = document.location.pathname; | ||
1594 | 232 | var parts = path.split(/\//); | ||
1595 | 233 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { | ||
1596 | 234 | if (this == '..') | ||
1597 | 235 | parts.pop(); | ||
1598 | 236 | }); | ||
1599 | 237 | var url = parts.join('/'); | ||
1600 | 238 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); | ||
1601 | 239 | } | ||
1602 | 240 | }; | ||
1603 | 241 | |||
1604 | 242 | // quick alias for translations | ||
1605 | 243 | _ = Documentation.gettext; | ||
1606 | 244 | |||
1607 | 245 | $(document).ready(function() { | ||
1608 | 246 | Documentation.init(); | ||
1609 | 247 | }); | ||
1610 | 0 | 248 | ||
1611 | === added file 'doc/build/html/_static/email-small.png' | |||
1612 | 1 | Binary files doc/build/html/_static/email-small.png 1970-01-01 00:00:00 +0000 and doc/build/html/_static/email-small.png 2012-03-08 09:19:21 +0000 differ | 249 | Binary files doc/build/html/_static/email-small.png 1970-01-01 00:00:00 +0000 and doc/build/html/_static/email-small.png 2012-03-08 09:19:21 +0000 differ |
1613 | === added file 'doc/build/html/_static/file.png' | |||
1614 | 2 | Binary files doc/build/html/_static/file.png 1970-01-01 00:00:00 +0000 and doc/build/html/_static/file.png 2012-03-08 09:19:21 +0000 differ | 250 | Binary files doc/build/html/_static/file.png 1970-01-01 00:00:00 +0000 and doc/build/html/_static/file.png 2012-03-08 09:19:21 +0000 differ |
1615 | === added file 'doc/build/html/_static/jquery.js' | |||
1616 | --- doc/build/html/_static/jquery.js 1970-01-01 00:00:00 +0000 | |||
1617 | +++ doc/build/html/_static/jquery.js 2012-03-08 09:19:21 +0000 | |||
1618 | @@ -0,0 +1,8981 @@ | |||
1619 | 1 | /*! | ||
1620 | 2 | * jQuery JavaScript Library v1.6.2 | ||
1621 | 3 | * http://jquery.com/ | ||
1622 | 4 | * | ||
1623 | 5 | * Copyright 2011, John Resig | ||
1624 | 6 | * Dual licensed under the MIT or GPL Version 2 licenses. | ||
1625 | 7 | * http://jquery.org/license | ||
1626 | 8 | * | ||
1627 | 9 | * Includes Sizzle.js | ||
1628 | 10 | * http://sizzlejs.com/ | ||
1629 | 11 | * Copyright 2011, The Dojo Foundation | ||
1630 | 12 | * Released under the MIT, BSD, and GPL Licenses. | ||
1631 | 13 | * | ||
1632 | 14 | * Date: Thu Jun 30 14:16:56 2011 -0400 | ||
1633 | 15 | */ | ||
1634 | 16 | (function( window, undefined ) { | ||
1635 | 17 | |||
1636 | 18 | // Use the correct document accordingly with window argument (sandbox) | ||
1637 | 19 | var document = window.document, | ||
1638 | 20 | navigator = window.navigator, | ||
1639 | 21 | location = window.location; | ||
1640 | 22 | var jQuery = (function() { | ||
1641 | 23 | |||
1642 | 24 | // Define a local copy of jQuery | ||
1643 | 25 | var jQuery = function( selector, context ) { | ||
1644 | 26 | // The jQuery object is actually just the init constructor 'enhanced' | ||
1645 | 27 | return new jQuery.fn.init( selector, context, rootjQuery ); | ||
1646 | 28 | }, | ||
1647 | 29 | |||
1648 | 30 | // Map over jQuery in case of overwrite | ||
1649 | 31 | _jQuery = window.jQuery, | ||
1650 | 32 | |||
1651 | 33 | // Map over the $ in case of overwrite | ||
1652 | 34 | _$ = window.$, | ||
1653 | 35 | |||
1654 | 36 | // A central reference to the root jQuery(document) | ||
1655 | 37 | rootjQuery, | ||
1656 | 38 | |||
1657 | 39 | // A simple way to check for HTML strings or ID strings | ||
1658 | 40 | // (both of which we optimize for) | ||
1659 | 41 | quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, | ||
1660 | 42 | |||
1661 | 43 | // Check if a string has a non-whitespace character in it | ||
1662 | 44 | rnotwhite = /\S/, | ||
1663 | 45 | |||
1664 | 46 | // Used for trimming whitespace | ||
1665 | 47 | trimLeft = /^\s+/, | ||
1666 | 48 | trimRight = /\s+$/, | ||
1667 | 49 | |||
1668 | 50 | // Check for digits | ||
1669 | 51 | rdigit = /\d/, | ||
1670 | 52 | |||
1671 | 53 | // Match a standalone tag | ||
1672 | 54 | rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, | ||
1673 | 55 | |||
1674 | 56 | // JSON RegExp | ||
1675 | 57 | rvalidchars = /^[\],:{}\s]*$/, | ||
1676 | 58 | rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, | ||
1677 | 59 | rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, | ||
1678 | 60 | rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, | ||
1679 | 61 | |||
1680 | 62 | // Useragent RegExp | ||
1681 | 63 | rwebkit = /(webkit)[ \/]([\w.]+)/, | ||
1682 | 64 | ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, | ||
1683 | 65 | rmsie = /(msie) ([\w.]+)/, | ||
1684 | 66 | rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, | ||
1685 | 67 | |||
1686 | 68 | // Matches dashed string for camelizing | ||
1687 | 69 | rdashAlpha = /-([a-z])/ig, | ||
1688 | 70 | |||
1689 | 71 | // Used by jQuery.camelCase as callback to replace() | ||
1690 | 72 | fcamelCase = function( all, letter ) { | ||
1691 | 73 | return letter.toUpperCase(); | ||
1692 | 74 | }, | ||
1693 | 75 | |||
1694 | 76 | // Keep a UserAgent string for use with jQuery.browser | ||
1695 | 77 | userAgent = navigator.userAgent, | ||
1696 | 78 | |||
1697 | 79 | // For matching the engine and version of the browser | ||
1698 | 80 | browserMatch, | ||
1699 | 81 | |||
1700 | 82 | // The deferred used on DOM ready | ||
1701 | 83 | readyList, | ||
1702 | 84 | |||
1703 | 85 | // The ready event handler | ||
1704 | 86 | DOMContentLoaded, | ||
1705 | 87 | |||
1706 | 88 | // Save a reference to some core methods | ||
1707 | 89 | toString = Object.prototype.toString, | ||
1708 | 90 | hasOwn = Object.prototype.hasOwnProperty, | ||
1709 | 91 | push = Array.prototype.push, | ||
1710 | 92 | slice = Array.prototype.slice, | ||
1711 | 93 | trim = String.prototype.trim, | ||
1712 | 94 | indexOf = Array.prototype.indexOf, | ||
1713 | 95 | |||
1714 | 96 | // [[Class]] -> type pairs | ||
1715 | 97 | class2type = {}; | ||
1716 | 98 | |||
1717 | 99 | jQuery.fn = jQuery.prototype = { | ||
1718 | 100 | constructor: jQuery, | ||
1719 | 101 | init: function( selector, context, rootjQuery ) { | ||
1720 | 102 | var match, elem, ret, doc; | ||
1721 | 103 | |||
1722 | 104 | // Handle $(""), $(null), or $(undefined) | ||
1723 | 105 | if ( !selector ) { | ||
1724 | 106 | return this; | ||
1725 | 107 | } | ||
1726 | 108 | |||
1727 | 109 | // Handle $(DOMElement) | ||
1728 | 110 | if ( selector.nodeType ) { | ||
1729 | 111 | this.context = this[0] = selector; | ||
1730 | 112 | this.length = 1; | ||
1731 | 113 | return this; | ||
1732 | 114 | } | ||
1733 | 115 | |||
1734 | 116 | // The body element only exists once, optimize finding it | ||
1735 | 117 | if ( selector === "body" && !context && document.body ) { | ||
1736 | 118 | this.context = document; | ||
1737 | 119 | this[0] = document.body; | ||
1738 | 120 | this.selector = selector; | ||
1739 | 121 | this.length = 1; | ||
1740 | 122 | return this; | ||
1741 | 123 | } | ||
1742 | 124 | |||
1743 | 125 | // Handle HTML strings | ||
1744 | 126 | if ( typeof selector === "string" ) { | ||
1745 | 127 | // Are we dealing with HTML string or an ID? | ||
1746 | 128 | if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { | ||
1747 | 129 | // Assume that strings that start and end with <> are HTML and skip the regex check | ||
1748 | 130 | match = [ null, selector, null ]; | ||
1749 | 131 | |||
1750 | 132 | } else { | ||
1751 | 133 | match = quickExpr.exec( selector ); | ||
1752 | 134 | } | ||
1753 | 135 | |||
1754 | 136 | // Verify a match, and that no context was specified for #id | ||
1755 | 137 | if ( match && (match[1] || !context) ) { | ||
1756 | 138 | |||
1757 | 139 | // HANDLE: $(html) -> $(array) | ||
1758 | 140 | if ( match[1] ) { | ||
1759 | 141 | context = context instanceof jQuery ? context[0] : context; | ||
1760 | 142 | doc = (context ? context.ownerDocument || context : document); | ||
1761 | 143 | |||
1762 | 144 | // If a single string is passed in and it's a single tag | ||
1763 | 145 | // just do a createElement and skip the rest | ||
1764 | 146 | ret = rsingleTag.exec( selector ); | ||
1765 | 147 | |||
1766 | 148 | if ( ret ) { | ||
1767 | 149 | if ( jQuery.isPlainObject( context ) ) { | ||
1768 | 150 | selector = [ document.createElement( ret[1] ) ]; | ||
1769 | 151 | jQuery.fn.attr.call( selector, context, true ); | ||
1770 | 152 | |||
1771 | 153 | } else { | ||
1772 | 154 | selector = [ doc.createElement( ret[1] ) ]; | ||
1773 | 155 | } | ||
1774 | 156 | |||
1775 | 157 | } else { | ||
1776 | 158 | ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); | ||
1777 | 159 | selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; | ||
1778 | 160 | } | ||
1779 | 161 | |||
1780 | 162 | return jQuery.merge( this, selector ); | ||
1781 | 163 | |||
1782 | 164 | // HANDLE: $("#id") | ||
1783 | 165 | } else { | ||
1784 | 166 | elem = document.getElementById( match[2] ); | ||
1785 | 167 | |||
1786 | 168 | // Check parentNode to catch when Blackberry 4.6 returns | ||
1787 | 169 | // nodes that are no longer in the document #6963 | ||
1788 | 170 | if ( elem && elem.parentNode ) { | ||
1789 | 171 | // Handle the case where IE and Opera return items | ||
1790 | 172 | // by name instead of ID | ||
1791 | 173 | if ( elem.id !== match[2] ) { | ||
1792 | 174 | return rootjQuery.find( selector ); | ||
1793 | 175 | } | ||
1794 | 176 | |||
1795 | 177 | // Otherwise, we inject the element directly into the jQuery object | ||
1796 | 178 | this.length = 1; | ||
1797 | 179 | this[0] = elem; | ||
1798 | 180 | } | ||
1799 | 181 | |||
1800 | 182 | this.context = document; | ||
1801 | 183 | this.selector = selector; | ||
1802 | 184 | return this; | ||
1803 | 185 | } | ||
1804 | 186 | |||
1805 | 187 | // HANDLE: $(expr, $(...)) | ||
1806 | 188 | } else if ( !context || context.jquery ) { | ||
1807 | 189 | return (context || rootjQuery).find( selector ); | ||
1808 | 190 | |||
1809 | 191 | // HANDLE: $(expr, context) | ||
1810 | 192 | // (which is just equivalent to: $(context).find(expr) | ||
1811 | 193 | } else { | ||
1812 | 194 | return this.constructor( context ).find( selector ); | ||
1813 | 195 | } | ||
1814 | 196 | |||
1815 | 197 | // HANDLE: $(function) | ||
1816 | 198 | // Shortcut for document ready | ||
1817 | 199 | } else if ( jQuery.isFunction( selector ) ) { | ||
1818 | 200 | return rootjQuery.ready( selector ); | ||
1819 | 201 | } | ||
1820 | 202 | |||
1821 | 203 | if (selector.selector !== undefined) { | ||
1822 | 204 | this.selector = selector.selector; | ||
1823 | 205 | this.context = selector.context; | ||
1824 | 206 | } | ||
1825 | 207 | |||
1826 | 208 | return jQuery.makeArray( selector, this ); | ||
1827 | 209 | }, | ||
1828 | 210 | |||
1829 | 211 | // Start with an empty selector | ||
1830 | 212 | selector: "", | ||
1831 | 213 | |||
1832 | 214 | // The current version of jQuery being used | ||
1833 | 215 | jquery: "1.6.2", | ||
1834 | 216 | |||
1835 | 217 | // The default length of a jQuery object is 0 | ||
1836 | 218 | length: 0, | ||
1837 | 219 | |||
1838 | 220 | // The number of elements contained in the matched element set | ||
1839 | 221 | size: function() { | ||
1840 | 222 | return this.length; | ||
1841 | 223 | }, | ||
1842 | 224 | |||
1843 | 225 | toArray: function() { | ||
1844 | 226 | return slice.call( this, 0 ); | ||
1845 | 227 | }, | ||
1846 | 228 | |||
1847 | 229 | // Get the Nth element in the matched element set OR | ||
1848 | 230 | // Get the whole matched element set as a clean array | ||
1849 | 231 | get: function( num ) { | ||
1850 | 232 | return num == null ? | ||
1851 | 233 | |||
1852 | 234 | // Return a 'clean' array | ||
1853 | 235 | this.toArray() : | ||
1854 | 236 | |||
1855 | 237 | // Return just the object | ||
1856 | 238 | ( num < 0 ? this[ this.length + num ] : this[ num ] ); | ||
1857 | 239 | }, | ||
1858 | 240 | |||
1859 | 241 | // Take an array of elements and push it onto the stack | ||
1860 | 242 | // (returning the new matched element set) | ||
1861 | 243 | pushStack: function( elems, name, selector ) { | ||
1862 | 244 | // Build a new jQuery matched element set | ||
1863 | 245 | var ret = this.constructor(); | ||
1864 | 246 | |||
1865 | 247 | if ( jQuery.isArray( elems ) ) { | ||
1866 | 248 | push.apply( ret, elems ); | ||
1867 | 249 | |||
1868 | 250 | } else { | ||
1869 | 251 | jQuery.merge( ret, elems ); | ||
1870 | 252 | } | ||
1871 | 253 | |||
1872 | 254 | // Add the old object onto the stack (as a reference) | ||
1873 | 255 | ret.prevObject = this; | ||
1874 | 256 | |||
1875 | 257 | ret.context = this.context; | ||
1876 | 258 | |||
1877 | 259 | if ( name === "find" ) { | ||
1878 | 260 | ret.selector = this.selector + (this.selector ? " " : "") + selector; | ||
1879 | 261 | } else if ( name ) { | ||
1880 | 262 | ret.selector = this.selector + "." + name + "(" + selector + ")"; | ||
1881 | 263 | } | ||
1882 | 264 | |||
1883 | 265 | // Return the newly-formed element set | ||
1884 | 266 | return ret; | ||
1885 | 267 | }, | ||
1886 | 268 | |||
1887 | 269 | // Execute a callback for every element in the matched set. | ||
1888 | 270 | // (You can seed the arguments with an array of args, but this is | ||
1889 | 271 | // only used internally.) | ||
1890 | 272 | each: function( callback, args ) { | ||
1891 | 273 | return jQuery.each( this, callback, args ); | ||
1892 | 274 | }, | ||
1893 | 275 | |||
1894 | 276 | ready: function( fn ) { | ||
1895 | 277 | // Attach the listeners | ||
1896 | 278 | jQuery.bindReady(); | ||
1897 | 279 | |||
1898 | 280 | // Add the callback | ||
1899 | 281 | readyList.done( fn ); | ||
1900 | 282 | |||
1901 | 283 | return this; | ||
1902 | 284 | }, | ||
1903 | 285 | |||
1904 | 286 | eq: function( i ) { | ||
1905 | 287 | return i === -1 ? | ||
1906 | 288 | this.slice( i ) : | ||
1907 | 289 | this.slice( i, +i + 1 ); | ||
1908 | 290 | }, | ||
1909 | 291 | |||
1910 | 292 | first: function() { | ||
1911 | 293 | return this.eq( 0 ); | ||
1912 | 294 | }, | ||
1913 | 295 | |||
1914 | 296 | last: function() { | ||
1915 | 297 | return this.eq( -1 ); | ||
1916 | 298 | }, | ||
1917 | 299 | |||
1918 | 300 | slice: function() { | ||
1919 | 301 | return this.pushStack( slice.apply( this, arguments ), | ||
1920 | 302 | "slice", slice.call(arguments).join(",") ); | ||
1921 | 303 | }, | ||
1922 | 304 | |||
1923 | 305 | map: function( callback ) { | ||
1924 | 306 | return this.pushStack( jQuery.map(this, function( elem, i ) { | ||
1925 | 307 | return callback.call( elem, i, elem ); | ||
1926 | 308 | })); | ||
1927 | 309 | }, | ||
1928 | 310 | |||
1929 | 311 | end: function() { | ||
1930 | 312 | return this.prevObject || this.constructor(null); | ||
1931 | 313 | }, | ||
1932 | 314 | |||
1933 | 315 | // For internal use only. | ||
1934 | 316 | // Behaves like an Array's method, not like a jQuery method. | ||
1935 | 317 | push: push, | ||
1936 | 318 | sort: [].sort, | ||
1937 | 319 | splice: [].splice | ||
1938 | 320 | }; | ||
1939 | 321 | |||
1940 | 322 | // Give the init function the jQuery prototype for later instantiation | ||
1941 | 323 | jQuery.fn.init.prototype = jQuery.fn; | ||
1942 | 324 | |||
1943 | 325 | jQuery.extend = jQuery.fn.extend = function() { | ||
1944 | 326 | var options, name, src, copy, copyIsArray, clone, | ||
1945 | 327 | target = arguments[0] || {}, | ||
1946 | 328 | i = 1, | ||
1947 | 329 | length = arguments.length, | ||
1948 | 330 | deep = false; | ||
1949 | 331 | |||
1950 | 332 | // Handle a deep copy situation | ||
1951 | 333 | if ( typeof target === "boolean" ) { | ||
1952 | 334 | deep = target; | ||
1953 | 335 | target = arguments[1] || {}; | ||
1954 | 336 | // skip the boolean and the target | ||
1955 | 337 | i = 2; | ||
1956 | 338 | } | ||
1957 | 339 | |||
1958 | 340 | // Handle case when target is a string or something (possible in deep copy) | ||
1959 | 341 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { | ||
1960 | 342 | target = {}; | ||
1961 | 343 | } | ||
1962 | 344 | |||
1963 | 345 | // extend jQuery itself if only one argument is passed | ||
1964 | 346 | if ( length === i ) { | ||
1965 | 347 | target = this; | ||
1966 | 348 | --i; | ||
1967 | 349 | } | ||
1968 | 350 | |||
1969 | 351 | for ( ; i < length; i++ ) { | ||
1970 | 352 | // Only deal with non-null/undefined values | ||
1971 | 353 | if ( (options = arguments[ i ]) != null ) { | ||
1972 | 354 | // Extend the base object | ||
1973 | 355 | for ( name in options ) { | ||
1974 | 356 | src = target[ name ]; | ||
1975 | 357 | copy = options[ name ]; | ||
1976 | 358 | |||
1977 | 359 | // Prevent never-ending loop | ||
1978 | 360 | if ( target === copy ) { | ||
1979 | 361 | continue; | ||
1980 | 362 | } | ||
1981 | 363 | |||
1982 | 364 | // Recurse if we're merging plain objects or arrays | ||
1983 | 365 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { | ||
1984 | 366 | if ( copyIsArray ) { | ||
1985 | 367 | copyIsArray = false; | ||
1986 | 368 | clone = src && jQuery.isArray(src) ? src : []; | ||
1987 | 369 | |||
1988 | 370 | } else { | ||
1989 | 371 | clone = src && jQuery.isPlainObject(src) ? src : {}; | ||
1990 | 372 | } | ||
1991 | 373 | |||
1992 | 374 | // Never move original objects, clone them | ||
1993 | 375 | target[ name ] = jQuery.extend( deep, clone, copy ); | ||
1994 | 376 | |||
1995 | 377 | // Don't bring in undefined values | ||
1996 | 378 | } else if ( copy !== undefined ) { | ||
1997 | 379 | target[ name ] = copy; | ||
1998 | 380 | } | ||
1999 | 381 | } | ||
2000 | 382 | } | ||
2001 | 383 | } | ||
2002 | 384 | |||
2003 | 385 | // Return the modified object | ||
2004 | 386 | return target; | ||
2005 | 387 | }; | ||
2006 | 388 | |||
2007 | 389 | jQuery.extend({ | ||
2008 | 390 | noConflict: function( deep ) { | ||
2009 | 391 | if ( window.$ === jQuery ) { | ||
2010 | 392 | window.$ = _$; | ||
2011 | 393 | } | ||
2012 | 394 | |||
2013 | 395 | if ( deep && window.jQuery === jQuery ) { | ||
2014 | 396 | window.jQuery = _jQuery; | ||
2015 | 397 | } | ||
2016 | 398 | |||
2017 | 399 | return jQuery; | ||
2018 | 400 | }, | ||
2019 | 401 | |||
2020 | 402 | // Is the DOM ready to be used? Set to true once it occurs. | ||
2021 | 403 | isReady: false, | ||
2022 | 404 | |||
2023 | 405 | // A counter to track how many items to wait for before | ||
2024 | 406 | // the ready event fires. See #6781 | ||
2025 | 407 | readyWait: 1, | ||
2026 | 408 | |||
2027 | 409 | // Hold (or release) the ready event | ||
2028 | 410 | holdReady: function( hold ) { | ||
2029 | 411 | if ( hold ) { | ||
2030 | 412 | jQuery.readyWait++; | ||
2031 | 413 | } else { | ||
2032 | 414 | jQuery.ready( true ); | ||
2033 | 415 | } | ||
2034 | 416 | }, | ||
2035 | 417 | |||
2036 | 418 | // Handle when the DOM is ready | ||
2037 | 419 | ready: function( wait ) { | ||
2038 | 420 | // Either a released hold or an DOMready/load event and not yet ready | ||
2039 | 421 | if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { | ||
2040 | 422 | // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). | ||
2041 | 423 | if ( !document.body ) { | ||
2042 | 424 | return setTimeout( jQuery.ready, 1 ); | ||
2043 | 425 | } | ||
2044 | 426 | |||
2045 | 427 | // Remember that the DOM is ready | ||
2046 | 428 | jQuery.isReady = true; | ||
2047 | 429 | |||
2048 | 430 | // If a normal DOM Ready event fired, decrement, and wait if need be | ||
2049 | 431 | if ( wait !== true && --jQuery.readyWait > 0 ) { | ||
2050 | 432 | return; | ||
2051 | 433 | } | ||
2052 | 434 | |||
2053 | 435 | // If there are functions bound, to execute | ||
2054 | 436 | readyList.resolveWith( document, [ jQuery ] ); | ||
2055 | 437 | |||
2056 | 438 | // Trigger any bound ready events | ||
2057 | 439 | if ( jQuery.fn.trigger ) { | ||
2058 | 440 | jQuery( document ).trigger( "ready" ).unbind( "ready" ); | ||
2059 | 441 | } | ||
2060 | 442 | } | ||
2061 | 443 | }, | ||
2062 | 444 | |||
2063 | 445 | bindReady: function() { | ||
2064 | 446 | if ( readyList ) { | ||
2065 | 447 | return; | ||
2066 | 448 | } | ||
2067 | 449 | |||
2068 | 450 | readyList = jQuery._Deferred(); | ||
2069 | 451 | |||
2070 | 452 | // Catch cases where $(document).ready() is called after the | ||
2071 | 453 | // browser event has already occurred. | ||
2072 | 454 | if ( document.readyState === "complete" ) { | ||
2073 | 455 | // Handle it asynchronously to allow scripts the opportunity to delay ready | ||
2074 | 456 | return setTimeout( jQuery.ready, 1 ); | ||
2075 | 457 | } | ||
2076 | 458 | |||
2077 | 459 | // Mozilla, Opera and webkit nightlies currently support this event | ||
2078 | 460 | if ( document.addEventListener ) { | ||
2079 | 461 | // Use the handy event callback | ||
2080 | 462 | document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); | ||
2081 | 463 | |||
2082 | 464 | // A fallback to window.onload, that will always work | ||
2083 | 465 | window.addEventListener( "load", jQuery.ready, false ); | ||
2084 | 466 | |||
2085 | 467 | // If IE event model is used | ||
2086 | 468 | } else if ( document.attachEvent ) { | ||
2087 | 469 | // ensure firing before onload, | ||
2088 | 470 | // maybe late but safe also for iframes | ||
2089 | 471 | document.attachEvent( "onreadystatechange", DOMContentLoaded ); | ||
2090 | 472 | |||
2091 | 473 | // A fallback to window.onload, that will always work | ||
2092 | 474 | window.attachEvent( "onload", jQuery.ready ); | ||
2093 | 475 | |||
2094 | 476 | // If IE and not a frame | ||
2095 | 477 | // continually check to see if the document is ready | ||
2096 | 478 | var toplevel = false; | ||
2097 | 479 | |||
2098 | 480 | try { | ||
2099 | 481 | toplevel = window.frameElement == null; | ||
2100 | 482 | } catch(e) {} | ||
2101 | 483 | |||
2102 | 484 | if ( document.documentElement.doScroll && toplevel ) { | ||
2103 | 485 | doScrollCheck(); | ||
2104 | 486 | } | ||
2105 | 487 | } | ||
2106 | 488 | }, | ||
2107 | 489 | |||
2108 | 490 | // See test/unit/core.js for details concerning isFunction. | ||
2109 | 491 | // Since version 1.3, DOM methods and functions like alert | ||
2110 | 492 | // aren't supported. They return false on IE (#2968). | ||
2111 | 493 | isFunction: function( obj ) { | ||
2112 | 494 | return jQuery.type(obj) === "function"; | ||
2113 | 495 | }, | ||
2114 | 496 | |||
2115 | 497 | isArray: Array.isArray || function( obj ) { | ||
2116 | 498 | return jQuery.type(obj) === "array"; | ||
2117 | 499 | }, | ||
2118 | 500 | |||
2119 | 501 | // A crude way of determining if an object is a window | ||
2120 | 502 | isWindow: function( obj ) { | ||
2121 | 503 | return obj && typeof obj === "object" && "setInterval" in obj; | ||
2122 | 504 | }, | ||
2123 | 505 | |||
2124 | 506 | isNaN: function( obj ) { | ||
2125 | 507 | return obj == null || !rdigit.test( obj ) || isNaN( obj ); | ||
2126 | 508 | }, | ||
2127 | 509 | |||
2128 | 510 | type: function( obj ) { | ||
2129 | 511 | return obj == null ? | ||
2130 | 512 | String( obj ) : | ||
2131 | 513 | class2type[ toString.call(obj) ] || "object"; | ||
2132 | 514 | }, | ||
2133 | 515 | |||
2134 | 516 | isPlainObject: function( obj ) { | ||
2135 | 517 | // Must be an Object. | ||
2136 | 518 | // Because of IE, we also have to check the presence of the constructor property. | ||
2137 | 519 | // Make sure that DOM nodes and window objects don't pass through, as well | ||
2138 | 520 | if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { | ||
2139 | 521 | return false; | ||
2140 | 522 | } | ||
2141 | 523 | |||
2142 | 524 | // Not own constructor property must be Object | ||
2143 | 525 | if ( obj.constructor && | ||
2144 | 526 | !hasOwn.call(obj, "constructor") && | ||
2145 | 527 | !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { | ||
2146 | 528 | return false; | ||
2147 | 529 | } | ||
2148 | 530 | |||
2149 | 531 | // Own properties are enumerated firstly, so to speed up, | ||
2150 | 532 | // if last one is own, then all properties are own. | ||
2151 | 533 | |||
2152 | 534 | var key; | ||
2153 | 535 | for ( key in obj ) {} | ||
2154 | 536 | |||
2155 | 537 | return key === undefined || hasOwn.call( obj, key ); | ||
2156 | 538 | }, | ||
2157 | 539 | |||
2158 | 540 | isEmptyObject: function( obj ) { | ||
2159 | 541 | for ( var name in obj ) { | ||
2160 | 542 | return false; | ||
2161 | 543 | } | ||
2162 | 544 | return true; | ||
2163 | 545 | }, | ||
2164 | 546 | |||
2165 | 547 | error: function( msg ) { | ||
2166 | 548 | throw msg; | ||
2167 | 549 | }, | ||
2168 | 550 | |||
2169 | 551 | parseJSON: function( data ) { | ||
2170 | 552 | if ( typeof data !== "string" || !data ) { | ||
2171 | 553 | return null; | ||
2172 | 554 | } | ||
2173 | 555 | |||
2174 | 556 | // Make sure leading/trailing whitespace is removed (IE can't handle it) | ||
2175 | 557 | data = jQuery.trim( data ); | ||
2176 | 558 | |||
2177 | 559 | // Attempt to parse using the native JSON parser first | ||
2178 | 560 | if ( window.JSON && window.JSON.parse ) { | ||
2179 | 561 | return window.JSON.parse( data ); | ||
2180 | 562 | } | ||
2181 | 563 | |||
2182 | 564 | // Make sure the incoming data is actual JSON | ||
2183 | 565 | // Logic borrowed from http://json.org/json2.js | ||
2184 | 566 | if ( rvalidchars.test( data.replace( rvalidescape, "@" ) | ||
2185 | 567 | .replace( rvalidtokens, "]" ) | ||
2186 | 568 | .replace( rvalidbraces, "")) ) { | ||
2187 | 569 | |||
2188 | 570 | return (new Function( "return " + data ))(); | ||
2189 | 571 | |||
2190 | 572 | } | ||
2191 | 573 | jQuery.error( "Invalid JSON: " + data ); | ||
2192 | 574 | }, | ||
2193 | 575 | |||
2194 | 576 | // Cross-browser xml parsing | ||
2195 | 577 | // (xml & tmp used internally) | ||
2196 | 578 | parseXML: function( data , xml , tmp ) { | ||
2197 | 579 | |||
2198 | 580 | if ( window.DOMParser ) { // Standard | ||
2199 | 581 | tmp = new DOMParser(); | ||
2200 | 582 | xml = tmp.parseFromString( data , "text/xml" ); | ||
2201 | 583 | } else { // IE | ||
2202 | 584 | xml = new ActiveXObject( "Microsoft.XMLDOM" ); | ||
2203 | 585 | xml.async = "false"; | ||
2204 | 586 | xml.loadXML( data ); | ||
2205 | 587 | } | ||
2206 | 588 | |||
2207 | 589 | tmp = xml.documentElement; | ||
2208 | 590 | |||
2209 | 591 | if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { | ||
2210 | 592 | jQuery.error( "Invalid XML: " + data ); | ||
2211 | 593 | } | ||
2212 | 594 | |||
2213 | 595 | return xml; | ||
2214 | 596 | }, | ||
2215 | 597 | |||
2216 | 598 | noop: function() {}, | ||
2217 | 599 | |||
2218 | 600 | // Evaluates a script in a global context | ||
2219 | 601 | // Workarounds based on findings by Jim Driscoll | ||
2220 | 602 | // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context | ||
2221 | 603 | globalEval: function( data ) { | ||
2222 | 604 | if ( data && rnotwhite.test( data ) ) { | ||
2223 | 605 | // We use execScript on Internet Explorer | ||
2224 | 606 | // We use an anonymous function so that context is window | ||
2225 | 607 | // rather than jQuery in Firefox | ||
2226 | 608 | ( window.execScript || function( data ) { | ||
2227 | 609 | window[ "eval" ].call( window, data ); | ||
2228 | 610 | } )( data ); | ||
2229 | 611 | } | ||
2230 | 612 | }, | ||
2231 | 613 | |||
2232 | 614 | // Converts a dashed string to camelCased string; | ||
2233 | 615 | // Used by both the css and data modules | ||
2234 | 616 | camelCase: function( string ) { | ||
2235 | 617 | return string.replace( rdashAlpha, fcamelCase ); | ||
2236 | 618 | }, | ||
2237 | 619 | |||
2238 | 620 | nodeName: function( elem, name ) { | ||
2239 | 621 | return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); | ||
2240 | 622 | }, | ||
2241 | 623 | |||
2242 | 624 | // args is for internal usage only | ||
2243 | 625 | each: function( object, callback, args ) { | ||
2244 | 626 | var name, i = 0, | ||
2245 | 627 | length = object.length, | ||
2246 | 628 | isObj = length === undefined || jQuery.isFunction( object ); | ||
2247 | 629 | |||
2248 | 630 | if ( args ) { | ||
2249 | 631 | if ( isObj ) { | ||
2250 | 632 | for ( name in object ) { | ||
2251 | 633 | if ( callback.apply( object[ name ], args ) === false ) { | ||
2252 | 634 | break; | ||
2253 | 635 | } | ||
2254 | 636 | } | ||
2255 | 637 | } else { | ||
2256 | 638 | for ( ; i < length; ) { | ||
2257 | 639 | if ( callback.apply( object[ i++ ], args ) === false ) { | ||
2258 | 640 | break; | ||
2259 | 641 | } | ||
2260 | 642 | } | ||
2261 | 643 | } | ||
2262 | 644 | |||
2263 | 645 | // A special, fast, case for the most common use of each | ||
2264 | 646 | } else { | ||
2265 | 647 | if ( isObj ) { | ||
2266 | 648 | for ( name in object ) { | ||
2267 | 649 | if ( callback.call( object[ name ], name, object[ name ] ) === false ) { | ||
2268 | 650 | break; | ||
2269 | 651 | } | ||
2270 | 652 | } | ||
2271 | 653 | } else { | ||
2272 | 654 | for ( ; i < length; ) { | ||
2273 | 655 | if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { | ||
2274 | 656 | break; | ||
2275 | 657 | } | ||
2276 | 658 | } | ||
2277 | 659 | } | ||
2278 | 660 | } | ||
2279 | 661 | |||
2280 | 662 | return object; | ||
2281 | 663 | }, | ||
2282 | 664 | |||
2283 | 665 | // Use native String.trim function wherever possible | ||
2284 | 666 | trim: trim ? | ||
2285 | 667 | function( text ) { | ||
2286 | 668 | return text == null ? | ||
2287 | 669 | "" : | ||
2288 | 670 | trim.call( text ); | ||
2289 | 671 | } : | ||
2290 | 672 | |||
2291 | 673 | // Otherwise use our own trimming functionality | ||
2292 | 674 | function( text ) { | ||
2293 | 675 | return text == null ? | ||
2294 | 676 | "" : | ||
2295 | 677 | text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); | ||
2296 | 678 | }, | ||
2297 | 679 | |||
2298 | 680 | // results is for internal usage only | ||
2299 | 681 | makeArray: function( array, results ) { | ||
2300 | 682 | var ret = results || []; | ||
2301 | 683 | |||
2302 | 684 | if ( array != null ) { | ||
2303 | 685 | // The window, strings (and functions) also have 'length' | ||
2304 | 686 | // The extra typeof function check is to prevent crashes | ||
2305 | 687 | // in Safari 2 (See: #3039) | ||
2306 | 688 | // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 | ||
2307 | 689 | var type = jQuery.type( array ); | ||
2308 | 690 | |||
2309 | 691 | if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { | ||
2310 | 692 | push.call( ret, array ); | ||
2311 | 693 | } else { | ||
2312 | 694 | jQuery.merge( ret, array ); | ||
2313 | 695 | } | ||
2314 | 696 | } | ||
2315 | 697 | |||
2316 | 698 | return ret; | ||
2317 | 699 | }, | ||
2318 | 700 | |||
2319 | 701 | inArray: function( elem, array ) { | ||
2320 | 702 | |||
2321 | 703 | if ( indexOf ) { | ||
2322 | 704 | return indexOf.call( array, elem ); | ||
2323 | 705 | } | ||
2324 | 706 | |||
2325 | 707 | for ( var i = 0, length = array.length; i < length; i++ ) { | ||
2326 | 708 | if ( array[ i ] === elem ) { | ||
2327 | 709 | return i; | ||
2328 | 710 | } | ||
2329 | 711 | } | ||
2330 | 712 | |||
2331 | 713 | return -1; | ||
2332 | 714 | }, | ||
2333 | 715 | |||
2334 | 716 | merge: function( first, second ) { | ||
2335 | 717 | var i = first.length, | ||
2336 | 718 | j = 0; | ||
2337 | 719 | |||
2338 | 720 | if ( typeof second.length === "number" ) { | ||
2339 | 721 | for ( var l = second.length; j < l; j++ ) { | ||
2340 | 722 | first[ i++ ] = second[ j ]; | ||
2341 | 723 | } | ||
2342 | 724 | |||
2343 | 725 | } else { | ||
2344 | 726 | while ( second[j] !== undefined ) { | ||
2345 | 727 | first[ i++ ] = second[ j++ ]; | ||
2346 | 728 | } | ||
2347 | 729 | } | ||
2348 | 730 | |||
2349 | 731 | first.length = i; | ||
2350 | 732 | |||
2351 | 733 | return first; | ||
2352 | 734 | }, | ||
2353 | 735 | |||
2354 | 736 | grep: function( elems, callback, inv ) { | ||
2355 | 737 | var ret = [], retVal; | ||
2356 | 738 | inv = !!inv; | ||
2357 | 739 | |||
2358 | 740 | // Go through the array, only saving the items | ||
2359 | 741 | // that pass the validator function | ||
2360 | 742 | for ( var i = 0, length = elems.length; i < length; i++ ) { | ||
2361 | 743 | retVal = !!callback( elems[ i ], i ); | ||
2362 | 744 | if ( inv !== retVal ) { | ||
2363 | 745 | ret.push( elems[ i ] ); | ||
2364 | 746 | } | ||
2365 | 747 | } | ||
2366 | 748 | |||
2367 | 749 | return ret; | ||
2368 | 750 | }, | ||
2369 | 751 | |||
2370 | 752 | // arg is for internal usage only | ||
2371 | 753 | map: function( elems, callback, arg ) { | ||
2372 | 754 | var value, key, ret = [], | ||
2373 | 755 | i = 0, | ||
2374 | 756 | length = elems.length, | ||
2375 | 757 | // jquery objects are treated as arrays | ||
2376 | 758 | isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; | ||
2377 | 759 | |||
2378 | 760 | // Go through the array, translating each of the items to their | ||
2379 | 761 | if ( isArray ) { | ||
2380 | 762 | for ( ; i < length; i++ ) { | ||
2381 | 763 | value = callback( elems[ i ], i, arg ); | ||
2382 | 764 | |||
2383 | 765 | if ( value != null ) { | ||
2384 | 766 | ret[ ret.length ] = value; | ||
2385 | 767 | } | ||
2386 | 768 | } | ||
2387 | 769 | |||
2388 | 770 | // Go through every key on the object, | ||
2389 | 771 | } else { | ||
2390 | 772 | for ( key in elems ) { | ||
2391 | 773 | value = callback( elems[ key ], key, arg ); | ||
2392 | 774 | |||
2393 | 775 | if ( value != null ) { | ||
2394 | 776 | ret[ ret.length ] = value; | ||
2395 | 777 | } | ||
2396 | 778 | } | ||
2397 | 779 | } | ||
2398 | 780 | |||
2399 | 781 | // Flatten any nested arrays | ||
2400 | 782 | return ret.concat.apply( [], ret ); | ||
2401 | 783 | }, | ||
2402 | 784 | |||
2403 | 785 | // A global GUID counter for objects | ||
2404 | 786 | guid: 1, | ||
2405 | 787 | |||
2406 | 788 | // Bind a function to a context, optionally partially applying any | ||
2407 | 789 | // arguments. | ||
2408 | 790 | proxy: function( fn, context ) { | ||
2409 | 791 | if ( typeof context === "string" ) { | ||
2410 | 792 | var tmp = fn[ context ]; | ||
2411 | 793 | context = fn; | ||
2412 | 794 | fn = tmp; | ||
2413 | 795 | } | ||
2414 | 796 | |||
2415 | 797 | // Quick check to determine if target is callable, in the spec | ||
2416 | 798 | // this throws a TypeError, but we will just return undefined. | ||
2417 | 799 | if ( !jQuery.isFunction( fn ) ) { | ||
2418 | 800 | return undefined; | ||
2419 | 801 | } | ||
2420 | 802 | |||
2421 | 803 | // Simulated bind | ||
2422 | 804 | var args = slice.call( arguments, 2 ), | ||
2423 | 805 | proxy = function() { | ||
2424 | 806 | return fn.apply( context, args.concat( slice.call( arguments ) ) ); | ||
2425 | 807 | }; | ||
2426 | 808 | |||
2427 | 809 | // Set the guid of unique handler to the same of original handler, so it can be removed | ||
2428 | 810 | proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; | ||
2429 | 811 | |||
2430 | 812 | return proxy; | ||
2431 | 813 | }, | ||
2432 | 814 | |||
2433 | 815 | // Mutifunctional method to get and set values to a collection | ||
2434 | 816 | // The value/s can optionally be executed if it's a function | ||
2435 | 817 | access: function( elems, key, value, exec, fn, pass ) { | ||
2436 | 818 | var length = elems.length; | ||
2437 | 819 | |||
2438 | 820 | // Setting many attributes | ||
2439 | 821 | if ( typeof key === "object" ) { | ||
2440 | 822 | for ( var k in key ) { | ||
2441 | 823 | jQuery.access( elems, k, key[k], exec, fn, value ); | ||
2442 | 824 | } | ||
2443 | 825 | return elems; | ||
2444 | 826 | } | ||
2445 | 827 | |||
2446 | 828 | // Setting one attribute | ||
2447 | 829 | if ( value !== undefined ) { | ||
2448 | 830 | // Optionally, function values get executed if exec is true | ||
2449 | 831 | exec = !pass && exec && jQuery.isFunction(value); | ||
2450 | 832 | |||
2451 | 833 | for ( var i = 0; i < length; i++ ) { | ||
2452 | 834 | fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); | ||
2453 | 835 | } | ||
2454 | 836 | |||
2455 | 837 | return elems; | ||
2456 | 838 | } | ||
2457 | 839 | |||
2458 | 840 | // Getting an attribute | ||
2459 | 841 | return length ? fn( elems[0], key ) : undefined; | ||
2460 | 842 | }, | ||
2461 | 843 | |||
2462 | 844 | now: function() { | ||
2463 | 845 | return (new Date()).getTime(); | ||
2464 | 846 | }, | ||
2465 | 847 | |||
2466 | 848 | // Use of jQuery.browser is frowned upon. | ||
2467 | 849 | // More details: http://docs.jquery.com/Utilities/jQuery.browser | ||
2468 | 850 | uaMatch: function( ua ) { | ||
2469 | 851 | ua = ua.toLowerCase(); | ||
2470 | 852 | |||
2471 | 853 | var match = rwebkit.exec( ua ) || | ||
2472 | 854 | ropera.exec( ua ) || | ||
2473 | 855 | rmsie.exec( ua ) || | ||
2474 | 856 | ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || | ||
2475 | 857 | []; | ||
2476 | 858 | |||
2477 | 859 | return { browser: match[1] || "", version: match[2] || "0" }; | ||
2478 | 860 | }, | ||
2479 | 861 | |||
2480 | 862 | sub: function() { | ||
2481 | 863 | function jQuerySub( selector, context ) { | ||
2482 | 864 | return new jQuerySub.fn.init( selector, context ); | ||
2483 | 865 | } | ||
2484 | 866 | jQuery.extend( true, jQuerySub, this ); | ||
2485 | 867 | jQuerySub.superclass = this; | ||
2486 | 868 | jQuerySub.fn = jQuerySub.prototype = this(); | ||
2487 | 869 | jQuerySub.fn.constructor = jQuerySub; | ||
2488 | 870 | jQuerySub.sub = this.sub; | ||
2489 | 871 | jQuerySub.fn.init = function init( selector, context ) { | ||
2490 | 872 | if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { | ||
2491 | 873 | context = jQuerySub( context ); | ||
2492 | 874 | } | ||
2493 | 875 | |||
2494 | 876 | return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); | ||
2495 | 877 | }; | ||
2496 | 878 | jQuerySub.fn.init.prototype = jQuerySub.fn; | ||
2497 | 879 | var rootjQuerySub = jQuerySub(document); | ||
2498 | 880 | return jQuerySub; | ||
2499 | 881 | }, | ||
2500 | 882 | |||
2501 | 883 | browser: {} | ||
2502 | 884 | }); | ||
2503 | 885 | |||
2504 | 886 | // Populate the class2type map | ||
2505 | 887 | jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { | ||
2506 | 888 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); | ||
2507 | 889 | }); | ||
2508 | 890 | |||
2509 | 891 | browserMatch = jQuery.uaMatch( userAgent ); | ||
2510 | 892 | if ( browserMatch.browser ) { | ||
2511 | 893 | jQuery.browser[ browserMatch.browser ] = true; | ||
2512 | 894 | jQuery.browser.version = browserMatch.version; | ||
2513 | 895 | } | ||
2514 | 896 | |||
2515 | 897 | // Deprecated, use jQuery.browser.webkit instead | ||
2516 | 898 | if ( jQuery.browser.webkit ) { | ||
2517 | 899 | jQuery.browser.safari = true; | ||
2518 | 900 | } | ||
2519 | 901 | |||
2520 | 902 | // IE doesn't match non-breaking spaces with \s | ||
2521 | 903 | if ( rnotwhite.test( "\xA0" ) ) { | ||
2522 | 904 | trimLeft = /^[\s\xA0]+/; | ||
2523 | 905 | trimRight = /[\s\xA0]+$/; | ||
2524 | 906 | } | ||
2525 | 907 | |||
2526 | 908 | // All jQuery objects should point back to these | ||
2527 | 909 | rootjQuery = jQuery(document); | ||
2528 | 910 | |||
2529 | 911 | // Cleanup functions for the document ready method | ||
2530 | 912 | if ( document.addEventListener ) { | ||
2531 | 913 | DOMContentLoaded = function() { | ||
2532 | 914 | document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); | ||
2533 | 915 | jQuery.ready(); | ||
2534 | 916 | }; | ||
2535 | 917 | |||
2536 | 918 | } else if ( document.attachEvent ) { | ||
2537 | 919 | DOMContentLoaded = function() { | ||
2538 | 920 | // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). | ||
2539 | 921 | if ( document.readyState === "complete" ) { | ||
2540 | 922 | document.detachEvent( "onreadystatechange", DOMContentLoaded ); | ||
2541 | 923 | jQuery.ready(); | ||
2542 | 924 | } | ||
2543 | 925 | }; | ||
2544 | 926 | } | ||
2545 | 927 | |||
2546 | 928 | // The DOM ready check for Internet Explorer | ||
2547 | 929 | function doScrollCheck() { | ||
2548 | 930 | if ( jQuery.isReady ) { | ||
2549 | 931 | return; | ||
2550 | 932 | } | ||
2551 | 933 | |||
2552 | 934 | try { | ||
2553 | 935 | // If IE is used, use the trick by Diego Perini | ||
2554 | 936 | // http://javascript.nwbox.com/IEContentLoaded/ | ||
2555 | 937 | document.documentElement.doScroll("left"); | ||
2556 | 938 | } catch(e) { | ||
2557 | 939 | setTimeout( doScrollCheck, 1 ); | ||
2558 | 940 | return; | ||
2559 | 941 | } | ||
2560 | 942 | |||
2561 | 943 | // and execute any waiting functions | ||
2562 | 944 | jQuery.ready(); | ||
2563 | 945 | } | ||
2564 | 946 | |||
2565 | 947 | return jQuery; | ||
2566 | 948 | |||
2567 | 949 | })(); | ||
2568 | 950 | |||
2569 | 951 | |||
2570 | 952 | var // Promise methods | ||
2571 | 953 | promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), | ||
2572 | 954 | // Static reference to slice | ||
2573 | 955 | sliceDeferred = [].slice; | ||
2574 | 956 | |||
2575 | 957 | jQuery.extend({ | ||
2576 | 958 | // Create a simple deferred (one callbacks list) | ||
2577 | 959 | _Deferred: function() { | ||
2578 | 960 | var // callbacks list | ||
2579 | 961 | callbacks = [], | ||
2580 | 962 | // stored [ context , args ] | ||
2581 | 963 | fired, | ||
2582 | 964 | // to avoid firing when already doing so | ||
2583 | 965 | firing, | ||
2584 | 966 | // flag to know if the deferred has been cancelled | ||
2585 | 967 | cancelled, | ||
2586 | 968 | // the deferred itself | ||
2587 | 969 | deferred = { | ||
2588 | 970 | |||
2589 | 971 | // done( f1, f2, ...) | ||
2590 | 972 | done: function() { | ||
2591 | 973 | if ( !cancelled ) { | ||
2592 | 974 | var args = arguments, | ||
2593 | 975 | i, | ||
2594 | 976 | length, | ||
2595 | 977 | elem, | ||
2596 | 978 | type, | ||
2597 | 979 | _fired; | ||
2598 | 980 | if ( fired ) { | ||
2599 | 981 | _fired = fired; | ||
2600 | 982 | fired = 0; | ||
2601 | 983 | } | ||
2602 | 984 | for ( i = 0, length = args.length; i < length; i++ ) { | ||
2603 | 985 | elem = args[ i ]; | ||
2604 | 986 | type = jQuery.type( elem ); | ||
2605 | 987 | if ( type === "array" ) { | ||
2606 | 988 | deferred.done.apply( deferred, elem ); | ||
2607 | 989 | } else if ( type === "function" ) { | ||
2608 | 990 | callbacks.push( elem ); | ||
2609 | 991 | } | ||
2610 | 992 | } | ||
2611 | 993 | if ( _fired ) { | ||
2612 | 994 | deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); | ||
2613 | 995 | } | ||
2614 | 996 | } | ||
2615 | 997 | return this; | ||
2616 | 998 | }, | ||
2617 | 999 | |||
2618 | 1000 | // resolve with given context and args | ||
2619 | 1001 | resolveWith: function( context, args ) { | ||
2620 | 1002 | if ( !cancelled && !fired && !firing ) { | ||
2621 | 1003 | // make sure args are available (#8421) | ||
2622 | 1004 | args = args || []; | ||
2623 | 1005 | firing = 1; | ||
2624 | 1006 | try { | ||
2625 | 1007 | while( callbacks[ 0 ] ) { | ||
2626 | 1008 | callbacks.shift().apply( context, args ); | ||
2627 | 1009 | } | ||
2628 | 1010 | } | ||
2629 | 1011 | finally { | ||
2630 | 1012 | fired = [ context, args ]; | ||
2631 | 1013 | firing = 0; | ||
2632 | 1014 | } | ||
2633 | 1015 | } | ||
2634 | 1016 | return this; | ||
2635 | 1017 | }, | ||
2636 | 1018 | |||
2637 | 1019 | // resolve with this as context and given arguments | ||
2638 | 1020 | resolve: function() { | ||
2639 | 1021 | deferred.resolveWith( this, arguments ); | ||
2640 | 1022 | return this; | ||
2641 | 1023 | }, | ||
2642 | 1024 | |||
2643 | 1025 | // Has this deferred been resolved? | ||
2644 | 1026 | isResolved: function() { | ||
2645 | 1027 | return !!( firing || fired ); | ||
2646 | 1028 | }, | ||
2647 | 1029 | |||
2648 | 1030 | // Cancel | ||
2649 | 1031 | cancel: function() { | ||
2650 | 1032 | cancelled = 1; | ||
2651 | 1033 | callbacks = []; | ||
2652 | 1034 | return this; | ||
2653 | 1035 | } | ||
2654 | 1036 | }; | ||
2655 | 1037 | |||
2656 | 1038 | return deferred; | ||
2657 | 1039 | }, | ||
2658 | 1040 | |||
2659 | 1041 | // Full fledged deferred (two callbacks list) | ||
2660 | 1042 | Deferred: function( func ) { | ||
2661 | 1043 | var deferred = jQuery._Deferred(), | ||
2662 | 1044 | failDeferred = jQuery._Deferred(), | ||
2663 | 1045 | promise; | ||
2664 | 1046 | // Add errorDeferred methods, then and promise | ||
2665 | 1047 | jQuery.extend( deferred, { | ||
2666 | 1048 | then: function( doneCallbacks, failCallbacks ) { | ||
2667 | 1049 | deferred.done( doneCallbacks ).fail( failCallbacks ); | ||
2668 | 1050 | return this; | ||
2669 | 1051 | }, | ||
2670 | 1052 | always: function() { | ||
2671 | 1053 | return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); | ||
2672 | 1054 | }, | ||
2673 | 1055 | fail: failDeferred.done, | ||
2674 | 1056 | rejectWith: failDeferred.resolveWith, | ||
2675 | 1057 | reject: failDeferred.resolve, | ||
2676 | 1058 | isRejected: failDeferred.isResolved, | ||
2677 | 1059 | pipe: function( fnDone, fnFail ) { | ||
2678 | 1060 | return jQuery.Deferred(function( newDefer ) { | ||
2679 | 1061 | jQuery.each( { | ||
2680 | 1062 | done: [ fnDone, "resolve" ], | ||
2681 | 1063 | fail: [ fnFail, "reject" ] | ||
2682 | 1064 | }, function( handler, data ) { | ||
2683 | 1065 | var fn = data[ 0 ], | ||
2684 | 1066 | action = data[ 1 ], | ||
2685 | 1067 | returned; | ||
2686 | 1068 | if ( jQuery.isFunction( fn ) ) { | ||
2687 | 1069 | deferred[ handler ](function() { | ||
2688 | 1070 | returned = fn.apply( this, arguments ); | ||
2689 | 1071 | if ( returned && jQuery.isFunction( returned.promise ) ) { | ||
2690 | 1072 | returned.promise().then( newDefer.resolve, newDefer.reject ); | ||
2691 | 1073 | } else { | ||
2692 | 1074 | newDefer[ action ]( returned ); | ||
2693 | 1075 | } | ||
2694 | 1076 | }); | ||
2695 | 1077 | } else { | ||
2696 | 1078 | deferred[ handler ]( newDefer[ action ] ); | ||
2697 | 1079 | } | ||
2698 | 1080 | }); | ||
2699 | 1081 | }).promise(); | ||
2700 | 1082 | }, | ||
2701 | 1083 | // Get a promise for this deferred | ||
2702 | 1084 | // If obj is provided, the promise aspect is added to the object | ||
2703 | 1085 | promise: function( obj ) { | ||
2704 | 1086 | if ( obj == null ) { | ||
2705 | 1087 | if ( promise ) { | ||
2706 | 1088 | return promise; | ||
2707 | 1089 | } | ||
2708 | 1090 | promise = obj = {}; | ||
2709 | 1091 | } | ||
2710 | 1092 | var i = promiseMethods.length; | ||
2711 | 1093 | while( i-- ) { | ||
2712 | 1094 | obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; | ||
2713 | 1095 | } | ||
2714 | 1096 | return obj; | ||
2715 | 1097 | } | ||
2716 | 1098 | }); | ||
2717 | 1099 | // Make sure only one callback list will be used | ||
2718 | 1100 | deferred.done( failDeferred.cancel ).fail( deferred.cancel ); | ||
2719 | 1101 | // Unexpose cancel | ||
2720 | 1102 | delete deferred.cancel; | ||
2721 | 1103 | // Call given func if any | ||
2722 | 1104 | if ( func ) { | ||
2723 | 1105 | func.call( deferred, deferred ); | ||
2724 | 1106 | } | ||
2725 | 1107 | return deferred; | ||
2726 | 1108 | }, | ||
2727 | 1109 | |||
2728 | 1110 | // Deferred helper | ||
2729 | 1111 | when: function( firstParam ) { | ||
2730 | 1112 | var args = arguments, | ||
2731 | 1113 | i = 0, | ||
2732 | 1114 | length = args.length, | ||
2733 | 1115 | count = length, | ||
2734 | 1116 | deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? | ||
2735 | 1117 | firstParam : | ||
2736 | 1118 | jQuery.Deferred(); | ||
2737 | 1119 | function resolveFunc( i ) { | ||
2738 | 1120 | return function( value ) { | ||
2739 | 1121 | args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; | ||
2740 | 1122 | if ( !( --count ) ) { | ||
2741 | 1123 | // Strange bug in FF4: | ||
2742 | 1124 | // Values changed onto the arguments object sometimes end up as undefined values | ||
2743 | 1125 | // outside the $.when method. Cloning the object into a fresh array solves the issue | ||
2744 | 1126 | deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); | ||
2745 | 1127 | } | ||
2746 | 1128 | }; | ||
2747 | 1129 | } | ||
2748 | 1130 | if ( length > 1 ) { | ||
2749 | 1131 | for( ; i < length; i++ ) { | ||
2750 | 1132 | if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { | ||
2751 | 1133 | args[ i ].promise().then( resolveFunc(i), deferred.reject ); | ||
2752 | 1134 | } else { | ||
2753 | 1135 | --count; | ||
2754 | 1136 | } | ||
2755 | 1137 | } | ||
2756 | 1138 | if ( !count ) { | ||
2757 | 1139 | deferred.resolveWith( deferred, args ); | ||
2758 | 1140 | } | ||
2759 | 1141 | } else if ( deferred !== firstParam ) { | ||
2760 | 1142 | deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); | ||
2761 | 1143 | } | ||
2762 | 1144 | return deferred.promise(); | ||
2763 | 1145 | } | ||
2764 | 1146 | }); | ||
2765 | 1147 | |||
2766 | 1148 | |||
2767 | 1149 | |||
2768 | 1150 | jQuery.support = (function() { | ||
2769 | 1151 | |||
2770 | 1152 | var div = document.createElement( "div" ), | ||
2771 | 1153 | documentElement = document.documentElement, | ||
2772 | 1154 | all, | ||
2773 | 1155 | a, | ||
2774 | 1156 | select, | ||
2775 | 1157 | opt, | ||
2776 | 1158 | input, | ||
2777 | 1159 | marginDiv, | ||
2778 | 1160 | support, | ||
2779 | 1161 | fragment, | ||
2780 | 1162 | body, | ||
2781 | 1163 | testElementParent, | ||
2782 | 1164 | testElement, | ||
2783 | 1165 | testElementStyle, | ||
2784 | 1166 | tds, | ||
2785 | 1167 | events, | ||
2786 | 1168 | eventName, | ||
2787 | 1169 | i, | ||
2788 | 1170 | isSupported; | ||
2789 | 1171 | |||
2790 | 1172 | // Preliminary tests | ||
2791 | 1173 | div.setAttribute("className", "t"); | ||
2792 | 1174 | div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; | ||
2793 | 1175 | |||
2794 | 1176 | all = div.getElementsByTagName( "*" ); | ||
2795 | 1177 | a = div.getElementsByTagName( "a" )[ 0 ]; | ||
2796 | 1178 | |||
2797 | 1179 | // Can't get basic test support | ||
2798 | 1180 | if ( !all || !all.length || !a ) { | ||
2799 | 1181 | return {}; | ||
2800 | 1182 | } | ||
2801 | 1183 | |||
2802 | 1184 | // First batch of supports tests | ||
2803 | 1185 | select = document.createElement( "select" ); | ||
2804 | 1186 | opt = select.appendChild( document.createElement("option") ); | ||
2805 | 1187 | input = div.getElementsByTagName( "input" )[ 0 ]; | ||
2806 | 1188 | |||
2807 | 1189 | support = { | ||
2808 | 1190 | // IE strips leading whitespace when .innerHTML is used | ||
2809 | 1191 | leadingWhitespace: ( div.firstChild.nodeType === 3 ), | ||
2810 | 1192 | |||
2811 | 1193 | // Make sure that tbody elements aren't automatically inserted | ||
2812 | 1194 | // IE will insert them into empty tables | ||
2813 | 1195 | tbody: !div.getElementsByTagName( "tbody" ).length, | ||
2814 | 1196 | |||
2815 | 1197 | // Make sure that link elements get serialized correctly by innerHTML | ||
2816 | 1198 | // This requires a wrapper element in IE | ||
2817 | 1199 | htmlSerialize: !!div.getElementsByTagName( "link" ).length, | ||
2818 | 1200 | |||
2819 | 1201 | // Get the style information from getAttribute | ||
2820 | 1202 | // (IE uses .cssText instead) | ||
2821 | 1203 | style: /top/.test( a.getAttribute("style") ), | ||
2822 | 1204 | |||
2823 | 1205 | // Make sure that URLs aren't manipulated | ||
2824 | 1206 | // (IE normalizes it by default) | ||
2825 | 1207 | hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), | ||
2826 | 1208 | |||
2827 | 1209 | // Make sure that element opacity exists | ||
2828 | 1210 | // (IE uses filter instead) | ||
2829 | 1211 | // Use a regex to work around a WebKit issue. See #5145 | ||
2830 | 1212 | opacity: /^0.55$/.test( a.style.opacity ), | ||
2831 | 1213 | |||
2832 | 1214 | // Verify style float existence | ||
2833 | 1215 | // (IE uses styleFloat instead of cssFloat) | ||
2834 | 1216 | cssFloat: !!a.style.cssFloat, | ||
2835 | 1217 | |||
2836 | 1218 | // Make sure that if no value is specified for a checkbox | ||
2837 | 1219 | // that it defaults to "on". | ||
2838 | 1220 | // (WebKit defaults to "" instead) | ||
2839 | 1221 | checkOn: ( input.value === "on" ), | ||
2840 | 1222 | |||
2841 | 1223 | // Make sure that a selected-by-default option has a working selected property. | ||
2842 | 1224 | // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) | ||
2843 | 1225 | optSelected: opt.selected, | ||
2844 | 1226 | |||
2845 | 1227 | // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) | ||
2846 | 1228 | getSetAttribute: div.className !== "t", | ||
2847 | 1229 | |||
2848 | 1230 | // Will be defined later | ||
2849 | 1231 | submitBubbles: true, | ||
2850 | 1232 | changeBubbles: true, | ||
2851 | 1233 | focusinBubbles: false, | ||
2852 | 1234 | deleteExpando: true, | ||
2853 | 1235 | noCloneEvent: true, | ||
2854 | 1236 | inlineBlockNeedsLayout: false, | ||
2855 | 1237 | shrinkWrapBlocks: false, | ||
2856 | 1238 | reliableMarginRight: true | ||
2857 | 1239 | }; | ||
2858 | 1240 | |||
2859 | 1241 | // Make sure checked status is properly cloned | ||
2860 | 1242 | input.checked = true; | ||
2861 | 1243 | support.noCloneChecked = input.cloneNode( true ).checked; | ||
2862 | 1244 | |||
2863 | 1245 | // Make sure that the options inside disabled selects aren't marked as disabled | ||
2864 | 1246 | // (WebKit marks them as disabled) | ||
2865 | 1247 | select.disabled = true; | ||
2866 | 1248 | support.optDisabled = !opt.disabled; | ||
2867 | 1249 | |||
2868 | 1250 | // Test to see if it's possible to delete an expando from an element | ||
2869 | 1251 | // Fails in Internet Explorer | ||
2870 | 1252 | try { | ||
2871 | 1253 | delete div.test; | ||
2872 | 1254 | } catch( e ) { | ||
2873 | 1255 | support.deleteExpando = false; | ||
2874 | 1256 | } | ||
2875 | 1257 | |||
2876 | 1258 | if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { | ||
2877 | 1259 | div.attachEvent( "onclick", function() { | ||
2878 | 1260 | // Cloning a node shouldn't copy over any | ||
2879 | 1261 | // bound event handlers (IE does this) | ||
2880 | 1262 | support.noCloneEvent = false; | ||
2881 | 1263 | }); | ||
2882 | 1264 | div.cloneNode( true ).fireEvent( "onclick" ); | ||
2883 | 1265 | } | ||
2884 | 1266 | |||
2885 | 1267 | // Check if a radio maintains it's value | ||
2886 | 1268 | // after being appended to the DOM | ||
2887 | 1269 | input = document.createElement("input"); | ||
2888 | 1270 | input.value = "t"; | ||
2889 | 1271 | input.setAttribute("type", "radio"); | ||
2890 | 1272 | support.radioValue = input.value === "t"; | ||
2891 | 1273 | |||
2892 | 1274 | input.setAttribute("checked", "checked"); | ||
2893 | 1275 | div.appendChild( input ); | ||
2894 | 1276 | fragment = document.createDocumentFragment(); | ||
2895 | 1277 | fragment.appendChild( div.firstChild ); | ||
2896 | 1278 | |||
2897 | 1279 | // WebKit doesn't clone checked state correctly in fragments | ||
2898 | 1280 | support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; | ||
2899 | 1281 | |||
2900 | 1282 | div.innerHTML = ""; | ||
2901 | 1283 | |||
2902 | 1284 | // Figure out if the W3C box model works as expected | ||
2903 | 1285 | div.style.width = div.style.paddingLeft = "1px"; | ||
2904 | 1286 | |||
2905 | 1287 | body = document.getElementsByTagName( "body" )[ 0 ]; | ||
2906 | 1288 | // We use our own, invisible, body unless the body is already present | ||
2907 | 1289 | // in which case we use a div (#9239) | ||
2908 | 1290 | testElement = document.createElement( body ? "div" : "body" ); | ||
2909 | 1291 | testElementStyle = { | ||
2910 | 1292 | visibility: "hidden", | ||
2911 | 1293 | width: 0, | ||
2912 | 1294 | height: 0, | ||
2913 | 1295 | border: 0, | ||
2914 | 1296 | margin: 0 | ||
2915 | 1297 | }; | ||
2916 | 1298 | if ( body ) { | ||
2917 | 1299 | jQuery.extend( testElementStyle, { | ||
2918 | 1300 | position: "absolute", | ||
2919 | 1301 | left: -1000, | ||
2920 | 1302 | top: -1000 | ||
2921 | 1303 | }); | ||
2922 | 1304 | } | ||
2923 | 1305 | for ( i in testElementStyle ) { | ||
2924 | 1306 | testElement.style[ i ] = testElementStyle[ i ]; | ||
2925 | 1307 | } | ||
2926 | 1308 | testElement.appendChild( div ); | ||
2927 | 1309 | testElementParent = body || documentElement; | ||
2928 | 1310 | testElementParent.insertBefore( testElement, testElementParent.firstChild ); | ||
2929 | 1311 | |||
2930 | 1312 | // Check if a disconnected checkbox will retain its checked | ||
2931 | 1313 | // value of true after appended to the DOM (IE6/7) | ||
2932 | 1314 | support.appendChecked = input.checked; | ||
2933 | 1315 | |||
2934 | 1316 | support.boxModel = div.offsetWidth === 2; | ||
2935 | 1317 | |||
2936 | 1318 | if ( "zoom" in div.style ) { | ||
2937 | 1319 | // Check if natively block-level elements act like inline-block | ||
2938 | 1320 | // elements when setting their display to 'inline' and giving | ||
2939 | 1321 | // them layout | ||
2940 | 1322 | // (IE < 8 does this) | ||
2941 | 1323 | div.style.display = "inline"; | ||
2942 | 1324 | div.style.zoom = 1; | ||
2943 | 1325 | support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); | ||
2944 | 1326 | |||
2945 | 1327 | // Check if elements with layout shrink-wrap their children | ||
2946 | 1328 | // (IE 6 does this) | ||
2947 | 1329 | div.style.display = ""; | ||
2948 | 1330 | div.innerHTML = "<div style='width:4px;'></div>"; | ||
2949 | 1331 | support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); | ||
2950 | 1332 | } | ||
2951 | 1333 | |||
2952 | 1334 | div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; | ||
2953 | 1335 | tds = div.getElementsByTagName( "td" ); | ||
2954 | 1336 | |||
2955 | 1337 | // Check if table cells still have offsetWidth/Height when they are set | ||
2956 | 1338 | // to display:none and there are still other visible table cells in a | ||
2957 | 1339 | // table row; if so, offsetWidth/Height are not reliable for use when | ||
2958 | 1340 | // determining if an element has been hidden directly using | ||
2959 | 1341 | // display:none (it is still safe to use offsets if a parent element is | ||
2960 | 1342 | // hidden; don safety goggles and see bug #4512 for more information). | ||
2961 | 1343 | // (only IE 8 fails this test) | ||
2962 | 1344 | isSupported = ( tds[ 0 ].offsetHeight === 0 ); | ||
2963 | 1345 | |||
2964 | 1346 | tds[ 0 ].style.display = ""; | ||
2965 | 1347 | tds[ 1 ].style.display = "none"; | ||
2966 | 1348 | |||
2967 | 1349 | // Check if empty table cells still have offsetWidth/Height | ||
2968 | 1350 | // (IE < 8 fail this test) | ||
2969 | 1351 | support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); | ||
2970 | 1352 | div.innerHTML = ""; | ||
2971 | 1353 | |||
2972 | 1354 | // Check if div with explicit width and no margin-right incorrectly | ||
2973 | 1355 | // gets computed margin-right based on width of container. For more | ||
2974 | 1356 | // info see bug #3333 | ||
2975 | 1357 | // Fails in WebKit before Feb 2011 nightlies | ||
2976 | 1358 | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | ||
2977 | 1359 | if ( document.defaultView && document.defaultView.getComputedStyle ) { | ||
2978 | 1360 | marginDiv = document.createElement( "div" ); | ||
2979 | 1361 | marginDiv.style.width = "0"; | ||
2980 | 1362 | marginDiv.style.marginRight = "0"; | ||
2981 | 1363 | div.appendChild( marginDiv ); | ||
2982 | 1364 | support.reliableMarginRight = | ||
2983 | 1365 | ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; | ||
2984 | 1366 | } | ||
2985 | 1367 | |||
2986 | 1368 | // Remove the body element we added | ||
2987 | 1369 | testElement.innerHTML = ""; | ||
2988 | 1370 | testElementParent.removeChild( testElement ); | ||
2989 | 1371 | |||
2990 | 1372 | // Technique from Juriy Zaytsev | ||
2991 | 1373 | // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ | ||
2992 | 1374 | // We only care about the case where non-standard event systems | ||
2993 | 1375 | // are used, namely in IE. Short-circuiting here helps us to | ||
2994 | 1376 | // avoid an eval call (in setAttribute) which can cause CSP | ||
2995 | 1377 | // to go haywire. See: https://developer.mozilla.org/en/Security/CSP | ||
2996 | 1378 | if ( div.attachEvent ) { | ||
2997 | 1379 | for( i in { | ||
2998 | 1380 | submit: 1, | ||
2999 | 1381 | change: 1, | ||
3000 | 1382 | focusin: 1 | ||
3001 | 1383 | } ) { | ||
3002 | 1384 | eventName = "on" + i; | ||
3003 | 1385 | isSupported = ( eventName in div ); | ||
3004 | 1386 | if ( !isSupported ) { | ||
3005 | 1387 | div.setAttribute( eventName, "return;" ); | ||
3006 | 1388 | isSupported = ( typeof div[ eventName ] === "function" ); | ||
3007 | 1389 | } | ||
3008 | 1390 | support[ i + "Bubbles" ] = isSupported; | ||
3009 | 1391 | } | ||
3010 | 1392 | } | ||
3011 | 1393 | |||
3012 | 1394 | // Null connected elements to avoid leaks in IE | ||
3013 | 1395 | testElement = fragment = select = opt = body = marginDiv = div = input = null; | ||
3014 | 1396 | |||
3015 | 1397 | return support; | ||
3016 | 1398 | })(); | ||
3017 | 1399 | |||
3018 | 1400 | // Keep track of boxModel | ||
3019 | 1401 | jQuery.boxModel = jQuery.support.boxModel; | ||
3020 | 1402 | |||
3021 | 1403 | |||
3022 | 1404 | |||
3023 | 1405 | |||
3024 | 1406 | var rbrace = /^(?:\{.*\}|\[.*\])$/, | ||
3025 | 1407 | rmultiDash = /([a-z])([A-Z])/g; | ||
3026 | 1408 | |||
3027 | 1409 | jQuery.extend({ | ||
3028 | 1410 | cache: {}, | ||
3029 | 1411 | |||
3030 | 1412 | // Please use with caution | ||
3031 | 1413 | uuid: 0, | ||
3032 | 1414 | |||
3033 | 1415 | // Unique for each copy of jQuery on the page | ||
3034 | 1416 | // Non-digits removed to match rinlinejQuery | ||
3035 | 1417 | expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), | ||
3036 | 1418 | |||
3037 | 1419 | // The following elements throw uncatchable exceptions if you | ||
3038 | 1420 | // attempt to add expando properties to them. | ||
3039 | 1421 | noData: { | ||
3040 | 1422 | "embed": true, | ||
3041 | 1423 | // Ban all objects except for Flash (which handle expandos) | ||
3042 | 1424 | "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", | ||
3043 | 1425 | "applet": true | ||
3044 | 1426 | }, | ||
3045 | 1427 | |||
3046 | 1428 | hasData: function( elem ) { | ||
3047 | 1429 | elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; | ||
3048 | 1430 | |||
3049 | 1431 | return !!elem && !isEmptyDataObject( elem ); | ||
3050 | 1432 | }, | ||
3051 | 1433 | |||
3052 | 1434 | data: function( elem, name, data, pvt /* Internal Use Only */ ) { | ||
3053 | 1435 | if ( !jQuery.acceptData( elem ) ) { | ||
3054 | 1436 | return; | ||
3055 | 1437 | } | ||
3056 | 1438 | |||
3057 | 1439 | var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, | ||
3058 | 1440 | |||
3059 | 1441 | // We have to handle DOM nodes and JS objects differently because IE6-7 | ||
3060 | 1442 | // can't GC object references properly across the DOM-JS boundary | ||
3061 | 1443 | isNode = elem.nodeType, | ||
3062 | 1444 | |||
3063 | 1445 | // Only DOM nodes need the global jQuery cache; JS object data is | ||
3064 | 1446 | // attached directly to the object so GC can occur automatically | ||
3065 | 1447 | cache = isNode ? jQuery.cache : elem, | ||
3066 | 1448 | |||
3067 | 1449 | // Only defining an ID for JS objects if its cache already exists allows | ||
3068 | 1450 | // the code to shortcut on the same path as a DOM node with no cache | ||
3069 | 1451 | id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; | ||
3070 | 1452 | |||
3071 | 1453 | // Avoid doing any more work than we need to when trying to get data on an | ||
3072 | 1454 | // object that has no data at all | ||
3073 | 1455 | if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { | ||
3074 | 1456 | return; | ||
3075 | 1457 | } | ||
3076 | 1458 | |||
3077 | 1459 | if ( !id ) { | ||
3078 | 1460 | // Only DOM nodes need a new unique ID for each element since their data | ||
3079 | 1461 | // ends up in the global cache | ||
3080 | 1462 | if ( isNode ) { | ||
3081 | 1463 | elem[ jQuery.expando ] = id = ++jQuery.uuid; | ||
3082 | 1464 | } else { | ||
3083 | 1465 | id = jQuery.expando; | ||
3084 | 1466 | } | ||
3085 | 1467 | } | ||
3086 | 1468 | |||
3087 | 1469 | if ( !cache[ id ] ) { | ||
3088 | 1470 | cache[ id ] = {}; | ||
3089 | 1471 | |||
3090 | 1472 | // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery | ||
3091 | 1473 | // metadata on plain JS objects when the object is serialized using | ||
3092 | 1474 | // JSON.stringify | ||
3093 | 1475 | if ( !isNode ) { | ||
3094 | 1476 | cache[ id ].toJSON = jQuery.noop; | ||
3095 | 1477 | } | ||
3096 | 1478 | } | ||
3097 | 1479 | |||
3098 | 1480 | // An object can be passed to jQuery.data instead of a key/value pair; this gets | ||
3099 | 1481 | // shallow copied over onto the existing cache | ||
3100 | 1482 | if ( typeof name === "object" || typeof name === "function" ) { | ||
3101 | 1483 | if ( pvt ) { | ||
3102 | 1484 | cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); | ||
3103 | 1485 | } else { | ||
3104 | 1486 | cache[ id ] = jQuery.extend(cache[ id ], name); | ||
3105 | 1487 | } | ||
3106 | 1488 | } | ||
3107 | 1489 | |||
3108 | 1490 | thisCache = cache[ id ]; | ||
3109 | 1491 | |||
3110 | 1492 | // Internal jQuery data is stored in a separate object inside the object's data | ||
3111 | 1493 | // cache in order to avoid key collisions between internal data and user-defined | ||
3112 | 1494 | // data | ||
3113 | 1495 | if ( pvt ) { | ||
3114 | 1496 | if ( !thisCache[ internalKey ] ) { | ||
3115 | 1497 | thisCache[ internalKey ] = {}; | ||
3116 | 1498 | } | ||
3117 | 1499 | |||
3118 | 1500 | thisCache = thisCache[ internalKey ]; | ||
3119 | 1501 | } | ||
3120 | 1502 | |||
3121 | 1503 | if ( data !== undefined ) { | ||
3122 | 1504 | thisCache[ jQuery.camelCase( name ) ] = data; | ||
3123 | 1505 | } | ||
3124 | 1506 | |||
3125 | 1507 | // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should | ||
3126 | 1508 | // not attempt to inspect the internal events object using jQuery.data, as this | ||
3127 | 1509 | // internal data object is undocumented and subject to change. | ||
3128 | 1510 | if ( name === "events" && !thisCache[name] ) { | ||
3129 | 1511 | return thisCache[ internalKey ] && thisCache[ internalKey ].events; | ||
3130 | 1512 | } | ||
3131 | 1513 | |||
3132 | 1514 | return getByName ? | ||
3133 | 1515 | // Check for both converted-to-camel and non-converted data property names | ||
3134 | 1516 | thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] : | ||
3135 | 1517 | thisCache; | ||
3136 | 1518 | }, | ||
3137 | 1519 | |||
3138 | 1520 | removeData: function( elem, name, pvt /* Internal Use Only */ ) { | ||
3139 | 1521 | if ( !jQuery.acceptData( elem ) ) { | ||
3140 | 1522 | return; | ||
3141 | 1523 | } | ||
3142 | 1524 | |||
3143 | 1525 | var internalKey = jQuery.expando, isNode = elem.nodeType, | ||
3144 | 1526 | |||
3145 | 1527 | // See jQuery.data for more information | ||
3146 | 1528 | cache = isNode ? jQuery.cache : elem, | ||
3147 | 1529 | |||
3148 | 1530 | // See jQuery.data for more information | ||
3149 | 1531 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; | ||
3150 | 1532 | |||
3151 | 1533 | // If there is already no cache entry for this object, there is no | ||
3152 | 1534 | // purpose in continuing | ||
3153 | 1535 | if ( !cache[ id ] ) { | ||
3154 | 1536 | return; | ||
3155 | 1537 | } | ||
3156 | 1538 | |||
3157 | 1539 | if ( name ) { | ||
3158 | 1540 | var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; | ||
3159 | 1541 | |||
3160 | 1542 | if ( thisCache ) { | ||
3161 | 1543 | delete thisCache[ name ]; | ||
3162 | 1544 | |||
3163 | 1545 | // If there is no data left in the cache, we want to continue | ||
3164 | 1546 | // and let the cache object itself get destroyed | ||
3165 | 1547 | if ( !isEmptyDataObject(thisCache) ) { | ||
3166 | 1548 | return; | ||
3167 | 1549 | } | ||
3168 | 1550 | } | ||
3169 | 1551 | } | ||
3170 | 1552 | |||
3171 | 1553 | // See jQuery.data for more information | ||
3172 | 1554 | if ( pvt ) { | ||
3173 | 1555 | delete cache[ id ][ internalKey ]; | ||
3174 | 1556 | |||
3175 | 1557 | // Don't destroy the parent cache unless the internal data object | ||
3176 | 1558 | // had been the only thing left in it | ||
3177 | 1559 | if ( !isEmptyDataObject(cache[ id ]) ) { | ||
3178 | 1560 | return; | ||
3179 | 1561 | } | ||
3180 | 1562 | } | ||
3181 | 1563 | |||
3182 | 1564 | var internalCache = cache[ id ][ internalKey ]; | ||
3183 | 1565 | |||
3184 | 1566 | // Browsers that fail expando deletion also refuse to delete expandos on | ||
3185 | 1567 | // the window, but it will allow it on all other JS objects; other browsers | ||
3186 | 1568 | // don't care | ||
3187 | 1569 | if ( jQuery.support.deleteExpando || cache != window ) { | ||
3188 | 1570 | delete cache[ id ]; | ||
3189 | 1571 | } else { | ||
3190 | 1572 | cache[ id ] = null; | ||
3191 | 1573 | } | ||
3192 | 1574 | |||
3193 | 1575 | // We destroyed the entire user cache at once because it's faster than | ||
3194 | 1576 | // iterating through each key, but we need to continue to persist internal | ||
3195 | 1577 | // data if it existed | ||
3196 | 1578 | if ( internalCache ) { | ||
3197 | 1579 | cache[ id ] = {}; | ||
3198 | 1580 | // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery | ||
3199 | 1581 | // metadata on plain JS objects when the object is serialized using | ||
3200 | 1582 | // JSON.stringify | ||
3201 | 1583 | if ( !isNode ) { | ||
3202 | 1584 | cache[ id ].toJSON = jQuery.noop; | ||
3203 | 1585 | } | ||
3204 | 1586 | |||
3205 | 1587 | cache[ id ][ internalKey ] = internalCache; | ||
3206 | 1588 | |||
3207 | 1589 | // Otherwise, we need to eliminate the expando on the node to avoid | ||
3208 | 1590 | // false lookups in the cache for entries that no longer exist | ||
3209 | 1591 | } else if ( isNode ) { | ||
3210 | 1592 | // IE does not allow us to delete expando properties from nodes, | ||
3211 | 1593 | // nor does it have a removeAttribute function on Document nodes; | ||
3212 | 1594 | // we must handle all of these cases | ||
3213 | 1595 | if ( jQuery.support.deleteExpando ) { | ||
3214 | 1596 | delete elem[ jQuery.expando ]; | ||
3215 | 1597 | } else if ( elem.removeAttribute ) { | ||
3216 | 1598 | elem.removeAttribute( jQuery.expando ); | ||
3217 | 1599 | } else { | ||
3218 | 1600 | elem[ jQuery.expando ] = null; | ||
3219 | 1601 | } | ||
3220 | 1602 | } | ||
3221 | 1603 | }, | ||
3222 | 1604 | |||
3223 | 1605 | // For internal use only. | ||
3224 | 1606 | _data: function( elem, name, data ) { | ||
3225 | 1607 | return jQuery.data( elem, name, data, true ); | ||
3226 | 1608 | }, | ||
3227 | 1609 | |||
3228 | 1610 | // A method for determining if a DOM node can handle the data expando | ||
3229 | 1611 | acceptData: function( elem ) { | ||
3230 | 1612 | if ( elem.nodeName ) { | ||
3231 | 1613 | var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; | ||
3232 | 1614 | |||
3233 | 1615 | if ( match ) { | ||
3234 | 1616 | return !(match === true || elem.getAttribute("classid") !== match); | ||
3235 | 1617 | } | ||
3236 | 1618 | } | ||
3237 | 1619 | |||
3238 | 1620 | return true; | ||
3239 | 1621 | } | ||
3240 | 1622 | }); | ||
3241 | 1623 | |||
3242 | 1624 | jQuery.fn.extend({ | ||
3243 | 1625 | data: function( key, value ) { | ||
3244 | 1626 | var data = null; | ||
3245 | 1627 | |||
3246 | 1628 | if ( typeof key === "undefined" ) { | ||
3247 | 1629 | if ( this.length ) { | ||
3248 | 1630 | data = jQuery.data( this[0] ); | ||
3249 | 1631 | |||
3250 | 1632 | if ( this[0].nodeType === 1 ) { | ||
3251 | 1633 | var attr = this[0].attributes, name; | ||
3252 | 1634 | for ( var i = 0, l = attr.length; i < l; i++ ) { | ||
3253 | 1635 | name = attr[i].name; | ||
3254 | 1636 | |||
3255 | 1637 | if ( name.indexOf( "data-" ) === 0 ) { | ||
3256 | 1638 | name = jQuery.camelCase( name.substring(5) ); | ||
3257 | 1639 | |||
3258 | 1640 | dataAttr( this[0], name, data[ name ] ); | ||
3259 | 1641 | } | ||
3260 | 1642 | } | ||
3261 | 1643 | } | ||
3262 | 1644 | } | ||
3263 | 1645 | |||
3264 | 1646 | return data; | ||
3265 | 1647 | |||
3266 | 1648 | } else if ( typeof key === "object" ) { | ||
3267 | 1649 | return this.each(function() { | ||
3268 | 1650 | jQuery.data( this, key ); | ||
3269 | 1651 | }); | ||
3270 | 1652 | } | ||
3271 | 1653 | |||
3272 | 1654 | var parts = key.split("."); | ||
3273 | 1655 | parts[1] = parts[1] ? "." + parts[1] : ""; | ||
3274 | 1656 | |||
3275 | 1657 | if ( value === undefined ) { | ||
3276 | 1658 | data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); | ||
3277 | 1659 | |||
3278 | 1660 | // Try to fetch any internally stored data first | ||
3279 | 1661 | if ( data === undefined && this.length ) { | ||
3280 | 1662 | data = jQuery.data( this[0], key ); | ||
3281 | 1663 | data = dataAttr( this[0], key, data ); | ||
3282 | 1664 | } | ||
3283 | 1665 | |||
3284 | 1666 | return data === undefined && parts[1] ? | ||
3285 | 1667 | this.data( parts[0] ) : | ||
3286 | 1668 | data; | ||
3287 | 1669 | |||
3288 | 1670 | } else { | ||
3289 | 1671 | return this.each(function() { | ||
3290 | 1672 | var $this = jQuery( this ), | ||
3291 | 1673 | args = [ parts[0], value ]; | ||
3292 | 1674 | |||
3293 | 1675 | $this.triggerHandler( "setData" + parts[1] + "!", args ); | ||
3294 | 1676 | jQuery.data( this, key, value ); | ||
3295 | 1677 | $this.triggerHandler( "changeData" + parts[1] + "!", args ); | ||
3296 | 1678 | }); | ||
3297 | 1679 | } | ||
3298 | 1680 | }, | ||
3299 | 1681 | |||
3300 | 1682 | removeData: function( key ) { | ||
3301 | 1683 | return this.each(function() { | ||
3302 | 1684 | jQuery.removeData( this, key ); | ||
3303 | 1685 | }); | ||
3304 | 1686 | } | ||
3305 | 1687 | }); | ||
3306 | 1688 | |||
3307 | 1689 | function dataAttr( elem, key, data ) { | ||
3308 | 1690 | // If nothing was found internally, try to fetch any | ||
3309 | 1691 | // data from the HTML5 data-* attribute | ||
3310 | 1692 | if ( data === undefined && elem.nodeType === 1 ) { | ||
3311 | 1693 | var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase(); | ||
3312 | 1694 | |||
3313 | 1695 | data = elem.getAttribute( name ); | ||
3314 | 1696 | |||
3315 | 1697 | if ( typeof data === "string" ) { | ||
3316 | 1698 | try { | ||
3317 | 1699 | data = data === "true" ? true : | ||
3318 | 1700 | data === "false" ? false : | ||
3319 | 1701 | data === "null" ? null : | ||
3320 | 1702 | !jQuery.isNaN( data ) ? parseFloat( data ) : | ||
3321 | 1703 | rbrace.test( data ) ? jQuery.parseJSON( data ) : | ||
3322 | 1704 | data; | ||
3323 | 1705 | } catch( e ) {} | ||
3324 | 1706 | |||
3325 | 1707 | // Make sure we set the data so it isn't changed later | ||
3326 | 1708 | jQuery.data( elem, key, data ); | ||
3327 | 1709 | |||
3328 | 1710 | } else { | ||
3329 | 1711 | data = undefined; | ||
3330 | 1712 | } | ||
3331 | 1713 | } | ||
3332 | 1714 | |||
3333 | 1715 | return data; | ||
3334 | 1716 | } | ||
3335 | 1717 | |||
3336 | 1718 | // TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON | ||
3337 | 1719 | // property to be considered empty objects; this property always exists in | ||
3338 | 1720 | // order to make sure JSON.stringify does not expose internal metadata | ||
3339 | 1721 | function isEmptyDataObject( obj ) { | ||
3340 | 1722 | for ( var name in obj ) { | ||
3341 | 1723 | if ( name !== "toJSON" ) { | ||
3342 | 1724 | return false; | ||
3343 | 1725 | } | ||
3344 | 1726 | } | ||
3345 | 1727 | |||
3346 | 1728 | return true; | ||
3347 | 1729 | } | ||
3348 | 1730 | |||
3349 | 1731 | |||
3350 | 1732 | |||
3351 | 1733 | |||
3352 | 1734 | function handleQueueMarkDefer( elem, type, src ) { | ||
3353 | 1735 | var deferDataKey = type + "defer", | ||
3354 | 1736 | queueDataKey = type + "queue", | ||
3355 | 1737 | markDataKey = type + "mark", | ||
3356 | 1738 | defer = jQuery.data( elem, deferDataKey, undefined, true ); | ||
3357 | 1739 | if ( defer && | ||
3358 | 1740 | ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && | ||
3359 | 1741 | ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { | ||
3360 | 1742 | // Give room for hard-coded callbacks to fire first | ||
3361 | 1743 | // and eventually mark/queue something else on the element | ||
3362 | 1744 | setTimeout( function() { | ||
3363 | 1745 | if ( !jQuery.data( elem, queueDataKey, undefined, true ) && | ||
3364 | 1746 | !jQuery.data( elem, markDataKey, undefined, true ) ) { | ||
3365 | 1747 | jQuery.removeData( elem, deferDataKey, true ); | ||
3366 | 1748 | defer.resolve(); | ||
3367 | 1749 | } | ||
3368 | 1750 | }, 0 ); | ||
3369 | 1751 | } | ||
3370 | 1752 | } | ||
3371 | 1753 | |||
3372 | 1754 | jQuery.extend({ | ||
3373 | 1755 | |||
3374 | 1756 | _mark: function( elem, type ) { | ||
3375 | 1757 | if ( elem ) { | ||
3376 | 1758 | type = (type || "fx") + "mark"; | ||
3377 | 1759 | jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); | ||
3378 | 1760 | } | ||
3379 | 1761 | }, | ||
3380 | 1762 | |||
3381 | 1763 | _unmark: function( force, elem, type ) { | ||
3382 | 1764 | if ( force !== true ) { | ||
3383 | 1765 | type = elem; | ||
3384 | 1766 | elem = force; | ||
3385 | 1767 | force = false; | ||
3386 | 1768 | } | ||
3387 | 1769 | if ( elem ) { | ||
3388 | 1770 | type = type || "fx"; | ||
3389 | 1771 | var key = type + "mark", | ||
3390 | 1772 | count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); | ||
3391 | 1773 | if ( count ) { | ||
3392 | 1774 | jQuery.data( elem, key, count, true ); | ||
3393 | 1775 | } else { | ||
3394 | 1776 | jQuery.removeData( elem, key, true ); | ||
3395 | 1777 | handleQueueMarkDefer( elem, type, "mark" ); | ||
3396 | 1778 | } | ||
3397 | 1779 | } | ||
3398 | 1780 | }, | ||
3399 | 1781 | |||
3400 | 1782 | queue: function( elem, type, data ) { | ||
3401 | 1783 | if ( elem ) { | ||
3402 | 1784 | type = (type || "fx") + "queue"; | ||
3403 | 1785 | var q = jQuery.data( elem, type, undefined, true ); | ||
3404 | 1786 | // Speed up dequeue by getting out quickly if this is just a lookup | ||
3405 | 1787 | if ( data ) { | ||
3406 | 1788 | if ( !q || jQuery.isArray(data) ) { | ||
3407 | 1789 | q = jQuery.data( elem, type, jQuery.makeArray(data), true ); | ||
3408 | 1790 | } else { | ||
3409 | 1791 | q.push( data ); | ||
3410 | 1792 | } | ||
3411 | 1793 | } | ||
3412 | 1794 | return q || []; | ||
3413 | 1795 | } | ||
3414 | 1796 | }, | ||
3415 | 1797 | |||
3416 | 1798 | dequeue: function( elem, type ) { | ||
3417 | 1799 | type = type || "fx"; | ||
3418 | 1800 | |||
3419 | 1801 | var queue = jQuery.queue( elem, type ), | ||
3420 | 1802 | fn = queue.shift(), | ||
3421 | 1803 | defer; | ||
3422 | 1804 | |||
3423 | 1805 | // If the fx queue is dequeued, always remove the progress sentinel | ||
3424 | 1806 | if ( fn === "inprogress" ) { | ||
3425 | 1807 | fn = queue.shift(); | ||
3426 | 1808 | } | ||
3427 | 1809 | |||
3428 | 1810 | if ( fn ) { | ||
3429 | 1811 | // Add a progress sentinel to prevent the fx queue from being | ||
3430 | 1812 | // automatically dequeued | ||
3431 | 1813 | if ( type === "fx" ) { | ||
3432 | 1814 | queue.unshift("inprogress"); | ||
3433 | 1815 | } | ||
3434 | 1816 | |||
3435 | 1817 | fn.call(elem, function() { | ||
3436 | 1818 | jQuery.dequeue(elem, type); | ||
3437 | 1819 | }); | ||
3438 | 1820 | } | ||
3439 | 1821 | |||
3440 | 1822 | if ( !queue.length ) { | ||
3441 | 1823 | jQuery.removeData( elem, type + "queue", true ); | ||
3442 | 1824 | handleQueueMarkDefer( elem, type, "queue" ); | ||
3443 | 1825 | } | ||
3444 | 1826 | } | ||
3445 | 1827 | }); | ||
3446 | 1828 | |||
3447 | 1829 | jQuery.fn.extend({ | ||
3448 | 1830 | queue: function( type, data ) { | ||
3449 | 1831 | if ( typeof type !== "string" ) { | ||
3450 | 1832 | data = type; | ||
3451 | 1833 | type = "fx"; | ||
3452 | 1834 | } | ||
3453 | 1835 | |||
3454 | 1836 | if ( data === undefined ) { | ||
3455 | 1837 | return jQuery.queue( this[0], type ); | ||
3456 | 1838 | } | ||
3457 | 1839 | return this.each(function() { | ||
3458 | 1840 | var queue = jQuery.queue( this, type, data ); | ||
3459 | 1841 | |||
3460 | 1842 | if ( type === "fx" && queue[0] !== "inprogress" ) { | ||
3461 | 1843 | jQuery.dequeue( this, type ); | ||
3462 | 1844 | } | ||
3463 | 1845 | }); | ||
3464 | 1846 | }, | ||
3465 | 1847 | dequeue: function( type ) { | ||
3466 | 1848 | return this.each(function() { | ||
3467 | 1849 | jQuery.dequeue( this, type ); | ||
3468 | 1850 | }); | ||
3469 | 1851 | }, | ||
3470 | 1852 | // Based off of the plugin by Clint Helfers, with permission. | ||
3471 | 1853 | // http://blindsignals.com/index.php/2009/07/jquery-delay/ | ||
3472 | 1854 | delay: function( time, type ) { | ||
3473 | 1855 | time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; | ||
3474 | 1856 | type = type || "fx"; | ||
3475 | 1857 | |||
3476 | 1858 | return this.queue( type, function() { | ||
3477 | 1859 | var elem = this; | ||
3478 | 1860 | setTimeout(function() { | ||
3479 | 1861 | jQuery.dequeue( elem, type ); | ||
3480 | 1862 | }, time ); | ||
3481 | 1863 | }); | ||
3482 | 1864 | }, | ||
3483 | 1865 | clearQueue: function( type ) { | ||
3484 | 1866 | return this.queue( type || "fx", [] ); | ||
3485 | 1867 | }, | ||
3486 | 1868 | // Get a promise resolved when queues of a certain type | ||
3487 | 1869 | // are emptied (fx is the type by default) | ||
3488 | 1870 | promise: function( type, object ) { | ||
3489 | 1871 | if ( typeof type !== "string" ) { | ||
3490 | 1872 | object = type; | ||
3491 | 1873 | type = undefined; | ||
3492 | 1874 | } | ||
3493 | 1875 | type = type || "fx"; | ||
3494 | 1876 | var defer = jQuery.Deferred(), | ||
3495 | 1877 | elements = this, | ||
3496 | 1878 | i = elements.length, | ||
3497 | 1879 | count = 1, | ||
3498 | 1880 | deferDataKey = type + "defer", | ||
3499 | 1881 | queueDataKey = type + "queue", | ||
3500 | 1882 | markDataKey = type + "mark", | ||
3501 | 1883 | tmp; | ||
3502 | 1884 | function resolve() { | ||
3503 | 1885 | if ( !( --count ) ) { | ||
3504 | 1886 | defer.resolveWith( elements, [ elements ] ); | ||
3505 | 1887 | } | ||
3506 | 1888 | } | ||
3507 | 1889 | while( i-- ) { | ||
3508 | 1890 | if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || | ||
3509 | 1891 | ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || | ||
3510 | 1892 | jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && | ||
3511 | 1893 | jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { | ||
3512 | 1894 | count++; | ||
3513 | 1895 | tmp.done( resolve ); | ||
3514 | 1896 | } | ||
3515 | 1897 | } | ||
3516 | 1898 | resolve(); | ||
3517 | 1899 | return defer.promise(); | ||
3518 | 1900 | } | ||
3519 | 1901 | }); | ||
3520 | 1902 | |||
3521 | 1903 | |||
3522 | 1904 | |||
3523 | 1905 | |||
3524 | 1906 | var rclass = /[\n\t\r]/g, | ||
3525 | 1907 | rspace = /\s+/, | ||
3526 | 1908 | rreturn = /\r/g, | ||
3527 | 1909 | rtype = /^(?:button|input)$/i, | ||
3528 | 1910 | rfocusable = /^(?:button|input|object|select|textarea)$/i, | ||
3529 | 1911 | rclickable = /^a(?:rea)?$/i, | ||
3530 | 1912 | rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, | ||
3531 | 1913 | rinvalidChar = /\:|^on/, | ||
3532 | 1914 | formHook, boolHook; | ||
3533 | 1915 | |||
3534 | 1916 | jQuery.fn.extend({ | ||
3535 | 1917 | attr: function( name, value ) { | ||
3536 | 1918 | return jQuery.access( this, name, value, true, jQuery.attr ); | ||
3537 | 1919 | }, | ||
3538 | 1920 | |||
3539 | 1921 | removeAttr: function( name ) { | ||
3540 | 1922 | return this.each(function() { | ||
3541 | 1923 | jQuery.removeAttr( this, name ); | ||
3542 | 1924 | }); | ||
3543 | 1925 | }, | ||
3544 | 1926 | |||
3545 | 1927 | prop: function( name, value ) { | ||
3546 | 1928 | return jQuery.access( this, name, value, true, jQuery.prop ); | ||
3547 | 1929 | }, | ||
3548 | 1930 | |||
3549 | 1931 | removeProp: function( name ) { | ||
3550 | 1932 | name = jQuery.propFix[ name ] || name; | ||
3551 | 1933 | return this.each(function() { | ||
3552 | 1934 | // try/catch handles cases where IE balks (such as removing a property on window) | ||
3553 | 1935 | try { | ||
3554 | 1936 | this[ name ] = undefined; | ||
3555 | 1937 | delete this[ name ]; | ||
3556 | 1938 | } catch( e ) {} | ||
3557 | 1939 | }); | ||
3558 | 1940 | }, | ||
3559 | 1941 | |||
3560 | 1942 | addClass: function( value ) { | ||
3561 | 1943 | var classNames, i, l, elem, | ||
3562 | 1944 | setClass, c, cl; | ||
3563 | 1945 | |||
3564 | 1946 | if ( jQuery.isFunction( value ) ) { | ||
3565 | 1947 | return this.each(function( j ) { | ||
3566 | 1948 | jQuery( this ).addClass( value.call(this, j, this.className) ); | ||
3567 | 1949 | }); | ||
3568 | 1950 | } | ||
3569 | 1951 | |||
3570 | 1952 | if ( value && typeof value === "string" ) { | ||
3571 | 1953 | classNames = value.split( rspace ); | ||
3572 | 1954 | |||
3573 | 1955 | for ( i = 0, l = this.length; i < l; i++ ) { | ||
3574 | 1956 | elem = this[ i ]; | ||
3575 | 1957 | |||
3576 | 1958 | if ( elem.nodeType === 1 ) { | ||
3577 | 1959 | if ( !elem.className && classNames.length === 1 ) { | ||
3578 | 1960 | elem.className = value; | ||
3579 | 1961 | |||
3580 | 1962 | } else { | ||
3581 | 1963 | setClass = " " + elem.className + " "; | ||
3582 | 1964 | |||
3583 | 1965 | for ( c = 0, cl = classNames.length; c < cl; c++ ) { | ||
3584 | 1966 | if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { | ||
3585 | 1967 | setClass += classNames[ c ] + " "; | ||
3586 | 1968 | } | ||
3587 | 1969 | } | ||
3588 | 1970 | elem.className = jQuery.trim( setClass ); | ||
3589 | 1971 | } | ||
3590 | 1972 | } | ||
3591 | 1973 | } | ||
3592 | 1974 | } | ||
3593 | 1975 | |||
3594 | 1976 | return this; | ||
3595 | 1977 | }, | ||
3596 | 1978 | |||
3597 | 1979 | removeClass: function( value ) { | ||
3598 | 1980 | var classNames, i, l, elem, className, c, cl; | ||
3599 | 1981 | |||
3600 | 1982 | if ( jQuery.isFunction( value ) ) { | ||
3601 | 1983 | return this.each(function( j ) { | ||
3602 | 1984 | jQuery( this ).removeClass( value.call(this, j, this.className) ); | ||
3603 | 1985 | }); | ||
3604 | 1986 | } | ||
3605 | 1987 | |||
3606 | 1988 | if ( (value && typeof value === "string") || value === undefined ) { | ||
3607 | 1989 | classNames = (value || "").split( rspace ); | ||
3608 | 1990 | |||
3609 | 1991 | for ( i = 0, l = this.length; i < l; i++ ) { | ||
3610 | 1992 | elem = this[ i ]; | ||
3611 | 1993 | |||
3612 | 1994 | if ( elem.nodeType === 1 && elem.className ) { | ||
3613 | 1995 | if ( value ) { | ||
3614 | 1996 | className = (" " + elem.className + " ").replace( rclass, " " ); | ||
3615 | 1997 | for ( c = 0, cl = classNames.length; c < cl; c++ ) { | ||
3616 | 1998 | className = className.replace(" " + classNames[ c ] + " ", " "); | ||
3617 | 1999 | } | ||
3618 | 2000 | elem.className = jQuery.trim( className ); | ||
3619 | 2001 | |||
3620 | 2002 | } else { | ||
3621 | 2003 | elem.className = ""; | ||
3622 | 2004 | } | ||
3623 | 2005 | } | ||
3624 | 2006 | } | ||
3625 | 2007 | } | ||
3626 | 2008 | |||
3627 | 2009 | return this; | ||
3628 | 2010 | }, | ||
3629 | 2011 | |||
3630 | 2012 | toggleClass: function( value, stateVal ) { | ||
3631 | 2013 | var type = typeof value, | ||
3632 | 2014 | isBool = typeof stateVal === "boolean"; | ||
3633 | 2015 | |||
3634 | 2016 | if ( jQuery.isFunction( value ) ) { | ||
3635 | 2017 | return this.each(function( i ) { | ||
3636 | 2018 | jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); | ||
3637 | 2019 | }); | ||
3638 | 2020 | } | ||
3639 | 2021 | |||
3640 | 2022 | return this.each(function() { | ||
3641 | 2023 | if ( type === "string" ) { | ||
3642 | 2024 | // toggle individual class names | ||
3643 | 2025 | var className, | ||
3644 | 2026 | i = 0, | ||
3645 | 2027 | self = jQuery( this ), | ||
3646 | 2028 | state = stateVal, | ||
3647 | 2029 | classNames = value.split( rspace ); | ||
3648 | 2030 | |||
3649 | 2031 | while ( (className = classNames[ i++ ]) ) { | ||
3650 | 2032 | // check each className given, space seperated list | ||
3651 | 2033 | state = isBool ? state : !self.hasClass( className ); | ||
3652 | 2034 | self[ state ? "addClass" : "removeClass" ]( className ); | ||
3653 | 2035 | } | ||
3654 | 2036 | |||
3655 | 2037 | } else if ( type === "undefined" || type === "boolean" ) { | ||
3656 | 2038 | if ( this.className ) { | ||
3657 | 2039 | // store className if set | ||
3658 | 2040 | jQuery._data( this, "__className__", this.className ); | ||
3659 | 2041 | } | ||
3660 | 2042 | |||
3661 | 2043 | // toggle whole className | ||
3662 | 2044 | this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; | ||
3663 | 2045 | } | ||
3664 | 2046 | }); | ||
3665 | 2047 | }, | ||
3666 | 2048 | |||
3667 | 2049 | hasClass: function( selector ) { | ||
3668 | 2050 | var className = " " + selector + " "; | ||
3669 | 2051 | for ( var i = 0, l = this.length; i < l; i++ ) { | ||
3670 | 2052 | if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { | ||
3671 | 2053 | return true; | ||
3672 | 2054 | } | ||
3673 | 2055 | } | ||
3674 | 2056 | |||
3675 | 2057 | return false; | ||
3676 | 2058 | }, | ||
3677 | 2059 | |||
3678 | 2060 | val: function( value ) { | ||
3679 | 2061 | var hooks, ret, | ||
3680 | 2062 | elem = this[0]; | ||
3681 | 2063 | |||
3682 | 2064 | if ( !arguments.length ) { | ||
3683 | 2065 | if ( elem ) { | ||
3684 | 2066 | hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; | ||
3685 | 2067 | |||
3686 | 2068 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { | ||
3687 | 2069 | return ret; | ||
3688 | 2070 | } | ||
3689 | 2071 | |||
3690 | 2072 | ret = elem.value; | ||
3691 | 2073 | |||
3692 | 2074 | return typeof ret === "string" ? | ||
3693 | 2075 | // handle most common string cases | ||
3694 | 2076 | ret.replace(rreturn, "") : | ||
3695 | 2077 | // handle cases where value is null/undef or number | ||
3696 | 2078 | ret == null ? "" : ret; | ||
3697 | 2079 | } | ||
3698 | 2080 | |||
3699 | 2081 | return undefined; | ||
3700 | 2082 | } | ||
3701 | 2083 | |||
3702 | 2084 | var isFunction = jQuery.isFunction( value ); | ||
3703 | 2085 | |||
3704 | 2086 | return this.each(function( i ) { | ||
3705 | 2087 | var self = jQuery(this), val; | ||
3706 | 2088 | |||
3707 | 2089 | if ( this.nodeType !== 1 ) { | ||
3708 | 2090 | return; | ||
3709 | 2091 | } | ||
3710 | 2092 | |||
3711 | 2093 | if ( isFunction ) { | ||
3712 | 2094 | val = value.call( this, i, self.val() ); | ||
3713 | 2095 | } else { | ||
3714 | 2096 | val = value; | ||
3715 | 2097 | } | ||
3716 | 2098 | |||
3717 | 2099 | // Treat null/undefined as ""; convert numbers to string | ||
3718 | 2100 | if ( val == null ) { | ||
3719 | 2101 | val = ""; | ||
3720 | 2102 | } else if ( typeof val === "number" ) { | ||
3721 | 2103 | val += ""; | ||
3722 | 2104 | } else if ( jQuery.isArray( val ) ) { | ||
3723 | 2105 | val = jQuery.map(val, function ( value ) { | ||
3724 | 2106 | return value == null ? "" : value + ""; | ||
3725 | 2107 | }); | ||
3726 | 2108 | } | ||
3727 | 2109 | |||
3728 | 2110 | hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; | ||
3729 | 2111 | |||
3730 | 2112 | // If set returns undefined, fall back to normal setting | ||
3731 | 2113 | if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { | ||
3732 | 2114 | this.value = val; | ||
3733 | 2115 | } | ||
3734 | 2116 | }); | ||
3735 | 2117 | } | ||
3736 | 2118 | }); | ||
3737 | 2119 | |||
3738 | 2120 | jQuery.extend({ | ||
3739 | 2121 | valHooks: { | ||
3740 | 2122 | option: { | ||
3741 | 2123 | get: function( elem ) { | ||
3742 | 2124 | // attributes.value is undefined in Blackberry 4.7 but | ||
3743 | 2125 | // uses .value. See #6932 | ||
3744 | 2126 | var val = elem.attributes.value; | ||
3745 | 2127 | return !val || val.specified ? elem.value : elem.text; | ||
3746 | 2128 | } | ||
3747 | 2129 | }, | ||
3748 | 2130 | select: { | ||
3749 | 2131 | get: function( elem ) { | ||
3750 | 2132 | var value, | ||
3751 | 2133 | index = elem.selectedIndex, | ||
3752 | 2134 | values = [], | ||
3753 | 2135 | options = elem.options, | ||
3754 | 2136 | one = elem.type === "select-one"; | ||
3755 | 2137 | |||
3756 | 2138 | // Nothing was selected | ||
3757 | 2139 | if ( index < 0 ) { | ||
3758 | 2140 | return null; | ||
3759 | 2141 | } | ||
3760 | 2142 | |||
3761 | 2143 | // Loop through all the selected options | ||
3762 | 2144 | for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { | ||
3763 | 2145 | var option = options[ i ]; | ||
3764 | 2146 | |||
3765 | 2147 | // Don't return options that are disabled or in a disabled optgroup | ||
3766 | 2148 | if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && | ||
3767 | 2149 | (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { | ||
3768 | 2150 | |||
3769 | 2151 | // Get the specific value for the option | ||
3770 | 2152 | value = jQuery( option ).val(); | ||
3771 | 2153 | |||
3772 | 2154 | // We don't need an array for one selects | ||
3773 | 2155 | if ( one ) { | ||
3774 | 2156 | return value; | ||
3775 | 2157 | } | ||
3776 | 2158 | |||
3777 | 2159 | // Multi-Selects return an array | ||
3778 | 2160 | values.push( value ); | ||
3779 | 2161 | } | ||
3780 | 2162 | } | ||
3781 | 2163 | |||
3782 | 2164 | // Fixes Bug #2551 -- select.val() broken in IE after form.reset() | ||
3783 | 2165 | if ( one && !values.length && options.length ) { | ||
3784 | 2166 | return jQuery( options[ index ] ).val(); | ||
3785 | 2167 | } | ||
3786 | 2168 | |||
3787 | 2169 | return values; | ||
3788 | 2170 | }, | ||
3789 | 2171 | |||
3790 | 2172 | set: function( elem, value ) { | ||
3791 | 2173 | var values = jQuery.makeArray( value ); | ||
3792 | 2174 | |||
3793 | 2175 | jQuery(elem).find("option").each(function() { | ||
3794 | 2176 | this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; | ||
3795 | 2177 | }); | ||
3796 | 2178 | |||
3797 | 2179 | if ( !values.length ) { | ||
3798 | 2180 | elem.selectedIndex = -1; | ||
3799 | 2181 | } | ||
3800 | 2182 | return values; | ||
3801 | 2183 | } | ||
3802 | 2184 | } | ||
3803 | 2185 | }, | ||
3804 | 2186 | |||
3805 | 2187 | attrFn: { | ||
3806 | 2188 | val: true, | ||
3807 | 2189 | css: true, | ||
3808 | 2190 | html: true, | ||
3809 | 2191 | text: true, | ||
3810 | 2192 | data: true, | ||
3811 | 2193 | width: true, | ||
3812 | 2194 | height: true, | ||
3813 | 2195 | offset: true | ||
3814 | 2196 | }, | ||
3815 | 2197 | |||
3816 | 2198 | attrFix: { | ||
3817 | 2199 | // Always normalize to ensure hook usage | ||
3818 | 2200 | tabindex: "tabIndex" | ||
3819 | 2201 | }, | ||
3820 | 2202 | |||
3821 | 2203 | attr: function( elem, name, value, pass ) { | ||
3822 | 2204 | var nType = elem.nodeType; | ||
3823 | 2205 | |||
3824 | 2206 | // don't get/set attributes on text, comment and attribute nodes | ||
3825 | 2207 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
3826 | 2208 | return undefined; | ||
3827 | 2209 | } | ||
3828 | 2210 | |||
3829 | 2211 | if ( pass && name in jQuery.attrFn ) { | ||
3830 | 2212 | return jQuery( elem )[ name ]( value ); | ||
3831 | 2213 | } | ||
3832 | 2214 | |||
3833 | 2215 | // Fallback to prop when attributes are not supported | ||
3834 | 2216 | if ( !("getAttribute" in elem) ) { | ||
3835 | 2217 | return jQuery.prop( elem, name, value ); | ||
3836 | 2218 | } | ||
3837 | 2219 | |||
3838 | 2220 | var ret, hooks, | ||
3839 | 2221 | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); | ||
3840 | 2222 | |||
3841 | 2223 | // Normalize the name if needed | ||
3842 | 2224 | if ( notxml ) { | ||
3843 | 2225 | name = jQuery.attrFix[ name ] || name; | ||
3844 | 2226 | |||
3845 | 2227 | hooks = jQuery.attrHooks[ name ]; | ||
3846 | 2228 | |||
3847 | 2229 | if ( !hooks ) { | ||
3848 | 2230 | // Use boolHook for boolean attributes | ||
3849 | 2231 | if ( rboolean.test( name ) ) { | ||
3850 | 2232 | |||
3851 | 2233 | hooks = boolHook; | ||
3852 | 2234 | |||
3853 | 2235 | // Use formHook for forms and if the name contains certain characters | ||
3854 | 2236 | } else if ( formHook && name !== "className" && | ||
3855 | 2237 | (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) { | ||
3856 | 2238 | |||
3857 | 2239 | hooks = formHook; | ||
3858 | 2240 | } | ||
3859 | 2241 | } | ||
3860 | 2242 | } | ||
3861 | 2243 | |||
3862 | 2244 | if ( value !== undefined ) { | ||
3863 | 2245 | |||
3864 | 2246 | if ( value === null ) { | ||
3865 | 2247 | jQuery.removeAttr( elem, name ); | ||
3866 | 2248 | return undefined; | ||
3867 | 2249 | |||
3868 | 2250 | } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { | ||
3869 | 2251 | return ret; | ||
3870 | 2252 | |||
3871 | 2253 | } else { | ||
3872 | 2254 | elem.setAttribute( name, "" + value ); | ||
3873 | 2255 | return value; | ||
3874 | 2256 | } | ||
3875 | 2257 | |||
3876 | 2258 | } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { | ||
3877 | 2259 | return ret; | ||
3878 | 2260 | |||
3879 | 2261 | } else { | ||
3880 | 2262 | |||
3881 | 2263 | ret = elem.getAttribute( name ); | ||
3882 | 2264 | |||
3883 | 2265 | // Non-existent attributes return null, we normalize to undefined | ||
3884 | 2266 | return ret === null ? | ||
3885 | 2267 | undefined : | ||
3886 | 2268 | ret; | ||
3887 | 2269 | } | ||
3888 | 2270 | }, | ||
3889 | 2271 | |||
3890 | 2272 | removeAttr: function( elem, name ) { | ||
3891 | 2273 | var propName; | ||
3892 | 2274 | if ( elem.nodeType === 1 ) { | ||
3893 | 2275 | name = jQuery.attrFix[ name ] || name; | ||
3894 | 2276 | |||
3895 | 2277 | if ( jQuery.support.getSetAttribute ) { | ||
3896 | 2278 | // Use removeAttribute in browsers that support it | ||
3897 | 2279 | elem.removeAttribute( name ); | ||
3898 | 2280 | } else { | ||
3899 | 2281 | jQuery.attr( elem, name, "" ); | ||
3900 | 2282 | elem.removeAttributeNode( elem.getAttributeNode( name ) ); | ||
3901 | 2283 | } | ||
3902 | 2284 | |||
3903 | 2285 | // Set corresponding property to false for boolean attributes | ||
3904 | 2286 | if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { | ||
3905 | 2287 | elem[ propName ] = false; | ||
3906 | 2288 | } | ||
3907 | 2289 | } | ||
3908 | 2290 | }, | ||
3909 | 2291 | |||
3910 | 2292 | attrHooks: { | ||
3911 | 2293 | type: { | ||
3912 | 2294 | set: function( elem, value ) { | ||
3913 | 2295 | // We can't allow the type property to be changed (since it causes problems in IE) | ||
3914 | 2296 | if ( rtype.test( elem.nodeName ) && elem.parentNode ) { | ||
3915 | 2297 | jQuery.error( "type property can't be changed" ); | ||
3916 | 2298 | } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { | ||
3917 | 2299 | // Setting the type on a radio button after the value resets the value in IE6-9 | ||
3918 | 2300 | // Reset value to it's default in case type is set after value | ||
3919 | 2301 | // This is for element creation | ||
3920 | 2302 | var val = elem.value; | ||
3921 | 2303 | elem.setAttribute( "type", value ); | ||
3922 | 2304 | if ( val ) { | ||
3923 | 2305 | elem.value = val; | ||
3924 | 2306 | } | ||
3925 | 2307 | return value; | ||
3926 | 2308 | } | ||
3927 | 2309 | } | ||
3928 | 2310 | }, | ||
3929 | 2311 | tabIndex: { | ||
3930 | 2312 | get: function( elem ) { | ||
3931 | 2313 | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set | ||
3932 | 2314 | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ | ||
3933 | 2315 | var attributeNode = elem.getAttributeNode("tabIndex"); | ||
3934 | 2316 | |||
3935 | 2317 | return attributeNode && attributeNode.specified ? | ||
3936 | 2318 | parseInt( attributeNode.value, 10 ) : | ||
3937 | 2319 | rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? | ||
3938 | 2320 | 0 : | ||
3939 | 2321 | undefined; | ||
3940 | 2322 | } | ||
3941 | 2323 | }, | ||
3942 | 2324 | // Use the value property for back compat | ||
3943 | 2325 | // Use the formHook for button elements in IE6/7 (#1954) | ||
3944 | 2326 | value: { | ||
3945 | 2327 | get: function( elem, name ) { | ||
3946 | 2328 | if ( formHook && jQuery.nodeName( elem, "button" ) ) { | ||
3947 | 2329 | return formHook.get( elem, name ); | ||
3948 | 2330 | } | ||
3949 | 2331 | return name in elem ? | ||
3950 | 2332 | elem.value : | ||
3951 | 2333 | null; | ||
3952 | 2334 | }, | ||
3953 | 2335 | set: function( elem, value, name ) { | ||
3954 | 2336 | if ( formHook && jQuery.nodeName( elem, "button" ) ) { | ||
3955 | 2337 | return formHook.set( elem, value, name ); | ||
3956 | 2338 | } | ||
3957 | 2339 | // Does not return so that setAttribute is also used | ||
3958 | 2340 | elem.value = value; | ||
3959 | 2341 | } | ||
3960 | 2342 | } | ||
3961 | 2343 | }, | ||
3962 | 2344 | |||
3963 | 2345 | propFix: { | ||
3964 | 2346 | tabindex: "tabIndex", | ||
3965 | 2347 | readonly: "readOnly", | ||
3966 | 2348 | "for": "htmlFor", | ||
3967 | 2349 | "class": "className", | ||
3968 | 2350 | maxlength: "maxLength", | ||
3969 | 2351 | cellspacing: "cellSpacing", | ||
3970 | 2352 | cellpadding: "cellPadding", | ||
3971 | 2353 | rowspan: "rowSpan", | ||
3972 | 2354 | colspan: "colSpan", | ||
3973 | 2355 | usemap: "useMap", | ||
3974 | 2356 | frameborder: "frameBorder", | ||
3975 | 2357 | contenteditable: "contentEditable" | ||
3976 | 2358 | }, | ||
3977 | 2359 | |||
3978 | 2360 | prop: function( elem, name, value ) { | ||
3979 | 2361 | var nType = elem.nodeType; | ||
3980 | 2362 | |||
3981 | 2363 | // don't get/set properties on text, comment and attribute nodes | ||
3982 | 2364 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
3983 | 2365 | return undefined; | ||
3984 | 2366 | } | ||
3985 | 2367 | |||
3986 | 2368 | var ret, hooks, | ||
3987 | 2369 | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); | ||
3988 | 2370 | |||
3989 | 2371 | if ( notxml ) { | ||
3990 | 2372 | // Fix name and attach hooks | ||
3991 | 2373 | name = jQuery.propFix[ name ] || name; | ||
3992 | 2374 | hooks = jQuery.propHooks[ name ]; | ||
3993 | 2375 | } | ||
3994 | 2376 | |||
3995 | 2377 | if ( value !== undefined ) { | ||
3996 | 2378 | if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { | ||
3997 | 2379 | return ret; | ||
3998 | 2380 | |||
3999 | 2381 | } else { | ||
4000 | 2382 | return (elem[ name ] = value); | ||
4001 | 2383 | } | ||
4002 | 2384 | |||
4003 | 2385 | } else { | ||
4004 | 2386 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { | ||
4005 | 2387 | return ret; | ||
4006 | 2388 | |||
4007 | 2389 | } else { | ||
4008 | 2390 | return elem[ name ]; | ||
4009 | 2391 | } | ||
4010 | 2392 | } | ||
4011 | 2393 | }, | ||
4012 | 2394 | |||
4013 | 2395 | propHooks: {} | ||
4014 | 2396 | }); | ||
4015 | 2397 | |||
4016 | 2398 | // Hook for boolean attributes | ||
4017 | 2399 | boolHook = { | ||
4018 | 2400 | get: function( elem, name ) { | ||
4019 | 2401 | // Align boolean attributes with corresponding properties | ||
4020 | 2402 | return jQuery.prop( elem, name ) ? | ||
4021 | 2403 | name.toLowerCase() : | ||
4022 | 2404 | undefined; | ||
4023 | 2405 | }, | ||
4024 | 2406 | set: function( elem, value, name ) { | ||
4025 | 2407 | var propName; | ||
4026 | 2408 | if ( value === false ) { | ||
4027 | 2409 | // Remove boolean attributes when set to false | ||
4028 | 2410 | jQuery.removeAttr( elem, name ); | ||
4029 | 2411 | } else { | ||
4030 | 2412 | // value is true since we know at this point it's type boolean and not false | ||
4031 | 2413 | // Set boolean attributes to the same name and set the DOM property | ||
4032 | 2414 | propName = jQuery.propFix[ name ] || name; | ||
4033 | 2415 | if ( propName in elem ) { | ||
4034 | 2416 | // Only set the IDL specifically if it already exists on the element | ||
4035 | 2417 | elem[ propName ] = true; | ||
4036 | 2418 | } | ||
4037 | 2419 | |||
4038 | 2420 | elem.setAttribute( name, name.toLowerCase() ); | ||
4039 | 2421 | } | ||
4040 | 2422 | return name; | ||
4041 | 2423 | } | ||
4042 | 2424 | }; | ||
4043 | 2425 | |||
4044 | 2426 | // IE6/7 do not support getting/setting some attributes with get/setAttribute | ||
4045 | 2427 | if ( !jQuery.support.getSetAttribute ) { | ||
4046 | 2428 | |||
4047 | 2429 | // propFix is more comprehensive and contains all fixes | ||
4048 | 2430 | jQuery.attrFix = jQuery.propFix; | ||
4049 | 2431 | |||
4050 | 2432 | // Use this for any attribute on a form in IE6/7 | ||
4051 | 2433 | formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { | ||
4052 | 2434 | get: function( elem, name ) { | ||
4053 | 2435 | var ret; | ||
4054 | 2436 | ret = elem.getAttributeNode( name ); | ||
4055 | 2437 | // Return undefined if nodeValue is empty string | ||
4056 | 2438 | return ret && ret.nodeValue !== "" ? | ||
4057 | 2439 | ret.nodeValue : | ||
4058 | 2440 | undefined; | ||
4059 | 2441 | }, | ||
4060 | 2442 | set: function( elem, value, name ) { | ||
4061 | 2443 | // Check form objects in IE (multiple bugs related) | ||
4062 | 2444 | // Only use nodeValue if the attribute node exists on the form | ||
4063 | 2445 | var ret = elem.getAttributeNode( name ); | ||
4064 | 2446 | if ( ret ) { | ||
4065 | 2447 | ret.nodeValue = value; | ||
4066 | 2448 | return value; | ||
4067 | 2449 | } | ||
4068 | 2450 | } | ||
4069 | 2451 | }; | ||
4070 | 2452 | |||
4071 | 2453 | // Set width and height to auto instead of 0 on empty string( Bug #8150 ) | ||
4072 | 2454 | // This is for removals | ||
4073 | 2455 | jQuery.each([ "width", "height" ], function( i, name ) { | ||
4074 | 2456 | jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { | ||
4075 | 2457 | set: function( elem, value ) { | ||
4076 | 2458 | if ( value === "" ) { | ||
4077 | 2459 | elem.setAttribute( name, "auto" ); | ||
4078 | 2460 | return value; | ||
4079 | 2461 | } | ||
4080 | 2462 | } | ||
4081 | 2463 | }); | ||
4082 | 2464 | }); | ||
4083 | 2465 | } | ||
4084 | 2466 | |||
4085 | 2467 | |||
4086 | 2468 | // Some attributes require a special call on IE | ||
4087 | 2469 | if ( !jQuery.support.hrefNormalized ) { | ||
4088 | 2470 | jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { | ||
4089 | 2471 | jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { | ||
4090 | 2472 | get: function( elem ) { | ||
4091 | 2473 | var ret = elem.getAttribute( name, 2 ); | ||
4092 | 2474 | return ret === null ? undefined : ret; | ||
4093 | 2475 | } | ||
4094 | 2476 | }); | ||
4095 | 2477 | }); | ||
4096 | 2478 | } | ||
4097 | 2479 | |||
4098 | 2480 | if ( !jQuery.support.style ) { | ||
4099 | 2481 | jQuery.attrHooks.style = { | ||
4100 | 2482 | get: function( elem ) { | ||
4101 | 2483 | // Return undefined in the case of empty string | ||
4102 | 2484 | // Normalize to lowercase since IE uppercases css property names | ||
4103 | 2485 | return elem.style.cssText.toLowerCase() || undefined; | ||
4104 | 2486 | }, | ||
4105 | 2487 | set: function( elem, value ) { | ||
4106 | 2488 | return (elem.style.cssText = "" + value); | ||
4107 | 2489 | } | ||
4108 | 2490 | }; | ||
4109 | 2491 | } | ||
4110 | 2492 | |||
4111 | 2493 | // Safari mis-reports the default selected property of an option | ||
4112 | 2494 | // Accessing the parent's selectedIndex property fixes it | ||
4113 | 2495 | if ( !jQuery.support.optSelected ) { | ||
4114 | 2496 | jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { | ||
4115 | 2497 | get: function( elem ) { | ||
4116 | 2498 | var parent = elem.parentNode; | ||
4117 | 2499 | |||
4118 | 2500 | if ( parent ) { | ||
4119 | 2501 | parent.selectedIndex; | ||
4120 | 2502 | |||
4121 | 2503 | // Make sure that it also works with optgroups, see #5701 | ||
4122 | 2504 | if ( parent.parentNode ) { | ||
4123 | 2505 | parent.parentNode.selectedIndex; | ||
4124 | 2506 | } | ||
4125 | 2507 | } | ||
4126 | 2508 | } | ||
4127 | 2509 | }); | ||
4128 | 2510 | } | ||
4129 | 2511 | |||
4130 | 2512 | // Radios and checkboxes getter/setter | ||
4131 | 2513 | if ( !jQuery.support.checkOn ) { | ||
4132 | 2514 | jQuery.each([ "radio", "checkbox" ], function() { | ||
4133 | 2515 | jQuery.valHooks[ this ] = { | ||
4134 | 2516 | get: function( elem ) { | ||
4135 | 2517 | // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified | ||
4136 | 2518 | return elem.getAttribute("value") === null ? "on" : elem.value; | ||
4137 | 2519 | } | ||
4138 | 2520 | }; | ||
4139 | 2521 | }); | ||
4140 | 2522 | } | ||
4141 | 2523 | jQuery.each([ "radio", "checkbox" ], function() { | ||
4142 | 2524 | jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { | ||
4143 | 2525 | set: function( elem, value ) { | ||
4144 | 2526 | if ( jQuery.isArray( value ) ) { | ||
4145 | 2527 | return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); | ||
4146 | 2528 | } | ||
4147 | 2529 | } | ||
4148 | 2530 | }); | ||
4149 | 2531 | }); | ||
4150 | 2532 | |||
4151 | 2533 | |||
4152 | 2534 | |||
4153 | 2535 | |||
4154 | 2536 | var rnamespaces = /\.(.*)$/, | ||
4155 | 2537 | rformElems = /^(?:textarea|input|select)$/i, | ||
4156 | 2538 | rperiod = /\./g, | ||
4157 | 2539 | rspaces = / /g, | ||
4158 | 2540 | rescape = /[^\w\s.|`]/g, | ||
4159 | 2541 | fcleanup = function( nm ) { | ||
4160 | 2542 | return nm.replace(rescape, "\\$&"); | ||
4161 | 2543 | }; | ||
4162 | 2544 | |||
4163 | 2545 | /* | ||
4164 | 2546 | * A number of helper functions used for managing events. | ||
4165 | 2547 | * Many of the ideas behind this code originated from | ||
4166 | 2548 | * Dean Edwards' addEvent library. | ||
4167 | 2549 | */ | ||
4168 | 2550 | jQuery.event = { | ||
4169 | 2551 | |||
4170 | 2552 | // Bind an event to an element | ||
4171 | 2553 | // Original by Dean Edwards | ||
4172 | 2554 | add: function( elem, types, handler, data ) { | ||
4173 | 2555 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | ||
4174 | 2556 | return; | ||
4175 | 2557 | } | ||
4176 | 2558 | |||
4177 | 2559 | if ( handler === false ) { | ||
4178 | 2560 | handler = returnFalse; | ||
4179 | 2561 | } else if ( !handler ) { | ||
4180 | 2562 | // Fixes bug #7229. Fix recommended by jdalton | ||
4181 | 2563 | return; | ||
4182 | 2564 | } | ||
4183 | 2565 | |||
4184 | 2566 | var handleObjIn, handleObj; | ||
4185 | 2567 | |||
4186 | 2568 | if ( handler.handler ) { | ||
4187 | 2569 | handleObjIn = handler; | ||
4188 | 2570 | handler = handleObjIn.handler; | ||
4189 | 2571 | } | ||
4190 | 2572 | |||
4191 | 2573 | // Make sure that the function being executed has a unique ID | ||
4192 | 2574 | if ( !handler.guid ) { | ||
4193 | 2575 | handler.guid = jQuery.guid++; | ||
4194 | 2576 | } | ||
4195 | 2577 | |||
4196 | 2578 | // Init the element's event structure | ||
4197 | 2579 | var elemData = jQuery._data( elem ); | ||
4198 | 2580 | |||
4199 | 2581 | // If no elemData is found then we must be trying to bind to one of the | ||
4200 | 2582 | // banned noData elements | ||
4201 | 2583 | if ( !elemData ) { | ||
4202 | 2584 | return; | ||
4203 | 2585 | } | ||
4204 | 2586 | |||
4205 | 2587 | var events = elemData.events, | ||
4206 | 2588 | eventHandle = elemData.handle; | ||
4207 | 2589 | |||
4208 | 2590 | if ( !events ) { | ||
4209 | 2591 | elemData.events = events = {}; | ||
4210 | 2592 | } | ||
4211 | 2593 | |||
4212 | 2594 | if ( !eventHandle ) { | ||
4213 | 2595 | elemData.handle = eventHandle = function( e ) { | ||
4214 | 2596 | // Discard the second event of a jQuery.event.trigger() and | ||
4215 | 2597 | // when an event is called after a page has unloaded | ||
4216 | 2598 | return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? | ||
4217 | 2599 | jQuery.event.handle.apply( eventHandle.elem, arguments ) : | ||
4218 | 2600 | undefined; | ||
4219 | 2601 | }; | ||
4220 | 2602 | } | ||
4221 | 2603 | |||
4222 | 2604 | // Add elem as a property of the handle function | ||
4223 | 2605 | // This is to prevent a memory leak with non-native events in IE. | ||
4224 | 2606 | eventHandle.elem = elem; | ||
4225 | 2607 | |||
4226 | 2608 | // Handle multiple events separated by a space | ||
4227 | 2609 | // jQuery(...).bind("mouseover mouseout", fn); | ||
4228 | 2610 | types = types.split(" "); | ||
4229 | 2611 | |||
4230 | 2612 | var type, i = 0, namespaces; | ||
4231 | 2613 | |||
4232 | 2614 | while ( (type = types[ i++ ]) ) { | ||
4233 | 2615 | handleObj = handleObjIn ? | ||
4234 | 2616 | jQuery.extend({}, handleObjIn) : | ||
4235 | 2617 | { handler: handler, data: data }; | ||
4236 | 2618 | |||
4237 | 2619 | // Namespaced event handlers | ||
4238 | 2620 | if ( type.indexOf(".") > -1 ) { | ||
4239 | 2621 | namespaces = type.split("."); | ||
4240 | 2622 | type = namespaces.shift(); | ||
4241 | 2623 | handleObj.namespace = namespaces.slice(0).sort().join("."); | ||
4242 | 2624 | |||
4243 | 2625 | } else { | ||
4244 | 2626 | namespaces = []; | ||
4245 | 2627 | handleObj.namespace = ""; | ||
4246 | 2628 | } | ||
4247 | 2629 | |||
4248 | 2630 | handleObj.type = type; | ||
4249 | 2631 | if ( !handleObj.guid ) { | ||
4250 | 2632 | handleObj.guid = handler.guid; | ||
4251 | 2633 | } | ||
4252 | 2634 | |||
4253 | 2635 | // Get the current list of functions bound to this event | ||
4254 | 2636 | var handlers = events[ type ], | ||
4255 | 2637 | special = jQuery.event.special[ type ] || {}; | ||
4256 | 2638 | |||
4257 | 2639 | // Init the event handler queue | ||
4258 | 2640 | if ( !handlers ) { | ||
4259 | 2641 | handlers = events[ type ] = []; | ||
4260 | 2642 | |||
4261 | 2643 | // Check for a special event handler | ||
4262 | 2644 | // Only use addEventListener/attachEvent if the special | ||
4263 | 2645 | // events handler returns false | ||
4264 | 2646 | if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { | ||
4265 | 2647 | // Bind the global event handler to the element | ||
4266 | 2648 | if ( elem.addEventListener ) { | ||
4267 | 2649 | elem.addEventListener( type, eventHandle, false ); | ||
4268 | 2650 | |||
4269 | 2651 | } else if ( elem.attachEvent ) { | ||
4270 | 2652 | elem.attachEvent( "on" + type, eventHandle ); | ||
4271 | 2653 | } | ||
4272 | 2654 | } | ||
4273 | 2655 | } | ||
4274 | 2656 | |||
4275 | 2657 | if ( special.add ) { | ||
4276 | 2658 | special.add.call( elem, handleObj ); | ||
4277 | 2659 | |||
4278 | 2660 | if ( !handleObj.handler.guid ) { | ||
4279 | 2661 | handleObj.handler.guid = handler.guid; | ||
4280 | 2662 | } | ||
4281 | 2663 | } | ||
4282 | 2664 | |||
4283 | 2665 | // Add the function to the element's handler list | ||
4284 | 2666 | handlers.push( handleObj ); | ||
4285 | 2667 | |||
4286 | 2668 | // Keep track of which events have been used, for event optimization | ||
4287 | 2669 | jQuery.event.global[ type ] = true; | ||
4288 | 2670 | } | ||
4289 | 2671 | |||
4290 | 2672 | // Nullify elem to prevent memory leaks in IE | ||
4291 | 2673 | elem = null; | ||
4292 | 2674 | }, | ||
4293 | 2675 | |||
4294 | 2676 | global: {}, | ||
4295 | 2677 | |||
4296 | 2678 | // Detach an event or set of events from an element | ||
4297 | 2679 | remove: function( elem, types, handler, pos ) { | ||
4298 | 2680 | // don't do events on text and comment nodes | ||
4299 | 2681 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | ||
4300 | 2682 | return; | ||
4301 | 2683 | } | ||
4302 | 2684 | |||
4303 | 2685 | if ( handler === false ) { | ||
4304 | 2686 | handler = returnFalse; | ||
4305 | 2687 | } | ||
4306 | 2688 | |||
4307 | 2689 | var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, | ||
4308 | 2690 | elemData = jQuery.hasData( elem ) && jQuery._data( elem ), | ||
4309 | 2691 | events = elemData && elemData.events; | ||
4310 | 2692 | |||
4311 | 2693 | if ( !elemData || !events ) { | ||
4312 | 2694 | return; | ||
4313 | 2695 | } | ||
4314 | 2696 | |||
4315 | 2697 | // types is actually an event object here | ||
4316 | 2698 | if ( types && types.type ) { | ||
4317 | 2699 | handler = types.handler; | ||
4318 | 2700 | types = types.type; | ||
4319 | 2701 | } | ||
4320 | 2702 | |||
4321 | 2703 | // Unbind all events for the element | ||
4322 | 2704 | if ( !types || typeof types === "string" && types.charAt(0) === "." ) { | ||
4323 | 2705 | types = types || ""; | ||
4324 | 2706 | |||
4325 | 2707 | for ( type in events ) { | ||
4326 | 2708 | jQuery.event.remove( elem, type + types ); | ||
4327 | 2709 | } | ||
4328 | 2710 | |||
4329 | 2711 | return; | ||
4330 | 2712 | } | ||
4331 | 2713 | |||
4332 | 2714 | // Handle multiple events separated by a space | ||
4333 | 2715 | // jQuery(...).unbind("mouseover mouseout", fn); | ||
4334 | 2716 | types = types.split(" "); | ||
4335 | 2717 | |||
4336 | 2718 | while ( (type = types[ i++ ]) ) { | ||
4337 | 2719 | origType = type; | ||
4338 | 2720 | handleObj = null; | ||
4339 | 2721 | all = type.indexOf(".") < 0; | ||
4340 | 2722 | namespaces = []; | ||
4341 | 2723 | |||
4342 | 2724 | if ( !all ) { | ||
4343 | 2725 | // Namespaced event handlers | ||
4344 | 2726 | namespaces = type.split("."); | ||
4345 | 2727 | type = namespaces.shift(); | ||
4346 | 2728 | |||
4347 | 2729 | namespace = new RegExp("(^|\\.)" + | ||
4348 | 2730 | jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); | ||
4349 | 2731 | } | ||
4350 | 2732 | |||
4351 | 2733 | eventType = events[ type ]; | ||
4352 | 2734 | |||
4353 | 2735 | if ( !eventType ) { | ||
4354 | 2736 | continue; | ||
4355 | 2737 | } | ||
4356 | 2738 | |||
4357 | 2739 | if ( !handler ) { | ||
4358 | 2740 | for ( j = 0; j < eventType.length; j++ ) { | ||
4359 | 2741 | handleObj = eventType[ j ]; | ||
4360 | 2742 | |||
4361 | 2743 | if ( all || namespace.test( handleObj.namespace ) ) { | ||
4362 | 2744 | jQuery.event.remove( elem, origType, handleObj.handler, j ); | ||
4363 | 2745 | eventType.splice( j--, 1 ); | ||
4364 | 2746 | } | ||
4365 | 2747 | } | ||
4366 | 2748 | |||
4367 | 2749 | continue; | ||
4368 | 2750 | } | ||
4369 | 2751 | |||
4370 | 2752 | special = jQuery.event.special[ type ] || {}; | ||
4371 | 2753 | |||
4372 | 2754 | for ( j = pos || 0; j < eventType.length; j++ ) { | ||
4373 | 2755 | handleObj = eventType[ j ]; | ||
4374 | 2756 | |||
4375 | 2757 | if ( handler.guid === handleObj.guid ) { | ||
4376 | 2758 | // remove the given handler for the given type | ||
4377 | 2759 | if ( all || namespace.test( handleObj.namespace ) ) { | ||
4378 | 2760 | if ( pos == null ) { | ||
4379 | 2761 | eventType.splice( j--, 1 ); | ||
4380 | 2762 | } | ||
4381 | 2763 | |||
4382 | 2764 | if ( special.remove ) { | ||
4383 | 2765 | special.remove.call( elem, handleObj ); | ||
4384 | 2766 | } | ||
4385 | 2767 | } | ||
4386 | 2768 | |||
4387 | 2769 | if ( pos != null ) { | ||
4388 | 2770 | break; | ||
4389 | 2771 | } | ||
4390 | 2772 | } | ||
4391 | 2773 | } | ||
4392 | 2774 | |||
4393 | 2775 | // remove generic event handler if no more handlers exist | ||
4394 | 2776 | if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { | ||
4395 | 2777 | if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { | ||
4396 | 2778 | jQuery.removeEvent( elem, type, elemData.handle ); | ||
4397 | 2779 | } | ||
4398 | 2780 | |||
4399 | 2781 | ret = null; | ||
4400 | 2782 | delete events[ type ]; | ||
4401 | 2783 | } | ||
4402 | 2784 | } | ||
4403 | 2785 | |||
4404 | 2786 | // Remove the expando if it's no longer used | ||
4405 | 2787 | if ( jQuery.isEmptyObject( events ) ) { | ||
4406 | 2788 | var handle = elemData.handle; | ||
4407 | 2789 | if ( handle ) { | ||
4408 | 2790 | handle.elem = null; | ||
4409 | 2791 | } | ||
4410 | 2792 | |||
4411 | 2793 | delete elemData.events; | ||
4412 | 2794 | delete elemData.handle; | ||
4413 | 2795 | |||
4414 | 2796 | if ( jQuery.isEmptyObject( elemData ) ) { | ||
4415 | 2797 | jQuery.removeData( elem, undefined, true ); | ||
4416 | 2798 | } | ||
4417 | 2799 | } | ||
4418 | 2800 | }, | ||
4419 | 2801 | |||
4420 | 2802 | // Events that are safe to short-circuit if no handlers are attached. | ||
4421 | 2803 | // Native DOM events should not be added, they may have inline handlers. | ||
4422 | 2804 | customEvent: { | ||
4423 | 2805 | "getData": true, | ||
4424 | 2806 | "setData": true, | ||
4425 | 2807 | "changeData": true | ||
4426 | 2808 | }, | ||
4427 | 2809 | |||
4428 | 2810 | trigger: function( event, data, elem, onlyHandlers ) { | ||
4429 | 2811 | // Event object or event type | ||
4430 | 2812 | var type = event.type || event, | ||
4431 | 2813 | namespaces = [], | ||
4432 | 2814 | exclusive; | ||
4433 | 2815 | |||
4434 | 2816 | if ( type.indexOf("!") >= 0 ) { | ||
4435 | 2817 | // Exclusive events trigger only for the exact event (no namespaces) | ||
4436 | 2818 | type = type.slice(0, -1); | ||
4437 | 2819 | exclusive = true; | ||
4438 | 2820 | } | ||
4439 | 2821 | |||
4440 | 2822 | if ( type.indexOf(".") >= 0 ) { | ||
4441 | 2823 | // Namespaced trigger; create a regexp to match event type in handle() | ||
4442 | 2824 | namespaces = type.split("."); | ||
4443 | 2825 | type = namespaces.shift(); | ||
4444 | 2826 | namespaces.sort(); | ||
4445 | 2827 | } | ||
4446 | 2828 | |||
4447 | 2829 | if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { | ||
4448 | 2830 | // No jQuery handlers for this event type, and it can't have inline handlers | ||
4449 | 2831 | return; | ||
4450 | 2832 | } | ||
4451 | 2833 | |||
4452 | 2834 | // Caller can pass in an Event, Object, or just an event type string | ||
4453 | 2835 | event = typeof event === "object" ? | ||
4454 | 2836 | // jQuery.Event object | ||
4455 | 2837 | event[ jQuery.expando ] ? event : | ||
4456 | 2838 | // Object literal | ||
4457 | 2839 | new jQuery.Event( type, event ) : | ||
4458 | 2840 | // Just the event type (string) | ||
4459 | 2841 | new jQuery.Event( type ); | ||
4460 | 2842 | |||
4461 | 2843 | event.type = type; | ||
4462 | 2844 | event.exclusive = exclusive; | ||
4463 | 2845 | event.namespace = namespaces.join("."); | ||
4464 | 2846 | event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); | ||
4465 | 2847 | |||
4466 | 2848 | // triggerHandler() and global events don't bubble or run the default action | ||
4467 | 2849 | if ( onlyHandlers || !elem ) { | ||
4468 | 2850 | event.preventDefault(); | ||
4469 | 2851 | event.stopPropagation(); | ||
4470 | 2852 | } | ||
4471 | 2853 | |||
4472 | 2854 | // Handle a global trigger | ||
4473 | 2855 | if ( !elem ) { | ||
4474 | 2856 | // TODO: Stop taunting the data cache; remove global events and always attach to document | ||
4475 | 2857 | jQuery.each( jQuery.cache, function() { | ||
4476 | 2858 | // internalKey variable is just used to make it easier to find | ||
4477 | 2859 | // and potentially change this stuff later; currently it just | ||
4478 | 2860 | // points to jQuery.expando | ||
4479 | 2861 | var internalKey = jQuery.expando, | ||
4480 | 2862 | internalCache = this[ internalKey ]; | ||
4481 | 2863 | if ( internalCache && internalCache.events && internalCache.events[ type ] ) { | ||
4482 | 2864 | jQuery.event.trigger( event, data, internalCache.handle.elem ); | ||
4483 | 2865 | } | ||
4484 | 2866 | }); | ||
4485 | 2867 | return; | ||
4486 | 2868 | } | ||
4487 | 2869 | |||
4488 | 2870 | // Don't do events on text and comment nodes | ||
4489 | 2871 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | ||
4490 | 2872 | return; | ||
4491 | 2873 | } | ||
4492 | 2874 | |||
4493 | 2875 | // Clean up the event in case it is being reused | ||
4494 | 2876 | event.result = undefined; | ||
4495 | 2877 | event.target = elem; | ||
4496 | 2878 | |||
4497 | 2879 | // Clone any incoming data and prepend the event, creating the handler arg list | ||
4498 | 2880 | data = data != null ? jQuery.makeArray( data ) : []; | ||
4499 | 2881 | data.unshift( event ); | ||
4500 | 2882 | |||
4501 | 2883 | var cur = elem, | ||
4502 | 2884 | // IE doesn't like method names with a colon (#3533, #8272) | ||
4503 | 2885 | ontype = type.indexOf(":") < 0 ? "on" + type : ""; | ||
4504 | 2886 | |||
4505 | 2887 | // Fire event on the current element, then bubble up the DOM tree | ||
4506 | 2888 | do { | ||
4507 | 2889 | var handle = jQuery._data( cur, "handle" ); | ||
4508 | 2890 | |||
4509 | 2891 | event.currentTarget = cur; | ||
4510 | 2892 | if ( handle ) { | ||
4511 | 2893 | handle.apply( cur, data ); | ||
4512 | 2894 | } | ||
4513 | 2895 | |||
4514 | 2896 | // Trigger an inline bound script | ||
4515 | 2897 | if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) { | ||
4516 | 2898 | event.result = false; | ||
4517 | 2899 | event.preventDefault(); | ||
4518 | 2900 | } | ||
4519 | 2901 | |||
4520 | 2902 | // Bubble up to document, then to window | ||
4521 | 2903 | cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window; | ||
4522 | 2904 | } while ( cur && !event.isPropagationStopped() ); | ||
4523 | 2905 | |||
4524 | 2906 | // If nobody prevented the default action, do it now | ||
4525 | 2907 | if ( !event.isDefaultPrevented() ) { | ||
4526 | 2908 | var old, | ||
4527 | 2909 | special = jQuery.event.special[ type ] || {}; | ||
4528 | 2910 | |||
4529 | 2911 | if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) && | ||
4530 | 2912 | !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { | ||
4531 | 2913 | |||
4532 | 2914 | // Call a native DOM method on the target with the same name name as the event. | ||
4533 | 2915 | // Can't use an .isFunction)() check here because IE6/7 fails that test. | ||
4534 | 2916 | // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch. | ||
4535 | 2917 | try { | ||
4536 | 2918 | if ( ontype && elem[ type ] ) { | ||
4537 | 2919 | // Don't re-trigger an onFOO event when we call its FOO() method | ||
4538 | 2920 | old = elem[ ontype ]; | ||
4539 | 2921 | |||
4540 | 2922 | if ( old ) { | ||
4541 | 2923 | elem[ ontype ] = null; | ||
4542 | 2924 | } | ||
4543 | 2925 | |||
4544 | 2926 | jQuery.event.triggered = type; | ||
4545 | 2927 | elem[ type ](); | ||
4546 | 2928 | } | ||
4547 | 2929 | } catch ( ieError ) {} | ||
4548 | 2930 | |||
4549 | 2931 | if ( old ) { | ||
4550 | 2932 | elem[ ontype ] = old; | ||
4551 | 2933 | } | ||
4552 | 2934 | |||
4553 | 2935 | jQuery.event.triggered = undefined; | ||
4554 | 2936 | } | ||
4555 | 2937 | } | ||
4556 | 2938 | |||
4557 | 2939 | return event.result; | ||
4558 | 2940 | }, | ||
4559 | 2941 | |||
4560 | 2942 | handle: function( event ) { | ||
4561 | 2943 | event = jQuery.event.fix( event || window.event ); | ||
4562 | 2944 | // Snapshot the handlers list since a called handler may add/remove events. | ||
4563 | 2945 | var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), | ||
4564 | 2946 | run_all = !event.exclusive && !event.namespace, | ||
4565 | 2947 | args = Array.prototype.slice.call( arguments, 0 ); | ||
4566 | 2948 | |||
4567 | 2949 | // Use the fix-ed Event rather than the (read-only) native event | ||
4568 | 2950 | args[0] = event; | ||
4569 | 2951 | event.currentTarget = this; | ||
4570 | 2952 | |||
4571 | 2953 | for ( var j = 0, l = handlers.length; j < l; j++ ) { | ||
4572 | 2954 | var handleObj = handlers[ j ]; | ||
4573 | 2955 | |||
4574 | 2956 | // Triggered event must 1) be non-exclusive and have no namespace, or | ||
4575 | 2957 | // 2) have namespace(s) a subset or equal to those in the bound event. | ||
4576 | 2958 | if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { | ||
4577 | 2959 | // Pass in a reference to the handler function itself | ||
4578 | 2960 | // So that we can later remove it | ||
4579 | 2961 | event.handler = handleObj.handler; | ||
4580 | 2962 | event.data = handleObj.data; | ||
4581 | 2963 | event.handleObj = handleObj; | ||
4582 | 2964 | |||
4583 | 2965 | var ret = handleObj.handler.apply( this, args ); | ||
4584 | 2966 | |||
4585 | 2967 | if ( ret !== undefined ) { | ||
4586 | 2968 | event.result = ret; | ||
4587 | 2969 | if ( ret === false ) { | ||
4588 | 2970 | event.preventDefault(); | ||
4589 | 2971 | event.stopPropagation(); | ||
4590 | 2972 | } | ||
4591 | 2973 | } | ||
4592 | 2974 | |||
4593 | 2975 | if ( event.isImmediatePropagationStopped() ) { | ||
4594 | 2976 | break; | ||
4595 | 2977 | } | ||
4596 | 2978 | } | ||
4597 | 2979 | } | ||
4598 | 2980 | return event.result; | ||
4599 | 2981 | }, | ||
4600 | 2982 | |||
4601 | 2983 | props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), | ||
4602 | 2984 | |||
4603 | 2985 | fix: function( event ) { | ||
4604 | 2986 | if ( event[ jQuery.expando ] ) { | ||
4605 | 2987 | return event; | ||
4606 | 2988 | } | ||
4607 | 2989 | |||
4608 | 2990 | // store a copy of the original event object | ||
4609 | 2991 | // and "clone" to set read-only properties | ||
4610 | 2992 | var originalEvent = event; | ||
4611 | 2993 | event = jQuery.Event( originalEvent ); | ||
4612 | 2994 | |||
4613 | 2995 | for ( var i = this.props.length, prop; i; ) { | ||
4614 | 2996 | prop = this.props[ --i ]; | ||
4615 | 2997 | event[ prop ] = originalEvent[ prop ]; | ||
4616 | 2998 | } | ||
4617 | 2999 | |||
4618 | 3000 | // Fix target property, if necessary | ||
4619 | 3001 | if ( !event.target ) { | ||
4620 | 3002 | // Fixes #1925 where srcElement might not be defined either | ||
4621 | 3003 | event.target = event.srcElement || document; | ||
4622 | 3004 | } | ||
4623 | 3005 | |||
4624 | 3006 | // check if target is a textnode (safari) | ||
4625 | 3007 | if ( event.target.nodeType === 3 ) { | ||
4626 | 3008 | event.target = event.target.parentNode; | ||
4627 | 3009 | } | ||
4628 | 3010 | |||
4629 | 3011 | // Add relatedTarget, if necessary | ||
4630 | 3012 | if ( !event.relatedTarget && event.fromElement ) { | ||
4631 | 3013 | event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; | ||
4632 | 3014 | } | ||
4633 | 3015 | |||
4634 | 3016 | // Calculate pageX/Y if missing and clientX/Y available | ||
4635 | 3017 | if ( event.pageX == null && event.clientX != null ) { | ||
4636 | 3018 | var eventDocument = event.target.ownerDocument || document, | ||
4637 | 3019 | doc = eventDocument.documentElement, | ||
4638 | 3020 | body = eventDocument.body; | ||
4639 | 3021 | |||
4640 | 3022 | event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); | ||
4641 | 3023 | event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); | ||
4642 | 3024 | } | ||
4643 | 3025 | |||
4644 | 3026 | // Add which for key events | ||
4645 | 3027 | if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { | ||
4646 | 3028 | event.which = event.charCode != null ? event.charCode : event.keyCode; | ||
4647 | 3029 | } | ||
4648 | 3030 | |||
4649 | 3031 | // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) | ||
4650 | 3032 | if ( !event.metaKey && event.ctrlKey ) { | ||
4651 | 3033 | event.metaKey = event.ctrlKey; | ||
4652 | 3034 | } | ||
4653 | 3035 | |||
4654 | 3036 | // Add which for click: 1 === left; 2 === middle; 3 === right | ||
4655 | 3037 | // Note: button is not normalized, so don't use it | ||
4656 | 3038 | if ( !event.which && event.button !== undefined ) { | ||
4657 | 3039 | event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); | ||
4658 | 3040 | } | ||
4659 | 3041 | |||
4660 | 3042 | return event; | ||
4661 | 3043 | }, | ||
4662 | 3044 | |||
4663 | 3045 | // Deprecated, use jQuery.guid instead | ||
4664 | 3046 | guid: 1E8, | ||
4665 | 3047 | |||
4666 | 3048 | // Deprecated, use jQuery.proxy instead | ||
4667 | 3049 | proxy: jQuery.proxy, | ||
4668 | 3050 | |||
4669 | 3051 | special: { | ||
4670 | 3052 | ready: { | ||
4671 | 3053 | // Make sure the ready event is setup | ||
4672 | 3054 | setup: jQuery.bindReady, | ||
4673 | 3055 | teardown: jQuery.noop | ||
4674 | 3056 | }, | ||
4675 | 3057 | |||
4676 | 3058 | live: { | ||
4677 | 3059 | add: function( handleObj ) { | ||
4678 | 3060 | jQuery.event.add( this, | ||
4679 | 3061 | liveConvert( handleObj.origType, handleObj.selector ), | ||
4680 | 3062 | jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); | ||
4681 | 3063 | }, | ||
4682 | 3064 | |||
4683 | 3065 | remove: function( handleObj ) { | ||
4684 | 3066 | jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); | ||
4685 | 3067 | } | ||
4686 | 3068 | }, | ||
4687 | 3069 | |||
4688 | 3070 | beforeunload: { | ||
4689 | 3071 | setup: function( data, namespaces, eventHandle ) { | ||
4690 | 3072 | // We only want to do this special case on windows | ||
4691 | 3073 | if ( jQuery.isWindow( this ) ) { | ||
4692 | 3074 | this.onbeforeunload = eventHandle; | ||
4693 | 3075 | } | ||
4694 | 3076 | }, | ||
4695 | 3077 | |||
4696 | 3078 | teardown: function( namespaces, eventHandle ) { | ||
4697 | 3079 | if ( this.onbeforeunload === eventHandle ) { | ||
4698 | 3080 | this.onbeforeunload = null; | ||
4699 | 3081 | } | ||
4700 | 3082 | } | ||
4701 | 3083 | } | ||
4702 | 3084 | } | ||
4703 | 3085 | }; | ||
4704 | 3086 | |||
4705 | 3087 | jQuery.removeEvent = document.removeEventListener ? | ||
4706 | 3088 | function( elem, type, handle ) { | ||
4707 | 3089 | if ( elem.removeEventListener ) { | ||
4708 | 3090 | elem.removeEventListener( type, handle, false ); | ||
4709 | 3091 | } | ||
4710 | 3092 | } : | ||
4711 | 3093 | function( elem, type, handle ) { | ||
4712 | 3094 | if ( elem.detachEvent ) { | ||
4713 | 3095 | elem.detachEvent( "on" + type, handle ); | ||
4714 | 3096 | } | ||
4715 | 3097 | }; | ||
4716 | 3098 | |||
4717 | 3099 | jQuery.Event = function( src, props ) { | ||
4718 | 3100 | // Allow instantiation without the 'new' keyword | ||
4719 | 3101 | if ( !this.preventDefault ) { | ||
4720 | 3102 | return new jQuery.Event( src, props ); | ||
4721 | 3103 | } | ||
4722 | 3104 | |||
4723 | 3105 | // Event object | ||
4724 | 3106 | if ( src && src.type ) { | ||
4725 | 3107 | this.originalEvent = src; | ||
4726 | 3108 | this.type = src.type; | ||
4727 | 3109 | |||
4728 | 3110 | // Events bubbling up the document may have been marked as prevented | ||
4729 | 3111 | // by a handler lower down the tree; reflect the correct value. | ||
4730 | 3112 | this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || | ||
4731 | 3113 | src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; | ||
4732 | 3114 | |||
4733 | 3115 | // Event type | ||
4734 | 3116 | } else { | ||
4735 | 3117 | this.type = src; | ||
4736 | 3118 | } | ||
4737 | 3119 | |||
4738 | 3120 | // Put explicitly provided properties onto the event object | ||
4739 | 3121 | if ( props ) { | ||
4740 | 3122 | jQuery.extend( this, props ); | ||
4741 | 3123 | } | ||
4742 | 3124 | |||
4743 | 3125 | // timeStamp is buggy for some events on Firefox(#3843) | ||
4744 | 3126 | // So we won't rely on the native value | ||
4745 | 3127 | this.timeStamp = jQuery.now(); | ||
4746 | 3128 | |||
4747 | 3129 | // Mark it as fixed | ||
4748 | 3130 | this[ jQuery.expando ] = true; | ||
4749 | 3131 | }; | ||
4750 | 3132 | |||
4751 | 3133 | function returnFalse() { | ||
4752 | 3134 | return false; | ||
4753 | 3135 | } | ||
4754 | 3136 | function returnTrue() { | ||
4755 | 3137 | return true; | ||
4756 | 3138 | } | ||
4757 | 3139 | |||
4758 | 3140 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | ||
4759 | 3141 | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | ||
4760 | 3142 | jQuery.Event.prototype = { | ||
4761 | 3143 | preventDefault: function() { | ||
4762 | 3144 | this.isDefaultPrevented = returnTrue; | ||
4763 | 3145 | |||
4764 | 3146 | var e = this.originalEvent; | ||
4765 | 3147 | if ( !e ) { | ||
4766 | 3148 | return; | ||
4767 | 3149 | } | ||
4768 | 3150 | |||
4769 | 3151 | // if preventDefault exists run it on the original event | ||
4770 | 3152 | if ( e.preventDefault ) { | ||
4771 | 3153 | e.preventDefault(); | ||
4772 | 3154 | |||
4773 | 3155 | // otherwise set the returnValue property of the original event to false (IE) | ||
4774 | 3156 | } else { | ||
4775 | 3157 | e.returnValue = false; | ||
4776 | 3158 | } | ||
4777 | 3159 | }, | ||
4778 | 3160 | stopPropagation: function() { | ||
4779 | 3161 | this.isPropagationStopped = returnTrue; | ||
4780 | 3162 | |||
4781 | 3163 | var e = this.originalEvent; | ||
4782 | 3164 | if ( !e ) { | ||
4783 | 3165 | return; | ||
4784 | 3166 | } | ||
4785 | 3167 | // if stopPropagation exists run it on the original event | ||
4786 | 3168 | if ( e.stopPropagation ) { | ||
4787 | 3169 | e.stopPropagation(); | ||
4788 | 3170 | } | ||
4789 | 3171 | // otherwise set the cancelBubble property of the original event to true (IE) | ||
4790 | 3172 | e.cancelBubble = true; | ||
4791 | 3173 | }, | ||
4792 | 3174 | stopImmediatePropagation: function() { | ||
4793 | 3175 | this.isImmediatePropagationStopped = returnTrue; | ||
4794 | 3176 | this.stopPropagation(); | ||
4795 | 3177 | }, | ||
4796 | 3178 | isDefaultPrevented: returnFalse, | ||
4797 | 3179 | isPropagationStopped: returnFalse, | ||
4798 | 3180 | isImmediatePropagationStopped: returnFalse | ||
4799 | 3181 | }; | ||
4800 | 3182 | |||
4801 | 3183 | // Checks if an event happened on an element within another element | ||
4802 | 3184 | // Used in jQuery.event.special.mouseenter and mouseleave handlers | ||
4803 | 3185 | var withinElement = function( event ) { | ||
4804 | 3186 | |||
4805 | 3187 | // Check if mouse(over|out) are still within the same parent element | ||
4806 | 3188 | var related = event.relatedTarget, | ||
4807 | 3189 | inside = false, | ||
4808 | 3190 | eventType = event.type; | ||
4809 | 3191 | |||
4810 | 3192 | event.type = event.data; | ||
4811 | 3193 | |||
4812 | 3194 | if ( related !== this ) { | ||
4813 | 3195 | |||
4814 | 3196 | if ( related ) { | ||
4815 | 3197 | inside = jQuery.contains( this, related ); | ||
4816 | 3198 | } | ||
4817 | 3199 | |||
4818 | 3200 | if ( !inside ) { | ||
4819 | 3201 | |||
4820 | 3202 | jQuery.event.handle.apply( this, arguments ); | ||
4821 | 3203 | |||
4822 | 3204 | event.type = eventType; | ||
4823 | 3205 | } | ||
4824 | 3206 | } | ||
4825 | 3207 | }, | ||
4826 | 3208 | |||
4827 | 3209 | // In case of event delegation, we only need to rename the event.type, | ||
4828 | 3210 | // liveHandler will take care of the rest. | ||
4829 | 3211 | delegate = function( event ) { | ||
4830 | 3212 | event.type = event.data; | ||
4831 | 3213 | jQuery.event.handle.apply( this, arguments ); | ||
4832 | 3214 | }; | ||
4833 | 3215 | |||
4834 | 3216 | // Create mouseenter and mouseleave events | ||
4835 | 3217 | jQuery.each({ | ||
4836 | 3218 | mouseenter: "mouseover", | ||
4837 | 3219 | mouseleave: "mouseout" | ||
4838 | 3220 | }, function( orig, fix ) { | ||
4839 | 3221 | jQuery.event.special[ orig ] = { | ||
4840 | 3222 | setup: function( data ) { | ||
4841 | 3223 | jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); | ||
4842 | 3224 | }, | ||
4843 | 3225 | teardown: function( data ) { | ||
4844 | 3226 | jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); | ||
4845 | 3227 | } | ||
4846 | 3228 | }; | ||
4847 | 3229 | }); | ||
4848 | 3230 | |||
4849 | 3231 | // submit delegation | ||
4850 | 3232 | if ( !jQuery.support.submitBubbles ) { | ||
4851 | 3233 | |||
4852 | 3234 | jQuery.event.special.submit = { | ||
4853 | 3235 | setup: function( data, namespaces ) { | ||
4854 | 3236 | if ( !jQuery.nodeName( this, "form" ) ) { | ||
4855 | 3237 | jQuery.event.add(this, "click.specialSubmit", function( e ) { | ||
4856 | 3238 | var elem = e.target, | ||
4857 | 3239 | type = elem.type; | ||
4858 | 3240 | |||
4859 | 3241 | if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { | ||
4860 | 3242 | trigger( "submit", this, arguments ); | ||
4861 | 3243 | } | ||
4862 | 3244 | }); | ||
4863 | 3245 | |||
4864 | 3246 | jQuery.event.add(this, "keypress.specialSubmit", function( e ) { | ||
4865 | 3247 | var elem = e.target, | ||
4866 | 3248 | type = elem.type; | ||
4867 | 3249 | |||
4868 | 3250 | if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { | ||
4869 | 3251 | trigger( "submit", this, arguments ); | ||
4870 | 3252 | } | ||
4871 | 3253 | }); | ||
4872 | 3254 | |||
4873 | 3255 | } else { | ||
4874 | 3256 | return false; | ||
4875 | 3257 | } | ||
4876 | 3258 | }, | ||
4877 | 3259 | |||
4878 | 3260 | teardown: function( namespaces ) { | ||
4879 | 3261 | jQuery.event.remove( this, ".specialSubmit" ); | ||
4880 | 3262 | } | ||
4881 | 3263 | }; | ||
4882 | 3264 | |||
4883 | 3265 | } | ||
4884 | 3266 | |||
4885 | 3267 | // change delegation, happens here so we have bind. | ||
4886 | 3268 | if ( !jQuery.support.changeBubbles ) { | ||
4887 | 3269 | |||
4888 | 3270 | var changeFilters, | ||
4889 | 3271 | |||
4890 | 3272 | getVal = function( elem ) { | ||
4891 | 3273 | var type = elem.type, val = elem.value; | ||
4892 | 3274 | |||
4893 | 3275 | if ( type === "radio" || type === "checkbox" ) { | ||
4894 | 3276 | val = elem.checked; | ||
4895 | 3277 | |||
4896 | 3278 | } else if ( type === "select-multiple" ) { | ||
4897 | 3279 | val = elem.selectedIndex > -1 ? | ||
4898 | 3280 | jQuery.map( elem.options, function( elem ) { | ||
4899 | 3281 | return elem.selected; | ||
4900 | 3282 | }).join("-") : | ||
4901 | 3283 | ""; | ||
4902 | 3284 | |||
4903 | 3285 | } else if ( jQuery.nodeName( elem, "select" ) ) { | ||
4904 | 3286 | val = elem.selectedIndex; | ||
4905 | 3287 | } | ||
4906 | 3288 | |||
4907 | 3289 | return val; | ||
4908 | 3290 | }, | ||
4909 | 3291 | |||
4910 | 3292 | testChange = function testChange( e ) { | ||
4911 | 3293 | var elem = e.target, data, val; | ||
4912 | 3294 | |||
4913 | 3295 | if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { | ||
4914 | 3296 | return; | ||
4915 | 3297 | } | ||
4916 | 3298 | |||
4917 | 3299 | data = jQuery._data( elem, "_change_data" ); | ||
4918 | 3300 | val = getVal(elem); | ||
4919 | 3301 | |||
4920 | 3302 | // the current data will be also retrieved by beforeactivate | ||
4921 | 3303 | if ( e.type !== "focusout" || elem.type !== "radio" ) { | ||
4922 | 3304 | jQuery._data( elem, "_change_data", val ); | ||
4923 | 3305 | } | ||
4924 | 3306 | |||
4925 | 3307 | if ( data === undefined || val === data ) { | ||
4926 | 3308 | return; | ||
4927 | 3309 | } | ||
4928 | 3310 | |||
4929 | 3311 | if ( data != null || val ) { | ||
4930 | 3312 | e.type = "change"; | ||
4931 | 3313 | e.liveFired = undefined; | ||
4932 | 3314 | jQuery.event.trigger( e, arguments[1], elem ); | ||
4933 | 3315 | } | ||
4934 | 3316 | }; | ||
4935 | 3317 | |||
4936 | 3318 | jQuery.event.special.change = { | ||
4937 | 3319 | filters: { | ||
4938 | 3320 | focusout: testChange, | ||
4939 | 3321 | |||
4940 | 3322 | beforedeactivate: testChange, | ||
4941 | 3323 | |||
4942 | 3324 | click: function( e ) { | ||
4943 | 3325 | var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; | ||
4944 | 3326 | |||
4945 | 3327 | if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) { | ||
4946 | 3328 | testChange.call( this, e ); | ||
4947 | 3329 | } | ||
4948 | 3330 | }, | ||
4949 | 3331 | |||
4950 | 3332 | // Change has to be called before submit | ||
4951 | 3333 | // Keydown will be called before keypress, which is used in submit-event delegation | ||
4952 | 3334 | keydown: function( e ) { | ||
4953 | 3335 | var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; | ||
4954 | 3336 | |||
4955 | 3337 | if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) || | ||
4956 | 3338 | (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || | ||
4957 | 3339 | type === "select-multiple" ) { | ||
4958 | 3340 | testChange.call( this, e ); | ||
4959 | 3341 | } | ||
4960 | 3342 | }, | ||
4961 | 3343 | |||
4962 | 3344 | // Beforeactivate happens also before the previous element is blurred | ||
4963 | 3345 | // with this event you can't trigger a change event, but you can store | ||
4964 | 3346 | // information | ||
4965 | 3347 | beforeactivate: function( e ) { | ||
4966 | 3348 | var elem = e.target; | ||
4967 | 3349 | jQuery._data( elem, "_change_data", getVal(elem) ); | ||
4968 | 3350 | } | ||
4969 | 3351 | }, | ||
4970 | 3352 | |||
4971 | 3353 | setup: function( data, namespaces ) { | ||
4972 | 3354 | if ( this.type === "file" ) { | ||
4973 | 3355 | return false; | ||
4974 | 3356 | } | ||
4975 | 3357 | |||
4976 | 3358 | for ( var type in changeFilters ) { | ||
4977 | 3359 | jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); | ||
4978 | 3360 | } | ||
4979 | 3361 | |||
4980 | 3362 | return rformElems.test( this.nodeName ); | ||
4981 | 3363 | }, | ||
4982 | 3364 | |||
4983 | 3365 | teardown: function( namespaces ) { | ||
4984 | 3366 | jQuery.event.remove( this, ".specialChange" ); | ||
4985 | 3367 | |||
4986 | 3368 | return rformElems.test( this.nodeName ); | ||
4987 | 3369 | } | ||
4988 | 3370 | }; | ||
4989 | 3371 | |||
4990 | 3372 | changeFilters = jQuery.event.special.change.filters; | ||
4991 | 3373 | |||
4992 | 3374 | // Handle when the input is .focus()'d | ||
4993 | 3375 | changeFilters.focus = changeFilters.beforeactivate; | ||
4994 | 3376 | } | ||
4995 | 3377 | |||
4996 | 3378 | function trigger( type, elem, args ) { | ||
4997 | 3379 | // Piggyback on a donor event to simulate a different one. | ||
4998 | 3380 | // Fake originalEvent to avoid donor's stopPropagation, but if the | ||
4999 | 3381 | // simulated event prevents default then we do the same on the donor. | ||
5000 | 3382 | // Don't pass args or remember liveFired; they apply to the donor event. |
The diff has been truncated for viewing.