From ada1488366d8ece8e4f1bbbca6a4d76ade1ce66a Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:06:34 +0000 Subject: [PATCH 1/2] Format code with prettier and standardjs This commit fixes the style issues introduced in cbdaad3 according to the output from prettier and standardjs. Details: https://deepsource.io/gh/Wrlog/Wr.github.io/transform/c1aaf1c9-cfc4-46d1-8ba4-f9ec7d708769/ --- _includes/comments.html | 207 +- _includes/header.html | 243 +- _includes/sidebar-categories-nav.html | 16 +- _includes/sidebar-popular-repo.html | 60 +- _includes/sidebar-post-nav.html | 7 +- _includes/sidebar-search.html | 29 +- _includes/sns-share.html | 2 +- _layouts/categories.html | 46 +- _layouts/default.html | 4 +- _layouts/page.html | 56 +- _layouts/post.html | 65 +- _layouts/wiki.html | 39 +- _posts/2022-07-03-drug-drug-interaction.md | 37 +- _posts/2022-07-04-SpecialpopulationPK.md | 15 +- _posts/2022-07-05-Hysteresis.md | 10 +- _posts/2022-07-09-Transcription.md | 25 +- _posts/2022-07-12-ATACseq.md | 19 +- _posts/2022-08-01-Rstudymaterial.md | 5 +- _posts/2022-08-03-R_ggplot-Scatterplot.md | 5 +- .../2022-08-13-object_oriented_programming.md | 15 +- ...ability estimation and Bayesian formula.md | 70 +- _posts/2022-11-06-E-max.md | 15 +- assets/css/components/boxed-group.css | 162 +- assets/css/components/collection.css | 232 +- assets/css/components/repo-card.css | 62 +- assets/css/globals/common.css | 829 +- assets/css/globals/prism.css | 113 +- assets/css/globals/responsive.css | 47 +- assets/css/modules/sidebar-search.css | 10 +- assets/css/pages/index.css | 23 +- assets/css/posts/index.css | 145 +- assets/css/pygments/default.css | 269 +- assets/css/sections/mini-repo-list.css | 63 +- assets/css/sections/repo-list.css | 107 +- assets/js/flow.js | 90 +- assets/js/geopattern.js | 1632 +- assets/js/jquery-ui.js | 35272 ++++++++-------- assets/js/jquery.toc.js | 290 +- assets/js/main.js | 43 +- assets/js/prism.js | 565 +- assets/js/search.js | 28 +- assets/js/snap.svg-min.js | 4882 ++- assets/js/underscore-min.js | 1031 +- assets/js/webfont.js | 717 +- assets/vendor/flowchart.js/dist/flowchart.js | 2716 +- .../dist/sequence-diagram-min.css | 7 +- .../dist/sequence-diagram-min.js | 2465 +- .../dist/sequence-diagram-raphael-min.js | 2269 +- .../dist/sequence-diagram-raphael.js | 4491 +- .../dist/sequence-diagram-snap-min.js | 1468 +- .../dist/sequence-diagram-snap.js | 3247 +- .../dist/sequence-diagram.css | 10 +- .../dist/sequence-diagram.js | 4996 ++- assets/vendor/octicons/octicons/octicons.css | 664 +- .../overtrue-share.js/dist/css/share.min.css | 213 +- assets/vendor/primer-css/css/primer.css | 1807 +- .../primer-markdown/dist/user-content.min.css | 570 +- assets/vendor/share.js/dist/css/share.min.css | 213 +- images/posts/pharmacokinetic/Read_me.md | 1 - index.html | 211 +- pages/404.md | 33 +- pages/about.md | 28 +- pages/archives.md | 14 +- pages/categories.md | 1 - pages/links.md | 5 +- 65 files changed, 48157 insertions(+), 24874 deletions(-) diff --git a/_includes/comments.html b/_includes/comments.html index fb1b2d82e63..ec3880c1f0a 100644 --- a/_includes/comments.html +++ b/_includes/comments.html @@ -1,107 +1,114 @@ -{% if page.comments != false %} +{% if page.comments != false %} {% if site.comments_provider != 'disqus' and +site.lazy_load_disqus and site.disqus and site.disqus.username %} +Show Disqus Comments +
+ + +{% endif %} {% case site.comments_provider %} {% when 'disqus' %} {% if +site.disqus and site.disqus.username %} {% assign load_disqus = true %} + +{% if site.disqus.username == 'mzlogin' %} {% assign load_disqus = false %} {% +if site.url contains 'mazhuang.org' %} {% assign load_disqus = true %} {% endif +%} {% endif %} {% if load_disqus %} +
+ - - {% endif %} + s.type = "text/javascript"; + s.async = true; + var shortname = "{{ site.disqus.username }}"; - {% case site.comments_provider %} - {% when 'disqus' %} - {% if site.disqus and site.disqus.username %} - {% assign load_disqus = true %} - - {% if site.disqus.username == 'mzlogin' %} - {% assign load_disqus = false %} - {% if site.url contains 'mazhuang.org' %} - {% assign load_disqus = true %} - {% endif %} - {% endif %} - {% if load_disqus %} -
- - - {% endif %} - {% endif %} - {% when 'gitment' %} -
- - - - {% when 'gitalk' %} -
- - - - {% endcase %} -{% endif %} + s.setAttribute("data-timestamp", +new Date()); + (d.head || d.body).appendChild(s); + })(); + + +{% endif %} {% endif %} {% when 'gitment' %} +
+ + + +{% when 'gitalk' %} +
+ + + +{% endcase %} {% endif %} diff --git a/_includes/header.html b/_includes/header.html index 7f675c858ec..e59d5183703 100755 --- a/_includes/header.html +++ b/_includes/header.html @@ -1,12 +1,18 @@ - - - - - + + + + + - + - - {% if page.title %}{{ page.title }} — {% endif %}{{ site.title }} - - - - - - - - - - - - + + + + {% if page.title %}{{ page.title }} — {% endif %}{{ site.title }} + + + + + + + + + + + + + {% for css in page.css %} - - {% endfor %} - - {% if site.ios_app_name %} - - + + {% endfor %} {% if site.ios_app_name %} + + {% endif %} - - - + + + {% if page.title %} - - {% if page.keywords %} - {% assign keywords = page.keywords %} - {% else %} - {% assign keywords = site.keywords %} - {% endif %} - - - {% if page.excerpt %} - - - {% else if page.description %} - - - {% else if content %} - - - {% endif %} - {% else %} - - - {% endif %} - {% if page.og_image_url %} - - {% else %} - {% if page.photo_url %} - - {% endif %} - {% endif %} - - - + + {% if page.keywords %} {% assign keywords = page.keywords %} {% else %} {% + assign keywords = site.keywords %} {% endif %} + + + {% if page.excerpt %} + + + {% else if page.description %} + + + {% else if content %} + + + {% endif %} {% else %} + + + {% endif %} {% if page.og_image_url %} + + {% else %} {% if page.photo_url %} + + {% endif %} {% endif %} + + + {% if page.date %} - + {% endif %} - - + + + + diff --git a/_includes/sidebar-categories-nav.html b/_includes/sidebar-categories-nav.html index a1241146417..f54adf0eee3 100644 --- a/_includes/sidebar-categories-nav.html +++ b/_includes/sidebar-categories-nav.html @@ -1,22 +1,18 @@ -

Blog Categories

- diff --git a/_includes/sidebar-popular-repo.html b/_includes/sidebar-popular-repo.html index a4f86bdf07e..373aed41b7c 100644 --- a/_includes/sidebar-popular-repo.html +++ b/_includes/sidebar-popular-repo.html @@ -1,34 +1,34 @@

My Popular Repositories

-{% if site.github.public_repositories != null %} -{% assign repos = site.github.public_repositories | sort: "stargazers_count" | reverse%} -{% for repo in repos | limit: site.side_bar_repo_limit %} +{% if site.github.public_repositories != null %} {% assign repos = +site.github.public_repositories | sort: "stargazers_count" | reverse%} {% for +repo in repos | limit: site.side_bar_repo_limit %} -
-
-
-

- {{ repo.name }} -

-
-
-
-
-

{{ repo.description }}

-
-
- - {{ repo.stargazers_count }} - - - {{ repo.forks_count }} - - - - - -
-
+
+
+
+

{{ repo.name }}

+
+
+
+

{{ repo.description }}

+
+
+ + {{ repo.stargazers_count }} + + + {{ repo.forks_count + }} + + + + + +
+
+
-{% endfor %} -{% endif %} +{% endfor %} {% endif %} diff --git a/_includes/sidebar-post-nav.html b/_includes/sidebar-post-nav.html index 68903345a28..03121346dfb 100644 --- a/_includes/sidebar-post-nav.html +++ b/_includes/sidebar-post-nav.html @@ -1,10 +1,9 @@ -

Table of Contents

- - -
+ + +
diff --git a/_includes/sidebar-search.html b/_includes/sidebar-search.html index 77300b4af6f..b9e2835ae1f 100644 --- a/_includes/sidebar-search.html +++ b/_includes/sidebar-search.html @@ -1,24 +1,27 @@ -

Search

- + diff --git a/_includes/sns-share.html b/_includes/sns-share.html index a281e1293fc..ff36120b39d 100755 --- a/_includes/sns-share.html +++ b/_includes/sns-share.html @@ -1 +1 @@ -
\ No newline at end of file +
diff --git a/_layouts/categories.html b/_layouts/categories.html index 53c384e5a50..59e1087aa0d 100755 --- a/_layouts/categories.html +++ b/_layouts/categories.html @@ -1,35 +1,33 @@ --- layout: default --- -
-
-
-
-
-

{{ page.title }}

-
-
+ +
+
+
+
+
+

{{ page.title }}

+
+
-
-
-
- {{ content }} -
- -
- {% include comments.html %} -
-
-
- {% include sidebar-search.html %} - {% include sidebar-categories-nav.html %} -
+
+
+
{{ content }}
+ +
{% include comments.html %}
+
+
+ {% include sidebar-search.html %} {% include sidebar-categories-nav.html + %}
+
diff --git a/_layouts/default.html b/_layouts/default.html index 42a31d068f0..9bd241368e5 100755 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,3 +1 @@ -{% include header.html %} - {{ content }} -{% include footer.html %} \ No newline at end of file +{% include header.html %} {{ content }} {% include footer.html %} diff --git a/_layouts/page.html b/_layouts/page.html index f34a55e9d58..93fdd8bb0db 100755 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -1,37 +1,31 @@ --- layout: default --- -
-
-
-

{{ page.title }}

- {% if page.subtitle %} -
- - {{ page.subtitle}} - -
- {% endif %} -
+ +
+
+
+

{{ page.title }}

+ {% if page.subtitle %} +
+ {{ page.subtitle}} +
+ {% endif %}
+
-
-
-
-
- {{ content }} -
- -
- {% include comments.html %} -
-
- -
-
- +
+
+
+
{{ content }}
+ +
{% include comments.html %}
+
+ +
+
+ diff --git a/_layouts/post.html b/_layouts/post.html index 3fb25417556..1904047f357 100755 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,48 +1,47 @@ --- layout: default --- -
-
-
-
-
-

{{ page.title }}

-
- {% if page.date %} - - {{ page.date | date: "%Y/%m/%d" }} - - {% endif %} - {% for cat in page.categories %} - - - {{ cat }} - - {% endfor %} + +
+
+
+
+
+

{{ page.title }}

+
+ {% if page.date %} + + {{ page.date | + date: "%Y/%m/%d" }} + + {% endif %} {% for cat in page.categories %} + + + {{ cat }} + + {% endfor %} +
-
-
-
-
- {{ content }} -
-
diff --git a/_layouts/wiki.html b/_layouts/wiki.html index 96b684b3157..2ac476d78e3 100755 --- a/_layouts/wiki.html +++ b/_layouts/wiki.html @@ -1,35 +1,32 @@ --- layout: default --- -
-
-
-
-
-

{{ page.title }}

+ +
+
+
+
+
+

{{ page.title }}

+
-
-
-
-
- {{ content }} -
-
diff --git a/_posts/2022-07-03-drug-drug-interaction.md b/_posts/2022-07-03-drug-drug-interaction.md index 4d2fd679936..c822d7c5357 100644 --- a/_posts/2022-07-03-drug-drug-interaction.md +++ b/_posts/2022-07-03-drug-drug-interaction.md @@ -3,7 +3,7 @@ layout: post title: 【Pharmacokinetic】Drug Development and Drug-Drug Interactions categories: Pharmacokinetic description: 药物-药物相互作用 -keywords: Pharmacokinetic,Clinical,Drug Development, Drug Interactions +keywords: Pharmacokinetic,Clinical,Drug Development, Drug Interactions --- This short essay summarize some information on drug-drug interaction focues on CYP enzyme based on FDA guidance. (Available : ) @@ -14,73 +14,54 @@ This short essay summarize some information on drug-drug interaction focues on C ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/invitro%20marker%20reaction.png?raw=true) - ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/invitro%20selective%20inhibitor.png?raw=true) - ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/invitro%20selective%20inducer.png?raw=true) - **Clinical index drugs** According to FDA guidance on Clinical Drug Interaction Studies — Cytochrome P450 Enzyme- and Transporter-Mediated Drug Interactions Guidance for Industry (Available : ) ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/DDI%20CYP.png?raw=true) -This classification information helps to determine whether other drugs that have not been investigated in a DDI study have clinically significant DDIs with the investigational drug and therefore need to be mentioned in labeling. For example, if an investigational drug is a strong CYP3A inhibitor, its potential to interact with drugs that have clinically significant interactions with other strong CYP3A inhibitors should be considered, and the sponsor should add appropriate language regarding these additional interactions to the investigational drug’s labeling. - - -To test whether the investigational drug is a perpetrator, sponsors should use index substrates, which have defined changes in systemic exposure when administered with a strong inhibitor for a specific drug elimination pathway. A list of currently recommended index drugs for specific CYP pathways (either as substrates, inhibitors, or inducers) is maintained on the FDA’s Web site for Drug Development and Drug Interactions. (Available :https://www.fda.gov/drugs/drug-interactions-labeling/drug-development-and-drug-interactions-table-substrates-inhibitors-and-inducers#table2 ). +This classification information helps to determine whether other drugs that have not been investigated in a DDI study have clinically significant DDIs with the investigational drug and therefore need to be mentioned in labeling. For example, if an investigational drug is a strong CYP3A inhibitor, its potential to interact with drugs that have clinically significant interactions with other strong CYP3A inhibitors should be considered, and the sponsor should add appropriate language regarding these additional interactions to the investigational drug’s labeling. +To test whether the investigational drug is a perpetrator, sponsors should use index substrates, which have defined changes in systemic exposure when administered with a strong inhibitor for a specific drug elimination pathway. A list of currently recommended index drugs for specific CYP pathways (either as substrates, inhibitors, or inducers) is maintained on the FDA’s Web site for Drug Development and Drug Interactions. (Available :https://www.fda.gov/drugs/drug-interactions-labeling/drug-development-and-drug-interactions-table-substrates-inhibitors-and-inducers#table2 ). ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/clinical%20index%20substrate.png?raw=true) - Sensitive index substrates are index drugs that demonstrate an increase in AUC of ≥5-fold with strong index inhibitors of a given metabolic pathway in clinical DDI studies. Moderate sensitive substrates are drug that demonstrate an increase in AUC of ≥2 to <5-fold with strong index inhibitors of a given metabolic pathway in clinical DDI studies. - The above table is prepared to provide examples of clinical sensitive or moderate sensitive index substrates and is not intended to be an exhaustive list. Index substrates listed in this table were selected considering their sensitivity, specificity, safety profiles, and adequate number of reported clinical DDI studies with different in vivo inhibitors (≥ 3 for CYP3A or ≥ 2 for CYP1A2, 2C8, 2C9, 2C19, and 2D6). - ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/clinical%20index%20inhibitor.png?raw=true) - Index inhibitors predictably inhibit metabolism via a given pathway and are commonly used in prospective clinical DDI studies. - - +Index inhibitors predictably inhibit metabolism via a given pathway and are commonly used in prospective clinical DDI studies. + This table is prepared to provide examples of clinical index inhibitors and is not intended to be an exhaustive list. Index inhibitors listed in this table were selected based on potency and selectivity of inhibition, safety profiles, and adequate number of reported clinical DDI studies with different in vivo substrates [≥ 3 for CYP3A, ≥ 2 for CYP1A2, 2C9, 2C19, and 2D6, or ≥ 1 for CYP2C8 (strong inhibitors)]. - - + ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/clinical%20index%20inducer.png?raw=true) - - -Index inducers predictably induce metabolism via a given pathway and are commonly used in prospective clinical DDI studies. +Index inducers predictably induce metabolism via a given pathway and are commonly used in prospective clinical DDI studies. This table is prepared to provide examples of clinical index inducers and not intended to be an exhaustive list. Index inducers listed in this table were selected based on potency of induction, safety profiles, and number of reported clinical DDI studies with different in vivo substrates (≥ 2 substrates). - - ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/Probe%20for%20P450.png?raw=true) - **Examples of clinical substrates, inhibitors, and inducers** Sensitive substrates are drugs that demonstrate an increase in AUC of ≥5-fold with strong index inhibitors of a given metabolic pathway in clinical DDI studies. Moderate sensitive substrates are drugs that demonstrate an increase in AUC of ≥2 to <5-fold with strong index inhibitors of a given metabolic pathway in clinical DDI studies. -The above table is prepared to provide examples of clinical substrates and not intended to be an exhaustive list - +The above table is prepared to provide examples of clinical substrates and not intended to be an exhaustive list ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/clinical%20inhibitor%20of%20P450.png?raw=true) - Strong, moderate, and weak inhibitors are drugs that increase the AUC of sensitive index substrates of a given metabolic pathway ≥5-fold, ≥2 to <5-fold, and ≥1.25 to <2-fold, respectively. - +Strong, moderate, and weak inhibitors are drugs that increase the AUC of sensitive index substrates of a given metabolic pathway ≥5-fold, ≥2 to <5-fold, and ≥1.25 to <2-fold, respectively. This table is prepared to provide examples of clinical inhibitors and is not intended to be an exhaustive list. - ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/clinical%20inducer%20of%20P450.png?raw=true) Strong, moderate, and weak inducers are drugs that decreases the AUC of sensitive index substrates of a given metabolic pathway by ≥80%, ≥50% to <80%, and ≥20% to <50%, respectively. - This table is prepared to provide examples of clinical index inducers and not intended to be an exhaustive list. diff --git a/_posts/2022-07-04-SpecialpopulationPK.md b/_posts/2022-07-04-SpecialpopulationPK.md index 0a1a767a7af..3eecc30fa70 100644 --- a/_posts/2022-07-04-SpecialpopulationPK.md +++ b/_posts/2022-07-04-SpecialpopulationPK.md @@ -3,25 +3,23 @@ layout: post title: 【Pharmacokinetic】Pharmacokinetic Notes for Special Populations categories: Pharmacokinetic description: 特殊人群药代动力学笔记 -keywords: Pharmacokinetic,Clinical +keywords: Pharmacokinetic,Clinical --- -## Special Population +## Special Population **Renal Dysfunction** Drug may require adjustment when : -1) Drug >50% clearaed by renal excretion - -2) Renal <50% of normal +1. Drug >50% clearaed by renal excretion +2. Renal <50% of normal **Pregnancy** ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacokinetic/PK%20in%20pregnancy.png?raw=true) - **Pediatric** The sizes of different organs change: @@ -31,8 +29,3 @@ The sizes of different organs change: Enzyme Expression and Metabolic Rate: image - - - - - diff --git a/_posts/2022-07-05-Hysteresis.md b/_posts/2022-07-05-Hysteresis.md index 2c763af752a..37e022848af 100644 --- a/_posts/2022-07-05-Hysteresis.md +++ b/_posts/2022-07-05-Hysteresis.md @@ -3,27 +3,23 @@ layout: post title: 【Pharmacodynamic】Hysteresis categories: Pharmacodynamic description: Hysteresis -keywords: Pharmacokinetic,Clinical +keywords: Pharmacokinetic,Clinical --- ## Hysteresis Hysteresis may be defined as the retardation or lagging of an effect behind the cause of the effect. - ## How hysteresis occur **Counter-clockwise hysteresis** - -Some potential causes for counter-clockwise-hysteresis include distribution delay between the plasma and effect site, response delay,distributional delay, feedback regulation, input and output rate changes, +Some potential causes for counter-clockwise-hysteresis include distribution delay between the plasma and effect site, response delay,distributional delay, feedback regulation, input and output rate changes, sensitization of receptors, the formation and subsequent accumulation of active metabolites through drug metabolism as well as up regulation of receptors after ongoing exposure and the use of racemic drugs. - **Clockwise hysteresis** - -A clockwise hysteresis loop occurs when rapid tolerance (tachyphylaxis) develops. The response for a given plasma concentration is initially high, but decreases as tolerance rapidly develops. +A clockwise hysteresis loop occurs when rapid tolerance (tachyphylaxis) develops. The response for a given plasma concentration is initially high, but decreases as tolerance rapidly develops. Examples are cocaine or indirectly acting sympathomimetic drugs such as pseudoephedrine. diff --git a/_posts/2022-07-09-Transcription.md b/_posts/2022-07-09-Transcription.md index 2067ea54875..c38e5a5bfee 100644 --- a/_posts/2022-07-09-Transcription.md +++ b/_posts/2022-07-09-Transcription.md @@ -3,42 +3,35 @@ layout: post title: 【Genomic】Basic Transcription Note categories: Genomic description: Transcription -keywords: Transcription factor,RNA polymerase,DNA,genomic +keywords: Transcription factor,RNA polymerase,DNA,genomic --- **Transcription Factor** - -Transcription factors are proteins involved in the process of converting, or transcribing, DNA into RNA. Transcription factors include a wide number of proteins, excluding RNA polymerase, that initiate and regulate the transcription of genes. One distinct feature of transcription factors is that they have DNA-binding domains +Transcription factors are proteins involved in the process of converting, or transcribing, DNA into RNA. Transcription factors include a wide number of proteins, excluding RNA polymerase, that initiate and regulate the transcription of genes. One distinct feature of transcription factors is that they have DNA-binding domains that give them the ability to bind to specific sequences of DNA called enhancer or promoter sequences. -Some transcription factors bind to a DNA promoter sequence near the transcription start site and help form the transcription initiation complex. +Some transcription factors bind to a DNA promoter sequence near the transcription start site and help form the transcription initiation complex. Other transcription factors bind to regulatory sequences, such as enhancer sequences, and can either stimulate or repress transcription of the related gene. -These regulatory sequences can be thousands of base pairs upstream or downstream from the gene being transcribed. Regulation of transcription is the most common form of gene control. +These regulatory sequences can be thousands of base pairs upstream or downstream from the gene being transcribed. Regulation of transcription is the most common form of gene control. The action of transcription factors allows for unique expression of each gene in different cell types and during development. - **Chromatin and Nucleosome** -Chromatin is a complex of DNA and proteins that forms chromosomes within the nucleus of eukaryotic cells. The main purpose of chromatin is to tightly pack the DNA inside the cell nucleus. -Chromatin regulates the gene expression and allows DNA replication in addition to the packaging. It also prevents DNA damage. - -Nucleosome refers to the main structural unit of the eukaryotic chromatin that consists of a length of DNA coiled around a core of histones. This means the core particles that form chromatin are the nucleosomes. A nucleosome consists of 146 base pairs long DNA stretches, wrapped around a core of histone. -The histone core is made up of eight histone proteins. The histone octamer is formed by combining two of each four histones, H2A, H2B, H3, and H4. +Chromatin is a complex of DNA and proteins that forms chromosomes within the nucleus of eukaryotic cells. The main purpose of chromatin is to tightly pack the DNA inside the cell nucleus. +Chromatin regulates the gene expression and allows DNA replication in addition to the packaging. It also prevents DNA damage. +Nucleosome refers to the main structural unit of the eukaryotic chromatin that consists of a length of DNA coiled around a core of histones. This means the core particles that form chromatin are the nucleosomes. A nucleosome consists of 146 base pairs long DNA stretches, wrapped around a core of histone. +The histone core is made up of eight histone proteins. The histone octamer is formed by combining two of each four histones, H2A, H2B, H3, and H4. **Trans-regulatory sequences** Trans-regulatory sequences are transcription factor proteins that regulate the process of transcription such as general TFs and RNA pol2, sequence specific TFs, co-activators/co-repressor and histones. - - **Cis-regulatory sequences** -Cis-regulatory sequences are noncoding DNA sequences in or near a gene required for proper spatiotemporal expression of that gene, often containing binding sites for transcription factors such as enhancers promoters and insulator, control development and physiology by regulating gene expression. - - +Cis-regulatory sequences are noncoding DNA sequences in or near a gene required for proper spatiotemporal expression of that gene, often containing binding sites for transcription factors such as enhancers promoters and insulator, control development and physiology by regulating gene expression. **Primary Cell** diff --git a/_posts/2022-07-12-ATACseq.md b/_posts/2022-07-12-ATACseq.md index a8e8b62aac4..694f2641799 100644 --- a/_posts/2022-07-12-ATACseq.md +++ b/_posts/2022-07-12-ATACseq.md @@ -3,26 +3,25 @@ layout: post title: 【Genomic】ATAC-seq and Deep Learning in genomic categories: Genomic description: Transcription -keywords: Transcription factor,ATAC-seq +keywords: Transcription factor,ATAC-seq --- Some good article worth reading for ATAC-seq beginner -1) Transposition of native chromatin for fast and sensitive epigenomic profiling of open chromatin, DNA-binding proteins and nucleosome position +1. Transposition of native chromatin for fast and sensitive epigenomic profiling of open chromatin, DNA-binding proteins and nucleosome position -2) From reads to insight: a hitchhiker’s guide to ATAC-seq data analysis +2. From reads to insight: a hitchhiker’s guide to ATAC-seq data analysis -3) ATACseqQC: a Bioconductor package for post-alignment quality assessment of ATAC-seq data +3. ATACseqQC: a Bioconductor package for post-alignment quality assessment of ATAC-seq data -4) ChIP-seq guidelines and practices of the ENCODE and modENCODE consortia - -5) Model-based Analysis of ChIP-Seq (MACS) +4. ChIP-seq guidelines and practices of the ENCODE and modENCODE consortia +5. Model-based Analysis of ChIP-Seq (MACS) Some good article worth reading for Deep Learning in genomic -1) Deep learning: new computational modelling techniques for genomics +1. Deep learning: new computational modelling techniques for genomics -2) A primer on deep learning in genomics +2. A primer on deep learning in genomics -3) Navigating the pitfalls of applying machine learning in genomics +3. Navigating the pitfalls of applying machine learning in genomics diff --git a/_posts/2022-08-01-Rstudymaterial.md b/_posts/2022-08-01-Rstudymaterial.md index ce32609541e..09f941a4e98 100644 --- a/_posts/2022-08-01-Rstudymaterial.md +++ b/_posts/2022-08-01-Rstudymaterial.md @@ -3,12 +3,9 @@ layout: post title: 【R】R study material categories: R description: R -keywords: R, study material +keywords: R, study material --- - - - Good study website for R diff --git a/_posts/2022-08-03-R_ggplot-Scatterplot.md b/_posts/2022-08-03-R_ggplot-Scatterplot.md index e422b8c6e93..eaa22b0a951 100644 --- a/_posts/2022-08-03-R_ggplot-Scatterplot.md +++ b/_posts/2022-08-03-R_ggplot-Scatterplot.md @@ -3,7 +3,7 @@ layout: post title: 【R】ggplot--Scatterplot categories: R description: ggplot作图 -keywords: R, visualization ,scatterplot +keywords: R, visualization ,scatterplot --- Code @@ -19,7 +19,7 @@ college <- college %>% # Create the scatterplot from Video 2.1 ggplot(data=college) + - geom_point(mapping=aes(x=tuition, y=sat_avg, color=control, size=undergrads), alpha=1/2) + geom_point(mapping=aes(x=tuition, y=sat_avg, color=control, size=undergrads), alpha=1/2) # Add a text annotation ggplot(data=college) + @@ -67,4 +67,3 @@ ggplot(data=college) + Plot ![](https://github.com/Wrlog/Wr.github.io/blob/master/images/posts/R/scatterplot.png?raw=true) - diff --git a/_posts/2022-08-13-object_oriented_programming.md b/_posts/2022-08-13-object_oriented_programming.md index c445fe04c16..b6332df3d41 100644 --- a/_posts/2022-08-13-object_oriented_programming.md +++ b/_posts/2022-08-13-object_oriented_programming.md @@ -3,7 +3,7 @@ layout: post title: 【Python】Object Oriented Programming categories: Programming description: Programming -keywords: Python, Object Oriented Programming, +keywords: Python, Object Oriented Programming, --- ## Object Oreineted Programming @@ -15,10 +15,10 @@ class Dog: def __init__(self, name, breed): self.name = name self.breed = breed - + def bark(self): print("Woof!") - + def display(self): print("Name: ", self.name) print("Breed: ", self.breed) @@ -26,27 +26,22 @@ class Dog: dog1 = Dog("Fido", "Golden Retriever") dog1.bark() dog1.display() - + ``` **Object**: In object-oriented programming, an object is a piece of data that has a set of properties (also known as attributes) and methods that can be used to interact with the data. Objects are instances of classes, which are templates or blueprints for creating objects. - **Class**: A class is a blueprint or template for creating objects. It defines the properties (attributes) and methods that an object of that class will have. A class defines the structure of the object, but it does not contain any specific data. - **Instance**: An instance is a specific object that is created from a class. When an object is created from a class, it is said to be an instance of that class. Each instance has its own unique properties, but all instances have the same methods and behaviors defined by the class. - **Method**: A method is a function that is defined within a class and is associated with an object. Methods define the behavior of the object, and they can be used to interact with the object's properties (attributes). Methods are typically used to retrieve or update the object's data. - The term 'object' is often used to refer both to actual data structures and to the general paradigm of object-oriented programming, we'll typically stick to the terms 'class' and 'instance' instead. - ## Explanation -In this example, the Dog class is defined with two instance variables name and breed which are passed as arguments to the __init__ method. The __init__ method is a special method in Python classes that is called when an object of the class is created. The bark and display methods are also defined in the class. +In this example, the Dog class is defined with two instance variables name and breed which are passed as arguments to the **init** method. The **init** method is a special method in Python classes that is called when an object of the class is created. The bark and display methods are also defined in the class. We can create an object of the Dog class by calling it as a function and passing the required arguments, as you can see in the last line of the code dog1 = Dog("Fido", "Golden Retriever"). diff --git a/_posts/2022-09-03-Maximum likelihood estimation, maximum posterior probability estimation and Bayesian formula.md b/_posts/2022-09-03-Maximum likelihood estimation, maximum posterior probability estimation and Bayesian formula.md index 895ef792720..0dab1f0c7af 100644 --- a/_posts/2022-09-03-Maximum likelihood estimation, maximum posterior probability estimation and Bayesian formula.md +++ b/_posts/2022-09-03-Maximum likelihood estimation, maximum posterior probability estimation and Bayesian formula.md @@ -1,94 +1,81 @@ --- layout: post title: 【Statistic】Maximum likelihood estimation, Maximum a posteriori probability estimation -categories: Statistic +categories: Statistic description: MLE,MAP,Bayesian -keywords: Maximum likelihood estimation +keywords: Maximum likelihood estimation --- -Maximum likelihood estimation (MLE) and maximum a posteriori estimation (MAP) are two very common methods for parameter estimation, and it is easy to confuse them if you do not understand the ideas of these two methods. +Maximum likelihood estimation (MLE) and maximum a posteriori estimation (MAP) are two very common methods for parameter estimation, and it is easy to confuse them if you do not understand the ideas of these two methods. The following section will explain the ideas and differences of MLE and MAP in detail. Let's start with the difference between probability and statistics. - ## Probability and Statistics are the same thing? Probability and statistics may seem like two similar concepts, but they actually study the opposite research question. -The problem of probabilistic research is how to predict the characteristics of the results produced by a model (e.g. mean, variance, covariance, etc.) when the model and parameters are known. For example, I want to study how to raise swine (the model is pigs), +The problem of probabilistic research is how to predict the characteristics of the results produced by a model (e.g. mean, variance, covariance, etc.) when the model and parameters are known. For example, I want to study how to raise swine (the model is pigs), I have chosen the breed I want to raise, the feeding method, the design of the shed, etc. (choose the parameters), and I want to know approximately how fat and how good the meat will be when I raise the swine (predict the outcome). -The problem with statistical studies is the opposite. Statistics is that there is a pile of data that has to be used to predict models and parameters. -Still using the swine as an example. Now I get a pile of meat and through observation and judgment I determine that it is pork (which determines the model.) -In the actual research, also by observing the data to speculate the model is / like Gaussian distribution, exponential distribution, Laplace distribution, etc.), then, +The problem with statistical studies is the opposite. Statistics is that there is a pile of data that has to be used to predict models and parameters. +Still using the swine as an example. Now I get a pile of meat and through observation and judgment I determine that it is pork (which determines the model.) +In the actual research, also by observing the data to speculate the model is / like Gaussian distribution, exponential distribution, Laplace distribution, etc.), then, you can further research to determine the breed of this pig, this is a captive pig or a Wild Boar or other species, and so on (predict model parameters). **In a nutshell: probability is to predict the data with known model and parameters. Statistics is known data, predicting the model and parameters.** -Obviously, both MLE and MAP explained in this paper are problems in the field of **statistics**. -They are both methods used to infer parameters. Why do two different methods exist? This requires an understanding of Bayesian thinking. +Obviously, both MLE and MAP explained in this paper are problems in the field of **statistics**. +They are both methods used to infer parameters. Why do two different methods exist? This requires an understanding of Bayesian thinking. Let's take a look at the Bayesian formulation. +## Bayesian Formula -## Bayesian Formula ## What is it really saying? - Anyone studying machine learning and pattern recognition must have heard of the Bayes' Theorem formula: image - The Bayesian formula looks simple and is nothing more than a formula for playing the conditional probability and joint probability. - Expanding B, it can be written as follows : image - This equation is interesting. Think about this situation. A car (or electric car) alarm goes off, what is your usual reaction? A thief? A car crash? Nope. You usually do not react to anything. Because a car alarm goes off is just too normal! It happens many times a day. Originally, car alarms were set up to function as an unusual situation that required human attention. However, because there are simply too many false alarms, people gradually do not trust the function of the alarm. - **The Bayesian formula is a description of how much you can trust the evidence. (how much you can trust the evidence)** Let's assume that the purpose of the alarm is to say that the car was smashed. Take **A as "the car was smashed" and B as "the alarm went off"** and bring them into the Bayesian equation. We want to find the probability of the left side of the equation image , which is saying that the alarm went off and the car did get smashed. The car being smashed causes the alarm to go off, i.e.image. - However, it is also possible that the car was kicked by a child's ball, touched by a pedestrian and other reasons (statistics as image - ), other reasons caused the car alarm sounded, that is,image. So, what is the probability that the car has been smashed when the alarm is suddenly heard (i.e., with the evidence that the alarm is sounding, how sure can we be that it is indeed an alarm that the car has been smashed)? Let's think about it this way. Divide the number of events in which the alarm went off and the car was smashed by the number of events in which the alarm went off. - +), other reasons caused the car alarm sounded, that is,image. So, what is the probability that the car has been smashed when the alarm is suddenly heard (i.e., with the evidence that the alarm is sounding, how sure can we be that it is indeed an alarm that the car has been smashed)? Let's think about it this way. Divide the number of events in which the alarm went off and the car was smashed by the number of events in which the alarm went off. To expand further, the number of events where the alarm went off and the car was also smashed is divided by the number of events where the alarm went off and the car was smashed plus the number of events where the alarm went off and the car was not smashed **Summarize Bayes' formula from this perspective: When making judgments, consider all the factors.** When your boss scolds you, it doesn't necessarily mean that you screwed up some work, it might just be that he had a fight with his wife before he left home today. - Think of the Bayesian formula in this light: something that is already difficult to happen, even if some evidence appears that is strongly correlated with him, should be cautious. The evidence is likely to come from something else that, although not very relevant, has a higher probability of occurring. I found that the code I just wrote compiled with an error, but I am in a particularly good state today, and I am familiar with this language, so the probability of making a mistake is very low. So I think it's a compiler error. --don't, let's just check our code again. - ## Likelihood function - The word likelihood is actually similar in meaning to probability, and the Colins dictionary explains it this way: The **likelihood** of something happening is how likely it is to happen. You replace likelihood with probability, this interpretation also reads well. But in statistics, the likelihood function and the probability function are two different concepts (in fact, they are also very similar). For this function : image - There are two inputs: x denotes a specific data; and image is the parameters of the model. If image is known for sure and image is a variable, this function is called the probability function , which describes what the probability of occurrence is for different sample points x. +If image is known for sure and image is a variable, this function is called the likelihood function, which describes the probability of occurrence of the sample point x for different model parameters. -If image is known for sure and image is a variable, this function is called the likelihood function, which describes the probability of occurrence of the sample point x for different model parameters. - -It's kind of like "two dishes in one". In fact, it is not uncommon for us to encounter such a form before. For example,image ,that is, x to the yth power. +It's kind of like "two dishes in one". In fact, it is not uncommon for us to encounter such a form before. For example,image ,that is, x to the yth power. If it is known for sure x(e.g.x = 2), this isimage, this is the exponential function image. If it is known for sure y (e.g.y = 2), this isimage , this is the quadratic function. The same mathematical form can have different names when viewed from the perspective of different variables. @@ -96,28 +83,23 @@ That should make it clear, right? If it's not clear, don't worry, there will be Now it's really time to talk about MLE first. - ## Maximum Likelihood Estimation (MLE) Suppose there is a mint that produces a certain coin, and now we have one of these coins and want to see if it is uniform. That is, we want to know what is the probability of tossing this coin, and what is the probability of it coming up on both sides (denoted as image - )? +)? This is a statistical problem. Think back. What do you need to solve a statistical problem? Data! -So we take this coin and flip it 10 times, and the data we get (image ) is: tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails. The probability of heads,image we want to find is a model parameter, and the coin toss model we can assume is a binomial distribution. +So we take this coin and flip it 10 times, and the data we get (image ) is: tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails. The probability of heads,image we want to find is a model parameter, and the coin toss model we can assume is a binomial distribution. So, what is the likelihood function of the experimental result (i.e.,tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails)? - image - Note that this is a function that is only about the image. And the maximum likelihood estimation, as the name implies, is to maximize this function. We can draw the image of. - image - It can be seen that the likelihood function achieves its maximum value at time image. Thus, we have completed the maximum likelihood estimation of image. That is, if we flip a coin 10 times and find that 7 times the coin is tipped heads, the maximum likelihood estimate is 0.7. (ummm...that's pretty intuitive and reasonable, right?) @@ -126,59 +108,45 @@ Wait, some people may say, coins are usually even! Even if you do the experiment Here contains the Bayesian of thought - to consider the prior probability. For this reason, the maximum a posteriori probability estimate is introduced. - ## Maximum a posteriori probability estimation The maximum likelihood estimation is to find the parameter image , which maximizes the likelihood function image. The maximum a posterior probability estimation is to findimage that maximize image. Not only do we want the likelihood function of imageto be large, but we also want the prior probability of image occurrence to be large. (This is a pretty much like the idea of adding penalty terms in regularization, but regularization uses addition, while MAP uses multiplication) MAP is actually maximizing - image - However, since image - is a certainty (i.e.,"tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails"),image is a known value, so the denominator is removed image (suppose "10 tosses" is an experiment, and the experiment is done 1000 times, and "tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails" Ocurred n times, then image - - +is a certainty (i.e.,"tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails"),image is a known value, so the denominator is removed image (suppose "10 tosses" is an experiment, and the experiment is done 1000 times, and "tail,heads,heads,heads,heads,tails,,heads,heads,heads,tails" Ocurred n times, then image + In short, it is a value that can be obtained from the data set. The meaning of maximization of image is also clear,imagealready present ,Require image to tkae the value that maximize image .Incidentally, image - is the posterior probability, which is the origin of the name "maximum posterior probability estimation". - +is the posterior probability, which is the origin of the name "maximum posterior probability estimation". For the coin toss example, we believe ("know a priori") that there is a high probability of image taking 0.5 and a smaller probability of taking other values. We specify this prior knowledge we have with a Gaussian distribution, for example, assuming image as a Gaussian function with mean 0.5 and variance 0.1, as follows : - image - Then the image of the function ofimage is as follow : - image - Note that at this point, when the function takes its maximum value, image value is shifted to the left and is no longer 0.7. In fact, the function takes image as its maximum value at the time. That is, using the maximum posterior probability estimate, we get image . Finally, what does it take to convince a Bayesianimage ? You have to do more experiments. If you do 1000 experiments and 700 of them are positive, then the likelihood function is : - image - If one still assumesimage is a Gaussian function with mean 0.5 and variance 0.1, the image of the function image is : image - At image,image obtained the maximum value. - ## The difference between maximum likelihood estimation and maximum a posterior probability estimation - -I believe that after reading the above, the difference between MLE and MAP should be clear, MAP is multiple factors as a priori probability image. Alternatively, it can be reversed to consider MLE as the prior probability image equal to 1, i.e.,take image as a uniform distribution. +I believe that after reading the above, the difference between MLE and MAP should be clear, MAP is multiple factors as a priori probability image. Alternatively, it can be reversed to consider MLE as the prior probability image equal to 1, i.e.,take image as a uniform distribution. --From Wechat-- diff --git a/_posts/2022-11-06-E-max.md b/_posts/2022-11-06-E-max.md index 2165d8c2296..cfaf9761b83 100644 --- a/_posts/2022-11-06-E-max.md +++ b/_posts/2022-11-06-E-max.md @@ -3,7 +3,7 @@ layout: post title: 【Pharmacodynamic】Emax Model categories: Pharmacodynamic description: 药效学 -keywords: Pharmacodynamic,Clinical +keywords: Pharmacodynamic,Clinical --- ## Origin of Emax model @@ -13,16 +13,12 @@ pharmacological properties of a drug, to explain the apparent zero-order rate of ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacodynamic/1.1.png?raw=true) -With E0 as the effect value at the start of the decrease in E, k is a first-order elimination rate constant of the drug, m represents the linear positive slope of a concentration-effect plot when the effect is between 20 and 80 % maximal (abscissa = natural log of drug concentration and ordinate = effect on a linear scale), and t is time. This expression identifies the k * m product as the determinant of the linear decrease in drug effects for simple, rapid direct effects (i.e., reversible agonists or antagonists for which turnover processes are not rate-limiting). This discovery marked the beginning of identifying factors that regulate the in vivo time-course of drug effects in a quantitative manner. - +With E0 as the effect value at the start of the decrease in E, k is a first-order elimination rate constant of the drug, m represents the linear positive slope of a concentration-effect plot when the effect is between 20 and 80 % maximal (abscissa = natural log of drug concentration and ordinate = effect on a linear scale), and t is time. This expression identifies the k \* m product as the determinant of the linear decrease in drug effects for simple, rapid direct effects (i.e., reversible agonists or antagonists for which turnover processes are not rate-limiting). This discovery marked the beginning of identifying factors that regulate the in vivo time-course of drug effects in a quantitative manner. Shortly thereafter, Wagner suggested the use of the **Hill equation** to describe the temporal profile of direct and rapidly acting agents, which was based on a derivation starting with drug-receptor binding (Hill 1910; Wagner 1968): - - ![](https://github.com/WenruiTan/Wr.github.io/blob/master/images/posts/pharmacodynamic/1.2.png?raw=true) - with C(t) representing the plasma drug concentration, Emax is the maximal drug effect, and EC50 is the drug concentration producing 50 % of Emax. The use of the full Hill equation (or Emax model) avoided the restriction of the 20 to 80 % maximal effect as required for Eq. 1.1. However, the Emax model assumes that the time to peak drug effect coincides with the time to peak drug concentration, although most drugs exhibit a temporal delay between these events (so called hysteresis in the concentration-effect plot). Sheiner popularized the use of a simple delay compartment, initially developed by Segre, to accommodate the time for drug to equilibrate with concentrations in a hypothetical effect compartment or biophase (Segre 1968; Sheiner et al. 1979). The pharmacological effect is still defined by Eq. 1.2, but driven by concentrations in the effect compartment rather than plasma concentration. This was the first simultaneous PK/PD model to describe a relatively short delay in drug action owing to drug distribution to a biophase and assumes such distribution does not influence the PK of the drug. Many drugs can show much longer delays, not due to distribution to a biophase, @@ -47,7 +43,6 @@ parameters (Mager and Jusko 2001). From these basic structural models, one can add a plethora of additional complexities and arrive at a diverse array of PK/PD models for describing many animal and clinical drug effects. - ## Emax Emax graphical model is a very important model to describe the pharmacodynamics of a drug. It gives the possibility to describe the efficacy and potency of a drug with graphical means. In an Emax model, Potency = EC50, which is a concentration read from X-axis, and Efficacy = Emax, which is a dose-response read from Y-axis. Potency and efficacy are independent of each other. Neither can predict the other. @@ -56,8 +51,4 @@ Example of Emax Graphical model is as follow : image - -## - - - +## diff --git a/assets/css/components/boxed-group.css b/assets/css/components/boxed-group.css index 25e5cd98d3d..9a22f1214d6 100755 --- a/assets/css/components/boxed-group.css +++ b/assets/css/components/boxed-group.css @@ -1 +1,161 @@ -.boxed-group{position:relative;border-radius:3px;margin-bottom:30px}.boxed-group .counter{color:#fff;background-color:#babec0}.boxed-group.flush .boxed-group-inner{padding:0}.boxed-group.condensed .boxed-group-inner{font-size:12px;padding:0}.boxed-group .heading,.boxed-group>h3{background-color:#f5f5f5;margin:0;border-radius:3px 3px 0 0;border:1px solid #d8d8d8;border-bottom:0;padding:9px 10px 10px;font-size:14px;line-height:17px;display:block}.boxed-group .heading a,.boxed-group>h3 a{color:inherit}.boxed-group .heading a.boxed-group-breadcrumb,.boxed-group>h3 a.boxed-group-breadcrumb{color:#666;font-weight:400;text-decoration:none}.boxed-group .heading .avatar,.boxed-group>h3 .avatar{margin-top:-4px}.boxed-group .tabnav.heading{padding:0}.boxed-group .tabnav.heading .tabnav-tab.selected{border-top:0}.boxed-group .tabnav.heading li:first-child .selected{border-left-color:#fff;border-top-left-radius:3px}.boxed-group .tabnav-tab{border-radius:0;border-top:0}.boxed-group code.heading{font-size:12px}.boxed-group.dangerzone>h3{background-color:#df3e3e;border:1px solid #a00;color:#fff;text-shadow:0 -1px 0 #900}.boxed-group.dangerzone .boxed-group-inner{border-top:0}.boxed-group.condensed>h3{padding:6px 6px 7px;font-size:12px}.boxed-group.condensed>h3 .octicon{padding:0 6px 0 2px}.dashboard-sidebar .boxed-group,.one-half .boxed-group{margin-bottom:20px}.boxed-group .bleed-flush{width:100%;padding:0 10px;margin-left:-10px}.boxed-group .compact{margin-top:10px;margin-bottom:10px}.boxed-group-inner{padding:1px 10px;background:#fff;border:1px solid #d8d8d8;border-bottom-left-radius:3px;border-bottom-right-radius:3px;color:#666;font-size:13px}.boxed-group-inner .help,.boxed-group-inner .tabnav-tab.selected{border-top:1px solid #ddd}.boxed-group-inner .markdown-body{padding:20px 10px 10px;font-size:13px}.boxed-group-inner.markdown-body{padding-top:10px;padding-bottom:10px}.boxed-group-inner.seamless{padding:0}.boxed-group-inner h4{margin:15px 0 -5px;font-size:14px;color:#000}.boxed-group-inner .tabnav{margin-left:-10px;margin-right:-10px;padding-left:10px;padding-right:10px}.boxed-group-inner .help{clear:both;margin:1em -10px 0;padding:1em 10px 1em 35px;color:#999}.boxed-group-inner .help .octicon{margin-left:-25px;margin-right:5px}.boxed-group-inner .flash-global{margin-left:-10px;margin-right:-10px;border-top:0}.boxed-action{float:right;margin-left:10px}.boxed-group-action{float:right;margin:6px 10px 0 0;position:relative;z-index:2}.boxed-group-action.flush{margin-top:0;margin-right:0}.boxed-group-action>button{background-color:transparent;border:0;-webkit-appearance:none}.boxed-group-icon{padding:4px;color:#777} \ No newline at end of file +.boxed-group { + position: relative; + border-radius: 3px; + margin-bottom: 30px; +} +.boxed-group .counter { + color: #fff; + background-color: #babec0; +} +.boxed-group.flush .boxed-group-inner { + padding: 0; +} +.boxed-group.condensed .boxed-group-inner { + font-size: 12px; + padding: 0; +} +.boxed-group .heading, +.boxed-group > h3 { + background-color: #f5f5f5; + margin: 0; + border-radius: 3px 3px 0 0; + border: 1px solid #d8d8d8; + border-bottom: 0; + padding: 9px 10px 10px; + font-size: 14px; + line-height: 17px; + display: block; +} +.boxed-group .heading a, +.boxed-group > h3 a { + color: inherit; +} +.boxed-group .heading a.boxed-group-breadcrumb, +.boxed-group > h3 a.boxed-group-breadcrumb { + color: #666; + font-weight: 400; + text-decoration: none; +} +.boxed-group .heading .avatar, +.boxed-group > h3 .avatar { + margin-top: -4px; +} +.boxed-group .tabnav.heading { + padding: 0; +} +.boxed-group .tabnav.heading .tabnav-tab.selected { + border-top: 0; +} +.boxed-group .tabnav.heading li:first-child .selected { + border-left-color: #fff; + border-top-left-radius: 3px; +} +.boxed-group .tabnav-tab { + border-radius: 0; + border-top: 0; +} +.boxed-group code.heading { + font-size: 12px; +} +.boxed-group.dangerzone > h3 { + background-color: #df3e3e; + border: 1px solid #a00; + color: #fff; + text-shadow: 0 -1px 0 #900; +} +.boxed-group.dangerzone .boxed-group-inner { + border-top: 0; +} +.boxed-group.condensed > h3 { + padding: 6px 6px 7px; + font-size: 12px; +} +.boxed-group.condensed > h3 .octicon { + padding: 0 6px 0 2px; +} +.dashboard-sidebar .boxed-group, +.one-half .boxed-group { + margin-bottom: 20px; +} +.boxed-group .bleed-flush { + width: 100%; + padding: 0 10px; + margin-left: -10px; +} +.boxed-group .compact { + margin-top: 10px; + margin-bottom: 10px; +} +.boxed-group-inner { + padding: 1px 10px; + background: #fff; + border: 1px solid #d8d8d8; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + color: #666; + font-size: 13px; +} +.boxed-group-inner .help, +.boxed-group-inner .tabnav-tab.selected { + border-top: 1px solid #ddd; +} +.boxed-group-inner .markdown-body { + padding: 20px 10px 10px; + font-size: 13px; +} +.boxed-group-inner.markdown-body { + padding-top: 10px; + padding-bottom: 10px; +} +.boxed-group-inner.seamless { + padding: 0; +} +.boxed-group-inner h4 { + margin: 15px 0 -5px; + font-size: 14px; + color: #000; +} +.boxed-group-inner .tabnav { + margin-left: -10px; + margin-right: -10px; + padding-left: 10px; + padding-right: 10px; +} +.boxed-group-inner .help { + clear: both; + margin: 1em -10px 0; + padding: 1em 10px 1em 35px; + color: #999; +} +.boxed-group-inner .help .octicon { + margin-left: -25px; + margin-right: 5px; +} +.boxed-group-inner .flash-global { + margin-left: -10px; + margin-right: -10px; + border-top: 0; +} +.boxed-action { + float: right; + margin-left: 10px; +} +.boxed-group-action { + float: right; + margin: 6px 10px 0 0; + position: relative; + z-index: 2; +} +.boxed-group-action.flush { + margin-top: 0; + margin-right: 0; +} +.boxed-group-action > button { + background-color: transparent; + border: 0; + -webkit-appearance: none; +} +.boxed-group-icon { + padding: 4px; + color: #777; +} diff --git a/assets/css/components/collection.css b/assets/css/components/collection.css index e7d51f80292..edc01e80825 100755 --- a/assets/css/components/collection.css +++ b/assets/css/components/collection.css @@ -1 +1,231 @@ -.collection-head,.side-collection-image{-webkit-box-shadow:inset 0 10px 20px rgba(0,0,0,.1);text-shadow:0 1px 2px rgba(0,0,0,.3)}.collection-card-image,.collection-head,.side-collection-image{text-shadow:0 1px 2px rgba(0,0,0,.3)}.collection-head{padding:1.5rem 0;margin-top:-20px;margin-bottom:20px;background:url(/assets/images/octicons-bg.png) center #302F2F;box-shadow:inset 0 10px 20px rgba(0,0,0,.1);color:#fff}.collection-head.small{padding:.8rem 0}.collection-head.small .collection-title{padding:10px 0}.collection-head.small .collection-title h1.collection-header{font-size:30px}.collection-head a{color:#fff}.collection-head a:hover{text-decoration:none}.collection-head .collection-title{display:table-cell;padding:20px 0;vertical-align:middle}.collection-head .collection-info{margin:0}.collection-head .collection-info .meta-info{margin-right:15px}.collection-head .collection-info .avatar{background-color:rgba(255,255,255,.7);border:1px solid rgba(255,255,255,.7)}.collection-head .collection-head .container{position:relative}.collection-head .draft-tag{position:absolute;top:0;left:0}.collection-head .collection-header{margin-top:0;font-size:45px;line-height:1.5;font-weight:400}.collection-head .collection-description{position:relative;font-size:16px}.collection-page .collection-info{margin-top:10px;margin-bottom:20px;font-size:13px;color:#999}.collection-page .column.main{margin-right:260px!important}.collection-page .column.sidebar{width:240px}.collection-page .other-content{padding:20px 0 20px 20px;border-left:1px solid #f1f1f1}.collection-page .other-content .subnav-search{margin-left:0}.collection-page .other-content input.subnav-search-input{width:100%}.collection-page .other-content-title{margin-top:40px}.collection-page .other-content-title:first-child,.collection-search-result-title{margin-top:0}.side-collection-list{margin:0;list-style-type:none}.side-collection-link{display:table;width:100%;height:100px;color:#fff}.collection-card-title,.side-collection-image{height:100%;text-align:center;vertical-align:middle}.side-collection-item-title{font-size:16px;font-weight:100}.side-collection-image{background:url(/assets/images/octicons-bg.png) center #555;box-shadow:inset 0 10px 20px rgba(0,0,0,.1);color:#fff;display:table-cell;width:100%;margin-bottom:5px;border-radius:3px}.side-collection-list-item{margin-bottom:20px}.collection-tools{list-style-type:none;margin-bottom:10px;font-size:15px}.collection-tools .edit-link{color:#333}.collection-tools .edit-link:hover{color:#4183c4;cursor:pointer}.collection-tools .octicon{margin-right:5px}.collection-tools .select-menu-button{position:relative;display:inline-block;color:#333}.collection-tools .select-menu-button :hover{color:#4183c4;cursor:pointer}.collection-tool{margin-left:20px}.collection-search-results em{padding:.1em;background-color:#faffa6}.collection-search-result{margin-bottom:40px;list-style-type:none}.collection-search-page .search-results-info{line-height:33px;float:right;margin-left:10px;font-size:15px}.collection-listing{text-align:center}.collection-card{position:relative;display:inline-block;width:30%;max-width:313px;margin:0 10px 20px;list-style-type:none;background:#f7f7f7;border:1px solid #ddd;border-radius:3px;overflow:hidden}.collection-card .draft-tag{position:absolute;top:-1px;left:10px}.collection-card-title{padding:0 15px;margin:10px 0;display:table-cell;width:100%;font-size:19px;font-weight:700}.collection-card-body{padding:0 15px;margin:0 0 10px;height:3em;overflow:hidden;font-size:15px;line-height:1.5em}.collection-card-image{position:relative;display:table;width:101%;height:120px;margin:-1px -1px 15px;background:url(/assets/images/octicons-bg.png) center #555;-webkit-box-shadow:inset 0 10px 20px rgba(0,0,0,.1);box-shadow:inset 0 10px 20px rgba(0,0,0,.1);color:#fff;border-top-right-radius:3px;border-top-left-radius:3px}.collection-card-meta{padding:0 15px;margin-top:5px;margin-bottom:15px;color:#777;font-size:12px}.collection-card-meta .meta-info{margin-right:10px}.collection-card-meta .last-updated{float:right;margin-right:0} \ No newline at end of file +.collection-head, +.side-collection-image { + -webkit-box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.1); + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); +} +.collection-card-image, +.collection-head, +.side-collection-image { + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); +} +.collection-head { + padding: 1.5rem 0; + margin-top: -20px; + margin-bottom: 20px; + background: url(/assets/images/octicons-bg.png) center #302f2f; + box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.1); + color: #fff; +} +.collection-head.small { + padding: 0.8rem 0; +} +.collection-head.small .collection-title { + padding: 10px 0; +} +.collection-head.small .collection-title h1.collection-header { + font-size: 30px; +} +.collection-head a { + color: #fff; +} +.collection-head a:hover { + text-decoration: none; +} +.collection-head .collection-title { + display: table-cell; + padding: 20px 0; + vertical-align: middle; +} +.collection-head .collection-info { + margin: 0; +} +.collection-head .collection-info .meta-info { + margin-right: 15px; +} +.collection-head .collection-info .avatar { + background-color: rgba(255, 255, 255, 0.7); + border: 1px solid rgba(255, 255, 255, 0.7); +} +.collection-head .collection-head .container { + position: relative; +} +.collection-head .draft-tag { + position: absolute; + top: 0; + left: 0; +} +.collection-head .collection-header { + margin-top: 0; + font-size: 45px; + line-height: 1.5; + font-weight: 400; +} +.collection-head .collection-description { + position: relative; + font-size: 16px; +} +.collection-page .collection-info { + margin-top: 10px; + margin-bottom: 20px; + font-size: 13px; + color: #999; +} +.collection-page .column.main { + margin-right: 260px !important; +} +.collection-page .column.sidebar { + width: 240px; +} +.collection-page .other-content { + padding: 20px 0 20px 20px; + border-left: 1px solid #f1f1f1; +} +.collection-page .other-content .subnav-search { + margin-left: 0; +} +.collection-page .other-content input.subnav-search-input { + width: 100%; +} +.collection-page .other-content-title { + margin-top: 40px; +} +.collection-page .other-content-title:first-child, +.collection-search-result-title { + margin-top: 0; +} +.side-collection-list { + margin: 0; + list-style-type: none; +} +.side-collection-link { + display: table; + width: 100%; + height: 100px; + color: #fff; +} +.collection-card-title, +.side-collection-image { + height: 100%; + text-align: center; + vertical-align: middle; +} +.side-collection-item-title { + font-size: 16px; + font-weight: 100; +} +.side-collection-image { + background: url(/assets/images/octicons-bg.png) center #555; + box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.1); + color: #fff; + display: table-cell; + width: 100%; + margin-bottom: 5px; + border-radius: 3px; +} +.side-collection-list-item { + margin-bottom: 20px; +} +.collection-tools { + list-style-type: none; + margin-bottom: 10px; + font-size: 15px; +} +.collection-tools .edit-link { + color: #333; +} +.collection-tools .edit-link:hover { + color: #4183c4; + cursor: pointer; +} +.collection-tools .octicon { + margin-right: 5px; +} +.collection-tools .select-menu-button { + position: relative; + display: inline-block; + color: #333; +} +.collection-tools .select-menu-button :hover { + color: #4183c4; + cursor: pointer; +} +.collection-tool { + margin-left: 20px; +} +.collection-search-results em { + padding: 0.1em; + background-color: #faffa6; +} +.collection-search-result { + margin-bottom: 40px; + list-style-type: none; +} +.collection-search-page .search-results-info { + line-height: 33px; + float: right; + margin-left: 10px; + font-size: 15px; +} +.collection-listing { + text-align: center; +} +.collection-card { + position: relative; + display: inline-block; + width: 30%; + max-width: 313px; + margin: 0 10px 20px; + list-style-type: none; + background: #f7f7f7; + border: 1px solid #ddd; + border-radius: 3px; + overflow: hidden; +} +.collection-card .draft-tag { + position: absolute; + top: -1px; + left: 10px; +} +.collection-card-title { + padding: 0 15px; + margin: 10px 0; + display: table-cell; + width: 100%; + font-size: 19px; + font-weight: 700; +} +.collection-card-body { + padding: 0 15px; + margin: 0 0 10px; + height: 3em; + overflow: hidden; + font-size: 15px; + line-height: 1.5em; +} +.collection-card-image { + position: relative; + display: table; + width: 101%; + height: 120px; + margin: -1px -1px 15px; + background: url(/assets/images/octicons-bg.png) center #555; + -webkit-box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.1); + color: #fff; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} +.collection-card-meta { + padding: 0 15px; + margin-top: 5px; + margin-bottom: 15px; + color: #777; + font-size: 12px; +} +.collection-card-meta .meta-info { + margin-right: 10px; +} +.collection-card-meta .last-updated { + float: right; + margin-right: 0; +} diff --git a/assets/css/components/repo-card.css b/assets/css/components/repo-card.css index e05fd3fd767..fae0d997a65 100755 --- a/assets/css/components/repo-card.css +++ b/assets/css/components/repo-card.css @@ -6,30 +6,30 @@ } .card-image { - display: table; - height: 120px; - width: 100%; - border-radius: 4px; + display: table; + height: 120px; + width: 100%; + border-radius: 4px; } .card-image .card-image-cell { - display: table-cell; - vertical-align: middle; + display: table-cell; + vertical-align: middle; } .card-image h3 { - margin: 0; - font-size: 1.5em; - color: white; + margin: 0; + font-size: 1.5em; + color: white; } .card-image a { - color: #fff; + color: #fff; } .card-description { - height: 3em; - overflow: hidden; + height: 3em; + overflow: hidden; } .card:hover, @@ -38,25 +38,25 @@ } .card .thumbnail { - border: 1px solid rgba(0,0,0,0.075); - border-bottom-color: rgba(0,0,0,0.125); - border-radius: 4px; - box-shadow: 0 1px 2px rgba(0,0,0,0.05),0 5px 10px rgba(0,0,0,0.05); - -webkit-transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out; - transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out; - opacity: 0.8; - overflow-x: hidden; + border: 1px solid rgba(0, 0, 0, 0.075); + border-bottom-color: rgba(0, 0, 0, 0.125); + border-radius: 4px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 5px 10px rgba(0, 0, 0, 0.05); + -webkit-transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out; + transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out; + opacity: 0.8; + overflow-x: hidden; } -.card .thumbnail:hover{ - border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.15); - box-shadow:0 2px 4px rgba(0,0,0,0.05),0 10px 18px rgba(0,0,0,0.1); - opacity: 1; +.card .thumbnail:hover { + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.15); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 10px 18px rgba(0, 0, 0, 0.1); + opacity: 1; } -.card .thumbnail:hover .card-title a{ - color:#000; - text-decoration:none; +.card .thumbnail:hover .card-title a { + color: #000; + text-decoration: none; } .thumbnail { @@ -67,9 +67,9 @@ background-color: #fff; border: 1px solid #ddd; border-radius: 4px; - -webkit-transition: border .2s ease-in-out; - -o-transition: border .2s ease-in-out; - transition: border .2s ease-in-out + -webkit-transition: border 0.2s ease-in-out; + -o-transition: border 0.2s ease-in-out; + transition: border 0.2s ease-in-out; } .thumbnail .caption { @@ -83,5 +83,5 @@ } .card-text .meta-info { - margin-right: 10px; + margin-right: 10px; } diff --git a/assets/css/globals/common.css b/assets/css/globals/common.css index 0ce1a97f5e0..3e6e8f39214 100755 --- a/assets/css/globals/common.css +++ b/assets/css/globals/common.css @@ -1,702 +1,793 @@ -.site-header,.site-header-actions .select-menu { - position: relative +.site-header, +.site-header-actions .select-menu { + position: relative; } -.markdown-body,body { - font-family: Arial,"Hiragino Sans GB","冬青黑","Microsoft YaHei","微软雅黑",SimSun,"宋体",Helvetica,Tahoma,Arial sans-serif; - font-size: 16px; - line-height: 1.6; - word-wrap: break-word; - -webkit-tap-highlight-color: transparent; - -webkit-font-smoothing: antialiased; - -webkit-backface-visibility: hidden +.markdown-body, +body { + font-family: Arial, "Hiragino Sans GB", "冬青黑", "Microsoft YaHei", + "微软雅黑", SimSun, "宋体", Helvetica, Tahoma, Arial sans-serif; + font-size: 16px; + line-height: 1.6; + word-wrap: break-word; + -webkit-tap-highlight-color: transparent; + -webkit-font-smoothing: antialiased; + -webkit-backface-visibility: hidden; } @font-face { - font-family:octicons;src:font-url(../fonts/octicons.eot?#iefix) format("embedded-opentype"),font-url(../fonts/octicons.woff) format("woff"),font-url(../fonts/octicons.ttf) format("truetype"),font-url(../fonts/octicons.svg#octicons) format("svg");font-weight:400;font-style:normal + font-family: octicons; + src: font-url(../fonts/octicons.eot?#iefix) format("embedded-opentype"), + font-url(../fonts/octicons.woff) format("woff"), + font-url(../fonts/octicons.ttf) format("truetype"), + font-url(../fonts/octicons.svg#octicons) format("svg"); + font-weight: 400; + font-style: normal; } .pagination { - padding: 20px 0 + padding: 20px 0; } .pagination a.active { - background: #337ab7; - border-color: #337ab7; - z-index: 2; - color: #fff; - cursor: default + background: #337ab7; + border-color: #337ab7; + z-index: 2; + color: #fff; + cursor: default; } .text-center { - text-align: center + text-align: center; } .btn-inline .btn { - margin: 5px + margin: 5px; } .site-header { - padding-top: 20px; - padding-bottom: 20px; - margin-bottom: 20px; - border-bottom: 1px solid #eee + padding-top: 20px; + padding-bottom: 20px; + margin-bottom: 20px; + border-bottom: 1px solid #eee; } .site-header .account-switcher { - display: inline-block; - margin-top: -2px; - margin-bottom: -6px + display: inline-block; + margin-top: -2px; + margin-bottom: -6px; } -.site-header-actions .select-menu:after,.site-header-actions .select-menu:before { - display: table; - content: "" +.site-header-actions .select-menu:after, +.site-header-actions .select-menu:before { + display: table; + content: ""; } .site-header ul.site-header-actions { - z-index: 21; - float: right; - margin: 0 + z-index: 21; + float: right; + margin: 0; } .site-header ul.site-header-actions .feed-icon { - margin-top: 5px + margin-top: 5px; } .site-header .path-divider { - margin: 0 .25em + margin: 0 0.25em; } .site-header h1 { - float: left + float: left; } -.site-header h1,.site-header h1 .octicon { - margin-top: 0; - margin-bottom: 0; - font-size: 32px; - font-weight: 400; - line-height: 28px; - vertical-align: top +.site-header h1, +.site-header h1 .octicon { + margin-top: 0; + margin-bottom: 0; + font-size: 32px; + font-weight: 400; + line-height: 28px; + vertical-align: top; } -.context-loader,.markdown-body dl dt,.markdown-body table th,.pl-mb,.pl-mdr,.pl-mh,.pl-mh .pl-en,.pl-ms,.pl-sr .pl-cce,.site-header h1 strong { - font-weight: 700 +.context-loader, +.markdown-body dl dt, +.markdown-body table th, +.pl-mb, +.pl-mdr, +.pl-mh, +.pl-mh .pl-en, +.pl-ms, +.pl-sr .pl-cce, +.site-header h1 strong { + font-weight: 700; } .site-header h1 a { - white-space: nowrap; - color: #333 + white-space: nowrap; + color: #333; } .site-header h1 a:hover { - text-decoration: none + text-decoration: none; } .site-header h1 .avatar { - margin-top: -2px; - margin-right: 9px; - margin-bottom: -2px + margin-top: -2px; + margin-right: 9px; + margin-bottom: -2px; } -.site-header-actions>li { - float: left; - margin: 0 10px 0 0; - font-size: 11px; - color: #333; - list-style-type: none +.site-header-actions > li { + float: left; + margin: 0 10px 0 0; + font-size: 11px; + color: #333; + list-style-type: none; } -.site-header-actions>li:last-child { - margin-right: 0 +.site-header-actions > li:last-child { + margin-right: 0; } .site-header-actions .octicon-mute { - color: #c00 + color: #c00; } .site-header-actions .select-menu:after { - clear: both + clear: both; } .site-header-actions .select-menu-modal-holder { - top: 100% + top: 100%; } .context-loader { - position: absolute; - top: 0; - left: 50%; - z-index: 20; - width: 154px; - padding: 10px 10px 10px 30px; - margin-left: -75px; - font-size: 12px; - color: #666; - background: url(../images/min/octocat-spinner-16px.gif) 10px 50% no-repeat #eee; - border: 1px solid #ddd; - border-top: 1px solid #fff; - border-radius: 0 0 5px 5px -} - -@media screen and (-webkit-min-device-pixel-ratio:2),screen and (max--moz-device-pixel-ratio:2) { - .context-loader { - background: url(../images/min/octocat-spinner-32-EAF2F5.gif) 10px 50% no-repeat #eee; - background-size: 16px auto - } + position: absolute; + top: 0; + left: 50%; + z-index: 20; + width: 154px; + padding: 10px 10px 10px 30px; + margin-left: -75px; + font-size: 12px; + color: #666; + background: url(../images/min/octocat-spinner-16px.gif) 10px 50% no-repeat + #eee; + border: 1px solid #ddd; + border-top: 1px solid #fff; + border-radius: 0 0 5px 5px; +} + +@media screen and (-webkit-min-device-pixel-ratio: 2), + screen and (max--moz-device-pixel-ratio: 2) { + .context-loader { + background: url(../images/min/octocat-spinner-32-EAF2F5.gif) 10px 50% + no-repeat #eee; + background-size: 16px auto; + } } .site-header-nav { - float: right; - margin-bottom: -20px + float: right; + margin-bottom: -20px; } .site-header-nav-item { - display: inline-block; - padding: 6px 10px 15px; - margin-left: 1.25rem; - font-size: 1rem; - color: #777 + display: inline-block; + padding: 6px 10px 15px; + margin-left: 1.25rem; + font-size: 1rem; + color: #777; } -.site-footer:after,.site-footer:before { - display: table; - content: "" +.site-footer:after, +.site-footer:before { + display: table; + content: ""; } .site-header-nav-item:hover { - color: #333; - text-decoration: none + color: #333; + text-decoration: none; } .site-header-nav-item.selected { - color: #333; - padding: 6px 10px 13px; - border-bottom: 2px solid #d26911 + color: #333; + padding: 6px 10px 13px; + border-bottom: 2px solid #d26911; } -.site-header-nav-item+.btn-outline { - margin-top: -1px; - margin-left: 20px +.site-header-nav-item + .btn-outline { + margin-top: -1px; + margin-left: 20px; } .site-footer { - position: relative; - margin-top: 40px; - padding-top: 40px; - padding-bottom: 40px; - font-size: 12px; - line-height: 1.5; - color: #777; - border-top: 1px solid #eee + position: relative; + margin-top: 40px; + padding-top: 40px; + padding-bottom: 40px; + font-size: 12px; + line-height: 1.5; + color: #777; + border-top: 1px solid #eee; } -.markdown-body h1,.markdown-body h2 { - padding-bottom: .3em; - border-bottom: 1px solid #eee +.markdown-body h1, +.markdown-body h2 { + padding-bottom: 0.3em; + border-bottom: 1px solid #eee; } .site-footer .copyright { - padding-right: 20px + padding-right: 20px; } .site-footer:after { - clear: both + clear: both; } .site-footer .octicon-mark-github { - position: absolute; - top: 38px; - left: 50%; - height: 24px; - width: 24px; - margin-left: -12px; - font-size: 24px; - color: #ccc + position: absolute; + top: 38px; + left: 50%; + height: 24px; + width: 24px; + margin-left: -12px; + font-size: 24px; + color: #ccc; } .site-footer .octicon-mark-github:hover { - color: #bbb + color: #bbb; } .site-footer-links { - margin: 0; - list-style: none + margin: 0; + list-style: none; } .site-footer-links li { - display: inline-block; - line-height: 16px + display: inline-block; + line-height: 16px; } -.site-footer-links li+li { - margin-left: 10px +.site-footer-links li + li { + margin-left: 10px; } .share { - margin: 20px 0 + margin: 20px 0; } .markdown-body { - overflow: hidden + overflow: hidden; } -.markdown-body>:first-child { - margin-top: 0!important +.markdown-body > :first-child { + margin-top: 0 !important; } -.markdown-body>:last-child { - margin-bottom: 0!important +.markdown-body > :last-child { + margin-bottom: 0 !important; } .markdown-body a:not([href]) { - color: inherit; - text-decoration: none + color: inherit; + text-decoration: none; } .markdown-body .absent { - color: #c00 + color: #c00; } .markdown-body .anchor { - position: absolute; - top: 0; - left: 0; - display: block; - padding-right: 6px; - padding-left: 30px; - margin-left: -30px + position: absolute; + top: 0; + left: 0; + display: block; + padding-right: 6px; + padding-left: 30px; + margin-left: -30px; } .markdown-body .anchor:focus { - outline: 0 + outline: 0; } -.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6 { - position: relative; - margin-top: 1em; - margin-bottom: 16px; - font-weight: 700; - line-height: 1.4 -} - -.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link { - display: none; - color: #000; - vertical-align: middle -} - -.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor { - padding-left: 8px; - margin-left: -30px; - text-decoration: none -} - -.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link { - display: inline-block -} - -.markdown-body h1 code,.markdown-body h1 tt,.markdown-body h2 code,.markdown-body h2 tt,.markdown-body h3 code,.markdown-body h3 tt,.markdown-body h4 code,.markdown-body h4 tt,.markdown-body h5 code,.markdown-body h5 tt,.markdown-body h6 code,.markdown-body h6 tt { - font-size: inherit +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + position: relative; + margin-top: 1em; + margin-bottom: 16px; + font-weight: 700; + line-height: 1.4; +} + +.markdown-body h1 .octicon-link, +.markdown-body h2 .octicon-link, +.markdown-body h3 .octicon-link, +.markdown-body h4 .octicon-link, +.markdown-body h5 .octicon-link, +.markdown-body h6 .octicon-link { + display: none; + color: #000; + vertical-align: middle; +} + +.markdown-body h1:hover .anchor, +.markdown-body h2:hover .anchor, +.markdown-body h3:hover .anchor, +.markdown-body h4:hover .anchor, +.markdown-body h5:hover .anchor, +.markdown-body h6:hover .anchor { + padding-left: 8px; + margin-left: -30px; + text-decoration: none; +} + +.markdown-body h1:hover .anchor .octicon-link, +.markdown-body h2:hover .anchor .octicon-link, +.markdown-body h3:hover .anchor .octicon-link, +.markdown-body h4:hover .anchor .octicon-link, +.markdown-body h5:hover .anchor .octicon-link, +.markdown-body h6:hover .anchor .octicon-link { + display: inline-block; +} + +.markdown-body h1 code, +.markdown-body h1 tt, +.markdown-body h2 code, +.markdown-body h2 tt, +.markdown-body h3 code, +.markdown-body h3 tt, +.markdown-body h4 code, +.markdown-body h4 tt, +.markdown-body h5 code, +.markdown-body h5 tt, +.markdown-body h6 code, +.markdown-body h6 tt { + font-size: inherit; } .markdown-body h1 { - font-size: 2.25em; - line-height: 1.2 + font-size: 2.25em; + line-height: 1.2; } .markdown-body h1 .anchor { - line-height: 1 + line-height: 1; } .markdown-body h2 { - font-size: 1.75em; - line-height: 1.225 + font-size: 1.75em; + line-height: 1.225; } .markdown-body h2 .anchor { - line-height: 1 + line-height: 1; } .markdown-body h3 { - font-size: 1.5em; - line-height: 1.43 + font-size: 1.5em; + line-height: 1.43; } -.markdown-body h3 .anchor,.markdown-body h4 .anchor { - line-height: 1.2 +.markdown-body h3 .anchor, +.markdown-body h4 .anchor { + line-height: 1.2; } .markdown-body h4 { - font-size: 1.25em + font-size: 1.25em; } -.markdown-body h5 .anchor,.markdown-body h6 .anchor { - line-height: 1.1 +.markdown-body h5 .anchor, +.markdown-body h6 .anchor { + line-height: 1.1; } .markdown-body h5 { - font-size: 1em + font-size: 1em; } .markdown-body h6 { - font-size: 1em; - color: #777 + font-size: 1em; + color: #777; } -.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul { - margin-top: 0; - margin-bottom: 16px +.markdown-body blockquote, +.markdown-body dl, +.markdown-body ol, +.markdown-body p, +.markdown-body pre, +.markdown-body table, +.markdown-body ul { + margin-top: 0; + margin-bottom: 16px; } .markdown-body hr { - height: 4px; - padding: 0; - margin: 16px 0; - background-color: #e7e7e7; - border: 0 + height: 4px; + padding: 0; + margin: 16px 0; + background-color: #e7e7e7; + border: 0; } -.markdown-body ol,.markdown-body ul { - padding-left: 2em +.markdown-body ol, +.markdown-body ul { + padding-left: 2em; } -.markdown-body ol.no-list,.markdown-body ul.no-list { - padding: 0; - list-style-type: none +.markdown-body ol.no-list, +.markdown-body ul.no-list { + padding: 0; + list-style-type: none; } -.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul { - margin-top: 0; - margin-bottom: 0 +.markdown-body ol ol, +.markdown-body ol ul, +.markdown-body ul ol, +.markdown-body ul ul { + margin-top: 0; + margin-bottom: 0; } -.markdown-body li>p { - margin-top: 16px +.markdown-body li > p { + margin-top: 16px; } .markdown-body dl { - padding: 0 + padding: 0; } .markdown-body dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; } .markdown-body dl dd { - padding: 0 16px; - margin-bottom: 16px + padding: 0 16px; + margin-bottom: 16px; } .markdown-body blockquote { - padding: 0 15px; - color: #777; - border-left: 4px solid #ddd + padding: 0 15px; + color: #777; + border-left: 4px solid #ddd; } -.markdown-body blockquote>:first-child { - margin-top: 0 +.markdown-body blockquote > :first-child { + margin-top: 0; } -.markdown-body blockquote>:last-child { - margin-bottom: 0 +.markdown-body blockquote > :last-child { + margin-bottom: 0; } .markdown-body table { - display: block; - width: 100%; - overflow: auto; - word-break: normal; - word-break: keep-all + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; } -.markdown-body table td,.markdown-body table th { - padding: 6px 13px; - border: 1px solid #ddd +.markdown-body table td, +.markdown-body table th { + padding: 6px 13px; + border: 1px solid #ddd; } .markdown-body table tr { - background-color: #fff; - border-top: 1px solid #ccc + background-color: #fff; + border-top: 1px solid #ccc; } .markdown-body table tr:nth-child(2n) { - background-color: #f8f8f8 + background-color: #f8f8f8; } .markdown-body img { - max-width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box + max-width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } .markdown-body .emoji { - max-width: none + max-width: none; } .markdown-body span.frame { - display: block; - overflow: hidden + display: block; + overflow: hidden; } -.markdown-body span.frame>span { - display: block; - float: left; - width: auto; - padding: 7px; - margin: 13px 0 0; - overflow: hidden; - border: 1px solid #ddd +.markdown-body span.frame > span { + display: block; + float: left; + width: auto; + padding: 7px; + margin: 13px 0 0; + overflow: hidden; + border: 1px solid #ddd; } .markdown-body span.frame span img { - display: block; - float: left + display: block; + float: left; } .markdown-body span.frame span span { - display: block; - padding: 5px 0 0; - clear: both; - color: #333 + display: block; + padding: 5px 0 0; + clear: both; + color: #333; } .markdown-body span.align-center { - display: block; - overflow: hidden; - clear: both + display: block; + overflow: hidden; + clear: both; } -.markdown-body span.align-center>span { - display: block; - margin: 13px auto 0; - overflow: hidden; - text-align: center +.markdown-body span.align-center > span { + display: block; + margin: 13px auto 0; + overflow: hidden; + text-align: center; } .markdown-body span.align-center span img { - margin: 0 auto; - text-align: center + margin: 0 auto; + text-align: center; } .markdown-body span.align-right { - display: block; - overflow: hidden; - clear: both + display: block; + overflow: hidden; + clear: both; } -.markdown-body span.align-right>span { - display: block; - margin: 13px 0 0; - overflow: hidden; - text-align: right +.markdown-body span.align-right > span { + display: block; + margin: 13px 0 0; + overflow: hidden; + text-align: right; } .markdown-body span.align-right span img { - margin: 0; - text-align: right + margin: 0; + text-align: right; } .markdown-body span.float-left { - display: block; - float: left; - margin-right: 13px; - overflow: hidden + display: block; + float: left; + margin-right: 13px; + overflow: hidden; } .markdown-body span.float-left span { - margin: 13px 0 0 + margin: 13px 0 0; } .markdown-body span.float-right { - display: block; - float: right; - margin-left: 13px; - overflow: hidden + display: block; + float: right; + margin-left: 13px; + overflow: hidden; } -.markdown-body span.float-right>span { - display: block; - margin: 13px auto 0; - overflow: hidden; - text-align: right +.markdown-body span.float-right > span { + display: block; + margin: 13px auto 0; + overflow: hidden; + text-align: right; } -.markdown-body code,.markdown-body tt { - padding: .2em 0; - margin: 0; - font-size: 85%; - background-color: rgba(0,0,0,.04); - border-radius: 3px +.markdown-body code, +.markdown-body tt { + padding: 0.2em 0; + margin: 0; + font-size: 85%; + background-color: rgba(0, 0, 0, 0.04); + border-radius: 3px; } -.markdown-body code:after,.markdown-body code:before,.markdown-body tt:after,.markdown-body tt:before { - letter-spacing: -.2em; - content: " " +.markdown-body code:after, +.markdown-body code:before, +.markdown-body tt:after, +.markdown-body tt:before { + letter-spacing: -0.2em; + content: " "; } -.markdown-body code br,.markdown-body tt br { - display: none +.markdown-body code br, +.markdown-body tt br { + display: none; } .markdown-body del code { - text-decoration: inherit + text-decoration: inherit; } -.markdown-body pre>code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: 0 0; - border: 0 +.markdown-body pre > code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: 0 0; + border: 0; } .markdown-body .highlight { - margin-bottom: 16px + margin-bottom: 16px; } -.markdown-body .highlight pre,.markdown-body pre { - padding: 16px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - background-color: #f7f7f7; - border-radius: 3px +.markdown-body .highlight pre, +.markdown-body pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f7f7f7; + border-radius: 3px; } .markdown-body .highlight pre { - margin-bottom: 0; - word-break: normal + margin-bottom: 0; + word-break: normal; } .markdown-body pre { - word-wrap: normal + word-wrap: normal; } -.markdown-body pre code,.markdown-body pre tt { - display: inline; - max-width: initial; - padding: 0; - margin: 0; - overflow: initial; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0 +.markdown-body pre code, +.markdown-body pre tt { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; } -.markdown-body pre code:after,.markdown-body pre code:before,.markdown-body pre tt:after,.markdown-body pre tt:before { - content: normal +.markdown-body pre code:after, +.markdown-body pre code:before, +.markdown-body pre tt:after, +.markdown-body pre tt:before { + content: normal; } .markdown-body kbd { - display: inline-block; - padding: 3px 5px; - font-size: 11px; - line-height: 10px; - color: #555; - vertical-align: middle; - background-color: #fcfcfc; - border: 1px solid #ccc; - border-bottom-color: #bbb; - border-radius: 3px; - -webkit-box-shadow: inset 0 -1px 0 #bbb; - box-shadow: inset 0 -1px 0 #bbb + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: 1px solid #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + -webkit-box-shadow: inset 0 -1px 0 #bbb; + box-shadow: inset 0 -1px 0 #bbb; } .pl-c { - color: #969896 + color: #969896; } -.pl-c1,.pl-s .pl-v { - color: #0086b3 +.pl-c1, +.pl-s .pl-v { + color: #0086b3; } -.pl-e,.pl-en { - color: #795da3 +.pl-e, +.pl-en { + color: #795da3; } -.pl-s .pl-s1,.pl-smi { - color: #333 +.pl-s .pl-s1, +.pl-smi { + color: #333; } .pl-ent { - color: #63a35c + color: #63a35c; } .pl-k { - color: #a71d5d + color: #a71d5d; } -.pl-pds,.pl-s,.pl-s .pl-pse .pl-s1,.pl-sr,.pl-sr .pl-cce,.pl-sr .pl-sra,.pl-sr .pl-sre { - color: #183691 +.pl-pds, +.pl-s, +.pl-s .pl-pse .pl-s1, +.pl-sr, +.pl-sr .pl-cce, +.pl-sr .pl-sra, +.pl-sr .pl-sre { + color: #183691; } .pl-v { - color: #ed6a43 + color: #ed6a43; } .pl-id { - color: #b52a1d + color: #b52a1d; } .pl-ii { - background-color: #b52a1d; - color: #f8f8f8 + background-color: #b52a1d; + color: #f8f8f8; } .pl-sr .pl-cce { - color: #63a35c + color: #63a35c; } .pl-ml { - color: #693a17 + color: #693a17; } -.pl-mh,.pl-mh .pl-en,.pl-ms { - color: #1d3e81 +.pl-mh, +.pl-mh .pl-en, +.pl-ms { + color: #1d3e81; } .pl-mq { - color: teal + color: teal; } .pl-mi { - color: #333; - font-style: italic + color: #333; + font-style: italic; } .pl-mb { - color: #333 + color: #333; } .pl-md { - background-color: #ffecec; - color: #bd2c00 + background-color: #ffecec; + color: #bd2c00; } .pl-mi1 { - background-color: #eaffea; - color: #55a532 + background-color: #eaffea; + color: #55a532; } .pl-mdr { - color: #795da3 + color: #795da3; } .pl-mo { - color: #1d3e81 + color: #1d3e81; } pre { - border: 1px solid #ccc; + border: 1px solid #ccc; } .tools-wrapper { diff --git a/assets/css/globals/prism.css b/assets/css/globals/prism.css index 6f4d600a804..a191acd49a0 100755 --- a/assets/css/globals/prism.css +++ b/assets/css/globals/prism.css @@ -1 +1,112 @@ -code[class*=language-],pre[class*=language-]{color:#000;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono',monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f9f9f9}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#a67f59;background:rgba(255,255,255,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.function{color:#DD4A68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help} \ No newline at end of file +code[class*="language-"], +pre[class*="language-"] { + color: #000; + text-shadow: 0 1px #fff; + font-family: Consolas, Monaco, "Andale Mono", monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} +code[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, +pre[class*="language-"] ::-moz-selection, +pre[class*="language-"]::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} +code[class*="language-"] ::selection, +code[class*="language-"]::selection, +pre[class*="language-"] ::selection, +pre[class*="language-"]::selection { + text-shadow: none; + background: #b3d4fc; +} +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} +pre[class*="language-"] { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f9f9f9; +} +:not(pre) > code[class*="language-"] { + padding: 0.1em; + border-radius: 0.3em; +} +.token.cdata, +.token.comment, +.token.doctype, +.token.prolog { + color: #708090; +} +.token.punctuation { + color: #999; +} +.namespace { + opacity: 0.7; +} +.token.boolean, +.token.constant, +.token.deleted, +.token.number, +.token.property, +.token.symbol, +.token.tag { + color: #905; +} +.token.attr-name, +.token.builtin, +.token.char, +.token.inserted, +.token.selector, +.token.string { + color: #690; +} +.language-css .token.string, +.style .token.string, +.token.entity, +.token.operator, +.token.url { + color: #a67f59; + background: rgba(255, 255, 255, 0.5); +} +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} +.token.function { + color: #dd4a68; +} +.token.important, +.token.regex, +.token.variable { + color: #e90; +} +.token.bold, +.token.important { + font-weight: 700; +} +.token.italic { + font-style: italic; +} +.token.entity { + cursor: help; +} diff --git a/assets/css/globals/responsive.css b/assets/css/globals/responsive.css index 6adf6fb4dbf..1d6d26b13a7 100755 --- a/assets/css/globals/responsive.css +++ b/assets/css/globals/responsive.css @@ -2,45 +2,45 @@ width: auto; max-width: 1020px; padding-left: 20px; - padding-right: 20px + padding-right: 20px; } .mobile-visible { - display: none + display: none; } -@media (max-width:60em) { +@media (max-width: 60em) { .collection-card { width: 45%; - height: 225px + height: 225px; } } -@media (max-width:35em) { +@media (max-width: 35em) { .collection-card { width: 100%; max-width: 350px; - margin: 10px auto + margin: 10px auto; } } -@media (max-width:50em) { +@media (max-width: 50em) { .mobile-block { display: block; - float: none + float: none; } .mobile-hidden { - display: none + display: none; } .mobile-visible { - display: inline-block + display: inline-block; } .mobile-md-section { - padding: 10px 0 + padding: 10px 0; } .column, .one-third-column { - width: 100%!important; + width: 100% !important; float: none; } .home .banner .collection-head { @@ -63,7 +63,8 @@ padding-bottom: 0; padding-top: 5px; } - .site-header h1, .site-header h1 .octicon { + .site-header h1, + .site-header h1 .octicon { font-size: 1em; } .site-header .site-header-nav { @@ -72,7 +73,7 @@ margin-bottom: 0; } .site-header .site-header-nav .site-header-nav-item { - padding: 0 .5rem; + padding: 0 0.5rem; margin-left: 0; font-size: 1rem; display: block; @@ -108,22 +109,22 @@ .mini-repo-list-item .owner.css-truncate-target, .mini-repo-list-item .repo-and-owner.css-truncate-target { - max-width: 300px + max-width: 300px; } .markdown-body h1 { - font-size: 2rem + font-size: 2rem; } .markdown-body h2 { - font-size: 1.4rem + font-size: 1.4rem; } .markdown-body h3 { - font-size: 1.2rem + font-size: 1.2rem; } .markdown-body h4 { - font-size: 1.1em + font-size: 1.1em; } .markdown-body h5 { - font-size: 1em + font-size: 1em; } .tools-wrapper { @@ -131,12 +132,12 @@ } } -@media (max-width:20em) { +@media (max-width: 20em) { .site-header-nav .site-header-nav-item { - min-width: 20% + min-width: 20%; } .collection-head .collection-info .meta-info { display: block; - margin-top: 15px + margin-top: 15px; } } diff --git a/assets/css/modules/sidebar-search.css b/assets/css/modules/sidebar-search.css index 469b98e9517..04c33b1d350 100644 --- a/assets/css/modules/sidebar-search.css +++ b/assets/css/modules/sidebar-search.css @@ -1,6 +1,6 @@ #search_results { - font-size: 14px; - list-style-type: none; - padding-top: 10px; - padding-left: 10px; -} \ No newline at end of file + font-size: 14px; + list-style-type: none; + padding-top: 10px; + padding-left: 10px; +} diff --git a/assets/css/pages/index.css b/assets/css/pages/index.css index e3dd301ea24..5ea4981f8e2 100755 --- a/assets/css/pages/index.css +++ b/assets/css/pages/index.css @@ -1,34 +1,33 @@ .home .banner, .home .site-header { - background: #4183c4; - color: #fff + background: #4183c4; + color: #fff; } .home .banner .collection-head { - color: #fff; - background: 0 0; - box-shadow: none; - -webkit-box-shadow: none + color: #fff; + background: 0 0; + box-shadow: none; + -webkit-box-shadow: none; } .home .site-header { - border-bottom: none + border-bottom: none; } .home .site-header h1 a { - color: #fff + color: #fff; } .home .site-header .site-header-nav-item { - color: rgba(255, 255, 255, .5) + color: rgba(255, 255, 255, 0.5); } .home .site-header .site-header-nav-item:hover { - color: #fff + color: #fff; } - -@media (max-width:50em) { +@media (max-width: 50em) { .home .collapsed .icon-bar { background-color: white; } diff --git a/assets/css/posts/index.css b/assets/css/posts/index.css index 483e813d707..ff3eb849a2d 100644 --- a/assets/css/posts/index.css +++ b/assets/css/posts/index.css @@ -1,125 +1,124 @@ #post-directory-module { - z-index: 999; + z-index: 999; } .post-directory { - font-size: 14px; - background: #fff; - overflow: hidden; - width: 300px; - padding-bottom: 1em; - border: 1px solid #efefef; - color: #999; + font-size: 14px; + background: #fff; + overflow: hidden; + width: 300px; + padding-bottom: 1em; + border: 1px solid #efefef; + color: #999; } .post-directory ul, .post-directory ol { - padding-left: 1.5em; - list-style: none; + padding-left: 1.5em; + list-style: none; } .post-directory strong { - border-left: 5px solid #999; - padding: 2px 5px 2px 15px; + border-left: 5px solid #999; + padding: 2px 5px 2px 15px; } .post-directory a { - text-decoration: none; - color: #bababa; + text-decoration: none; + color: #bababa; } .post-directory a:hover, .post-directory a:active, .post-directory a.on { - color: #4183c4; + color: #4183c4; } .posts-list { - line-height: 2; - color: #555; - list-style-type:disc; + line-height: 2; + color: #555; + list-style-type: disc; } .posts-list::before { -/* content: " ";*/ - position: absolute; - left: 0; - top: 12px; - width: 6px; - height: 6px; - margin-left: -4px; - background: #bbb; - border-radius: 50%; - border: 1px solid #fff; - transition-duration: 0.2s; - transition-timing-function: ease-in-out; - transition-delay: 0s; - transition-property: background; + /* content: " ";*/ + position: absolute; + left: 0; + top: 12px; + width: 6px; + height: 6px; + margin-left: -4px; + background: #bbb; + border-radius: 50%; + border: 1px solid #fff; + transition-duration: 0.2s; + transition-timing-function: ease-in-out; + transition-delay: 0s; + transition-property: background; } .posts-list-item { - border-bottom: 1px dashed #ccc; - margin: 10px; - padding: 0; + border-bottom: 1px dashed #ccc; + margin: 10px; + padding: 0; } .posts-list-item a { - font-size: 16px; - font-weight: normal; - font-family: Lato, "PingFang SC", "Microsoft YaHei", sans-serif; - line-height: inherit; - color: #666; + font-size: 16px; + font-weight: normal; + font-family: Lato, "PingFang SC", "Microsoft YaHei", sans-serif; + line-height: inherit; + color: #666; } .posts-list-meta { - font-size: 12px; - font-family: Lato, "PingFang SC", "Microsoft YaHei", sans-serif; - line-height: 2; - color: #555; - background: #fff; + font-size: 12px; + font-family: Lato, "PingFang SC", "Microsoft YaHei", sans-serif; + line-height: 2; + color: #555; + background: #fff; } .list-group { - padding-left: 0; - margin-bottom: 20px; + padding-left: 0; + margin-bottom: 20px; } .list-group-item { - position: relative; - display: block; - padding: 10px 15px; - margin-bottom: -1px; - background-color: #fff; - border: 1px solid #ddd; + position: relative; + display: block; + padding: 10px 15px; + margin-bottom: -1px; + background-color: #fff; + border: 1px solid #ddd; } - .list-group-item:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; } .list-group-item:last-child { - margin-bottom: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; + margin-bottom: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; } -.list-group-item>.badge { - float: right; +.list-group-item > .badge { + float: right; } .badge { - display: inline-block; - min-width: 10px; - padding: 3px 7px; - font-size: 12px; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: middle; - background-color: #777; - border-radius: 10px; + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: 700; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: middle; + background-color: #777; + border-radius: 10px; } diff --git a/assets/css/pygments/default.css b/assets/css/pygments/default.css index 251b50dd581..2162321bda7 100644 --- a/assets/css/pygments/default.css +++ b/assets/css/pygments/default.css @@ -1,62 +1,207 @@ -.hll { background-color: #ffffcc } -.c { color: #408080; font-style: italic } /* Comment */ -.err { border: 1px solid #FF0000 } /* Error */ -.k { color: #008000; font-weight: bold } /* Keyword */ -.o { color: #666666 } /* Operator */ -.cm { color: #408080; font-style: italic } /* Comment.Multiline */ -.cp { color: #BC7A00 } /* Comment.Preproc */ -.c1 { color: #408080; font-style: italic } /* Comment.Single */ -.cs { color: #408080; font-style: italic } /* Comment.Special */ -.gd { color: #A00000 } /* Generic.Deleted */ -.ge { font-style: italic } /* Generic.Emph */ -.gr { color: #FF0000 } /* Generic.Error */ -.gh { color: #000080; font-weight: bold } /* Generic.Heading */ -.gi { color: #00A000 } /* Generic.Inserted */ -.go { color: #888888 } /* Generic.Output */ -.gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -.gs { font-weight: bold } /* Generic.Strong */ -.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -.gt { color: #0044DD } /* Generic.Traceback */ -.kc { color: #008000; font-weight: bold } /* Keyword.Constant */ -.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ -.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ -.kp { color: #008000 } /* Keyword.Pseudo */ -.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ -.kt { color: #B00040 } /* Keyword.Type */ -.m { color: #666666 } /* Literal.Number */ -.s { color: #BA2121 } /* Literal.String */ -.na { color: #7D9029 } /* Name.Attribute */ -.nb { color: #008000 } /* Name.Builtin */ -.nc { color: #0000FF; font-weight: bold } /* Name.Class */ -.no { color: #880000 } /* Name.Constant */ -.nd { color: #AA22FF } /* Name.Decorator */ -.ni { color: #999999; font-weight: bold } /* Name.Entity */ -.ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -.nf { color: #0000FF } /* Name.Function */ -.nl { color: #A0A000 } /* Name.Label */ -.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -.nt { color: #008000; font-weight: bold } /* Name.Tag */ -.nv { color: #19177C } /* Name.Variable */ -.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -.w { color: #bbbbbb } /* Text.Whitespace */ -.mb { color: #666666 } /* Literal.Number.Bin */ -.mf { color: #666666 } /* Literal.Number.Float */ -.mh { color: #666666 } /* Literal.Number.Hex */ -.mi { color: #666666 } /* Literal.Number.Integer */ -.mo { color: #666666 } /* Literal.Number.Oct */ -.sb { color: #BA2121 } /* Literal.String.Backtick */ -.sc { color: #BA2121 } /* Literal.String.Char */ -.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ -.s2 { color: #BA2121 } /* Literal.String.Double */ -.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -.sh { color: #BA2121 } /* Literal.String.Heredoc */ -.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -.sx { color: #008000 } /* Literal.String.Other */ -.sr { color: #BB6688 } /* Literal.String.Regex */ -.s1 { color: #BA2121 } /* Literal.String.Single */ -.ss { color: #19177C } /* Literal.String.Symbol */ -.bp { color: #008000 } /* Name.Builtin.Pseudo */ -.vc { color: #19177C } /* Name.Variable.Class */ -.vg { color: #19177C } /* Name.Variable.Global */ -.vi { color: #19177C } /* Name.Variable.Instance */ -.il { color: #666666 } /* Literal.Number.Integer.Long */ +.hll { + background-color: #ffffcc; +} +.c { + color: #408080; + font-style: italic; +} /* Comment */ +.err { + border: 1px solid #ff0000; +} /* Error */ +.k { + color: #008000; + font-weight: bold; +} /* Keyword */ +.o { + color: #666666; +} /* Operator */ +.cm { + color: #408080; + font-style: italic; +} /* Comment.Multiline */ +.cp { + color: #bc7a00; +} /* Comment.Preproc */ +.c1 { + color: #408080; + font-style: italic; +} /* Comment.Single */ +.cs { + color: #408080; + font-style: italic; +} /* Comment.Special */ +.gd { + color: #a00000; +} /* Generic.Deleted */ +.ge { + font-style: italic; +} /* Generic.Emph */ +.gr { + color: #ff0000; +} /* Generic.Error */ +.gh { + color: #000080; + font-weight: bold; +} /* Generic.Heading */ +.gi { + color: #00a000; +} /* Generic.Inserted */ +.go { + color: #888888; +} /* Generic.Output */ +.gp { + color: #000080; + font-weight: bold; +} /* Generic.Prompt */ +.gs { + font-weight: bold; +} /* Generic.Strong */ +.gu { + color: #800080; + font-weight: bold; +} /* Generic.Subheading */ +.gt { + color: #0044dd; +} /* Generic.Traceback */ +.kc { + color: #008000; + font-weight: bold; +} /* Keyword.Constant */ +.kd { + color: #008000; + font-weight: bold; +} /* Keyword.Declaration */ +.kn { + color: #008000; + font-weight: bold; +} /* Keyword.Namespace */ +.kp { + color: #008000; +} /* Keyword.Pseudo */ +.kr { + color: #008000; + font-weight: bold; +} /* Keyword.Reserved */ +.kt { + color: #b00040; +} /* Keyword.Type */ +.m { + color: #666666; +} /* Literal.Number */ +.s { + color: #ba2121; +} /* Literal.String */ +.na { + color: #7d9029; +} /* Name.Attribute */ +.nb { + color: #008000; +} /* Name.Builtin */ +.nc { + color: #0000ff; + font-weight: bold; +} /* Name.Class */ +.no { + color: #880000; +} /* Name.Constant */ +.nd { + color: #aa22ff; +} /* Name.Decorator */ +.ni { + color: #999999; + font-weight: bold; +} /* Name.Entity */ +.ne { + color: #d2413a; + font-weight: bold; +} /* Name.Exception */ +.nf { + color: #0000ff; +} /* Name.Function */ +.nl { + color: #a0a000; +} /* Name.Label */ +.nn { + color: #0000ff; + font-weight: bold; +} /* Name.Namespace */ +.nt { + color: #008000; + font-weight: bold; +} /* Name.Tag */ +.nv { + color: #19177c; +} /* Name.Variable */ +.ow { + color: #aa22ff; + font-weight: bold; +} /* Operator.Word */ +.w { + color: #bbbbbb; +} /* Text.Whitespace */ +.mb { + color: #666666; +} /* Literal.Number.Bin */ +.mf { + color: #666666; +} /* Literal.Number.Float */ +.mh { + color: #666666; +} /* Literal.Number.Hex */ +.mi { + color: #666666; +} /* Literal.Number.Integer */ +.mo { + color: #666666; +} /* Literal.Number.Oct */ +.sb { + color: #ba2121; +} /* Literal.String.Backtick */ +.sc { + color: #ba2121; +} /* Literal.String.Char */ +.sd { + color: #ba2121; + font-style: italic; +} /* Literal.String.Doc */ +.s2 { + color: #ba2121; +} /* Literal.String.Double */ +.se { + color: #bb6622; + font-weight: bold; +} /* Literal.String.Escape */ +.sh { + color: #ba2121; +} /* Literal.String.Heredoc */ +.si { + color: #bb6688; + font-weight: bold; +} /* Literal.String.Interpol */ +.sx { + color: #008000; +} /* Literal.String.Other */ +.sr { + color: #bb6688; +} /* Literal.String.Regex */ +.s1 { + color: #ba2121; +} /* Literal.String.Single */ +.ss { + color: #19177c; +} /* Literal.String.Symbol */ +.bp { + color: #008000; +} /* Name.Builtin.Pseudo */ +.vc { + color: #19177c; +} /* Name.Variable.Class */ +.vg { + color: #19177c; +} /* Name.Variable.Global */ +.vi { + color: #19177c; +} /* Name.Variable.Instance */ +.il { + color: #666666; +} /* Literal.Number.Integer.Long */ diff --git a/assets/css/sections/mini-repo-list.css b/assets/css/sections/mini-repo-list.css index 5fd7ea76d06..ae4242af3fd 100755 --- a/assets/css/sections/mini-repo-list.css +++ b/assets/css/sections/mini-repo-list.css @@ -1 +1,62 @@ -.mini-repo-list .repo-name,.mini-repo-list-item .repo{font-weight:700}.mini-repo-list{list-style:none}.mini-repo-list>li:first-child .mini-repo-list-item{border-top:0}.mini-repo-list>li:last-child .mini-repo-list-item{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.mini-repo-list .no-repo{padding:15px;color:#999;text-align:center}.mini-repo-list-item{position:relative;display:block;padding:6px 64px 6px 30px;font-size:14px;border-top:1px solid #e5e5e5}.mini-repo-list-item.nostars{padding:6px 6px 6px 30px}.mini-repo-list-item:hover{text-decoration:none}.mini-repo-list-item:hover .owner,.mini-repo-list-item:hover .repo{text-decoration:underline}.mini-repo-list-item .repo-icon{float:left;margin-top:2px;margin-left:-20px;color:#666}.mini-repo-list-item .owner,.mini-repo-list-item .owner.css-truncate-target,.mini-repo-list-item .repo-and-owner.css-truncate-target{max-width:95%}.mini-repo-list-item .stars{position:absolute;top:0;right:10px;margin-top:6px;font-size:12px;color:#888}.mini-repo-list-item .repo-description{display:block;max-width:100%;font-size:12px;color:#777;line-height:21px} \ No newline at end of file +.mini-repo-list .repo-name, +.mini-repo-list-item .repo { + font-weight: 700; +} +.mini-repo-list { + list-style: none; +} +.mini-repo-list > li:first-child .mini-repo-list-item { + border-top: 0; +} +.mini-repo-list > li:last-child .mini-repo-list-item { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.mini-repo-list .no-repo { + padding: 15px; + color: #999; + text-align: center; +} +.mini-repo-list-item { + position: relative; + display: block; + padding: 6px 64px 6px 30px; + font-size: 14px; + border-top: 1px solid #e5e5e5; +} +.mini-repo-list-item.nostars { + padding: 6px 6px 6px 30px; +} +.mini-repo-list-item:hover { + text-decoration: none; +} +.mini-repo-list-item:hover .owner, +.mini-repo-list-item:hover .repo { + text-decoration: underline; +} +.mini-repo-list-item .repo-icon { + float: left; + margin-top: 2px; + margin-left: -20px; + color: #666; +} +.mini-repo-list-item .owner, +.mini-repo-list-item .owner.css-truncate-target, +.mini-repo-list-item .repo-and-owner.css-truncate-target { + max-width: 95%; +} +.mini-repo-list-item .stars { + position: absolute; + top: 0; + right: 10px; + margin-top: 6px; + font-size: 12px; + color: #888; +} +.mini-repo-list-item .repo-description { + display: block; + max-width: 100%; + font-size: 12px; + color: #777; + line-height: 21px; +} diff --git a/assets/css/sections/repo-list.css b/assets/css/sections/repo-list.css index 9f7277603c5..5cdbf38dab5 100755 --- a/assets/css/sections/repo-list.css +++ b/assets/css/sections/repo-list.css @@ -1 +1,106 @@ -.repo-list-name,.repo-list-name .prefix,.repo-list-name .slash{font-weight:400}.repo-list{position:relative;padding-left:0}.repo-list .participation-graph{position:absolute;right:0;bottom:0;left:0;z-index:-1}.repo-list .participation-graph.disabled{display:none}.repo-list .participation-graph .bars{position:absolute;bottom:0}.repo-list-item{position:relative;padding-top:30px;padding-bottom:30px;list-style:none;border-bottom:1px solid #eee}.repo-list-name{margin:0 0 8px;font-size:20px;line-height:1.2}.repo-list-name:hover{text-decoration:none;color:#4169E1}.repo-list-name .slash{margin-right:-4px;margin-left:-4px}.repo-list-description{max-width:550px;margin-top:8px;margin-bottom:0;font-size:14px;color:#666}.repo-list-stats{margin-top:6px;float:right;font-size:12px;font-weight:700;color:#888}.repo-list-stats .repo-list-stat-item{margin-left:8px;display:inline-block;color:#888;text-decoration:none}.repo-list-stats .repo-list-stat-item:hover{color:#4183c4}.repo-list-stats .repo-list-stat-item>.octicon{font-size:14px}.repo-list-info{display:inline-block;height:100%;margin-top:0;margin-bottom:0;font-size:12px;color:#888;vertical-align:middle}.repo-list-info .octicon{margin-top:-3px;font-size:12px;vertical-align:middle}.repo-list-meta{display:block;margin-top:8px;margin-bottom:0;font-size:13px;color:#999}.repo-list-meta .avatar{margin-top:-2px}.repo-list-meta a:hover{text-decoration:none}.repo-list-meta .meta-info{margin-right:15px}.repo-list-meta .meta-info a{color:#999}.repo-list-meta .meta-info a:hover,.repo-list-meta .meta-info a:hover{text-decoration: underline} +.repo-list-name, +.repo-list-name .prefix, +.repo-list-name .slash { + font-weight: 400; +} +.repo-list { + position: relative; + padding-left: 0; +} +.repo-list .participation-graph { + position: absolute; + right: 0; + bottom: 0; + left: 0; + z-index: -1; +} +.repo-list .participation-graph.disabled { + display: none; +} +.repo-list .participation-graph .bars { + position: absolute; + bottom: 0; +} +.repo-list-item { + position: relative; + padding-top: 30px; + padding-bottom: 30px; + list-style: none; + border-bottom: 1px solid #eee; +} +.repo-list-name { + margin: 0 0 8px; + font-size: 20px; + line-height: 1.2; +} +.repo-list-name:hover { + text-decoration: none; + color: #4169e1; +} +.repo-list-name .slash { + margin-right: -4px; + margin-left: -4px; +} +.repo-list-description { + max-width: 550px; + margin-top: 8px; + margin-bottom: 0; + font-size: 14px; + color: #666; +} +.repo-list-stats { + margin-top: 6px; + float: right; + font-size: 12px; + font-weight: 700; + color: #888; +} +.repo-list-stats .repo-list-stat-item { + margin-left: 8px; + display: inline-block; + color: #888; + text-decoration: none; +} +.repo-list-stats .repo-list-stat-item:hover { + color: #4183c4; +} +.repo-list-stats .repo-list-stat-item > .octicon { + font-size: 14px; +} +.repo-list-info { + display: inline-block; + height: 100%; + margin-top: 0; + margin-bottom: 0; + font-size: 12px; + color: #888; + vertical-align: middle; +} +.repo-list-info .octicon { + margin-top: -3px; + font-size: 12px; + vertical-align: middle; +} +.repo-list-meta { + display: block; + margin-top: 8px; + margin-bottom: 0; + font-size: 13px; + color: #999; +} +.repo-list-meta .avatar { + margin-top: -2px; +} +.repo-list-meta a:hover { + text-decoration: none; +} +.repo-list-meta .meta-info { + margin-right: 15px; +} +.repo-list-meta .meta-info a { + color: #999; +} +.repo-list-meta .meta-info a:hover, +.repo-list-meta .meta-info a:hover { + text-decoration: underline; +} diff --git a/assets/js/flow.js b/assets/js/flow.js index 320c91c81e2..45f3f3c184b 100644 --- a/assets/js/flow.js +++ b/assets/js/flow.js @@ -1,26 +1,34 @@ -'use strict'; +'use strict' $(function () { - var flowchart = window.flowchart; - var uuid = function () { + const flowchart = window.flowchart + const uuid = function () { return new Date().getTime() - }; + } $('code.language-flow').each(function (i, n) { - var codePre = $(n); + const codePre = $(n) if (codePre.attr('flow-flag') == 'compiled') { return } - var codeText = codePre.text(); - var _uuid = uuid(); - var div = $('
'); - div.css({'overflow-x': 'auto'}); - codePre.parent().before(div); - codePre.parent().before($('source')); - codePre.parent().hide(); - var chart; + const codeText = codePre.text() + const _uuid = uuid() + const div = $('
') + div.css({ 'overflow-x': 'auto' }) + codePre.parent().before(div) + codePre + .parent() + .before( + $( + 'source' + ) + ) + codePre.parent().hide() + let chart if (chart) { - chart.clean(); + chart.clean() } - chart = flowchart.parse(codeText); + chart = flowchart.parse(codeText) chart.drawSVG('div_' + _uuid, { // 'x': 30, // 'y': 50, @@ -28,42 +36,52 @@ $(function () { 'line-length': 50, 'text-margin': 10, 'font-size': 14, - 'font': 'normal', + font: 'normal', 'font-family': 'Helvetica', 'font-weight': 'normal', 'font-color': 'black', 'line-color': 'black', 'element-color': 'black', - 'fill': 'white', + fill: 'white', 'yes-text': 'yes', 'no-text': 'no', 'arrow-end': 'block', - 'scale': 1, - 'symbols': { - 'start': { + scale: 1, + symbols: { + start: { 'font-color': 'red', 'element-color': 'green', - 'fill': 'yellow' + fill: 'yellow' }, - 'end': { - 'class': 'end-element' + end: { + class: 'end-element' } }, - 'flowstate': { - 'past': {'fill': '#CCCCCC', 'font-size': 12}, - 'current': {'fill': 'yellow', 'font-color': 'red', 'font-weight': 'bold'}, - 'future': {'fill': '#FFFF99'}, - 'request': {'fill': 'blue'}, - 'invalid': {'fill': '#444444'}, - 'approved': {'fill': '#58C4A3', 'font-size': 12, 'yes-text': 'APPROVED', 'no-text': 'n/a'}, - 'rejected': {'fill': '#C45879', 'font-size': 12, 'yes-text': 'n/a', 'no-text': 'REJECTED'} + flowstate: { + past: { fill: '#CCCCCC', 'font-size': 12 }, + current: { fill: 'yellow', 'font-color': 'red', 'font-weight': 'bold' }, + future: { fill: '#FFFF99' }, + request: { fill: 'blue' }, + invalid: { fill: '#444444' }, + approved: { + fill: '#58C4A3', + 'font-size': 12, + 'yes-text': 'APPROVED', + 'no-text': 'n/a' + }, + rejected: { + fill: '#C45879', + 'font-size': 12, + 'yes-text': 'n/a', + 'no-text': 'REJECTED' + } } - }); - }); + }) + }) $('body').on('click.source', 'a.look-source', function () { - var $this = $(this); - $this.nextAll('pre').slideToggle(); + const $this = $(this) + $this.nextAll('pre').slideToggle() }) -}); +}) // code from https://bqxu.me/assets/flow.js diff --git a/assets/js/geopattern.js b/assets/js/geopattern.js index 9172650c386..ea3662e845f 100755 --- a/assets/js/geopattern.js +++ b/assets/js/geopattern.js @@ -1 +1,1631 @@ -!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.GeoPattern=t()}}(function(){return function t(r,s,e){function i(o,a){if(!s[o]){if(!r[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(n)return n(o,!0);throw new Error("Cannot find module '"+o+"'")}var l=s[o]={exports:{}};r[o][0].call(l.exports,function(t){var s=r[o][1][t];return i(s?s:t)},l,l.exports,t,r,s,e)}return s[o].exports}for(var n="function"==typeof require&&require,o=0;o.5?l/(2-o-a):l/(o+a),o){case r:i=(s-e)/l+(e>s?6:0);break;case s:i=(e-r)/l+2;break;case e:i=(r-s)/l+4}i/=6}return{h:i,s:n,l:h}}function n(t){function r(t,r,s){return 0>s&&(s+=1),s>1&&(s-=1),1/6>s?t+6*(r-t)*s:.5>s?r:2/3>s?t+(r-t)*(2/3-s)*6:t}var s,e,i,n=t.h,o=t.s,a=t.l;if(0===o)s=e=i=a;else{var h=.5>a?a*(1+o):a+o-a*o,l=2*a-h;s=r(l,h,n+1/3),e=r(l,h,n),i=r(l,h,n-1/3)}return{r:Math.round(255*s),g:Math.round(255*e),b:Math.round(255*i)}}r.exports={hex2rgb:s,rgb2hex:e,rgb2hsl:i,hsl2rgb:n,rgb2rgbString:function(t){return"rgb("+[t.r,t.g,t.b].join(",")+")"}}},{}],3:[function(t,r){!function(s){"use strict";function e(t){return function(r,s){return"object"==typeof r&&(s=r,r=null),(null===r||void 0===r)&&(r=(new Date).toString()),s||(s={}),t.call(this,r,s)}}var i=t("./pattern"),n=r.exports={generate:e(function(t,r){return new i(t,r)})};s&&(s.fn.geopattern=e(function(t,r){return this.each(function(){var e=s(this).attr("data-title-sha");e&&(r=s.extend({hash:e},r));var i=n.generate(t,r);s(this).css("background-image",i.toDataUrl())})}))}("undefined"!=typeof jQuery?jQuery:null)},{"./pattern":4}],4:[function(t,r){(function(s){"use strict";function e(t,r,s){return parseInt(t.substr(r,s||1),16)}function i(t,r,s,e,i){var n=parseFloat(t),o=s-r,a=i-e;return(n-r)*a/o+e}function n(t){return t%2===0?C:j}function o(t){return i(t,0,15,M,W)}function a(t){var r=t,s=r/2,e=Math.sin(60*Math.PI/180)*r;return[0,e,s,0,s+r,0,2*r,e,s+r,2*e,s,2*e,0,e].join(",")}function h(t,r){var s=.66*r;return[[0,0,t/2,r-s,t/2,r,0,s,0,0],[t/2,r-s,t,0,t,s,t/2,r,t/2,r-s]].map(function(t){return t.join(",")})}function l(t){return[[t,0,t,3*t],[0,t,3*t,t]]}function c(t){var r=t,s=.33*r;return[s,0,r-s,0,r,s,r,r-s,r-s,r,s,r,0,r-s,0,s,s,0].join(",")}function f(t,r){var s=t/2;return[s,0,t,r,0,r,s,0].join(",")}function u(t,r){return[t/2,0,t,r/2,t/2,r,0,r/2].join(",")}function p(t){return[0,0,t,t,0,t,0,0].join(",")}function g(t,r,s,e,i){var a=p(e),h=o(i[0]),l=n(i[0]),c={stroke:S,"stroke-opacity":A,"fill-opacity":h,fill:l};t.polyline(a,c).transform({translate:[r+e,s],scale:[-1,1]}),t.polyline(a,c).transform({translate:[r+e,s+2*e],scale:[1,-1]}),h=o(i[1]),l=n(i[1]),c={stroke:S,"stroke-opacity":A,"fill-opacity":h,fill:l},t.polyline(a,c).transform({translate:[r+e,s+2*e],scale:[-1,-1]}),t.polyline(a,c).transform({translate:[r+e,s],scale:[1,1]})}function v(t,r,s,e,i){var a=o(i),h=n(i),l=p(e),c={stroke:S,"stroke-opacity":A,"fill-opacity":a,fill:h};t.polyline(l,c).transform({translate:[r,s+e],scale:[1,-1]}),t.polyline(l,c).transform({translate:[r+2*e,s+e],scale:[-1,-1]}),t.polyline(l,c).transform({translate:[r,s+e],scale:[1,1]}),t.polyline(l,c).transform({translate:[r+2*e,s+e],scale:[-1,1]})}function y(t,r){var s=t/2;return[0,0,r,s,0,t,0,0].join(",")}var d=t("extend"),b=t("./color"),m=t("./sha1"),k=t("./svg"),x={baseColor:"#933c3c"},w=["octogons","overlappingCircles","plusSigns","xes","sineWaves","hexagons","overlappingRings","plaid","triangles","squares","concentricCircles","diamonds","tessellation","nestedSquares","mosaicSquares","chevrons"],j="#222",C="#ddd",S="#000",A=.02,M=.02,W=.15,H=r.exports=function(t,r){return this.opts=d({},x,r),this.hash=r.hash||m(t),this.svg=new k,this.generateBackground(),this.generatePattern(),this};H.prototype.toSvg=function(){return this.svg.toString()},H.prototype.toString=function(){return this.toSvg()},H.prototype.toBase64=function(){var t,r=this.toSvg();return t="undefined"!=typeof window&&"function"==typeof window.btoa?window.btoa(r):new s(r).toString("base64")},H.prototype.toDataUri=function(){return"data:image/svg+xml;base64,"+this.toBase64()},H.prototype.toDataUrl=function(){return'url("'+this.toDataUri()+'")'},H.prototype.generateBackground=function(){var t,r,s,n;this.opts.color?s=b.hex2rgb(this.opts.color):(r=i(e(this.hash,14,3),0,4095,0,359),n=e(this.hash,17),t=b.rgb2hsl(b.hex2rgb(this.opts.baseColor)),t.h=(360*t.h-r+360)%360/360,t.s=n%2===0?Math.min(1,(100*t.s+n)/100):Math.max(0,(100*t.s-n)/100),s=b.hsl2rgb(t)),this.color=b.rgb2hex(s),this.svg.rect(0,0,"100%","100%",{fill:b.rgb2rgbString(s)})},H.prototype.generatePattern=function(){var t=this.opts.generator;if(t){if(w.indexOf(t)<0)throw new Error("The generator "+t+" does not exist.")}else t=w[e(this.hash,20)];return this["geo"+t.slice(0,1).toUpperCase()+t.slice(1)]()},H.prototype.geoHexagons=function(){var t,r,s,h,l,c,f,u,p=e(this.hash,0),g=i(p,0,15,8,60),v=g*Math.sqrt(3),y=2*g,d=a(g);for(this.svg.setWidth(3*y+3*g),this.svg.setHeight(6*v),s=0,u=0;6>u;u++)for(f=0;6>f;f++)c=e(this.hash,s),t=f%2===0?u*v:u*v+v/2,h=o(c),r=n(c),l={fill:r,"fill-opacity":h,stroke:S,"stroke-opacity":A},this.svg.polyline(d,l).transform({translate:[f*g*1.5-y/2,t-v/2]}),0===f&&this.svg.polyline(d,l).transform({translate:[6*g*1.5-y/2,t-v/2]}),0===u&&(t=f%2===0?6*v:6*v+v/2,this.svg.polyline(d,l).transform({translate:[f*g*1.5-y/2,t-v/2]})),0===f&&0===u&&this.svg.polyline(d,l).transform({translate:[6*g*1.5-y/2,5*v+v/2]}),s++},H.prototype.geoSineWaves=function(){var t,r,s,a,h,l,c,f=Math.floor(i(e(this.hash,0),0,15,100,400)),u=Math.floor(i(e(this.hash,1),0,15,30,100)),p=Math.floor(i(e(this.hash,2),0,15,3,30));for(this.svg.setWidth(f),this.svg.setHeight(36*p),r=0;36>r;r++)l=e(this.hash,r),s=o(l),t=n(l),c=f/4*.7,h={fill:"none",stroke:t,opacity:s,"stroke-width":""+p+"px"},a="M0 "+u+" C "+c+" 0, "+(f/2-c)+" 0, "+f/2+" "+u+" S "+(f-c)+" "+2*u+", "+f+" "+u+" S "+(1.5*f-c)+" 0, "+1.5*f+", "+u,this.svg.path(a,h).transform({translate:[-f/4,p*r-1.5*u]}),this.svg.path(a,h).transform({translate:[-f/4,p*r-1.5*u+36*p]})},H.prototype.geoChevrons=function(){var t,r,s,a,l,c,f,u=i(e(this.hash,0),0,15,30,80),p=i(e(this.hash,0),0,15,30,80),g=h(u,p);for(this.svg.setWidth(6*u),this.svg.setHeight(6*p*.66),r=0,f=0;6>f;f++)for(c=0;6>c;c++)l=e(this.hash,r),s=o(l),t=n(l),a={stroke:S,"stroke-opacity":A,fill:t,"fill-opacity":s,"stroke-width":1},this.svg.group(a).transform({translate:[c*u,f*p*.66-p/2]}).polyline(g).end(),0===f&&this.svg.group(a).transform({translate:[c*u,6*p*.66-p/2]}).polyline(g).end(),r+=1},H.prototype.geoPlusSigns=function(){var t,r,s,a,h,c,f,u,p=i(e(this.hash,0),0,15,10,25),g=3*p,v=l(p);for(this.svg.setWidth(12*p),this.svg.setHeight(12*p),s=0,u=0;6>u;u++)for(f=0;6>f;f++)c=e(this.hash,s),a=o(c),r=n(c),t=u%2===0?0:1,h={fill:r,stroke:S,"stroke-opacity":A,"fill-opacity":a},this.svg.group(h).transform({translate:[f*g-f*p+t*p-p,u*g-u*p-g/2]}).rect(v).end(),0===f&&this.svg.group(h).transform({translate:[4*g-f*p+t*p-p,u*g-u*p-g/2]}).rect(v).end(),0===u&&this.svg.group(h).transform({translate:[f*g-f*p+t*p-p,4*g-u*p-g/2]}).rect(v).end(),0===f&&0===u&&this.svg.group(h).transform({translate:[4*g-f*p+t*p-p,4*g-u*p-g/2]}).rect(v).end(),s++},H.prototype.geoXes=function(){var t,r,s,a,h,c,f,u,p=i(e(this.hash,0),0,15,10,25),g=l(p),v=3*p*.943;for(this.svg.setWidth(3*v),this.svg.setHeight(3*v),s=0,u=0;6>u;u++)for(f=0;6>f;f++)c=e(this.hash,s),a=o(c),t=f%2===0?u*v-.5*v:u*v-.5*v+v/4,r=n(c),h={fill:r,opacity:a},this.svg.group(h).transform({translate:[f*v/2-v/2,t-u*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),0===f&&this.svg.group(h).transform({translate:[6*v/2-v/2,t-u*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),0===u&&(t=f%2===0?6*v-v/2:6*v-v/2+v/4,this.svg.group(h).transform({translate:[f*v/2-v/2,t-6*v/2],rotate:[45,v/2,v/2]}).rect(g).end()),5===u&&this.svg.group(h).transform({translate:[f*v/2-v/2,t-11*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),0===f&&0===u&&this.svg.group(h).transform({translate:[6*v/2-v/2,t-6*v/2],rotate:[45,v/2,v/2]}).rect(g).end(),s++},H.prototype.geoOverlappingCircles=function(){var t,r,s,a,h,l,c,f=e(this.hash,0),u=i(f,0,15,25,200),p=u/2;for(this.svg.setWidth(6*p),this.svg.setHeight(6*p),r=0,c=0;6>c;c++)for(l=0;6>l;l++)h=e(this.hash,r),s=o(h),t=n(h),a={fill:t,opacity:s},this.svg.circle(l*p,c*p,p,a),0===l&&this.svg.circle(6*p,c*p,p,a),0===c&&this.svg.circle(l*p,6*p,p,a),0===l&&0===c&&this.svg.circle(6*p,6*p,p,a),r++},H.prototype.geoOctogons=function(){var t,r,s,a,h,l,f=i(e(this.hash,0),0,15,10,60),u=c(f);for(this.svg.setWidth(6*f),this.svg.setHeight(6*f),r=0,l=0;6>l;l++)for(h=0;6>h;h++)a=e(this.hash,r),s=o(a),t=n(a),this.svg.polyline(u,{fill:t,"fill-opacity":s,stroke:S,"stroke-opacity":A}).transform({translate:[h*f,l*f]}),r+=1},H.prototype.geoSquares=function(){var t,r,s,a,h,l,c=i(e(this.hash,0),0,15,10,60);for(this.svg.setWidth(6*c),this.svg.setHeight(6*c),r=0,l=0;6>l;l++)for(h=0;6>h;h++)a=e(this.hash,r),s=o(a),t=n(a),this.svg.rect(h*c,l*c,c,c,{fill:t,"fill-opacity":s,stroke:S,"stroke-opacity":A}),r+=1},H.prototype.geoConcentricCircles=function(){var t,r,s,a,h,l,c=e(this.hash,0),f=i(c,0,15,10,60),u=f/5;for(this.svg.setWidth(6*(f+u)),this.svg.setHeight(6*(f+u)),r=0,l=0;6>l;l++)for(h=0;6>h;h++)a=e(this.hash,r),s=o(a),t=n(a),this.svg.circle(h*f+h*u+(f+u)/2,l*f+l*u+(f+u)/2,f/2,{fill:"none",stroke:t,opacity:s,"stroke-width":u+"px"}),a=e(this.hash,39-r),s=o(a),t=n(a),this.svg.circle(h*f+h*u+(f+u)/2,l*f+l*u+(f+u)/2,f/4,{fill:t,"fill-opacity":s}),r+=1},H.prototype.geoOverlappingRings=function(){var t,r,s,a,h,l,c,f=e(this.hash,0),u=i(f,0,15,10,60),p=u/4;for(this.svg.setWidth(6*u),this.svg.setHeight(6*u),r=0,c=0;6>c;c++)for(l=0;6>l;l++)h=e(this.hash,r),s=o(h),t=n(h),a={fill:"none",stroke:t,opacity:s,"stroke-width":p+"px"},this.svg.circle(l*u,c*u,u-p/2,a),0===l&&this.svg.circle(6*u,c*u,u-p/2,a),0===c&&this.svg.circle(l*u,6*u,u-p/2,a),0===l&&0===c&&this.svg.circle(6*u,6*u,u-p/2,a),r+=1},H.prototype.geoTriangles=function(){var t,r,s,a,h,l,c,u,p=e(this.hash,0),g=i(p,0,15,15,80),v=g/2*Math.sqrt(3),y=f(g,v);for(this.svg.setWidth(3*g),this.svg.setHeight(6*v),r=0,u=0;6>u;u++)for(c=0;6>c;c++)l=e(this.hash,r),s=o(l),t=n(l),h={fill:t,"fill-opacity":s,stroke:S,"stroke-opacity":A},a=u%2===0?c%2===0?180:0:c%2!==0?180:0,this.svg.polyline(y,h).transform({translate:[c*g*.5-g/2,v*u],rotate:[a,g/2,v/2]}),0===c&&this.svg.polyline(y,h).transform({translate:[6*g*.5-g/2,v*u],rotate:[a,g/2,v/2]}),r+=1},H.prototype.geoDiamonds=function(){var t,r,s,a,h,l,c,f,p=i(e(this.hash,0),0,15,10,50),g=i(e(this.hash,1),0,15,10,50),v=u(p,g);for(this.svg.setWidth(6*p),this.svg.setHeight(3*g),s=0,f=0;6>f;f++)for(c=0;6>c;c++)l=e(this.hash,s),a=o(l),r=n(l),h={fill:r,"fill-opacity":a,stroke:S,"stroke-opacity":A},t=f%2===0?0:p/2,this.svg.polyline(v,h).transform({translate:[c*p-p/2+t,g/2*f-g/2]}),0===c&&this.svg.polyline(v,h).transform({translate:[6*p-p/2+t,g/2*f-g/2]}),0===f&&this.svg.polyline(v,h).transform({translate:[c*p-p/2+t,g/2*6-g/2]}),0===c&&0===f&&this.svg.polyline(v,h).transform({translate:[6*p-p/2+t,g/2*6-g/2]}),s+=1},H.prototype.geoNestedSquares=function(){var t,r,s,a,h,l,c,f=i(e(this.hash,0),0,15,4,12),u=7*f;for(this.svg.setWidth(6*(u+f)+6*f),this.svg.setHeight(6*(u+f)+6*f),r=0,c=0;6>c;c++)for(l=0;6>l;l++)h=e(this.hash,r),s=o(h),t=n(h),a={fill:"none",stroke:t,opacity:s,"stroke-width":f+"px"},this.svg.rect(l*u+l*f*2+f/2,c*u+c*f*2+f/2,u,u,a),h=e(this.hash,39-r),s=o(h),t=n(h),a={fill:"none",stroke:t,opacity:s,"stroke-width":f+"px"},this.svg.rect(l*u+l*f*2+f/2+2*f,c*u+c*f*2+f/2+2*f,3*f,3*f,a),r+=1},H.prototype.geoMosaicSquares=function(){var t,r,s,n=i(e(this.hash,0),0,15,15,50);for(this.svg.setWidth(8*n),this.svg.setHeight(8*n),t=0,s=0;4>s;s++)for(r=0;4>r;r++)r%2===0?s%2===0?v(this.svg,r*n*2,s*n*2,n,e(this.hash,t)):g(this.svg,r*n*2,s*n*2,n,[e(this.hash,t),e(this.hash,t+1)]):s%2===0?g(this.svg,r*n*2,s*n*2,n,[e(this.hash,t),e(this.hash,t+1)]):v(this.svg,r*n*2,s*n*2,n,e(this.hash,t)),t+=1},H.prototype.geoPlaid=function(){var t,r,s,i,a,h,l,c=0,f=0;for(r=0;36>r;)i=e(this.hash,r),c+=i+5,l=e(this.hash,r+1),s=o(l),t=n(l),a=l+5,this.svg.rect(0,c,"100%",a,{opacity:s,fill:t}),c+=a,r+=2;for(r=0;36>r;)i=e(this.hash,r),f+=i+5,l=e(this.hash,r+1),s=o(l),t=n(l),h=l+5,this.svg.rect(f,0,h,"100%",{opacity:s,fill:t}),f+=h,r+=2;this.svg.setWidth(f),this.svg.setHeight(c)},H.prototype.geoTessellation=function(){var t,r,s,a,h,l=i(e(this.hash,0),0,15,5,40),c=l*Math.sqrt(3),f=2*l,u=l/2*Math.sqrt(3),p=y(l,u),g=3*l+2*u,v=2*c+2*l;for(this.svg.setWidth(g),this.svg.setHeight(v),r=0;20>r;r++)switch(h=e(this.hash,r),s=o(h),t=n(h),a={stroke:S,"stroke-opacity":A,fill:t,"fill-opacity":s,"stroke-width":1},r){case 0:this.svg.rect(-l/2,-l/2,l,l,a),this.svg.rect(g-l/2,-l/2,l,l,a),this.svg.rect(-l/2,v-l/2,l,l,a),this.svg.rect(g-l/2,v-l/2,l,l,a);break;case 1:this.svg.rect(f/2+u,c/2,l,l,a);break;case 2:this.svg.rect(-l/2,v/2-l/2,l,l,a),this.svg.rect(g-l/2,v/2-l/2,l,l,a);break;case 3:this.svg.rect(f/2+u,1.5*c+l,l,l,a);break;case 4:this.svg.polyline(p,a).transform({translate:[l/2,-l/2],rotate:[0,l/2,u/2]}),this.svg.polyline(p,a).transform({translate:[l/2,v- -l/2],rotate:[0,l/2,u/2],scale:[1,-1]});break;case 5:this.svg.polyline(p,a).transform({translate:[g-l/2,-l/2],rotate:[0,l/2,u/2],scale:[-1,1]}),this.svg.polyline(p,a).transform({translate:[g-l/2,v+l/2],rotate:[0,l/2,u/2],scale:[-1,-1]});break;case 6:this.svg.polyline(p,a).transform({translate:[g/2+l/2,c/2]});break;case 7:this.svg.polyline(p,a).transform({translate:[g-g/2-l/2,c/2],scale:[-1,1]});break;case 8:this.svg.polyline(p,a).transform({translate:[g/2+l/2,v-c/2],scale:[1,-1]});break;case 9:this.svg.polyline(p,a).transform({translate:[g-g/2-l/2,v-c/2],scale:[-1,-1]});break;case 10:this.svg.polyline(p,a).transform({translate:[l/2,v/2-l/2]});break;case 11:this.svg.polyline(p,a).transform({translate:[g-l/2,v/2-l/2],scale:[-1,1]});break;case 12:this.svg.rect(0,0,l,l,a).transform({translate:[l/2,l/2],rotate:[-30,0,0]});break;case 13:this.svg.rect(0,0,l,l,a).transform({scale:[-1,1],translate:[-g+l/2,l/2],rotate:[-30,0,0]});break;case 14:this.svg.rect(0,0,l,l,a).transform({translate:[l/2,v/2-l/2-l],rotate:[30,0,l]});break;case 15:this.svg.rect(0,0,l,l,a).transform({scale:[-1,1],translate:[-g+l/2,v/2-l/2-l],rotate:[30,0,l]});break;case 16:this.svg.rect(0,0,l,l,a).transform({scale:[1,-1],translate:[l/2,-v+v/2-l/2-l],rotate:[30,0,l]});break;case 17:this.svg.rect(0,0,l,l,a).transform({scale:[-1,-1],translate:[-g+l/2,-v+v/2-l/2-l],rotate:[30,0,l]});break;case 18:this.svg.rect(0,0,l,l,a).transform({scale:[1,-1],translate:[l/2,-v+l/2],rotate:[-30,0,0]});break;case 19:this.svg.rect(0,0,l,l,a).transform({scale:[-1,-1],translate:[-g+l/2,-v+l/2],rotate:[-30,0,0]})}}}).call(this,t("buffer").Buffer)},{"./color":2,"./sha1":5,"./svg":6,buffer:8,extend:9}],5:[function(t,r){"use strict";function s(){function t(){for(var t=16;80>t;t++){var r=f[t-3]^f[t-8]^f[t-14]^f[t-16];f[t]=r<<1|r>>>31}var s,e,i=o,n=a,p=h,g=l,v=c;for(t=0;80>t;t++){20>t?(s=g^n&(p^g),e=1518500249):40>t?(s=n^p^g,e=1859775393):60>t?(s=n&p|g&(n|p),e=2400959708):(s=n^p^g,e=3395469782);var y=(i<<5|i>>>27)+s+v+e+(0|f[t]);v=g,g=p,p=n<<30|n>>>2,n=i,i=y}for(o=o+i|0,a=a+n|0,h=h+p|0,l=l+g|0,c=c+v|0,u=0,t=0;16>t;t++)f[t]=0}function r(r){f[u]|=(255&r)<e;e++)r(t.charCodeAt(e))}function e(t){if("string"==typeof t)return s(t);var e=t.length;g+=8*e;for(var i=0;e>i;i++)r(t[i])}function i(t){for(var r="",s=28;s>=0;s-=4)r+=(t>>s&15).toString(16);return r}function n(){r(128),(u>14||14===u&&24>p)&&t(),u=14,p=24,r(0),r(0),r(g>0xffffffffff?g/1099511627776:0),r(g>4294967295?g/4294967296:0);for(var s=24;s>=0;s-=8)r(g>>s);return i(o)+i(a)+i(h)+i(l)+i(c)}var o=1732584193,a=4023233417,h=2562383102,l=271733878,c=3285377520,f=new Uint32Array(80),u=0,p=24,g=0;return{update:e,digest:n}}r.exports=function(t){if(void 0===t)return s();var r=s();return r.update(t),r.digest()}},{}],6:[function(t,r){"use strict";function s(){return this.width=100,this.height=100,this.svg=new i("svg"),this.context=[],this.setAttributes(this.svg,{xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height}),this}var e=t("extend"),i=t("./xml");r.exports=s,s.prototype.currentContext=function(){return this.context[this.context.length-1]||this.svg},s.prototype.end=function(){return this.context.pop(),this},s.prototype.currentNode=function(){var t=this.currentContext();return t.lastChild||t},s.prototype.transform=function(t){return this.currentNode().setAttribute("transform",Object.keys(t).map(function(r){return r+"("+t[r].join(",")+")"}).join(" ")),this},s.prototype.setAttributes=function(t,r){Object.keys(r).forEach(function(s){t.setAttribute(s,r[s])})},s.prototype.setWidth=function(t){this.svg.setAttribute("width",Math.floor(t))},s.prototype.setHeight=function(t){this.svg.setAttribute("height",Math.floor(t))},s.prototype.toString=function(){return this.svg.toString()},s.prototype.rect=function(t,r,s,n,o){var a=this;if(Array.isArray(t))return t.forEach(function(t){a.rect.apply(a,t.concat(o))}),this;var h=new i("rect");return this.currentContext().appendChild(h),this.setAttributes(h,e({x:t,y:r,width:s,height:n},o)),this},s.prototype.circle=function(t,r,s,n){var o=new i("circle");return this.currentContext().appendChild(o),this.setAttributes(o,e({cx:t,cy:r,r:s},n)),this},s.prototype.path=function(t,r){var s=new i("path");return this.currentContext().appendChild(s),this.setAttributes(s,e({d:t},r)),this},s.prototype.polyline=function(t,r){var s=this;if(Array.isArray(t))return t.forEach(function(t){s.polyline(t,r)}),this;var n=new i("polyline");return this.currentContext().appendChild(n),this.setAttributes(n,e({points:t},r)),this},s.prototype.group=function(t){var r=new i("g");return this.currentContext().appendChild(r),this.context.push(r),this.setAttributes(r,e({},t)),this}},{"./xml":7,extend:9}],7:[function(t,r){"use strict";var s=r.exports=function(t){return this instanceof s?(this.tagName=t,this.attributes=Object.create(null),this.children=[],this.lastChild=null,this):new s(t)};s.prototype.appendChild=function(t){return this.children.push(t),this.lastChild=t,this},s.prototype.setAttribute=function(t,r){return this.attributes[t]=r,this},s.prototype.toString=function(){var t=this;return["<",t.tagName,Object.keys(t.attributes).map(function(r){return[" ",r,'="',t.attributes[r],'"'].join("")}).join(""),">",t.children.map(function(t){return t.toString()}).join(""),""].join("")}},{}],8:[function(){},{}],9:[function(t,r){function s(t){if(!t||"[object Object]"!==i.call(t)||t.nodeType||t.setInterval)return!1;var r=e.call(t,"constructor"),s=e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!s)return!1;var n;for(n in t);return void 0===n||e.call(t,n)}var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString;r.exports=function n(){var t,r,e,i,o,a,h=arguments[0]||{},l=1,c=arguments.length,f=!1;for("boolean"==typeof h&&(f=h,h=arguments[1]||{},l=2),"object"!=typeof h&&"function"!=typeof h&&(h={});c>l;l++)if(null!=(t=arguments[l]))for(r in t)e=h[r],i=t[r],h!==i&&(f&&i&&(s(i)||(o=Array.isArray(i)))?(o?(o=!1,a=e&&Array.isArray(e)?e:[]):a=e&&s(e)?e:{},h[r]=n(f,a,i)):void 0!==i&&(h[r]=i));return h}},{}]},{},[1])(1)}); \ No newline at end of file +!(function (t) { + if (typeof exports === 'object') module.exports = t() + else if (typeof define === 'function' && define.amd) define(t) + else { + let r + typeof window !== 'undefined' + ? (r = window) + : typeof global !== 'undefined' + ? (r = global) + : typeof self !== 'undefined' && (r = self), + (r.GeoPattern = t()) + } +})(function () { + return (function t (r, s, e) { + function i (o, a) { + if (!s[o]) { + if (!r[o]) { + const h = typeof require === 'function' && require + if (!a && h) return h(o, !0) + if (n) return n(o, !0) + throw new Error("Cannot find module '" + o + "'") + } + const l = (s[o] = { exports: {} }) + r[o][0].call( + l.exports, + function (t) { + const s = r[o][1][t] + return i(s || t) + }, + l, + l.exports, + t, + r, + s, + e + ) + } + return s[o].exports + } + for ( + var n = typeof require === 'function' && require, o = 0; + o < e.length; + o++ + ) { + i(e[o]) + } + return i + })( + { + 1: [ + function (t, r) { + r.exports = t('./lib/') + }, + { './lib/': 3 } + ], + 2: [ + function (t, r) { + 'use strict' + function s (t) { + const r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i + t = t.replace(r, function (t, r, s, e) { + return r + r + s + s + e + e + }) + const s = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t) + return s + ? { + r: parseInt(s[1], 16), + g: parseInt(s[2], 16), + b: parseInt(s[3], 16) + } + : null + } + function e (t) { + return ( + '#' + + ['r', 'g', 'b'] + .map(function (r) { + return ('0' + t[r].toString(16)).slice(-2) + }) + .join('') + ) + } + function i (t) { + let r = t.r + let s = t.g + let e = t.b; + (r /= 255), (s /= 255), (e /= 255) + let i + let n + const o = Math.max(r, s, e) + const a = Math.min(r, s, e) + const h = (o + a) / 2 + if (o === a) i = n = 0 + else { + const l = o - a + switch (((n = h > 0.5 ? l / (2 - o - a) : l / (o + a)), o)) { + case r: + i = (s - e) / l + (e > s ? 6 : 0) + break + case s: + i = (e - r) / l + 2 + break + case e: + i = (r - s) / l + 4 + } + i /= 6 + } + return { h: i, s: n, l: h } + } + function n (t) { + function r (t, r, s) { + return ( + s < 0 && (s += 1), + s > 1 && (s -= 1), + 1 / 6 > s + ? t + 6 * (r - t) * s + : s < 0.5 + ? r + : 2 / 3 > s + ? t + (r - t) * (2 / 3 - s) * 6 + : t + ) + } + let s + let e + let i + const n = t.h + const o = t.s + const a = t.l + if (o === 0) s = e = i = a + else { + const h = a < 0.5 ? a * (1 + o) : a + o - a * o + const l = 2 * a - h; + (s = r(l, h, n + 1 / 3)), + (e = r(l, h, n)), + (i = r(l, h, n - 1 / 3)) + } + return { + r: Math.round(255 * s), + g: Math.round(255 * e), + b: Math.round(255 * i) + } + } + r.exports = { + hex2rgb: s, + rgb2hex: e, + rgb2hsl: i, + hsl2rgb: n, + rgb2rgbString: function (t) { + return 'rgb(' + [t.r, t.g, t.b].join(',') + ')' + } + } + }, + {} + ], + 3: [ + function (t, r) { + !(function (s) { + 'use strict' + function e (t) { + return function (r, s) { + return ( + typeof r === 'object' && ((s = r), (r = null)), + (r === null || void 0 === r) && (r = new Date().toString()), + s || (s = {}), + t.call(this, r, s) + ) + } + } + const i = t('./pattern') + const n = (r.exports = { + generate: e(function (t, r) { + return new i(t, r) + }) + }) + s && + (s.fn.geopattern = e(function (t, r) { + return this.each(function () { + const e = s(this).attr('data-title-sha') + e && (r = s.extend({ hash: e }, r)) + const i = n.generate(t, r) + s(this).css('background-image', i.toDataUrl()) + }) + })) + })(typeof jQuery !== 'undefined' ? jQuery : null) + }, + { './pattern': 4 } + ], + 4: [ + function (t, r) { + (function (s) { + 'use strict' + function e (t, r, s) { + return parseInt(t.substr(r, s || 1), 16) + } + function i (t, r, s, e, i) { + const n = parseFloat(t) + const o = s - r + const a = i - e + return ((n - r) * a) / o + e + } + function n (t) { + return t % 2 === 0 ? C : j + } + function o (t) { + return i(t, 0, 15, M, W) + } + function a (t) { + const r = t + const s = r / 2 + const e = Math.sin((60 * Math.PI) / 180) * r + return [ + 0, + e, + s, + 0, + s + r, + 0, + 2 * r, + e, + s + r, + 2 * e, + s, + 2 * e, + 0, + e + ].join(',') + } + function h (t, r) { + const s = 0.66 * r + return [ + [0, 0, t / 2, r - s, t / 2, r, 0, s, 0, 0], + [t / 2, r - s, t, 0, t, s, t / 2, r, t / 2, r - s] + ].map(function (t) { + return t.join(',') + }) + } + function l (t) { + return [ + [t, 0, t, 3 * t], + [0, t, 3 * t, t] + ] + } + function c (t) { + const r = t + const s = 0.33 * r + return [ + s, + 0, + r - s, + 0, + r, + s, + r, + r - s, + r - s, + r, + s, + r, + 0, + r - s, + 0, + s, + s, + 0 + ].join(',') + } + function f (t, r) { + const s = t / 2 + return [s, 0, t, r, 0, r, s, 0].join(',') + } + function u (t, r) { + return [t / 2, 0, t, r / 2, t / 2, r, 0, r / 2].join(',') + } + function p (t) { + return [0, 0, t, t, 0, t, 0, 0].join(',') + } + function g (t, r, s, e, i) { + const a = p(e) + let h = o(i[0]) + let l = n(i[0]) + let c = { + stroke: S, + 'stroke-opacity': A, + 'fill-opacity': h, + fill: l + } + t + .polyline(a, c) + .transform({ translate: [r + e, s], scale: [-1, 1] }), + t + .polyline(a, c) + .transform({ translate: [r + e, s + 2 * e], scale: [1, -1] }), + (h = o(i[1])), + (l = n(i[1])), + (c = { + stroke: S, + 'stroke-opacity': A, + 'fill-opacity': h, + fill: l + }), + t.polyline(a, c).transform({ + translate: [r + e, s + 2 * e], + scale: [-1, -1] + }), + t + .polyline(a, c) + .transform({ translate: [r + e, s], scale: [1, 1] }) + } + function v (t, r, s, e, i) { + const a = o(i) + const h = n(i) + const l = p(e) + const c = { + stroke: S, + 'stroke-opacity': A, + 'fill-opacity': a, + fill: h + } + t + .polyline(l, c) + .transform({ translate: [r, s + e], scale: [1, -1] }), + t.polyline(l, c).transform({ + translate: [r + 2 * e, s + e], + scale: [-1, -1] + }), + t + .polyline(l, c) + .transform({ translate: [r, s + e], scale: [1, 1] }), + t + .polyline(l, c) + .transform({ translate: [r + 2 * e, s + e], scale: [-1, 1] }) + } + function y (t, r) { + const s = t / 2 + return [0, 0, r, s, 0, t, 0, 0].join(',') + } + const d = t('extend') + const b = t('./color') + const m = t('./sha1') + const k = t('./svg') + const x = { baseColor: '#933c3c' } + const w = [ + 'octogons', + 'overlappingCircles', + 'plusSigns', + 'xes', + 'sineWaves', + 'hexagons', + 'overlappingRings', + 'plaid', + 'triangles', + 'squares', + 'concentricCircles', + 'diamonds', + 'tessellation', + 'nestedSquares', + 'mosaicSquares', + 'chevrons' + ] + var j = '#222' + var C = '#ddd' + var S = '#000' + var A = 0.02 + var M = 0.02 + var W = 0.15 + const H = (r.exports = function (t, r) { + return ( + (this.opts = d({}, x, r)), + (this.hash = r.hash || m(t)), + (this.svg = new k()), + this.generateBackground(), + this.generatePattern(), + this + ) + }); + (H.prototype.toSvg = function () { + return this.svg.toString() + }), + (H.prototype.toString = function () { + return this.toSvg() + }), + (H.prototype.toBase64 = function () { + let t + const r = this.toSvg() + return (t = + typeof window !== 'undefined' && + typeof window.btoa === 'function' + ? window.btoa(r) + : new s(r).toString('base64')) + }), + (H.prototype.toDataUri = function () { + return 'data:image/svg+xml;base64,' + this.toBase64() + }), + (H.prototype.toDataUrl = function () { + return 'url("' + this.toDataUri() + '")' + }), + (H.prototype.generateBackground = function () { + let t, r, s, n + this.opts.color + ? (s = b.hex2rgb(this.opts.color)) + : ((r = i(e(this.hash, 14, 3), 0, 4095, 0, 359)), + (n = e(this.hash, 17)), + (t = b.rgb2hsl(b.hex2rgb(this.opts.baseColor))), + (t.h = ((360 * t.h - r + 360) % 360) / 360), + (t.s = + n % 2 === 0 + ? Math.min(1, (100 * t.s + n) / 100) + : Math.max(0, (100 * t.s - n) / 100)), + (s = b.hsl2rgb(t))), + (this.color = b.rgb2hex(s)), + this.svg.rect(0, 0, '100%', '100%', { + fill: b.rgb2rgbString(s) + }) + }), + (H.prototype.generatePattern = function () { + let t = this.opts.generator + if (t) { + if (w.indexOf(t) < 0) { + throw new Error('The generator ' + t + ' does not exist.') + } + } else t = w[e(this.hash, 20)] + return this['geo' + t.slice(0, 1).toUpperCase() + t.slice(1)]() + }), + (H.prototype.geoHexagons = function () { + let t + let r + let s + let h + let l + let c + let f + let u + const p = e(this.hash, 0) + const g = i(p, 0, 15, 8, 60) + const v = g * Math.sqrt(3) + const y = 2 * g + const d = a(g) + for ( + this.svg.setWidth(3 * y + 3 * g), + this.svg.setHeight(6 * v), + s = 0, + u = 0; + u < 6; + u++ + ) { + for (f = 0; f < 6; f++) { + (c = e(this.hash, s)), + (t = f % 2 === 0 ? u * v : u * v + v / 2), + (h = o(c)), + (r = n(c)), + (l = { + fill: r, + 'fill-opacity': h, + stroke: S, + 'stroke-opacity': A + }), + this.svg.polyline(d, l).transform({ + translate: [f * g * 1.5 - y / 2, t - v / 2] + }), + f === 0 && + this.svg.polyline(d, l).transform({ + translate: [6 * g * 1.5 - y / 2, t - v / 2] + }), + u === 0 && + ((t = f % 2 === 0 ? 6 * v : 6 * v + v / 2), + this.svg.polyline(d, l).transform({ + translate: [f * g * 1.5 - y / 2, t - v / 2] + })), + f === 0 && + u === 0 && + this.svg.polyline(d, l).transform({ + translate: [6 * g * 1.5 - y / 2, 5 * v + v / 2] + }), + s++ + } + } + }), + (H.prototype.geoSineWaves = function () { + let t + let r + let s + let a + let h + let l + let c + const f = Math.floor(i(e(this.hash, 0), 0, 15, 100, 400)) + const u = Math.floor(i(e(this.hash, 1), 0, 15, 30, 100)) + const p = Math.floor(i(e(this.hash, 2), 0, 15, 3, 30)) + for ( + this.svg.setWidth(f), this.svg.setHeight(36 * p), r = 0; + r < 36; + r++ + ) { + (l = e(this.hash, r)), + (s = o(l)), + (t = n(l)), + (c = (f / 4) * 0.7), + (h = { + fill: 'none', + stroke: t, + opacity: s, + 'stroke-width': '' + p + 'px' + }), + (a = + 'M0 ' + + u + + ' C ' + + c + + ' 0, ' + + (f / 2 - c) + + ' 0, ' + + f / 2 + + ' ' + + u + + ' S ' + + (f - c) + + ' ' + + 2 * u + + ', ' + + f + + ' ' + + u + + ' S ' + + (1.5 * f - c) + + ' 0, ' + + 1.5 * f + + ', ' + + u), + this.svg + .path(a, h) + .transform({ translate: [-f / 4, p * r - 1.5 * u] }), + this.svg.path(a, h).transform({ + translate: [-f / 4, p * r - 1.5 * u + 36 * p] + }) + } + }), + (H.prototype.geoChevrons = function () { + let t + let r + let s + let a + let l + let c + let f + const u = i(e(this.hash, 0), 0, 15, 30, 80) + const p = i(e(this.hash, 0), 0, 15, 30, 80) + const g = h(u, p) + for ( + this.svg.setWidth(6 * u), + this.svg.setHeight(6 * p * 0.66), + r = 0, + f = 0; + f < 6; + f++ + ) { + for (c = 0; c < 6; c++) { + (l = e(this.hash, r)), + (s = o(l)), + (t = n(l)), + (a = { + stroke: S, + 'stroke-opacity': A, + fill: t, + 'fill-opacity': s, + 'stroke-width': 1 + }), + this.svg + .group(a) + .transform({ translate: [c * u, f * p * 0.66 - p / 2] }) + .polyline(g) + .end(), + f === 0 && + this.svg + .group(a) + .transform({ + translate: [c * u, 6 * p * 0.66 - p / 2] + }) + .polyline(g) + .end(), + (r += 1) + } + } + }), + (H.prototype.geoPlusSigns = function () { + let t + let r + let s + let a + let h + let c + let f + let u + const p = i(e(this.hash, 0), 0, 15, 10, 25) + const g = 3 * p + const v = l(p) + for ( + this.svg.setWidth(12 * p), + this.svg.setHeight(12 * p), + s = 0, + u = 0; + u < 6; + u++ + ) { + for (f = 0; f < 6; f++) { + (c = e(this.hash, s)), + (a = o(c)), + (r = n(c)), + (t = u % 2 === 0 ? 0 : 1), + (h = { + fill: r, + stroke: S, + 'stroke-opacity': A, + 'fill-opacity': a + }), + this.svg + .group(h) + .transform({ + translate: [ + f * g - f * p + t * p - p, + u * g - u * p - g / 2 + ] + }) + .rect(v) + .end(), + f === 0 && + this.svg + .group(h) + .transform({ + translate: [ + 4 * g - f * p + t * p - p, + u * g - u * p - g / 2 + ] + }) + .rect(v) + .end(), + u === 0 && + this.svg + .group(h) + .transform({ + translate: [ + f * g - f * p + t * p - p, + 4 * g - u * p - g / 2 + ] + }) + .rect(v) + .end(), + f === 0 && + u === 0 && + this.svg + .group(h) + .transform({ + translate: [ + 4 * g - f * p + t * p - p, + 4 * g - u * p - g / 2 + ] + }) + .rect(v) + .end(), + s++ + } + } + }), + (H.prototype.geoXes = function () { + let t + let r + let s + let a + let h + let c + let f + let u + const p = i(e(this.hash, 0), 0, 15, 10, 25) + const g = l(p) + const v = 3 * p * 0.943 + for ( + this.svg.setWidth(3 * v), + this.svg.setHeight(3 * v), + s = 0, + u = 0; + u < 6; + u++ + ) { + for (f = 0; f < 6; f++) { + (c = e(this.hash, s)), + (a = o(c)), + (t = + f % 2 === 0 + ? u * v - 0.5 * v + : u * v - 0.5 * v + v / 4), + (r = n(c)), + (h = { fill: r, opacity: a }), + this.svg + .group(h) + .transform({ + translate: [(f * v) / 2 - v / 2, t - (u * v) / 2], + rotate: [45, v / 2, v / 2] + }) + .rect(g) + .end(), + f === 0 && + this.svg + .group(h) + .transform({ + translate: [(6 * v) / 2 - v / 2, t - (u * v) / 2], + rotate: [45, v / 2, v / 2] + }) + .rect(g) + .end(), + u === 0 && + ((t = + f % 2 === 0 ? 6 * v - v / 2 : 6 * v - v / 2 + v / 4), + this.svg + .group(h) + .transform({ + translate: [(f * v) / 2 - v / 2, t - (6 * v) / 2], + rotate: [45, v / 2, v / 2] + }) + .rect(g) + .end()), + u === 5 && + this.svg + .group(h) + .transform({ + translate: [(f * v) / 2 - v / 2, t - (11 * v) / 2], + rotate: [45, v / 2, v / 2] + }) + .rect(g) + .end(), + f === 0 && + u === 0 && + this.svg + .group(h) + .transform({ + translate: [(6 * v) / 2 - v / 2, t - (6 * v) / 2], + rotate: [45, v / 2, v / 2] + }) + .rect(g) + .end(), + s++ + } + } + }), + (H.prototype.geoOverlappingCircles = function () { + let t + let r + let s + let a + let h + let l + let c + const f = e(this.hash, 0) + const u = i(f, 0, 15, 25, 200) + const p = u / 2 + for ( + this.svg.setWidth(6 * p), + this.svg.setHeight(6 * p), + r = 0, + c = 0; + c < 6; + c++ + ) { + for (l = 0; l < 6; l++) { + (h = e(this.hash, r)), + (s = o(h)), + (t = n(h)), + (a = { fill: t, opacity: s }), + this.svg.circle(l * p, c * p, p, a), + l === 0 && this.svg.circle(6 * p, c * p, p, a), + c === 0 && this.svg.circle(l * p, 6 * p, p, a), + l === 0 && c === 0 && this.svg.circle(6 * p, 6 * p, p, a), + r++ + } + } + }), + (H.prototype.geoOctogons = function () { + let t + let r + let s + let a + let h + let l + const f = i(e(this.hash, 0), 0, 15, 10, 60) + const u = c(f) + for ( + this.svg.setWidth(6 * f), + this.svg.setHeight(6 * f), + r = 0, + l = 0; + l < 6; + l++ + ) { + for (h = 0; h < 6; h++) { + (a = e(this.hash, r)), + (s = o(a)), + (t = n(a)), + this.svg + .polyline(u, { + fill: t, + 'fill-opacity': s, + stroke: S, + 'stroke-opacity': A + }) + .transform({ translate: [h * f, l * f] }), + (r += 1) + } + } + }), + (H.prototype.geoSquares = function () { + let t + let r + let s + let a + let h + let l + const c = i(e(this.hash, 0), 0, 15, 10, 60) + for ( + this.svg.setWidth(6 * c), + this.svg.setHeight(6 * c), + r = 0, + l = 0; + l < 6; + l++ + ) { + for (h = 0; h < 6; h++) { + (a = e(this.hash, r)), + (s = o(a)), + (t = n(a)), + this.svg.rect(h * c, l * c, c, c, { + fill: t, + 'fill-opacity': s, + stroke: S, + 'stroke-opacity': A + }), + (r += 1) + } + } + }), + (H.prototype.geoConcentricCircles = function () { + let t + let r + let s + let a + let h + let l + const c = e(this.hash, 0) + const f = i(c, 0, 15, 10, 60) + const u = f / 5 + for ( + this.svg.setWidth(6 * (f + u)), + this.svg.setHeight(6 * (f + u)), + r = 0, + l = 0; + l < 6; + l++ + ) { + for (h = 0; h < 6; h++) { + (a = e(this.hash, r)), + (s = o(a)), + (t = n(a)), + this.svg.circle( + h * f + h * u + (f + u) / 2, + l * f + l * u + (f + u) / 2, + f / 2, + { + fill: 'none', + stroke: t, + opacity: s, + 'stroke-width': u + 'px' + } + ), + (a = e(this.hash, 39 - r)), + (s = o(a)), + (t = n(a)), + this.svg.circle( + h * f + h * u + (f + u) / 2, + l * f + l * u + (f + u) / 2, + f / 4, + { fill: t, 'fill-opacity': s } + ), + (r += 1) + } + } + }), + (H.prototype.geoOverlappingRings = function () { + let t + let r + let s + let a + let h + let l + let c + const f = e(this.hash, 0) + const u = i(f, 0, 15, 10, 60) + const p = u / 4 + for ( + this.svg.setWidth(6 * u), + this.svg.setHeight(6 * u), + r = 0, + c = 0; + c < 6; + c++ + ) { + for (l = 0; l < 6; l++) { + (h = e(this.hash, r)), + (s = o(h)), + (t = n(h)), + (a = { + fill: 'none', + stroke: t, + opacity: s, + 'stroke-width': p + 'px' + }), + this.svg.circle(l * u, c * u, u - p / 2, a), + l === 0 && this.svg.circle(6 * u, c * u, u - p / 2, a), + c === 0 && this.svg.circle(l * u, 6 * u, u - p / 2, a), + l === 0 && + c === 0 && + this.svg.circle(6 * u, 6 * u, u - p / 2, a), + (r += 1) + } + } + }), + (H.prototype.geoTriangles = function () { + let t + let r + let s + let a + let h + let l + let c + let u + const p = e(this.hash, 0) + const g = i(p, 0, 15, 15, 80) + const v = (g / 2) * Math.sqrt(3) + const y = f(g, v) + for ( + this.svg.setWidth(3 * g), + this.svg.setHeight(6 * v), + r = 0, + u = 0; + u < 6; + u++ + ) { + for (c = 0; c < 6; c++) { + (l = e(this.hash, r)), + (s = o(l)), + (t = n(l)), + (h = { + fill: t, + 'fill-opacity': s, + stroke: S, + 'stroke-opacity': A + }), + (a = + u % 2 === 0 + ? c % 2 === 0 + ? 180 + : 0 + : c % 2 !== 0 + ? 180 + : 0), + this.svg.polyline(y, h).transform({ + translate: [c * g * 0.5 - g / 2, v * u], + rotate: [a, g / 2, v / 2] + }), + c === 0 && + this.svg.polyline(y, h).transform({ + translate: [6 * g * 0.5 - g / 2, v * u], + rotate: [a, g / 2, v / 2] + }), + (r += 1) + } + } + }), + (H.prototype.geoDiamonds = function () { + let t + let r + let s + let a + let h + let l + let c + let f + const p = i(e(this.hash, 0), 0, 15, 10, 50) + const g = i(e(this.hash, 1), 0, 15, 10, 50) + const v = u(p, g) + for ( + this.svg.setWidth(6 * p), + this.svg.setHeight(3 * g), + s = 0, + f = 0; + f < 6; + f++ + ) { + for (c = 0; c < 6; c++) { + (l = e(this.hash, s)), + (a = o(l)), + (r = n(l)), + (h = { + fill: r, + 'fill-opacity': a, + stroke: S, + 'stroke-opacity': A + }), + (t = f % 2 === 0 ? 0 : p / 2), + this.svg.polyline(v, h).transform({ + translate: [c * p - p / 2 + t, (g / 2) * f - g / 2] + }), + c === 0 && + this.svg.polyline(v, h).transform({ + translate: [6 * p - p / 2 + t, (g / 2) * f - g / 2] + }), + f === 0 && + this.svg.polyline(v, h).transform({ + translate: [c * p - p / 2 + t, (g / 2) * 6 - g / 2] + }), + c === 0 && + f === 0 && + this.svg.polyline(v, h).transform({ + translate: [6 * p - p / 2 + t, (g / 2) * 6 - g / 2] + }), + (s += 1) + } + } + }), + (H.prototype.geoNestedSquares = function () { + let t + let r + let s + let a + let h + let l + let c + const f = i(e(this.hash, 0), 0, 15, 4, 12) + const u = 7 * f + for ( + this.svg.setWidth(6 * (u + f) + 6 * f), + this.svg.setHeight(6 * (u + f) + 6 * f), + r = 0, + c = 0; + c < 6; + c++ + ) { + for (l = 0; l < 6; l++) { + (h = e(this.hash, r)), + (s = o(h)), + (t = n(h)), + (a = { + fill: 'none', + stroke: t, + opacity: s, + 'stroke-width': f + 'px' + }), + this.svg.rect( + l * u + l * f * 2 + f / 2, + c * u + c * f * 2 + f / 2, + u, + u, + a + ), + (h = e(this.hash, 39 - r)), + (s = o(h)), + (t = n(h)), + (a = { + fill: 'none', + stroke: t, + opacity: s, + 'stroke-width': f + 'px' + }), + this.svg.rect( + l * u + l * f * 2 + f / 2 + 2 * f, + c * u + c * f * 2 + f / 2 + 2 * f, + 3 * f, + 3 * f, + a + ), + (r += 1) + } + } + }), + (H.prototype.geoMosaicSquares = function () { + let t + let r + let s + const n = i(e(this.hash, 0), 0, 15, 15, 50) + for ( + this.svg.setWidth(8 * n), + this.svg.setHeight(8 * n), + t = 0, + s = 0; + s < 4; + s++ + ) { + for (r = 0; r < 4; r++) { + r % 2 === 0 + ? s % 2 === 0 + ? v(this.svg, r * n * 2, s * n * 2, n, e(this.hash, t)) + : g(this.svg, r * n * 2, s * n * 2, n, [ + e(this.hash, t), + e(this.hash, t + 1) + ]) + : s % 2 === 0 + ? g(this.svg, r * n * 2, s * n * 2, n, [ + e(this.hash, t), + e(this.hash, t + 1) + ]) + : v(this.svg, r * n * 2, s * n * 2, n, e(this.hash, t)), + (t += 1) + } + } + }), + (H.prototype.geoPlaid = function () { + let t + let r + let s + let i + let a + let h + let l + let c = 0 + let f = 0 + for (r = 0; r < 36;) { + (i = e(this.hash, r)), + (c += i + 5), + (l = e(this.hash, r + 1)), + (s = o(l)), + (t = n(l)), + (a = l + 5), + this.svg.rect(0, c, '100%', a, { opacity: s, fill: t }), + (c += a), + (r += 2) + } + for (r = 0; r < 36;) { + (i = e(this.hash, r)), + (f += i + 5), + (l = e(this.hash, r + 1)), + (s = o(l)), + (t = n(l)), + (h = l + 5), + this.svg.rect(f, 0, h, '100%', { opacity: s, fill: t }), + (f += h), + (r += 2) + } + this.svg.setWidth(f), this.svg.setHeight(c) + }), + (H.prototype.geoTessellation = function () { + let t + let r + let s + let a + let h + const l = i(e(this.hash, 0), 0, 15, 5, 40) + const c = l * Math.sqrt(3) + const f = 2 * l + const u = (l / 2) * Math.sqrt(3) + const p = y(l, u) + const g = 3 * l + 2 * u + const v = 2 * c + 2 * l + for ( + this.svg.setWidth(g), this.svg.setHeight(v), r = 0; + r < 20; + r++ + ) { + switch ( + ((h = e(this.hash, r)), + (s = o(h)), + (t = n(h)), + (a = { + stroke: S, + 'stroke-opacity': A, + fill: t, + 'fill-opacity': s, + 'stroke-width': 1 + }), + r) + ) { + case 0: + this.svg.rect(-l / 2, -l / 2, l, l, a), + this.svg.rect(g - l / 2, -l / 2, l, l, a), + this.svg.rect(-l / 2, v - l / 2, l, l, a), + this.svg.rect(g - l / 2, v - l / 2, l, l, a) + break + case 1: + this.svg.rect(f / 2 + u, c / 2, l, l, a) + break + case 2: + this.svg.rect(-l / 2, v / 2 - l / 2, l, l, a), + this.svg.rect(g - l / 2, v / 2 - l / 2, l, l, a) + break + case 3: + this.svg.rect(f / 2 + u, 1.5 * c + l, l, l, a) + break + case 4: + this.svg.polyline(p, a).transform({ + translate: [l / 2, -l / 2], + rotate: [0, l / 2, u / 2] + }), + this.svg.polyline(p, a).transform({ + translate: [l / 2, v - -l / 2], + rotate: [0, l / 2, u / 2], + scale: [1, -1] + }) + break + case 5: + this.svg.polyline(p, a).transform({ + translate: [g - l / 2, -l / 2], + rotate: [0, l / 2, u / 2], + scale: [-1, 1] + }), + this.svg.polyline(p, a).transform({ + translate: [g - l / 2, v + l / 2], + rotate: [0, l / 2, u / 2], + scale: [-1, -1] + }) + break + case 6: + this.svg + .polyline(p, a) + .transform({ translate: [g / 2 + l / 2, c / 2] }) + break + case 7: + this.svg.polyline(p, a).transform({ + translate: [g - g / 2 - l / 2, c / 2], + scale: [-1, 1] + }) + break + case 8: + this.svg.polyline(p, a).transform({ + translate: [g / 2 + l / 2, v - c / 2], + scale: [1, -1] + }) + break + case 9: + this.svg.polyline(p, a).transform({ + translate: [g - g / 2 - l / 2, v - c / 2], + scale: [-1, -1] + }) + break + case 10: + this.svg + .polyline(p, a) + .transform({ translate: [l / 2, v / 2 - l / 2] }) + break + case 11: + this.svg.polyline(p, a).transform({ + translate: [g - l / 2, v / 2 - l / 2], + scale: [-1, 1] + }) + break + case 12: + this.svg.rect(0, 0, l, l, a).transform({ + translate: [l / 2, l / 2], + rotate: [-30, 0, 0] + }) + break + case 13: + this.svg.rect(0, 0, l, l, a).transform({ + scale: [-1, 1], + translate: [-g + l / 2, l / 2], + rotate: [-30, 0, 0] + }) + break + case 14: + this.svg.rect(0, 0, l, l, a).transform({ + translate: [l / 2, v / 2 - l / 2 - l], + rotate: [30, 0, l] + }) + break + case 15: + this.svg.rect(0, 0, l, l, a).transform({ + scale: [-1, 1], + translate: [-g + l / 2, v / 2 - l / 2 - l], + rotate: [30, 0, l] + }) + break + case 16: + this.svg.rect(0, 0, l, l, a).transform({ + scale: [1, -1], + translate: [l / 2, -v + v / 2 - l / 2 - l], + rotate: [30, 0, l] + }) + break + case 17: + this.svg.rect(0, 0, l, l, a).transform({ + scale: [-1, -1], + translate: [-g + l / 2, -v + v / 2 - l / 2 - l], + rotate: [30, 0, l] + }) + break + case 18: + this.svg.rect(0, 0, l, l, a).transform({ + scale: [1, -1], + translate: [l / 2, -v + l / 2], + rotate: [-30, 0, 0] + }) + break + case 19: + this.svg.rect(0, 0, l, l, a).transform({ + scale: [-1, -1], + translate: [-g + l / 2, -v + l / 2], + rotate: [-30, 0, 0] + }) + } + } + }) + }.call(this, t('buffer').Buffer)) + }, + { './color': 2, './sha1': 5, './svg': 6, buffer: 8, extend: 9 } + ], + 5: [ + function (t, r) { + 'use strict' + function s () { + function t () { + for (var t = 16; t < 80; t++) { + const r = f[t - 3] ^ f[t - 8] ^ f[t - 14] ^ f[t - 16] + f[t] = (r << 1) | (r >>> 31) + } + let s + let e + let i = o + let n = a + let p = h + let g = l + let v = c + for (t = 0; t < 80; t++) { + t < 20 + ? ((s = g ^ (n & (p ^ g))), (e = 1518500249)) + : t < 40 + ? ((s = n ^ p ^ g), (e = 1859775393)) + : t < 60 + ? ((s = (n & p) | (g & (n | p))), (e = 2400959708)) + : ((s = n ^ p ^ g), (e = 3395469782)) + const y = ((i << 5) | (i >>> 27)) + s + v + e + (0 | f[t]); + (v = g), (g = p), (p = (n << 30) | (n >>> 2)), (n = i), (i = y) + } + for ( + o = (o + i) | 0, + a = (a + n) | 0, + h = (h + p) | 0, + l = (l + g) | 0, + c = (c + v) | 0, + u = 0, + t = 0; + t < 16; + t++ + ) { + f[t] = 0 + } + } + function r (r) { + (f[u] |= (255 & r) << p), + p ? (p -= 8) : (u++, (p = 24)), + u === 16 && t() + } + function s (t) { + const s = t.length + g += 8 * s + for (let e = 0; s > e; e++) r(t.charCodeAt(e)) + } + function e (t) { + if (typeof t === 'string') return s(t) + const e = t.length + g += 8 * e + for (let i = 0; e > i; i++) r(t[i]) + } + function i (t) { + for (var r = '', s = 28; s >= 0; s -= 4) { + r += ((t >> s) & 15).toString(16) + } + return r + } + function n () { + r(128), + (u > 14 || (u === 14 && p < 24)) && t(), + (u = 14), + (p = 24), + r(0), + r(0), + r(g > 0xffffffffff ? g / 1099511627776 : 0), + r(g > 4294967295 ? g / 4294967296 : 0) + for (let s = 24; s >= 0; s -= 8) r(g >> s) + return i(o) + i(a) + i(h) + i(l) + i(c) + } + var o = 1732584193 + var a = 4023233417 + var h = 2562383102 + var l = 271733878 + var c = 3285377520 + var f = new Uint32Array(80) + var u = 0 + var p = 24 + var g = 0 + return { update: e, digest: n } + } + r.exports = function (t) { + if (void 0 === t) return s() + const r = s() + return r.update(t), r.digest() + } + }, + {} + ], + 6: [ + function (t, r) { + 'use strict' + function s () { + return ( + (this.width = 100), + (this.height = 100), + (this.svg = new i('svg')), + (this.context = []), + this.setAttributes(this.svg, { + xmlns: 'http://www.w3.org/2000/svg', + width: this.width, + height: this.height + }), + this + ) + } + const e = t('extend') + var i = t('./xml'); + (r.exports = s), + (s.prototype.currentContext = function () { + return this.context[this.context.length - 1] || this.svg + }), + (s.prototype.end = function () { + return this.context.pop(), this + }), + (s.prototype.currentNode = function () { + const t = this.currentContext() + return t.lastChild || t + }), + (s.prototype.transform = function (t) { + return ( + this.currentNode().setAttribute( + 'transform', + Object.keys(t) + .map(function (r) { + return r + '(' + t[r].join(',') + ')' + }) + .join(' ') + ), + this + ) + }), + (s.prototype.setAttributes = function (t, r) { + Object.keys(r).forEach(function (s) { + t.setAttribute(s, r[s]) + }) + }), + (s.prototype.setWidth = function (t) { + this.svg.setAttribute('width', Math.floor(t)) + }), + (s.prototype.setHeight = function (t) { + this.svg.setAttribute('height', Math.floor(t)) + }), + (s.prototype.toString = function () { + return this.svg.toString() + }), + (s.prototype.rect = function (t, r, s, n, o) { + const a = this + if (Array.isArray(t)) { + return ( + t.forEach(function (t) { + a.rect.apply(a, t.concat(o)) + }), + this + ) + } + const h = new i('rect') + return ( + this.currentContext().appendChild(h), + this.setAttributes( + h, + e({ x: t, y: r, width: s, height: n }, o) + ), + this + ) + }), + (s.prototype.circle = function (t, r, s, n) { + const o = new i('circle') + return ( + this.currentContext().appendChild(o), + this.setAttributes(o, e({ cx: t, cy: r, r: s }, n)), + this + ) + }), + (s.prototype.path = function (t, r) { + const s = new i('path') + return ( + this.currentContext().appendChild(s), + this.setAttributes(s, e({ d: t }, r)), + this + ) + }), + (s.prototype.polyline = function (t, r) { + const s = this + if (Array.isArray(t)) { + return ( + t.forEach(function (t) { + s.polyline(t, r) + }), + this + ) + } + const n = new i('polyline') + return ( + this.currentContext().appendChild(n), + this.setAttributes(n, e({ points: t }, r)), + this + ) + }), + (s.prototype.group = function (t) { + const r = new i('g') + return ( + this.currentContext().appendChild(r), + this.context.push(r), + this.setAttributes(r, e({}, t)), + this + ) + }) + }, + { './xml': 7, extend: 9 } + ], + 7: [ + function (t, r) { + 'use strict' + var s = (r.exports = function (t) { + return this instanceof s + ? ((this.tagName = t), + (this.attributes = Object.create(null)), + (this.children = []), + (this.lastChild = null), + this) + : new s(t) + }); + (s.prototype.appendChild = function (t) { + return this.children.push(t), (this.lastChild = t), this + }), + (s.prototype.setAttribute = function (t, r) { + return (this.attributes[t] = r), this + }), + (s.prototype.toString = function () { + const t = this + return [ + '<', + t.tagName, + Object.keys(t.attributes) + .map(function (r) { + return [' ', r, '="', t.attributes[r], '"'].join('') + }) + .join(''), + '>', + t.children + .map(function (t) { + return t.toString() + }) + .join(''), + '' + ].join('') + }) + }, + {} + ], + 8: [function () {}, {}], + 9: [ + function (t, r) { + function s (t) { + if ( + !t || + i.call(t) !== '[object Object]' || + t.nodeType || + t.setInterval + ) { + return !1 + } + const r = e.call(t, 'constructor') + const s = e.call(t.constructor.prototype, 'isPrototypeOf') + if (t.constructor && !r && !s) return !1 + let n + for (n in t); + return void 0 === n || e.call(t, n) + } + var e = Object.prototype.hasOwnProperty + var i = Object.prototype.toString + r.exports = function n () { + let t + let r + let e + let i + let o + let a + let h = arguments[0] || {} + let l = 1 + const c = arguments.length + let f = !1 + for ( + typeof h === 'boolean' && + ((f = h), (h = arguments[1] || {}), (l = 2)), + typeof h !== 'object' && typeof h !== 'function' && (h = {}); + c > l; + l++ + ) { + if ((t = arguments[l]) != null) { + for (r in t) { + (e = h[r]), + (i = t[r]), + h !== i && + (f && i && (s(i) || (o = Array.isArray(i))) + ? (o + ? ((o = !1), (a = e && Array.isArray(e) ? e : [])) + : (a = e && s(e) ? e : {}), + (h[r] = n(f, a, i))) + : void 0 !== i && (h[r] = i)) + } + } + } + return h + } + }, + {} + ] + }, + {}, + [1] + )(1) +}) diff --git a/assets/js/jquery-ui.js b/assets/js/jquery-ui.js index 31ee9cd8116..455625f01d7 100644 --- a/assets/js/jquery-ui.js +++ b/assets/js/jquery-ui.js @@ -1,16617 +1,18677 @@ /*! jQuery UI - v1.11.4 - 2015-03-11 -* http://jqueryui.com -* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js -* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ - -(function( factory ) { - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define([ "jquery" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -}(function( $ ) { -/*! - * jQuery UI Core 1.11.4 * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/category/ui-core/ - */ - - -// $.ui might exist from components with no dependencies, e.g., $.ui.position -$.ui = $.ui || {}; - -$.extend( $.ui, { - version: "1.11.4", - - keyCode: { - BACKSPACE: 8, - COMMA: 188, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - LEFT: 37, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SPACE: 32, - TAB: 9, - UP: 38 - } -}); - -// plugins -$.fn.extend({ - scrollParent: function( includeHidden ) { - var position = this.css( "position" ), - excludeStaticParent = position === "absolute", - overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, - scrollParent = this.parents().filter( function() { - var parent = $( this ); - if ( excludeStaticParent && parent.css( "position" ) === "static" ) { - return false; - } - return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); - }).eq( 0 ); - - return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; - }, - - uniqueId: (function() { - var uuid = 0; - - return function() { - return this.each(function() { - if ( !this.id ) { - this.id = "ui-id-" + ( ++uuid ); - } - }); - }; - })(), - - removeUniqueId: function() { - return this.each(function() { - if ( /^ui-id-\d+$/.test( this.id ) ) { - $( this ).removeAttr( "id" ); - } - }); - } -}); - -// selectors -function focusable( element, isTabIndexNotNaN ) { - var map, mapName, img, - nodeName = element.nodeName.toLowerCase(); - if ( "area" === nodeName ) { - map = element.parentNode; - mapName = map.name; - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { - return false; - } - img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; - return !!img && visible( img ); - } - return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ? - !element.disabled : - "a" === nodeName ? - element.href || isTabIndexNotNaN : - isTabIndexNotNaN) && - // the element and all of its ancestors must be visible - visible( element ); -} - -function visible( element ) { - return $.expr.filters.visible( element ) && - !$( element ).parents().addBack().filter(function() { - return $.css( this, "visibility" ) === "hidden"; - }).length; -} - -$.extend( $.expr[ ":" ], { - data: $.expr.createPseudo ? - $.expr.createPseudo(function( dataName ) { - return function( elem ) { - return !!$.data( elem, dataName ); - }; - }) : - // support: jQuery <1.8 - function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, - - focusable: function( element ) { - return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); - }, - - tabbable: function( element ) { - var tabIndex = $.attr( element, "tabindex" ), - isTabIndexNaN = isNaN( tabIndex ); - return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); - } -}); - -// support: jQuery <1.8 -if ( !$( "" ).outerWidth( 1 ).jquery ) { - $.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; - - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; - if ( border ) { - size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; - } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - - return this.each(function() { - $( this ).css( type, reduce( this, size ) + "px" ); - }); - }; - - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each(function() { - $( this).css( type, reduce( this, size, true, margin ) + "px" ); - }); - }; - }); -} - -// support: jQuery <1.8 -if ( !$.fn.addBack ) { - $.fn.addBack = function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - }; -} - -// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) -if ( $( "" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { - $.fn.removeData = (function( removeData ) { - return function( key ) { - if ( arguments.length ) { - return removeData.call( this, $.camelCase( key ) ); - } else { - return removeData.call( this ); - } - }; - })( $.fn.removeData ); -} - -// deprecated -$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); - -$.fn.extend({ - focus: (function( orig ) { - return function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - orig.apply( this, arguments ); - }; - })( $.fn.focus ), - - disableSelection: (function() { - var eventType = "onselectstart" in document.createElement( "div" ) ? - "selectstart" : - "mousedown"; - - return function() { - return this.bind( eventType + ".ui-disableSelection", function( event ) { - event.preventDefault(); - }); - }; - })(), - - enableSelection: function() { - return this.unbind( ".ui-disableSelection" ); - }, - - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
- value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - } -}); - -// $.ui.plugin is deprecated. Use $.widget() extensions instead. -$.ui.plugin = { - add: function( module, option, set ) { - var i, - proto = $.ui[ module ].prototype; - for ( i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args, allowDisconnected ) { - var i, - set = instance.plugins[ name ]; - - if ( !set ) { - return; - } - - if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { - return; - } - - for ( i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } -}; - - -/*! - * jQuery UI Widget 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/jQuery.widget/ - */ - - -var widget_uuid = 0, - widget_slice = Array.prototype.slice; - -$.cleanData = (function( orig ) { - return function( elems ) { - var events, elem, i; - for ( i = 0; (elem = elems[i]) != null; i++ ) { - try { - - // Only trigger remove when necessary to save time - events = $._data( elem, "events" ); - if ( events && events.remove ) { - $( elem ).triggerHandler( "remove" ); - } - - // http://bugs.jquery.com/ticket/8235 - } catch ( e ) {} - } - orig( elems ); - }; -})( $.cleanData ); - -$.widget = function( name, base, prototype ) { - var fullName, existingConstructor, constructor, basePrototype, - // proxiedPrototype allows the provided prototype to remain unmodified - // so that it can be used as a mixin for multiple widgets (#8876) - proxiedPrototype = {}, - namespace = name.split( "." )[ 0 ]; - - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { - return !!$.data( elem, fullName ); - }; - - $[ namespace ] = $[ namespace ] || {}; - existingConstructor = $[ namespace ][ name ]; - constructor = $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without "new" keyword - if ( !this._createWidget ) { - return new constructor( options, element ); - } - - // allow instantiation without initializing for simple inheritance - // must use "new" keyword (the code above always passes args) - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - // extend with the existing constructor to carry over any static properties - $.extend( constructor, existingConstructor, { - version: prototype.version, - // copy the object used to create the prototype in case we need to - // redefine the widget later - _proto: $.extend( {}, prototype ), - // track widgets that inherit from this widget in case this widget is - // redefined after a widget inherits from it - _childConstructors: [] - }); - - basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from - basePrototype.options = $.widget.extend( {}, basePrototype.options ); - $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { - proxiedPrototype[ prop ] = value; - return; - } - proxiedPrototype[ prop ] = (function() { - var _super = function() { - return base.prototype[ prop ].apply( this, arguments ); - }, - _superApply = function( args ) { - return base.prototype[ prop ].apply( this, args ); - }; - return function() { - var __super = this._super, - __superApply = this._superApply, - returnValue; - - this._super = _super; - this._superApply = _superApply; - - returnValue = value.apply( this, arguments ); - - this._super = __super; - this._superApply = __superApply; - - return returnValue; - }; - })(); - }); - constructor.prototype = $.widget.extend( basePrototype, { - // TODO: remove support for widgetEventPrefix - // always use the name + a colon as the prefix, e.g., draggable:start - // don't prefix for widgets that aren't DOM-based - widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name - }, proxiedPrototype, { - constructor: constructor, - namespace: namespace, - widgetName: name, - widgetFullName: fullName - }); - - // If this widget is being redefined then we need to find all widgets that - // are inheriting from it and redefine all of them so that they inherit from - // the new version of this widget. We're essentially trying to replace one - // level in the prototype chain. - if ( existingConstructor ) { - $.each( existingConstructor._childConstructors, function( i, child ) { - var childPrototype = child.prototype; - - // redefine the child widget using the same prototype that was - // originally used, but inherit from the new version of the base - $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); - }); - // remove the list of existing child constructors from the old constructor - // so the old child constructors can be garbage collected - delete existingConstructor._childConstructors; - } else { - base._childConstructors.push( constructor ); - } - - $.widget.bridge( name, constructor ); - - return constructor; -}; - -$.widget.extend = function( target ) { - var input = widget_slice.call( arguments, 1 ), - inputIndex = 0, - inputLength = input.length, - key, - value; - for ( ; inputIndex < inputLength; inputIndex++ ) { - for ( key in input[ inputIndex ] ) { - value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { - // Clone objects - if ( $.isPlainObject( value ) ) { - target[ key ] = $.isPlainObject( target[ key ] ) ? - $.widget.extend( {}, target[ key ], value ) : - // Don't extend strings, arrays, etc. with objects - $.widget.extend( {}, value ); - // Copy everything else by reference - } else { - target[ key ] = value; - } - } - } - } - return target; -}; - -$.widget.bridge = function( name, object ) { - var fullName = object.prototype.widgetFullName || name; - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = widget_slice.call( arguments, 1 ), - returnValue = this; - - if ( isMethodCall ) { - this.each(function() { - var methodValue, - instance = $.data( this, fullName ); - if ( options === "instance" ) { - returnValue = instance; - return false; - } - if ( !instance ) { - return $.error( "cannot call methods on " + name + " prior to initialization; " + - "attempted to call method '" + options + "'" ); - } - if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { - return $.error( "no such method '" + options + "' for " + name + " widget instance" ); - } - methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue && methodValue.jquery ? - returnValue.pushStack( methodValue.get() ) : - methodValue; - return false; - } - }); - } else { - - // Allow multiple hashes to be passed on init - if ( args.length ) { - options = $.widget.extend.apply( null, [ options ].concat(args) ); - } - - this.each(function() { - var instance = $.data( this, fullName ); - if ( instance ) { - instance.option( options || {} ); - if ( instance._init ) { - instance._init(); - } - } else { - $.data( this, fullName, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( /* options, element */ ) {}; -$.Widget._childConstructors = []; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - defaultElement: "
", - options: { - disabled: false, - - // callbacks - create: null - }, - _createWidget: function( options, element ) { - element = $( element || this.defaultElement || this )[ 0 ]; - this.element = $( element ); - this.uuid = widget_uuid++; - this.eventNamespace = "." + this.widgetName + this.uuid; - - this.bindings = $(); - this.hoverable = $(); - this.focusable = $(); - - if ( element !== this ) { - $.data( element, this.widgetFullName, this ); - this._on( true, this.element, { - remove: function( event ) { - if ( event.target === element ) { - this.destroy(); - } - } - }); - this.document = $( element.style ? - // element within the document - element.ownerDocument : - // element is window or document - element.document || element ); - this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); - } - - this.options = $.widget.extend( {}, - this.options, - this._getCreateOptions(), - options ); - - this._create(); - this._trigger( "create", null, this._getCreateEventData() ); - this._init(); - }, - _getCreateOptions: $.noop, - _getCreateEventData: $.noop, - _create: $.noop, - _init: $.noop, - - destroy: function() { - this._destroy(); - // we can probably remove the unbind calls in 2.0 - // all event bindings should go through this._on() - this.element - .unbind( this.eventNamespace ) - .removeData( this.widgetFullName ) - // support: jquery <1.6.3 - // http://bugs.jquery.com/ticket/9413 - .removeData( $.camelCase( this.widgetFullName ) ); - this.widget() - .unbind( this.eventNamespace ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetFullName + "-disabled " + - "ui-state-disabled" ); - - // clean up events and states - this.bindings.unbind( this.eventNamespace ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - }, - _destroy: $.noop, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key, - parts, - curOption, - i; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.widget.extend( {}, this.options ); - } - - if ( typeof key === "string" ) { - // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } - options = {}; - parts = key.split( "." ); - key = parts.shift(); - if ( parts.length ) { - curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); - for ( i = 0; i < parts.length - 1; i++ ) { - curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; - curOption = curOption[ parts[ i ] ]; - } - key = parts.pop(); - if ( arguments.length === 1 ) { - return curOption[ key ] === undefined ? null : curOption[ key ]; - } - curOption[ key ] = value; - } else { - if ( arguments.length === 1 ) { - return this.options[ key ] === undefined ? null : this.options[ key ]; - } - options[ key ] = value; - } - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var key; - - for ( key in options ) { - this._setOption( key, options[ key ] ); - } - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - .toggleClass( this.widgetFullName + "-disabled", !!value ); - - // If the widget is becoming disabled, then nothing is interactive - if ( value ) { - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - } - } - - return this; - }, - - enable: function() { - return this._setOptions({ disabled: false }); - }, - disable: function() { - return this._setOptions({ disabled: true }); - }, - - _on: function( suppressDisabledCheck, element, handlers ) { - var delegateElement, - instance = this; - - // no suppressDisabledCheck flag, shuffle arguments - if ( typeof suppressDisabledCheck !== "boolean" ) { - handlers = element; - element = suppressDisabledCheck; - suppressDisabledCheck = false; - } - - // no element argument, shuffle and use this.element - if ( !handlers ) { - handlers = element; - element = this.element; - delegateElement = this.widget(); - } else { - element = delegateElement = $( element ); - this.bindings = this.bindings.add( element ); - } - - $.each( handlers, function( event, handler ) { - function handlerProxy() { - // allow widgets to customize the disabled handling - // - disabled as an array instead of boolean - // - disabled class as method for disabling individual parts - if ( !suppressDisabledCheck && - ( instance.options.disabled === true || - $( this ).hasClass( "ui-state-disabled" ) ) ) { - return; - } - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - - // copy the guid so direct unbinding works - if ( typeof handler !== "string" ) { - handlerProxy.guid = handler.guid = - handler.guid || handlerProxy.guid || $.guid++; - } - - var match = event.match( /^([\w:-]*)\s*(.*)$/ ), - eventName = match[1] + instance.eventNamespace, - selector = match[2]; - if ( selector ) { - delegateElement.delegate( selector, eventName, handlerProxy ); - } else { - element.bind( eventName, handlerProxy ); - } - }); - }, - - _off: function( element, eventName ) { - eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + - this.eventNamespace; - element.unbind( eventName ).undelegate( eventName ); - - // Clear the stack to avoid memory leaks (#10056) - this.bindings = $( this.bindings.not( element ).get() ); - this.focusable = $( this.focusable.not( element ).get() ); - this.hoverable = $( this.hoverable.not( element ).get() ); - }, - - _delay: function( handler, delay ) { - function handlerProxy() { - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - var instance = this; - return setTimeout( handlerProxy, delay || 0 ); - }, - - _hoverable: function( element ) { - this.hoverable = this.hoverable.add( element ); - this._on( element, { - mouseenter: function( event ) { - $( event.currentTarget ).addClass( "ui-state-hover" ); - }, - mouseleave: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-hover" ); - } - }); - }, - - _focusable: function( element ) { - this.focusable = this.focusable.add( element ); - this._on( element, { - focusin: function( event ) { - $( event.currentTarget ).addClass( "ui-state-focus" ); - }, - focusout: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-focus" ); - } - }); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - return !( $.isFunction( callback ) && - callback.apply( this.element[0], [ event ].concat( data ) ) === false || - event.isDefaultPrevented() ); - } -}; - -$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { - $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { - if ( typeof options === "string" ) { - options = { effect: options }; - } - var hasOptions, - effectName = !options ? - method : - options === true || typeof options === "number" ? - defaultEffect : - options.effect || defaultEffect; - options = options || {}; - if ( typeof options === "number" ) { - options = { duration: options }; - } - hasOptions = !$.isEmptyObject( options ); - options.complete = callback; - if ( options.delay ) { - element.delay( options.delay ); - } - if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { - element[ method ]( options ); - } else if ( effectName !== method && element[ effectName ] ) { - element[ effectName ]( options.duration, options.easing, callback ); - } else { - element.queue(function( next ) { - $( this )[ method ](); - if ( callback ) { - callback.call( element[ 0 ] ); - } - next(); - }); - } - }; -}); - -var widget = $.widget; - - -/*! - * jQuery UI Mouse 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/mouse/ - */ - - -var mouseHandled = false; -$( document ).mouseup( function() { - mouseHandled = false; -}); - -var mouse = $.widget("ui.mouse", { - version: "1.11.4", - options: { - cancel: "input,textarea,button,select,option", - distance: 1, - delay: 0 - }, - _mouseInit: function() { - var that = this; - - this.element - .bind("mousedown." + this.widgetName, function(event) { - return that._mouseDown(event); - }) - .bind("click." + this.widgetName, function(event) { - if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { - $.removeData(event.target, that.widgetName + ".preventClickEvent"); - event.stopImmediatePropagation(); - return false; - } - }); - - this.started = false; - }, - - // TODO: make sure destroying one instance of mouse doesn't mess with - // other instances of mouse - _mouseDestroy: function() { - this.element.unbind("." + this.widgetName); - if ( this._mouseMoveDelegate ) { - this.document - .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) - .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); - } - }, - - _mouseDown: function(event) { - // don't let more than one widget handle mouseStart - if ( mouseHandled ) { - return; - } - - this._mouseMoved = false; - - // we may have missed mouseup (out of window) - (this._mouseStarted && this._mouseUp(event)); - - this._mouseDownEvent = event; - - var that = this, - btnIsLeft = (event.which === 1), - // event.target.nodeName works around a bug in IE 8 with - // disabled inputs (#7620) - elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); - if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { - return true; - } - - this.mouseDelayMet = !this.options.delay; - if (!this.mouseDelayMet) { - this._mouseDelayTimer = setTimeout(function() { - that.mouseDelayMet = true; - }, this.options.delay); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = (this._mouseStart(event) !== false); - if (!this._mouseStarted) { - event.preventDefault(); - return true; - } - } - - // Click event may never have fired (Gecko & Opera) - if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { - $.removeData(event.target, this.widgetName + ".preventClickEvent"); - } - - // these delegates are required to keep context - this._mouseMoveDelegate = function(event) { - return that._mouseMove(event); - }; - this._mouseUpDelegate = function(event) { - return that._mouseUp(event); - }; - - this.document - .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) - .bind( "mouseup." + this.widgetName, this._mouseUpDelegate ); - - event.preventDefault(); - - mouseHandled = true; - return true; - }, - - _mouseMove: function(event) { - // Only check for mouseups outside the document if you've moved inside the document - // at least once. This prevents the firing of mouseup in the case of IE<9, which will - // fire a mousemove event if content is placed under the cursor. See #7778 - // Support: IE <9 - if ( this._mouseMoved ) { - // IE mouseup check - mouseup happened when mouse was out of window - if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { - return this._mouseUp(event); - - // Iframe mouseup check - mouseup occurred in another document - } else if ( !event.which ) { - return this._mouseUp( event ); - } - } - - if ( event.which || event.button ) { - this._mouseMoved = true; - } - - if (this._mouseStarted) { - this._mouseDrag(event); - return event.preventDefault(); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = - (this._mouseStart(this._mouseDownEvent, event) !== false); - (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); - } - - return !this._mouseStarted; - }, - - _mouseUp: function(event) { - this.document - .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) - .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate ); - - if (this._mouseStarted) { - this._mouseStarted = false; - - if (event.target === this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + ".preventClickEvent", true); - } - - this._mouseStop(event); - } - - mouseHandled = false; - return false; - }, - - _mouseDistanceMet: function(event) { - return (Math.max( - Math.abs(this._mouseDownEvent.pageX - event.pageX), - Math.abs(this._mouseDownEvent.pageY - event.pageY) - ) >= this.options.distance - ); - }, - - _mouseDelayMet: function(/* event */) { - return this.mouseDelayMet; - }, - - // These are placeholder methods, to be overriden by extending plugin - _mouseStart: function(/* event */) {}, - _mouseDrag: function(/* event */) {}, - _mouseStop: function(/* event */) {}, - _mouseCapture: function(/* event */) { return true; } -}); - - -/*! - * jQuery UI Position 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/position/ - */ - -(function() { - -$.ui = $.ui || {}; - -var cachedScrollbarWidth, supportsOffsetFractions, - max = Math.max, - abs = Math.abs, - round = Math.round, - rhorizontal = /left|center|right/, - rvertical = /top|center|bottom/, - roffset = /[\+\-]\d+(\.[\d]+)?%?/, - rposition = /^\w+/, - rpercent = /%$/, - _position = $.fn.position; - -function getOffsets( offsets, width, height ) { - return [ - parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), - parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) - ]; -} - -function parseCss( element, property ) { - return parseInt( $.css( element, property ), 10 ) || 0; -} - -function getDimensions( elem ) { - var raw = elem[0]; - if ( raw.nodeType === 9 ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: 0, left: 0 } - }; - } - if ( $.isWindow( raw ) ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: elem.scrollTop(), left: elem.scrollLeft() } - }; - } - if ( raw.preventDefault ) { - return { - width: 0, - height: 0, - offset: { top: raw.pageY, left: raw.pageX } - }; - } - return { - width: elem.outerWidth(), - height: elem.outerHeight(), - offset: elem.offset() - }; -} - -$.position = { - scrollbarWidth: function() { - if ( cachedScrollbarWidth !== undefined ) { - return cachedScrollbarWidth; - } - var w1, w2, - div = $( "
" ), - innerDiv = div.children()[0]; - - $( "body" ).append( div ); - w1 = innerDiv.offsetWidth; - div.css( "overflow", "scroll" ); - - w2 = innerDiv.offsetWidth; - - if ( w1 === w2 ) { - w2 = div[0].clientWidth; - } - - div.remove(); - - return (cachedScrollbarWidth = w1 - w2); - }, - getScrollInfo: function( within ) { - var overflowX = within.isWindow || within.isDocument ? "" : - within.element.css( "overflow-x" ), - overflowY = within.isWindow || within.isDocument ? "" : - within.element.css( "overflow-y" ), - hasOverflowX = overflowX === "scroll" || - ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), - hasOverflowY = overflowY === "scroll" || - ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); - return { - width: hasOverflowY ? $.position.scrollbarWidth() : 0, - height: hasOverflowX ? $.position.scrollbarWidth() : 0 - }; - }, - getWithinInfo: function( element ) { - var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ), - isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; - return { - element: withinElement, - isWindow: isWindow, - isDocument: isDocument, - offset: withinElement.offset() || { left: 0, top: 0 }, - scrollLeft: withinElement.scrollLeft(), - scrollTop: withinElement.scrollTop(), - - // support: jQuery 1.6.x - // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows - width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(), - height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight() - }; - } -}; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), - within = $.position.getWithinInfo( options.within ), - scrollInfo = $.position.getScrollInfo( within ), - collision = ( options.collision || "flip" ).split( " " ), - offsets = {}; - - dimensions = getDimensions( target ); - if ( target[0].preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - } - targetWidth = dimensions.width; - targetHeight = dimensions.height; - targetOffset = dimensions.offset; - // clone to reuse original targetOffset later - basePosition = $.extend( {}, targetOffset ); - - // force my and at to have valid horizontal and vertical positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[ this ] || "" ).split( " " ), - horizontalOffset, - verticalOffset; - - if ( pos.length === 1) { - pos = rhorizontal.test( pos[ 0 ] ) ? - pos.concat( [ "center" ] ) : - rvertical.test( pos[ 0 ] ) ? - [ "center" ].concat( pos ) : - [ "center", "center" ]; - } - pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; - pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; - - // calculate offsets - horizontalOffset = roffset.exec( pos[ 0 ] ); - verticalOffset = roffset.exec( pos[ 1 ] ); - offsets[ this ] = [ - horizontalOffset ? horizontalOffset[ 0 ] : 0, - verticalOffset ? verticalOffset[ 0 ] : 0 - ]; - - // reduce to just the positions without the offsets - options[ this ] = [ - rposition.exec( pos[ 0 ] )[ 0 ], - rposition.exec( pos[ 1 ] )[ 0 ] - ]; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } - - if ( options.at[ 0 ] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[ 0 ] === "center" ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[ 1 ] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[ 1 ] === "center" ) { - basePosition.top += targetHeight / 2; - } - - atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); - basePosition.left += atOffset[ 0 ]; - basePosition.top += atOffset[ 1 ]; - - return this.each(function() { - var collisionPosition, using, - elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseCss( this, "marginLeft" ), - marginTop = parseCss( this, "marginTop" ), - collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, - collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, - position = $.extend( {}, basePosition ), - myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); - - if ( options.my[ 0 ] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[ 0 ] === "center" ) { - position.left -= elemWidth / 2; - } - - if ( options.my[ 1 ] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[ 1 ] === "center" ) { - position.top -= elemHeight / 2; - } - - position.left += myOffset[ 0 ]; - position.top += myOffset[ 1 ]; - - // if the browser doesn't support fractions, then round for consistent results - if ( !supportsOffsetFractions ) { - position.left = round( position.left ); - position.top = round( position.top ); - } - - collisionPosition = { - marginLeft: marginLeft, - marginTop: marginTop - }; - - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[ i ] ] ) { - $.ui.position[ collision[ i ] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], - my: options.my, - at: options.at, - within: within, - elem: elem - }); - } - }); - - if ( options.using ) { - // adds feedback as second argument to using callback, if present - using = function( props ) { - var left = targetOffset.left - position.left, - right = left + targetWidth - elemWidth, - top = targetOffset.top - position.top, - bottom = top + targetHeight - elemHeight, - feedback = { - target: { - element: target, - left: targetOffset.left, - top: targetOffset.top, - width: targetWidth, - height: targetHeight - }, - element: { - element: elem, - left: position.left, - top: position.top, - width: elemWidth, - height: elemHeight - }, - horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", - vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" - }; - if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { - feedback.horizontal = "center"; - } - if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { - feedback.vertical = "middle"; - } - if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { - feedback.important = "horizontal"; - } else { - feedback.important = "vertical"; - } - options.using.call( this, props, feedback ); - }; - } - - elem.offset( $.extend( position, { using: using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, - outerWidth = within.width, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = withinOffset - collisionPosLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, - newOverRight; - - // element is wider than within - if ( data.collisionWidth > outerWidth ) { - // element is initially over the left side of within - if ( overLeft > 0 && overRight <= 0 ) { - newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; - position.left += overLeft - newOverRight; - // element is initially over right side of within - } else if ( overRight > 0 && overLeft <= 0 ) { - position.left = withinOffset; - // element is initially over both left and right sides of within - } else { - if ( overLeft > overRight ) { - position.left = withinOffset + outerWidth - data.collisionWidth; - } else { - position.left = withinOffset; - } - } - // too far left -> align with left edge - } else if ( overLeft > 0 ) { - position.left += overLeft; - // too far right -> align with right edge - } else if ( overRight > 0 ) { - position.left -= overRight; - // adjust based on position and margin - } else { - position.left = max( position.left - collisionPosLeft, position.left ); - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollTop : within.offset.top, - outerHeight = data.within.height, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = withinOffset - collisionPosTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, - newOverBottom; - - // element is taller than within - if ( data.collisionHeight > outerHeight ) { - // element is initially over the top of within - if ( overTop > 0 && overBottom <= 0 ) { - newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; - position.top += overTop - newOverBottom; - // element is initially over bottom of within - } else if ( overBottom > 0 && overTop <= 0 ) { - position.top = withinOffset; - // element is initially over both top and bottom of within - } else { - if ( overTop > overBottom ) { - position.top = withinOffset + outerHeight - data.collisionHeight; - } else { - position.top = withinOffset; - } - } - // too far up -> align with top - } else if ( overTop > 0 ) { - position.top += overTop; - // too far down -> align with bottom edge - } else if ( overBottom > 0 ) { - position.top -= overBottom; - // adjust based on position and margin - } else { - position.top = max( position.top - collisionPosTop, position.top ); - } - } - }, - flip: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.offset.left + within.scrollLeft, - outerWidth = within.width, - offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = collisionPosLeft - offsetLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - data.at[ 0 ] === "right" ? - -data.targetWidth : - 0, - offset = -2 * data.offset[ 0 ], - newOverRight, - newOverLeft; - - if ( overLeft < 0 ) { - newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; - if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { - position.left += myOffset + atOffset + offset; - } - } else if ( overRight > 0 ) { - newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; - if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { - position.left += myOffset + atOffset + offset; - } - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.offset.top + within.scrollTop, - outerHeight = within.height, - offsetTop = within.isWindow ? within.scrollTop : within.offset.top, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = collisionPosTop - offsetTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, - top = data.my[ 1 ] === "top", - myOffset = top ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - data.at[ 1 ] === "bottom" ? - -data.targetHeight : - 0, - offset = -2 * data.offset[ 1 ], - newOverTop, - newOverBottom; - if ( overTop < 0 ) { - newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; - if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { - position.top += myOffset + atOffset + offset; - } - } else if ( overBottom > 0 ) { - newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; - if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { - position.top += myOffset + atOffset + offset; - } - } - } - }, - flipfit: { - left: function() { - $.ui.position.flip.left.apply( this, arguments ); - $.ui.position.fit.left.apply( this, arguments ); - }, - top: function() { - $.ui.position.flip.top.apply( this, arguments ); - $.ui.position.fit.top.apply( this, arguments ); - } - } -}; - -// fraction support test -(function() { - var testElement, testElementParent, testElementStyle, offsetLeft, i, - body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ); - - //Create a "fake body" for testing based on method used in jQuery.support - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - $.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || document.documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - div.style.cssText = "position: absolute; left: 10.7432222px;"; - - offsetLeft = $( div ).offset().left; - supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; - - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); -})(); - -})(); - -var position = $.ui.position; - - -/*! - * jQuery UI Accordion 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/accordion/ - */ - - -var accordion = $.widget( "ui.accordion", { - version: "1.11.4", - options: { - active: 0, - animate: {}, - collapsible: false, - event: "click", - header: "> li > :first-child,> :not(li):even", - heightStyle: "auto", - icons: { - activeHeader: "ui-icon-triangle-1-s", - header: "ui-icon-triangle-1-e" - }, - - // callbacks - activate: null, - beforeActivate: null - }, - - hideProps: { - borderTopWidth: "hide", - borderBottomWidth: "hide", - paddingTop: "hide", - paddingBottom: "hide", - height: "hide" - }, - - showProps: { - borderTopWidth: "show", - borderBottomWidth: "show", - paddingTop: "show", - paddingBottom: "show", - height: "show" - }, - - _create: function() { - var options = this.options; - this.prevShow = this.prevHide = $(); - this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) - // ARIA - .attr( "role", "tablist" ); - - // don't allow collapsible: false and active: false / null - if ( !options.collapsible && (options.active === false || options.active == null) ) { - options.active = 0; - } - - this._processPanels(); - // handle negative values - if ( options.active < 0 ) { - options.active += this.headers.length; - } - this._refresh(); - }, - - _getCreateEventData: function() { - return { - header: this.active, - panel: !this.active.length ? $() : this.active.next() - }; - }, - - _createIcons: function() { - var icons = this.options.icons; - if ( icons ) { - $( "" ) - .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) - .prependTo( this.headers ); - this.active.children( ".ui-accordion-header-icon" ) - .removeClass( icons.header ) - .addClass( icons.activeHeader ); - this.headers.addClass( "ui-accordion-icons" ); - } - }, - - _destroyIcons: function() { - this.headers - .removeClass( "ui-accordion-icons" ) - .children( ".ui-accordion-header-icon" ) - .remove(); - }, - - _destroy: function() { - var contents; - - // clean up main element - this.element - .removeClass( "ui-accordion ui-widget ui-helper-reset" ) - .removeAttr( "role" ); - - // clean up headers - this.headers - .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " + - "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) - .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-selected" ) - .removeAttr( "aria-controls" ) - .removeAttr( "tabIndex" ) - .removeUniqueId(); - - this._destroyIcons(); - - // clean up content panels - contents = this.headers.next() - .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + - "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) - .css( "display", "" ) - .removeAttr( "role" ) - .removeAttr( "aria-hidden" ) - .removeAttr( "aria-labelledby" ) - .removeUniqueId(); - - if ( this.options.heightStyle !== "content" ) { - contents.css( "height", "" ); - } - }, - - _setOption: function( key, value ) { - if ( key === "active" ) { - // _activate() will handle invalid values and update this.options - this._activate( value ); - return; - } - - if ( key === "event" ) { - if ( this.options.event ) { - this._off( this.headers, this.options.event ); - } - this._setupEvents( value ); - } - - this._super( key, value ); - - // setting collapsible: false while collapsed; open first panel - if ( key === "collapsible" && !value && this.options.active === false ) { - this._activate( 0 ); - } - - if ( key === "icons" ) { - this._destroyIcons(); - if ( value ) { - this._createIcons(); - } - } - - // #5332 - opacity doesn't cascade to positioned elements in IE - // so we need to add the disabled class to the headers and panels - if ( key === "disabled" ) { - this.element - .toggleClass( "ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); - this.headers.add( this.headers.next() ) - .toggleClass( "ui-state-disabled", !!value ); - } - }, - - _keydown: function( event ) { - if ( event.altKey || event.ctrlKey ) { - return; - } - - var keyCode = $.ui.keyCode, - length = this.headers.length, - currentIndex = this.headers.index( event.target ), - toFocus = false; - - switch ( event.keyCode ) { - case keyCode.RIGHT: - case keyCode.DOWN: - toFocus = this.headers[ ( currentIndex + 1 ) % length ]; - break; - case keyCode.LEFT: - case keyCode.UP: - toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; - break; - case keyCode.SPACE: - case keyCode.ENTER: - this._eventHandler( event ); - break; - case keyCode.HOME: - toFocus = this.headers[ 0 ]; - break; - case keyCode.END: - toFocus = this.headers[ length - 1 ]; - break; - } - - if ( toFocus ) { - $( event.target ).attr( "tabIndex", -1 ); - $( toFocus ).attr( "tabIndex", 0 ); - toFocus.focus(); - event.preventDefault(); - } - }, - - _panelKeyDown: function( event ) { - if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { - $( event.currentTarget ).prev().focus(); - } - }, - - refresh: function() { - var options = this.options; - this._processPanels(); - - // was collapsed or no panel - if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { - options.active = false; - this.active = $(); - // active false only when collapsible is true - } else if ( options.active === false ) { - this._activate( 0 ); - // was active, but active panel is gone - } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { - // all remaining panel are disabled - if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { - options.active = false; - this.active = $(); - // activate previous panel - } else { - this._activate( Math.max( 0, options.active - 1 ) ); - } - // was active, active panel still exists - } else { - // make sure active index is correct - options.active = this.headers.index( this.active ); - } - - this._destroyIcons(); - - this._refresh(); - }, - - _processPanels: function() { - var prevHeaders = this.headers, - prevPanels = this.panels; - - this.headers = this.element.find( this.options.header ) - .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); - - this.panels = this.headers.next() - .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) - .filter( ":not(.ui-accordion-content-active)" ) - .hide(); - - // Avoid memory leaks (#10056) - if ( prevPanels ) { - this._off( prevHeaders.not( this.headers ) ); - this._off( prevPanels.not( this.panels ) ); - } - }, - - _refresh: function() { - var maxHeight, - options = this.options, - heightStyle = options.heightStyle, - parent = this.element.parent(); - - this.active = this._findActive( options.active ) - .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) - .removeClass( "ui-corner-all" ); - this.active.next() - .addClass( "ui-accordion-content-active" ) - .show(); - - this.headers - .attr( "role", "tab" ) - .each(function() { - var header = $( this ), - headerId = header.uniqueId().attr( "id" ), - panel = header.next(), - panelId = panel.uniqueId().attr( "id" ); - header.attr( "aria-controls", panelId ); - panel.attr( "aria-labelledby", headerId ); - }) - .next() - .attr( "role", "tabpanel" ); - - this.headers - .not( this.active ) - .attr({ - "aria-selected": "false", - "aria-expanded": "false", - tabIndex: -1 - }) - .next() - .attr({ - "aria-hidden": "true" - }) - .hide(); - - // make sure at least one header is in the tab order - if ( !this.active.length ) { - this.headers.eq( 0 ).attr( "tabIndex", 0 ); - } else { - this.active.attr({ - "aria-selected": "true", - "aria-expanded": "true", - tabIndex: 0 - }) - .next() - .attr({ - "aria-hidden": "false" - }); - } - - this._createIcons(); - - this._setupEvents( options.event ); - - if ( heightStyle === "fill" ) { - maxHeight = parent.height(); - this.element.siblings( ":visible" ).each(function() { - var elem = $( this ), - position = elem.css( "position" ); - - if ( position === "absolute" || position === "fixed" ) { - return; - } - maxHeight -= elem.outerHeight( true ); - }); - - this.headers.each(function() { - maxHeight -= $( this ).outerHeight( true ); - }); - - this.headers.next() - .each(function() { - $( this ).height( Math.max( 0, maxHeight - - $( this ).innerHeight() + $( this ).height() ) ); - }) - .css( "overflow", "auto" ); - } else if ( heightStyle === "auto" ) { - maxHeight = 0; - this.headers.next() - .each(function() { - maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); - }) - .height( maxHeight ); - } - }, - - _activate: function( index ) { - var active = this._findActive( index )[ 0 ]; - - // trying to activate the already active panel - if ( active === this.active[ 0 ] ) { - return; - } - - // trying to collapse, simulate a click on the currently active header - active = active || this.active[ 0 ]; - - this._eventHandler({ - target: active, - currentTarget: active, - preventDefault: $.noop - }); - }, - - _findActive: function( selector ) { - return typeof selector === "number" ? this.headers.eq( selector ) : $(); - }, - - _setupEvents: function( event ) { - var events = { - keydown: "_keydown" - }; - if ( event ) { - $.each( event.split( " " ), function( index, eventName ) { - events[ eventName ] = "_eventHandler"; - }); - } - - this._off( this.headers.add( this.headers.next() ) ); - this._on( this.headers, events ); - this._on( this.headers.next(), { keydown: "_panelKeyDown" }); - this._hoverable( this.headers ); - this._focusable( this.headers ); - }, - - _eventHandler: function( event ) { - var options = this.options, - active = this.active, - clicked = $( event.currentTarget ), - clickedIsActive = clicked[ 0 ] === active[ 0 ], - collapsing = clickedIsActive && options.collapsible, - toShow = collapsing ? $() : clicked.next(), - toHide = active.next(), - eventData = { - oldHeader: active, - oldPanel: toHide, - newHeader: collapsing ? $() : clicked, - newPanel: toShow - }; - - event.preventDefault(); - - if ( - // click on active header, but not collapsible - ( clickedIsActive && !options.collapsible ) || - // allow canceling activation - ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { - return; - } - - options.active = collapsing ? false : this.headers.index( clicked ); - - // when the call to ._toggle() comes after the class changes - // it causes a very odd bug in IE 8 (see #6720) - this.active = clickedIsActive ? $() : clicked; - this._toggle( eventData ); - - // switch classes - // corner classes on the previously active header stay after the animation - active.removeClass( "ui-accordion-header-active ui-state-active" ); - if ( options.icons ) { - active.children( ".ui-accordion-header-icon" ) - .removeClass( options.icons.activeHeader ) - .addClass( options.icons.header ); - } - - if ( !clickedIsActive ) { - clicked - .removeClass( "ui-corner-all" ) - .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); - if ( options.icons ) { - clicked.children( ".ui-accordion-header-icon" ) - .removeClass( options.icons.header ) - .addClass( options.icons.activeHeader ); - } - - clicked - .next() - .addClass( "ui-accordion-content-active" ); - } - }, - - _toggle: function( data ) { - var toShow = data.newPanel, - toHide = this.prevShow.length ? this.prevShow : data.oldPanel; - - // handle activating a panel during the animation for another activation - this.prevShow.add( this.prevHide ).stop( true, true ); - this.prevShow = toShow; - this.prevHide = toHide; - - if ( this.options.animate ) { - this._animate( toShow, toHide, data ); - } else { - toHide.hide(); - toShow.show(); - this._toggleComplete( data ); - } - - toHide.attr({ - "aria-hidden": "true" - }); - toHide.prev().attr({ - "aria-selected": "false", - "aria-expanded": "false" - }); - // if we're switching panels, remove the old header from the tab order - // if we're opening from collapsed state, remove the previous header from the tab order - // if we're collapsing, then keep the collapsing header in the tab order - if ( toShow.length && toHide.length ) { - toHide.prev().attr({ - "tabIndex": -1, - "aria-expanded": "false" - }); - } else if ( toShow.length ) { - this.headers.filter(function() { - return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; - }) - .attr( "tabIndex", -1 ); - } - - toShow - .attr( "aria-hidden", "false" ) - .prev() - .attr({ - "aria-selected": "true", - "aria-expanded": "true", - tabIndex: 0 - }); - }, - - _animate: function( toShow, toHide, data ) { - var total, easing, duration, - that = this, - adjust = 0, - boxSizing = toShow.css( "box-sizing" ), - down = toShow.length && - ( !toHide.length || ( toShow.index() < toHide.index() ) ), - animate = this.options.animate || {}, - options = down && animate.down || animate, - complete = function() { - that._toggleComplete( data ); - }; - - if ( typeof options === "number" ) { - duration = options; - } - if ( typeof options === "string" ) { - easing = options; - } - // fall back from options to animation in case of partial down settings - easing = easing || options.easing || animate.easing; - duration = duration || options.duration || animate.duration; - - if ( !toHide.length ) { - return toShow.animate( this.showProps, duration, easing, complete ); - } - if ( !toShow.length ) { - return toHide.animate( this.hideProps, duration, easing, complete ); - } - - total = toShow.show().outerHeight(); - toHide.animate( this.hideProps, { - duration: duration, - easing: easing, - step: function( now, fx ) { - fx.now = Math.round( now ); - } - }); - toShow - .hide() - .animate( this.showProps, { - duration: duration, - easing: easing, - complete: complete, - step: function( now, fx ) { - fx.now = Math.round( now ); - if ( fx.prop !== "height" ) { - if ( boxSizing === "content-box" ) { - adjust += fx.now; - } - } else if ( that.options.heightStyle !== "content" ) { - fx.now = Math.round( total - toHide.outerHeight() - adjust ); - adjust = 0; - } - } - }); - }, - - _toggleComplete: function( data ) { - var toHide = data.oldPanel; - - toHide - .removeClass( "ui-accordion-content-active" ) - .prev() - .removeClass( "ui-corner-top" ) - .addClass( "ui-corner-all" ); - - // Work around for rendering bug in IE (#5421) - if ( toHide.length ) { - toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; - } - this._trigger( "activate", null, data ); - } -}); - - -/*! - * jQuery UI Menu 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/menu/ - */ - - -var menu = $.widget( "ui.menu", { - version: "1.11.4", - defaultElement: "
    ", - delay: 300, - options: { - icons: { - submenu: "ui-icon-carat-1-e" - }, - items: "> *", - menus: "ul", - position: { - my: "left-1 top", - at: "right top" - }, - role: "menu", - - // callbacks - blur: null, - focus: null, - select: null - }, - - _create: function() { - this.activeMenu = this.element; - - // Flag used to prevent firing of the click handler - // as the event bubbles up through nested menus - this.mouseHandled = false; - this.element - .uniqueId() - .addClass( "ui-menu ui-widget ui-widget-content" ) - .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) - .attr({ - role: this.options.role, - tabIndex: 0 - }); - - if ( this.options.disabled ) { - this.element - .addClass( "ui-state-disabled" ) - .attr( "aria-disabled", "true" ); - } - - this._on({ - // Prevent focus from sticking to links inside menu after clicking - // them (focus should always stay on UL during navigation). - "mousedown .ui-menu-item": function( event ) { - event.preventDefault(); - }, - "click .ui-menu-item": function( event ) { - var target = $( event.target ); - if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { - this.select( event ); - - // Only set the mouseHandled flag if the event will bubble, see #9469. - if ( !event.isPropagationStopped() ) { - this.mouseHandled = true; - } - - // Open submenu on click - if ( target.has( ".ui-menu" ).length ) { - this.expand( event ); - } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { - - // Redirect focus to the menu - this.element.trigger( "focus", [ true ] ); - - // If the active item is on the top level, let it stay active. - // Otherwise, blur the active item since it is no longer visible. - if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { - clearTimeout( this.timer ); - } - } - } - }, - "mouseenter .ui-menu-item": function( event ) { - // Ignore mouse events while typeahead is active, see #10458. - // Prevents focusing the wrong item when typeahead causes a scroll while the mouse - // is over an item in the menu - if ( this.previousFilter ) { - return; - } - var target = $( event.currentTarget ); - // Remove ui-state-active class from siblings of the newly focused menu item - // to avoid a jump caused by adjacent elements both having a class with a border - target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" ); - this.focus( event, target ); - }, - mouseleave: "collapseAll", - "mouseleave .ui-menu": "collapseAll", - focus: function( event, keepActiveItem ) { - // If there's already an active item, keep it active - // If not, activate the first item - var item = this.active || this.element.find( this.options.items ).eq( 0 ); - - if ( !keepActiveItem ) { - this.focus( event, item ); - } - }, - blur: function( event ) { - this._delay(function() { - if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { - this.collapseAll( event ); - } - }); - }, - keydown: "_keydown" - }); - - this.refresh(); - - // Clicks outside of a menu collapse any open menus - this._on( this.document, { - click: function( event ) { - if ( this._closeOnDocumentClick( event ) ) { - this.collapseAll( event ); - } - - // Reset the mouseHandled flag - this.mouseHandled = false; - } - }); - }, - - _destroy: function() { - // Destroy (sub)menus - this.element - .removeAttr( "aria-activedescendant" ) - .find( ".ui-menu" ).addBack() - .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" ) - .removeAttr( "role" ) - .removeAttr( "tabIndex" ) - .removeAttr( "aria-labelledby" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-hidden" ) - .removeAttr( "aria-disabled" ) - .removeUniqueId() - .show(); - - // Destroy menu items - this.element.find( ".ui-menu-item" ) - .removeClass( "ui-menu-item" ) - .removeAttr( "role" ) - .removeAttr( "aria-disabled" ) - .removeUniqueId() - .removeClass( "ui-state-hover" ) - .removeAttr( "tabIndex" ) - .removeAttr( "role" ) - .removeAttr( "aria-haspopup" ) - .children().each( function() { - var elem = $( this ); - if ( elem.data( "ui-menu-submenu-carat" ) ) { - elem.remove(); - } - }); - - // Destroy menu dividers - this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); - }, - - _keydown: function( event ) { - var match, prev, character, skip, - preventDefault = true; - - switch ( event.keyCode ) { - case $.ui.keyCode.PAGE_UP: - this.previousPage( event ); - break; - case $.ui.keyCode.PAGE_DOWN: - this.nextPage( event ); - break; - case $.ui.keyCode.HOME: - this._move( "first", "first", event ); - break; - case $.ui.keyCode.END: - this._move( "last", "last", event ); - break; - case $.ui.keyCode.UP: - this.previous( event ); - break; - case $.ui.keyCode.DOWN: - this.next( event ); - break; - case $.ui.keyCode.LEFT: - this.collapse( event ); - break; - case $.ui.keyCode.RIGHT: - if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { - this.expand( event ); - } - break; - case $.ui.keyCode.ENTER: - case $.ui.keyCode.SPACE: - this._activate( event ); - break; - case $.ui.keyCode.ESCAPE: - this.collapse( event ); - break; - default: - preventDefault = false; - prev = this.previousFilter || ""; - character = String.fromCharCode( event.keyCode ); - skip = false; - - clearTimeout( this.filterTimer ); - - if ( character === prev ) { - skip = true; - } else { - character = prev + character; - } - - match = this._filterMenuItems( character ); - match = skip && match.index( this.active.next() ) !== -1 ? - this.active.nextAll( ".ui-menu-item" ) : - match; - - // If no matches on the current filter, reset to the last character pressed - // to move down the menu to the first item that starts with that character - if ( !match.length ) { - character = String.fromCharCode( event.keyCode ); - match = this._filterMenuItems( character ); - } - - if ( match.length ) { - this.focus( event, match ); - this.previousFilter = character; - this.filterTimer = this._delay(function() { - delete this.previousFilter; - }, 1000 ); - } else { - delete this.previousFilter; - } - } - - if ( preventDefault ) { - event.preventDefault(); - } - }, - - _activate: function( event ) { - if ( !this.active.is( ".ui-state-disabled" ) ) { - if ( this.active.is( "[aria-haspopup='true']" ) ) { - this.expand( event ); - } else { - this.select( event ); - } - } - }, - - refresh: function() { - var menus, items, - that = this, - icon = this.options.icons.submenu, - submenus = this.element.find( this.options.menus ); - - this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ); - - // Initialize nested menus - submenus.filter( ":not(.ui-menu)" ) - .addClass( "ui-menu ui-widget ui-widget-content ui-front" ) - .hide() - .attr({ - role: this.options.role, - "aria-hidden": "true", - "aria-expanded": "false" - }) - .each(function() { - var menu = $( this ), - item = menu.parent(), - submenuCarat = $( "" ) - .addClass( "ui-menu-icon ui-icon " + icon ) - .data( "ui-menu-submenu-carat", true ); - - item - .attr( "aria-haspopup", "true" ) - .prepend( submenuCarat ); - menu.attr( "aria-labelledby", item.attr( "id" ) ); - }); - - menus = submenus.add( this.element ); - items = menus.find( this.options.items ); - - // Initialize menu-items containing spaces and/or dashes only as dividers - items.not( ".ui-menu-item" ).each(function() { - var item = $( this ); - if ( that._isDivider( item ) ) { - item.addClass( "ui-widget-content ui-menu-divider" ); - } - }); - - // Don't refresh list items that are already adapted - items.not( ".ui-menu-item, .ui-menu-divider" ) - .addClass( "ui-menu-item" ) - .uniqueId() - .attr({ - tabIndex: -1, - role: this._itemRole() - }); - - // Add aria-disabled attribute to any disabled menu item - items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); - - // If the active item has been removed, blur the menu - if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { - this.blur(); - } - }, - - _itemRole: function() { - return { - menu: "menuitem", - listbox: "option" - }[ this.options.role ]; - }, - - _setOption: function( key, value ) { - if ( key === "icons" ) { - this.element.find( ".ui-menu-icon" ) - .removeClass( this.options.icons.submenu ) - .addClass( value.submenu ); - } - if ( key === "disabled" ) { - this.element - .toggleClass( "ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); - } - this._super( key, value ); - }, - - focus: function( event, item ) { - var nested, focused; - this.blur( event, event && event.type === "focus" ); - - this._scrollIntoView( item ); - - this.active = item.first(); - focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" ); - // Only update aria-activedescendant if there's a role - // otherwise we assume focus is managed elsewhere - if ( this.options.role ) { - this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); - } - - // Highlight active parent menu item, if any - this.active - .parent() - .closest( ".ui-menu-item" ) - .addClass( "ui-state-active" ); - - if ( event && event.type === "keydown" ) { - this._close(); - } else { - this.timer = this._delay(function() { - this._close(); - }, this.delay ); - } - - nested = item.children( ".ui-menu" ); - if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { - this._startOpening(nested); - } - this.activeMenu = item.parent(); - - this._trigger( "focus", event, { item: item } ); - }, - - _scrollIntoView: function( item ) { - var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; - if ( this._hasScroll() ) { - borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; - paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; - offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; - scroll = this.activeMenu.scrollTop(); - elementHeight = this.activeMenu.height(); - itemHeight = item.outerHeight(); - - if ( offset < 0 ) { - this.activeMenu.scrollTop( scroll + offset ); - } else if ( offset + itemHeight > elementHeight ) { - this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); - } - } - }, - - blur: function( event, fromFocus ) { - if ( !fromFocus ) { - clearTimeout( this.timer ); - } - - if ( !this.active ) { - return; - } - - this.active.removeClass( "ui-state-focus" ); - this.active = null; - - this._trigger( "blur", event, { item: this.active } ); - }, - - _startOpening: function( submenu ) { - clearTimeout( this.timer ); - - // Don't open if already open fixes a Firefox bug that caused a .5 pixel - // shift in the submenu position when mousing over the carat icon - if ( submenu.attr( "aria-hidden" ) !== "true" ) { - return; - } - - this.timer = this._delay(function() { - this._close(); - this._open( submenu ); - }, this.delay ); - }, - - _open: function( submenu ) { - var position = $.extend({ - of: this.active - }, this.options.position ); - - clearTimeout( this.timer ); - this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) - .hide() - .attr( "aria-hidden", "true" ); - - submenu - .show() - .removeAttr( "aria-hidden" ) - .attr( "aria-expanded", "true" ) - .position( position ); - }, - - collapseAll: function( event, all ) { - clearTimeout( this.timer ); - this.timer = this._delay(function() { - // If we were passed an event, look for the submenu that contains the event - var currentMenu = all ? this.element : - $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); - - // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway - if ( !currentMenu.length ) { - currentMenu = this.element; - } - - this._close( currentMenu ); - - this.blur( event ); - this.activeMenu = currentMenu; - }, this.delay ); - }, - - // With no arguments, closes the currently active menu - if nothing is active - // it closes all menus. If passed an argument, it will search for menus BELOW - _close: function( startMenu ) { - if ( !startMenu ) { - startMenu = this.active ? this.active.parent() : this.element; - } - - startMenu - .find( ".ui-menu" ) - .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ) - .end() - .find( ".ui-state-active" ).not( ".ui-state-focus" ) - .removeClass( "ui-state-active" ); - }, - - _closeOnDocumentClick: function( event ) { - return !$( event.target ).closest( ".ui-menu" ).length; - }, - - _isDivider: function( item ) { - - // Match hyphen, em dash, en dash - return !/[^\-\u2014\u2013\s]/.test( item.text() ); - }, - - collapse: function( event ) { - var newItem = this.active && - this.active.parent().closest( ".ui-menu-item", this.element ); - if ( newItem && newItem.length ) { - this._close(); - this.focus( event, newItem ); - } - }, - - expand: function( event ) { - var newItem = this.active && - this.active - .children( ".ui-menu " ) - .find( this.options.items ) - .first(); - - if ( newItem && newItem.length ) { - this._open( newItem.parent() ); - - // Delay so Firefox will not hide activedescendant change in expanding submenu from AT - this._delay(function() { - this.focus( event, newItem ); - }); - } - }, - - next: function( event ) { - this._move( "next", "first", event ); - }, - - previous: function( event ) { - this._move( "prev", "last", event ); - }, - - isFirstItem: function() { - return this.active && !this.active.prevAll( ".ui-menu-item" ).length; - }, - - isLastItem: function() { - return this.active && !this.active.nextAll( ".ui-menu-item" ).length; - }, - - _move: function( direction, filter, event ) { - var next; - if ( this.active ) { - if ( direction === "first" || direction === "last" ) { - next = this.active - [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) - .eq( -1 ); - } else { - next = this.active - [ direction + "All" ]( ".ui-menu-item" ) - .eq( 0 ); - } - } - if ( !next || !next.length || !this.active ) { - next = this.activeMenu.find( this.options.items )[ filter ](); - } - - this.focus( event, next ); - }, - - nextPage: function( event ) { - var item, base, height; - - if ( !this.active ) { - this.next( event ); - return; - } - if ( this.isLastItem() ) { - return; - } - if ( this._hasScroll() ) { - base = this.active.offset().top; - height = this.element.height(); - this.active.nextAll( ".ui-menu-item" ).each(function() { - item = $( this ); - return item.offset().top - base - height < 0; - }); - - this.focus( event, item ); - } else { - this.focus( event, this.activeMenu.find( this.options.items ) - [ !this.active ? "first" : "last" ]() ); - } - }, - - previousPage: function( event ) { - var item, base, height; - if ( !this.active ) { - this.next( event ); - return; - } - if ( this.isFirstItem() ) { - return; - } - if ( this._hasScroll() ) { - base = this.active.offset().top; - height = this.element.height(); - this.active.prevAll( ".ui-menu-item" ).each(function() { - item = $( this ); - return item.offset().top - base + height > 0; - }); - - this.focus( event, item ); - } else { - this.focus( event, this.activeMenu.find( this.options.items ).first() ); - } - }, - - _hasScroll: function() { - return this.element.outerHeight() < this.element.prop( "scrollHeight" ); - }, - - select: function( event ) { - // TODO: It should never be possible to not have an active item at this - // point, but the tests don't trigger mouseenter before click. - this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); - var ui = { item: this.active }; - if ( !this.active.has( ".ui-menu" ).length ) { - this.collapseAll( event, true ); - } - this._trigger( "select", event, ui ); - }, - - _filterMenuItems: function(character) { - var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), - regex = new RegExp( "^" + escapedCharacter, "i" ); - - return this.activeMenu - .find( this.options.items ) - - // Only match on items, not dividers or other content (#10571) - .filter( ".ui-menu-item" ) - .filter(function() { - return regex.test( $.trim( $( this ).text() ) ); - }); - } -}); - - -/*! - * jQuery UI Autocomplete 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/autocomplete/ - */ - - -$.widget( "ui.autocomplete", { - version: "1.11.4", - defaultElement: "", - options: { - appendTo: null, - autoFocus: false, - delay: 300, - minLength: 1, - position: { - my: "left top", - at: "left bottom", - collision: "none" - }, - source: null, - - // callbacks - change: null, - close: null, - focus: null, - open: null, - response: null, - search: null, - select: null - }, - - requestIndex: 0, - pending: 0, - - _create: function() { - // Some browsers only repeat keydown events, not keypress events, - // so we use the suppressKeyPress flag to determine if we've already - // handled the keydown event. #7269 - // Unfortunately the code for & in keypress is the same as the up arrow, - // so we use the suppressKeyPressRepeat flag to avoid handling keypress - // events when we know the keydown event was used to modify the - // search term. #7799 - var suppressKeyPress, suppressKeyPressRepeat, suppressInput, - nodeName = this.element[ 0 ].nodeName.toLowerCase(), - isTextarea = nodeName === "textarea", - isInput = nodeName === "input"; - - this.isMultiLine = - // Textareas are always multi-line - isTextarea ? true : - // Inputs are always single-line, even if inside a contentEditable element - // IE also treats inputs as contentEditable - isInput ? false : - // All other element types are determined by whether or not they're contentEditable - this.element.prop( "isContentEditable" ); - - this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; - this.isNewMenu = true; - - this.element - .addClass( "ui-autocomplete-input" ) - .attr( "autocomplete", "off" ); - - this._on( this.element, { - keydown: function( event ) { - if ( this.element.prop( "readOnly" ) ) { - suppressKeyPress = true; - suppressInput = true; - suppressKeyPressRepeat = true; - return; - } - - suppressKeyPress = false; - suppressInput = false; - suppressKeyPressRepeat = false; - var keyCode = $.ui.keyCode; - switch ( event.keyCode ) { - case keyCode.PAGE_UP: - suppressKeyPress = true; - this._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - suppressKeyPress = true; - this._move( "nextPage", event ); - break; - case keyCode.UP: - suppressKeyPress = true; - this._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - suppressKeyPress = true; - this._keyEvent( "next", event ); - break; - case keyCode.ENTER: - // when menu is open and has focus - if ( this.menu.active ) { - // #6055 - Opera still allows the keypress to occur - // which causes forms to submit - suppressKeyPress = true; - event.preventDefault(); - this.menu.select( event ); - } - break; - case keyCode.TAB: - if ( this.menu.active ) { - this.menu.select( event ); - } - break; - case keyCode.ESCAPE: - if ( this.menu.element.is( ":visible" ) ) { - if ( !this.isMultiLine ) { - this._value( this.term ); - } - this.close( event ); - // Different browsers have different default behavior for escape - // Single press can mean undo or clear - // Double press in IE means clear the whole form - event.preventDefault(); - } - break; - default: - suppressKeyPressRepeat = true; - // search timeout should be triggered before the input value is changed - this._searchTimeout( event ); - break; - } - }, - keypress: function( event ) { - if ( suppressKeyPress ) { - suppressKeyPress = false; - if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { - event.preventDefault(); - } - return; - } - if ( suppressKeyPressRepeat ) { - return; - } - - // replicate some key handlers to allow them to repeat in Firefox and Opera - var keyCode = $.ui.keyCode; - switch ( event.keyCode ) { - case keyCode.PAGE_UP: - this._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - this._move( "nextPage", event ); - break; - case keyCode.UP: - this._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - this._keyEvent( "next", event ); - break; - } - }, - input: function( event ) { - if ( suppressInput ) { - suppressInput = false; - event.preventDefault(); - return; - } - this._searchTimeout( event ); - }, - focus: function() { - this.selectedItem = null; - this.previous = this._value(); - }, - blur: function( event ) { - if ( this.cancelBlur ) { - delete this.cancelBlur; - return; - } - - clearTimeout( this.searching ); - this.close( event ); - this._change( event ); - } - }); - - this._initSource(); - this.menu = $( "
      " ) - .addClass( "ui-autocomplete ui-front" ) - .appendTo( this._appendTo() ) - .menu({ - // disable ARIA support, the live region takes care of that - role: null - }) - .hide() - .menu( "instance" ); - - this._on( this.menu.element, { - mousedown: function( event ) { - // prevent moving focus out of the text field - event.preventDefault(); - - // IE doesn't prevent moving focus even with event.preventDefault() - // so we set a flag to know when we should ignore the blur event - this.cancelBlur = true; - this._delay(function() { - delete this.cancelBlur; - }); - - // clicking on the scrollbar causes focus to shift to the body - // but we can't detect a mouseup or a click immediately afterward - // so we have to track the next mousedown and close the menu if - // the user clicks somewhere outside of the autocomplete - var menuElement = this.menu.element[ 0 ]; - if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { - this._delay(function() { - var that = this; - this.document.one( "mousedown", function( event ) { - if ( event.target !== that.element[ 0 ] && - event.target !== menuElement && - !$.contains( menuElement, event.target ) ) { - that.close(); - } - }); - }); - } - }, - menufocus: function( event, ui ) { - var label, item; - // support: Firefox - // Prevent accidental activation of menu items in Firefox (#7024 #9118) - if ( this.isNewMenu ) { - this.isNewMenu = false; - if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { - this.menu.blur(); - - this.document.one( "mousemove", function() { - $( event.target ).trigger( event.originalEvent ); - }); - - return; - } - } - - item = ui.item.data( "ui-autocomplete-item" ); - if ( false !== this._trigger( "focus", event, { item: item } ) ) { - // use value to match what will end up in the input, if it was a key event - if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { - this._value( item.value ); - } - } - - // Announce the value in the liveRegion - label = ui.item.attr( "aria-label" ) || item.value; - if ( label && $.trim( label ).length ) { - this.liveRegion.children().hide(); - $( "
      " ).text( label ).appendTo( this.liveRegion ); - } - }, - menuselect: function( event, ui ) { - var item = ui.item.data( "ui-autocomplete-item" ), - previous = this.previous; - - // only trigger when focus was lost (click on menu) - if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { - this.element.focus(); - this.previous = previous; - // #6109 - IE triggers two focus events and the second - // is asynchronous, so we need to reset the previous - // term synchronously and asynchronously :-( - this._delay(function() { - this.previous = previous; - this.selectedItem = item; - }); - } - - if ( false !== this._trigger( "select", event, { item: item } ) ) { - this._value( item.value ); - } - // reset the term after the select event - // this allows custom select handling to work properly - this.term = this._value(); - - this.close( event ); - this.selectedItem = item; - } - }); - - this.liveRegion = $( "", { - role: "status", - "aria-live": "assertive", - "aria-relevant": "additions" - }) - .addClass( "ui-helper-hidden-accessible" ) - .appendTo( this.document[ 0 ].body ); - - // turning off autocomplete prevents the browser from remembering the - // value when navigating through history, so we re-enable autocomplete - // if the page is unloaded before the widget is destroyed. #7790 - this._on( this.window, { - beforeunload: function() { - this.element.removeAttr( "autocomplete" ); - } - }); - }, - - _destroy: function() { - clearTimeout( this.searching ); - this.element - .removeClass( "ui-autocomplete-input" ) - .removeAttr( "autocomplete" ); - this.menu.element.remove(); - this.liveRegion.remove(); - }, - - _setOption: function( key, value ) { - this._super( key, value ); - if ( key === "source" ) { - this._initSource(); - } - if ( key === "appendTo" ) { - this.menu.element.appendTo( this._appendTo() ); - } - if ( key === "disabled" && value && this.xhr ) { - this.xhr.abort(); - } - }, - - _appendTo: function() { - var element = this.options.appendTo; - - if ( element ) { - element = element.jquery || element.nodeType ? - $( element ) : - this.document.find( element ).eq( 0 ); - } - - if ( !element || !element[ 0 ] ) { - element = this.element.closest( ".ui-front" ); - } - - if ( !element.length ) { - element = this.document[ 0 ].body; - } - - return element; - }, - - _initSource: function() { - var array, url, - that = this; - if ( $.isArray( this.options.source ) ) { - array = this.options.source; - this.source = function( request, response ) { - response( $.ui.autocomplete.filter( array, request.term ) ); - }; - } else if ( typeof this.options.source === "string" ) { - url = this.options.source; - this.source = function( request, response ) { - if ( that.xhr ) { - that.xhr.abort(); - } - that.xhr = $.ajax({ - url: url, - data: request, - dataType: "json", - success: function( data ) { - response( data ); - }, - error: function() { - response([]); - } - }); - }; - } else { - this.source = this.options.source; - } - }, - - _searchTimeout: function( event ) { - clearTimeout( this.searching ); - this.searching = this._delay(function() { - - // Search if the value has changed, or if the user retypes the same value (see #7434) - var equalValues = this.term === this._value(), - menuVisible = this.menu.element.is( ":visible" ), - modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; - - if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { - this.selectedItem = null; - this.search( null, event ); - } - }, this.options.delay ); - }, - - search: function( value, event ) { - value = value != null ? value : this._value(); - - // always save the actual value, not the one passed as an argument - this.term = this._value(); - - if ( value.length < this.options.minLength ) { - return this.close( event ); - } - - if ( this._trigger( "search", event ) === false ) { - return; - } - - return this._search( value ); - }, - - _search: function( value ) { - this.pending++; - this.element.addClass( "ui-autocomplete-loading" ); - this.cancelSearch = false; - - this.source( { term: value }, this._response() ); - }, - - _response: function() { - var index = ++this.requestIndex; - - return $.proxy(function( content ) { - if ( index === this.requestIndex ) { - this.__response( content ); - } - - this.pending--; - if ( !this.pending ) { - this.element.removeClass( "ui-autocomplete-loading" ); - } - }, this ); - }, - - __response: function( content ) { - if ( content ) { - content = this._normalize( content ); - } - this._trigger( "response", null, { content: content } ); - if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { - this._suggest( content ); - this._trigger( "open" ); - } else { - // use ._close() instead of .close() so we don't cancel future searches - this._close(); - } - }, - - close: function( event ) { - this.cancelSearch = true; - this._close( event ); - }, - - _close: function( event ) { - if ( this.menu.element.is( ":visible" ) ) { - this.menu.element.hide(); - this.menu.blur(); - this.isNewMenu = true; - this._trigger( "close", event ); - } - }, - - _change: function( event ) { - if ( this.previous !== this._value() ) { - this._trigger( "change", event, { item: this.selectedItem } ); - } - }, - - _normalize: function( items ) { - // assume all items have the right format when the first item is complete - if ( items.length && items[ 0 ].label && items[ 0 ].value ) { - return items; - } - return $.map( items, function( item ) { - if ( typeof item === "string" ) { - return { - label: item, - value: item - }; - } - return $.extend( {}, item, { - label: item.label || item.value, - value: item.value || item.label - }); - }); - }, - - _suggest: function( items ) { - var ul = this.menu.element.empty(); - this._renderMenu( ul, items ); - this.isNewMenu = true; - this.menu.refresh(); - - // size and position menu - ul.show(); - this._resizeMenu(); - ul.position( $.extend({ - of: this.element - }, this.options.position ) ); - - if ( this.options.autoFocus ) { - this.menu.next(); - } - }, - - _resizeMenu: function() { - var ul = this.menu.element; - ul.outerWidth( Math.max( - // Firefox wraps long text (possibly a rounding bug) - // so we add 1px to avoid the wrapping (#7513) - ul.width( "" ).outerWidth() + 1, - this.element.outerWidth() - ) ); - }, - - _renderMenu: function( ul, items ) { - var that = this; - $.each( items, function( index, item ) { - that._renderItemData( ul, item ); - }); - }, - - _renderItemData: function( ul, item ) { - return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); - }, - - _renderItem: function( ul, item ) { - return $( "
    • " ).text( item.label ).appendTo( ul ); - }, - - _move: function( direction, event ) { - if ( !this.menu.element.is( ":visible" ) ) { - this.search( null, event ); - return; - } - if ( this.menu.isFirstItem() && /^previous/.test( direction ) || - this.menu.isLastItem() && /^next/.test( direction ) ) { - - if ( !this.isMultiLine ) { - this._value( this.term ); - } - - this.menu.blur(); - return; - } - this.menu[ direction ]( event ); - }, - - widget: function() { - return this.menu.element; - }, - - _value: function() { - return this.valueMethod.apply( this.element, arguments ); - }, - - _keyEvent: function( keyEvent, event ) { - if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { - this._move( keyEvent, event ); - - // prevents moving cursor to beginning/end of the text field in some browsers - event.preventDefault(); - } - } -}); - -$.extend( $.ui.autocomplete, { - escapeRegex: function( value ) { - return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); - }, - filter: function( array, term ) { - var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); - return $.grep( array, function( value ) { - return matcher.test( value.label || value.value || value ); - }); - } -}); - -// live region extension, adding a `messages` option -// NOTE: This is an experimental API. We are still investigating -// a full solution for string manipulation and internationalization. -$.widget( "ui.autocomplete", $.ui.autocomplete, { - options: { - messages: { - noResults: "No search results.", - results: function( amount ) { - return amount + ( amount > 1 ? " results are" : " result is" ) + - " available, use up and down arrow keys to navigate."; - } - } - }, - - __response: function( content ) { - var message; - this._superApply( arguments ); - if ( this.options.disabled || this.cancelSearch ) { - return; - } - if ( content && content.length ) { - message = this.options.messages.results( content.length ); - } else { - message = this.options.messages.noResults; - } - this.liveRegion.children().hide(); - $( "
      " ).text( message ).appendTo( this.liveRegion ); - } -}); - -var autocomplete = $.ui.autocomplete; - - -/*! - * jQuery UI Button 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/button/ - */ - - -var lastActive, - baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", - formResetHandler = function() { - var form = $( this ); - setTimeout(function() { - form.find( ":ui-button" ).button( "refresh" ); - }, 1 ); - }, - radioGroup = function( radio ) { - var name = radio.name, - form = radio.form, - radios = $( [] ); - if ( name ) { - name = name.replace( /'/g, "\\'" ); - if ( form ) { - radios = $( form ).find( "[name='" + name + "'][type=radio]" ); - } else { - radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument ) - .filter(function() { - return !this.form; - }); - } - } - return radios; - }; - -$.widget( "ui.button", { - version: "1.11.4", - defaultElement: "").addClass(this._triggerClass). - html(!buttonImage ? buttonText : $("").attr( - { src:buttonImage, alt:buttonText, title:buttonText }))); - input[isRTL ? "before" : "after"](inst.trigger); - inst.trigger.click(function() { - if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { - $.datepicker._hideDatepicker(); - } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { - $.datepicker._hideDatepicker(); - $.datepicker._showDatepicker(input[0]); - } else { - $.datepicker._showDatepicker(input[0]); - } - return false; - }); - } - }, - - /* Apply the maximum length for the date format. */ - _autoSize: function(inst) { - if (this._get(inst, "autoSize") && !inst.inline) { - var findMax, max, maxI, i, - date = new Date(2009, 12 - 1, 20), // Ensure double digits - dateFormat = this._get(inst, "dateFormat"); - - if (dateFormat.match(/[DM]/)) { - findMax = function(names) { - max = 0; - maxI = 0; - for (i = 0; i < names.length; i++) { - if (names[i].length > max) { - max = names[i].length; - maxI = i; - } - } - return maxI; - }; - date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? - "monthNames" : "monthNamesShort")))); - date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? - "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); - } - inst.input.attr("size", this._formatDate(inst, date).length); - } - }, - - /* Attach an inline date picker to a div. */ - _inlineDatepicker: function(target, inst) { - var divSpan = $(target); - if (divSpan.hasClass(this.markerClassName)) { - return; - } - divSpan.addClass(this.markerClassName).append(inst.dpDiv); - $.data(target, "datepicker", inst); - this._setDate(inst, this._getDefaultDate(inst), true); - this._updateDatepicker(inst); - this._updateAlternate(inst); - //If disabled option is true, disable the datepicker before showing it (see ticket #5665) - if( inst.settings.disabled ) { - this._disableDatepicker( target ); - } - // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements - // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height - inst.dpDiv.css( "display", "block" ); - }, - - /* Pop-up the date picker in a "dialog" box. - * @param input element - ignored - * @param date string or Date - the initial date to display - * @param onSelect function - the function to call when a date is selected - * @param settings object - update the dialog date picker instance's settings (anonymous object) - * @param pos int[2] - coordinates for the dialog's position within the screen or - * event - with x/y coordinates or - * leave empty for default (screen centre) - * @return the manager object - */ - _dialogDatepicker: function(input, date, onSelect, settings, pos) { - var id, browserWidth, browserHeight, scrollX, scrollY, - inst = this._dialogInst; // internal instance - - if (!inst) { - this.uuid += 1; - id = "dp" + this.uuid; - this._dialogInput = $(""); - this._dialogInput.keydown(this._doKeyDown); - $("body").append(this._dialogInput); - inst = this._dialogInst = this._newInst(this._dialogInput, false); - inst.settings = {}; - $.data(this._dialogInput[0], "datepicker", inst); - } - datepicker_extendRemove(inst.settings, settings || {}); - date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); - this._dialogInput.val(date); - - this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); - if (!this._pos) { - browserWidth = document.documentElement.clientWidth; - browserHeight = document.documentElement.clientHeight; - scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; - scrollY = document.documentElement.scrollTop || document.body.scrollTop; - this._pos = // should use actual width/height below - [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; - } - - // move input on screen for focus, but hidden behind dialog - this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); - inst.settings.onSelect = onSelect; - this._inDialog = true; - this.dpDiv.addClass(this._dialogClass); - this._showDatepicker(this._dialogInput[0]); - if ($.blockUI) { - $.blockUI(this.dpDiv); - } - $.data(this._dialogInput[0], "datepicker", inst); - return this; - }, - - /* Detach a datepicker from its control. - * @param target element - the target input field or division or span - */ - _destroyDatepicker: function(target) { - var nodeName, - $target = $(target), - inst = $.data(target, "datepicker"); - - if (!$target.hasClass(this.markerClassName)) { - return; - } - - nodeName = target.nodeName.toLowerCase(); - $.removeData(target, "datepicker"); - if (nodeName === "input") { - inst.append.remove(); - inst.trigger.remove(); - $target.removeClass(this.markerClassName). - unbind("focus", this._showDatepicker). - unbind("keydown", this._doKeyDown). - unbind("keypress", this._doKeyPress). - unbind("keyup", this._doKeyUp); - } else if (nodeName === "div" || nodeName === "span") { - $target.removeClass(this.markerClassName).empty(); - } - - if ( datepicker_instActive === inst ) { - datepicker_instActive = null; - } - }, - - /* Enable the date picker to a jQuery selection. - * @param target element - the target input field or division or span - */ - _enableDatepicker: function(target) { - var nodeName, inline, - $target = $(target), - inst = $.data(target, "datepicker"); - - if (!$target.hasClass(this.markerClassName)) { - return; - } - - nodeName = target.nodeName.toLowerCase(); - if (nodeName === "input") { - target.disabled = false; - inst.trigger.filter("button"). - each(function() { this.disabled = false; }).end(). - filter("img").css({opacity: "1.0", cursor: ""}); - } else if (nodeName === "div" || nodeName === "span") { - inline = $target.children("." + this._inlineClass); - inline.children().removeClass("ui-state-disabled"); - inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - prop("disabled", false); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value === target ? null : value); }); // delete entry - }, - - /* Disable the date picker to a jQuery selection. - * @param target element - the target input field or division or span - */ - _disableDatepicker: function(target) { - var nodeName, inline, - $target = $(target), - inst = $.data(target, "datepicker"); - - if (!$target.hasClass(this.markerClassName)) { - return; - } - - nodeName = target.nodeName.toLowerCase(); - if (nodeName === "input") { - target.disabled = true; - inst.trigger.filter("button"). - each(function() { this.disabled = true; }).end(). - filter("img").css({opacity: "0.5", cursor: "default"}); - } else if (nodeName === "div" || nodeName === "span") { - inline = $target.children("." + this._inlineClass); - inline.children().addClass("ui-state-disabled"); - inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - prop("disabled", true); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value === target ? null : value); }); // delete entry - this._disabledInputs[this._disabledInputs.length] = target; - }, - - /* Is the first field in a jQuery collection disabled as a datepicker? - * @param target element - the target input field or division or span - * @return boolean - true if disabled, false if enabled - */ - _isDisabledDatepicker: function(target) { - if (!target) { - return false; - } - for (var i = 0; i < this._disabledInputs.length; i++) { - if (this._disabledInputs[i] === target) { - return true; - } - } - return false; - }, - - /* Retrieve the instance data for the target control. - * @param target element - the target input field or division or span - * @return object - the associated instance data - * @throws error if a jQuery problem getting data - */ - _getInst: function(target) { - try { - return $.data(target, "datepicker"); - } - catch (err) { - throw "Missing instance data for this datepicker"; - } - }, - - /* Update or retrieve the settings for a date picker attached to an input field or division. - * @param target element - the target input field or division or span - * @param name object - the new settings to update or - * string - the name of the setting to change or retrieve, - * when retrieving also "all" for all instance settings or - * "defaults" for all global defaults - * @param value any - the new value for the setting - * (omit if above is an object or to retrieve a value) - */ - _optionDatepicker: function(target, name, value) { - var settings, date, minDate, maxDate, - inst = this._getInst(target); - - if (arguments.length === 2 && typeof name === "string") { - return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : - (inst ? (name === "all" ? $.extend({}, inst.settings) : - this._get(inst, name)) : null)); - } - - settings = name || {}; - if (typeof name === "string") { - settings = {}; - settings[name] = value; - } - - if (inst) { - if (this._curInst === inst) { - this._hideDatepicker(); - } - - date = this._getDateDatepicker(target, true); - minDate = this._getMinMaxDate(inst, "min"); - maxDate = this._getMinMaxDate(inst, "max"); - datepicker_extendRemove(inst.settings, settings); - // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided - if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { - inst.settings.minDate = this._formatDate(inst, minDate); - } - if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { - inst.settings.maxDate = this._formatDate(inst, maxDate); - } - if ( "disabled" in settings ) { - if ( settings.disabled ) { - this._disableDatepicker(target); - } else { - this._enableDatepicker(target); - } - } - this._attachments($(target), inst); - this._autoSize(inst); - this._setDate(inst, date); - this._updateAlternate(inst); - this._updateDatepicker(inst); - } - }, - - // change method deprecated - _changeDatepicker: function(target, name, value) { - this._optionDatepicker(target, name, value); - }, - - /* Redraw the date picker attached to an input field or division. - * @param target element - the target input field or division or span - */ - _refreshDatepicker: function(target) { - var inst = this._getInst(target); - if (inst) { - this._updateDatepicker(inst); - } - }, - - /* Set the dates for a jQuery selection. - * @param target element - the target input field or division or span - * @param date Date - the new date - */ - _setDateDatepicker: function(target, date) { - var inst = this._getInst(target); - if (inst) { - this._setDate(inst, date); - this._updateDatepicker(inst); - this._updateAlternate(inst); - } - }, - - /* Get the date(s) for the first entry in a jQuery selection. - * @param target element - the target input field or division or span - * @param noDefault boolean - true if no default date is to be used - * @return Date - the current date - */ - _getDateDatepicker: function(target, noDefault) { - var inst = this._getInst(target); - if (inst && !inst.inline) { - this._setDateFromField(inst, noDefault); - } - return (inst ? this._getDate(inst) : null); - }, - - /* Handle keystrokes. */ - _doKeyDown: function(event) { - var onSelect, dateStr, sel, - inst = $.datepicker._getInst(event.target), - handled = true, - isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); - - inst._keyEvent = true; - if ($.datepicker._datepickerShowing) { - switch (event.keyCode) { - case 9: $.datepicker._hideDatepicker(); - handled = false; - break; // hide on tab out - case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + - $.datepicker._currentClass + ")", inst.dpDiv); - if (sel[0]) { - $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); - } - - onSelect = $.datepicker._get(inst, "onSelect"); - if (onSelect) { - dateStr = $.datepicker._formatDate(inst); - - // trigger custom callback - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); - } else { - $.datepicker._hideDatepicker(); - } - - return false; // don't submit the form - case 27: $.datepicker._hideDatepicker(); - break; // hide on escape - case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, "stepBigMonths") : - -$.datepicker._get(inst, "stepMonths")), "M"); - break; // previous month/year on page up/+ ctrl - case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, "stepBigMonths") : - +$.datepicker._get(inst, "stepMonths")), "M"); - break; // next month/year on page down/+ ctrl - case 35: if (event.ctrlKey || event.metaKey) { - $.datepicker._clearDate(event.target); - } - handled = event.ctrlKey || event.metaKey; - break; // clear on ctrl or command +end - case 36: if (event.ctrlKey || event.metaKey) { - $.datepicker._gotoToday(event.target); - } - handled = event.ctrlKey || event.metaKey; - break; // current on ctrl or command +home - case 37: if (event.ctrlKey || event.metaKey) { - $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); - } - handled = event.ctrlKey || event.metaKey; - // -1 day on ctrl or command +left - if (event.originalEvent.altKey) { - $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, "stepBigMonths") : - -$.datepicker._get(inst, "stepMonths")), "M"); - } - // next month/year on alt +left on Mac - break; - case 38: if (event.ctrlKey || event.metaKey) { - $.datepicker._adjustDate(event.target, -7, "D"); - } - handled = event.ctrlKey || event.metaKey; - break; // -1 week on ctrl or command +up - case 39: if (event.ctrlKey || event.metaKey) { - $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); - } - handled = event.ctrlKey || event.metaKey; - // +1 day on ctrl or command +right - if (event.originalEvent.altKey) { - $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, "stepBigMonths") : - +$.datepicker._get(inst, "stepMonths")), "M"); - } - // next month/year on alt +right - break; - case 40: if (event.ctrlKey || event.metaKey) { - $.datepicker._adjustDate(event.target, +7, "D"); - } - handled = event.ctrlKey || event.metaKey; - break; // +1 week on ctrl or command +down - default: handled = false; - } - } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home - $.datepicker._showDatepicker(this); - } else { - handled = false; - } - - if (handled) { - event.preventDefault(); - event.stopPropagation(); - } - }, - - /* Filter entered characters - based on date format. */ - _doKeyPress: function(event) { - var chars, chr, - inst = $.datepicker._getInst(event.target); - - if ($.datepicker._get(inst, "constrainInput")) { - chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); - chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); - return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); - } - }, - - /* Synchronise manual entry and field/alternate field. */ - _doKeyUp: function(event) { - var date, - inst = $.datepicker._getInst(event.target); - - if (inst.input.val() !== inst.lastVal) { - try { - date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), - (inst.input ? inst.input.val() : null), - $.datepicker._getFormatConfig(inst)); - - if (date) { // only if valid - $.datepicker._setDateFromField(inst); - $.datepicker._updateAlternate(inst); - $.datepicker._updateDatepicker(inst); - } - } - catch (err) { - } - } - return true; - }, - - /* Pop-up the date picker for a given input field. - * If false returned from beforeShow event handler do not show. - * @param input element - the input field attached to the date picker or - * event - if triggered by focus - */ - _showDatepicker: function(input) { - input = input.target || input; - if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger - input = $("input", input.parentNode)[0]; - } - - if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here - return; - } - - var inst, beforeShow, beforeShowSettings, isFixed, - offset, showAnim, duration; - - inst = $.datepicker._getInst(input); - if ($.datepicker._curInst && $.datepicker._curInst !== inst) { - $.datepicker._curInst.dpDiv.stop(true, true); - if ( inst && $.datepicker._datepickerShowing ) { - $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); - } - } - - beforeShow = $.datepicker._get(inst, "beforeShow"); - beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; - if(beforeShowSettings === false){ - return; - } - datepicker_extendRemove(inst.settings, beforeShowSettings); - - inst.lastVal = null; - $.datepicker._lastInput = input; - $.datepicker._setDateFromField(inst); - - if ($.datepicker._inDialog) { // hide cursor - input.value = ""; - } - if (!$.datepicker._pos) { // position below input - $.datepicker._pos = $.datepicker._findPos(input); - $.datepicker._pos[1] += input.offsetHeight; // add the height - } - - isFixed = false; - $(input).parents().each(function() { - isFixed |= $(this).css("position") === "fixed"; - return !isFixed; - }); - - offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; - $.datepicker._pos = null; - //to avoid flashes on Firefox - inst.dpDiv.empty(); - // determine sizing offscreen - inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"}); - $.datepicker._updateDatepicker(inst); - // fix width for dynamic number of date pickers - // and adjust position before showing - offset = $.datepicker._checkOffset(inst, offset, isFixed); - inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? - "static" : (isFixed ? "fixed" : "absolute")), display: "none", - left: offset.left + "px", top: offset.top + "px"}); - - if (!inst.inline) { - showAnim = $.datepicker._get(inst, "showAnim"); - duration = $.datepicker._get(inst, "duration"); - inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); - $.datepicker._datepickerShowing = true; - - if ( $.effects && $.effects.effect[ showAnim ] ) { - inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); - } else { - inst.dpDiv[showAnim || "show"](showAnim ? duration : null); - } - - if ( $.datepicker._shouldFocusInput( inst ) ) { - inst.input.focus(); - } - - $.datepicker._curInst = inst; - } - }, - - /* Generate the date picker content. */ - _updateDatepicker: function(inst) { - this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) - datepicker_instActive = inst; // for delegate hover events - inst.dpDiv.empty().append(this._generateHTML(inst)); - this._attachHandlers(inst); - - var origyearshtml, - numMonths = this._getNumberOfMonths(inst), - cols = numMonths[1], - width = 17, - activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ); - - if ( activeCell.length > 0 ) { - datepicker_handleMouseover.apply( activeCell.get( 0 ) ); - } - - inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); - if (cols > 1) { - inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); - } - inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + - "Class"]("ui-datepicker-multi"); - inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + - "Class"]("ui-datepicker-rtl"); - - if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { - inst.input.focus(); - } - - // deffered render of the years select (to avoid flashes on Firefox) - if( inst.yearshtml ){ - origyearshtml = inst.yearshtml; - setTimeout(function(){ - //assure that inst.yearshtml didn't change. - if( origyearshtml === inst.yearshtml && inst.yearshtml ){ - inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); - } - origyearshtml = inst.yearshtml = null; - }, 0); - } - }, - - // #6694 - don't focus the input if it's already focused - // this breaks the change event in IE - // Support: IE and jQuery <1.9 - _shouldFocusInput: function( inst ) { - return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); - }, - - /* Check positioning to remain on screen. */ - _checkOffset: function(inst, offset, isFixed) { - var dpWidth = inst.dpDiv.outerWidth(), - dpHeight = inst.dpDiv.outerHeight(), - inputWidth = inst.input ? inst.input.outerWidth() : 0, - inputHeight = inst.input ? inst.input.outerHeight() : 0, - viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), - viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); - - offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); - offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; - offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; - - // now check if datepicker is showing outside window viewport - move to a better place if so. - offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? - Math.abs(offset.left + dpWidth - viewWidth) : 0); - offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? - Math.abs(dpHeight + inputHeight) : 0); - - return offset; - }, - - /* Find an object's position on the screen. */ - _findPos: function(obj) { - var position, - inst = this._getInst(obj), - isRTL = this._get(inst, "isRTL"); - - while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { - obj = obj[isRTL ? "previousSibling" : "nextSibling"]; - } - - position = $(obj).offset(); - return [position.left, position.top]; - }, - - /* Hide the date picker from view. - * @param input element - the input field attached to the date picker - */ - _hideDatepicker: function(input) { - var showAnim, duration, postProcess, onClose, - inst = this._curInst; - - if (!inst || (input && inst !== $.data(input, "datepicker"))) { - return; - } - - if (this._datepickerShowing) { - showAnim = this._get(inst, "showAnim"); - duration = this._get(inst, "duration"); - postProcess = function() { - $.datepicker._tidyDialog(inst); - }; - - // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed - if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { - inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); - } else { - inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : - (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); - } - - if (!showAnim) { - postProcess(); - } - this._datepickerShowing = false; - - onClose = this._get(inst, "onClose"); - if (onClose) { - onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); - } - - this._lastInput = null; - if (this._inDialog) { - this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); - if ($.blockUI) { - $.unblockUI(); - $("body").append(this.dpDiv); - } - } - this._inDialog = false; - } - }, - - /* Tidy up after a dialog display. */ - _tidyDialog: function(inst) { - inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar"); - }, - - /* Close date picker if clicked elsewhere. */ - _checkExternalClick: function(event) { - if (!$.datepicker._curInst) { - return; - } - - var $target = $(event.target), - inst = $.datepicker._getInst($target[0]); - - if ( ( ( $target[0].id !== $.datepicker._mainDivId && - $target.parents("#" + $.datepicker._mainDivId).length === 0 && - !$target.hasClass($.datepicker.markerClassName) && - !$target.closest("." + $.datepicker._triggerClass).length && - $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || - ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) { - $.datepicker._hideDatepicker(); - } - }, - - /* Adjust one of the date sub-fields. */ - _adjustDate: function(id, offset, period) { - var target = $(id), - inst = this._getInst(target[0]); - - if (this._isDisabledDatepicker(target[0])) { - return; - } - this._adjustInstDate(inst, offset + - (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning - period); - this._updateDatepicker(inst); - }, - - /* Action for current link. */ - _gotoToday: function(id) { - var date, - target = $(id), - inst = this._getInst(target[0]); - - if (this._get(inst, "gotoCurrent") && inst.currentDay) { - inst.selectedDay = inst.currentDay; - inst.drawMonth = inst.selectedMonth = inst.currentMonth; - inst.drawYear = inst.selectedYear = inst.currentYear; - } else { - date = new Date(); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - } - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Action for selecting a new month/year. */ - _selectMonthYear: function(id, select, period) { - var target = $(id), - inst = this._getInst(target[0]); - - inst["selected" + (period === "M" ? "Month" : "Year")] = - inst["draw" + (period === "M" ? "Month" : "Year")] = - parseInt(select.options[select.selectedIndex].value,10); - - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Action for selecting a day. */ - _selectDay: function(id, month, year, td) { - var inst, - target = $(id); - - if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { - return; - } - - inst = this._getInst(target[0]); - inst.selectedDay = inst.currentDay = $("a", td).html(); - inst.selectedMonth = inst.currentMonth = month; - inst.selectedYear = inst.currentYear = year; - this._selectDate(id, this._formatDate(inst, - inst.currentDay, inst.currentMonth, inst.currentYear)); - }, - - /* Erase the input field and hide the date picker. */ - _clearDate: function(id) { - var target = $(id); - this._selectDate(target, ""); - }, - - /* Update the input field with the selected date. */ - _selectDate: function(id, dateStr) { - var onSelect, - target = $(id), - inst = this._getInst(target[0]); - - dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); - if (inst.input) { - inst.input.val(dateStr); - } - this._updateAlternate(inst); - - onSelect = this._get(inst, "onSelect"); - if (onSelect) { - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback - } else if (inst.input) { - inst.input.trigger("change"); // fire the change event - } - - if (inst.inline){ - this._updateDatepicker(inst); - } else { - this._hideDatepicker(); - this._lastInput = inst.input[0]; - if (typeof(inst.input[0]) !== "object") { - inst.input.focus(); // restore focus - } - this._lastInput = null; - } - }, - - /* Update any alternate field to synchronise with the main field. */ - _updateAlternate: function(inst) { - var altFormat, date, dateStr, - altField = this._get(inst, "altField"); - - if (altField) { // update alternate field too - altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); - date = this._getDate(inst); - dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); - $(altField).each(function() { $(this).val(dateStr); }); - } - }, - - /* Set as beforeShowDay function to prevent selection of weekends. - * @param date Date - the date to customise - * @return [boolean, string] - is this date selectable?, what is its CSS class? - */ - noWeekends: function(date) { - var day = date.getDay(); - return [(day > 0 && day < 6), ""]; - }, - - /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. - * @param date Date - the date to get the week for - * @return number - the number of the week within the year that contains this date - */ - iso8601Week: function(date) { - var time, - checkDate = new Date(date.getTime()); - - // Find Thursday of this week starting on Monday - checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); - - time = checkDate.getTime(); - checkDate.setMonth(0); // Compare with Jan 1 - checkDate.setDate(1); - return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; - }, - - /* Parse a string value into a date object. - * See formatDate below for the possible formats. - * - * @param format string - the expected format of the date - * @param value string - the date in the above format - * @param settings Object - attributes include: - * shortYearCutoff number - the cutoff year for determining the century (optional) - * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - * dayNames string[7] - names of the days from Sunday (optional) - * monthNamesShort string[12] - abbreviated names of the months (optional) - * monthNames string[12] - names of the months (optional) - * @return Date - the extracted date value or null if value is blank - */ - parseDate: function (format, value, settings) { - if (format == null || value == null) { - throw "Invalid arguments"; - } - - value = (typeof value === "object" ? value.toString() : value + ""); - if (value === "") { - return null; - } - - var iFormat, dim, extra, - iValue = 0, - shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, - shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : - new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), - dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, - dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, - monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, - monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, - year = -1, - month = -1, - day = -1, - doy = -1, - literal = false, - date, - // Check whether a format character is doubled - lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); - if (matches) { - iFormat++; - } - return matches; - }, - // Extract a number from the string value - getNumber = function(match) { - var isDoubled = lookAhead(match), - size = (match === "@" ? 14 : (match === "!" ? 20 : - (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), - minSize = (match === "y" ? size : 1), - digits = new RegExp("^\\d{" + minSize + "," + size + "}"), - num = value.substring(iValue).match(digits); - if (!num) { - throw "Missing number at position " + iValue; - } - iValue += num[0].length; - return parseInt(num[0], 10); - }, - // Extract a name from the string value and convert to an index - getName = function(match, shortNames, longNames) { - var index = -1, - names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { - return [ [k, v] ]; - }).sort(function (a, b) { - return -(a[1].length - b[1].length); - }); - - $.each(names, function (i, pair) { - var name = pair[1]; - if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { - index = pair[0]; - iValue += name.length; - return false; - } - }); - if (index !== -1) { - return index + 1; - } else { - throw "Unknown name at position " + iValue; - } - }, - // Confirm that a literal character matches the string value - checkLiteral = function() { - if (value.charAt(iValue) !== format.charAt(iFormat)) { - throw "Unexpected literal at position " + iValue; - } - iValue++; - }; - - for (iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !lookAhead("'")) { - literal = false; - } else { - checkLiteral(); - } - } else { - switch (format.charAt(iFormat)) { - case "d": - day = getNumber("d"); - break; - case "D": - getName("D", dayNamesShort, dayNames); - break; - case "o": - doy = getNumber("o"); - break; - case "m": - month = getNumber("m"); - break; - case "M": - month = getName("M", monthNamesShort, monthNames); - break; - case "y": - year = getNumber("y"); - break; - case "@": - date = new Date(getNumber("@")); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "!": - date = new Date((getNumber("!") - this._ticksTo1970) / 10000); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "'": - if (lookAhead("'")){ - checkLiteral(); - } else { - literal = true; - } - break; - default: - checkLiteral(); - } - } - } - - if (iValue < value.length){ - extra = value.substr(iValue); - if (!/^\s+/.test(extra)) { - throw "Extra/unparsed characters found in date: " + extra; - } - } - - if (year === -1) { - year = new Date().getFullYear(); - } else if (year < 100) { - year += new Date().getFullYear() - new Date().getFullYear() % 100 + - (year <= shortYearCutoff ? 0 : -100); - } - - if (doy > -1) { - month = 1; - day = doy; - do { - dim = this._getDaysInMonth(year, month - 1); - if (day <= dim) { - break; - } - month++; - day -= dim; - } while (true); - } - - date = this._daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { - throw "Invalid date"; // E.g. 31/02/00 - } - return date; - }, - - /* Standard date formats. */ - ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) - COOKIE: "D, dd M yy", - ISO_8601: "yy-mm-dd", - RFC_822: "D, d M y", - RFC_850: "DD, dd-M-y", - RFC_1036: "D, d M y", - RFC_1123: "D, d M yy", - RFC_2822: "D, d M yy", - RSS: "D, d M y", // RFC 822 - TICKS: "!", - TIMESTAMP: "@", - W3C: "yy-mm-dd", // ISO 8601 - - _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + - Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), - - /* Format a date object into a string value. - * The format can be combinations of the following: - * d - day of month (no leading zero) - * dd - day of month (two digit) - * o - day of year (no leading zeros) - * oo - day of year (three digit) - * D - day name short - * DD - day name long - * m - month of year (no leading zero) - * mm - month of year (two digit) - * M - month name short - * MM - month name long - * y - year (two digit) - * yy - year (four digit) - * @ - Unix timestamp (ms since 01/01/1970) - * ! - Windows ticks (100ns since 01/01/0001) - * "..." - literal text - * '' - single quote - * - * @param format string - the desired format of the date - * @param date Date - the date value to format - * @param settings Object - attributes include: - * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - * dayNames string[7] - names of the days from Sunday (optional) - * monthNamesShort string[12] - abbreviated names of the months (optional) - * monthNames string[12] - names of the months (optional) - * @return string - the date in the above format - */ - formatDate: function (format, date, settings) { - if (!date) { - return ""; - } - - var iFormat, - dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, - dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, - monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, - monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, - // Check whether a format character is doubled - lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); - if (matches) { - iFormat++; - } - return matches; - }, - // Format a number, with leading zero if necessary - formatNumber = function(match, value, len) { - var num = "" + value; - if (lookAhead(match)) { - while (num.length < len) { - num = "0" + num; - } - } - return num; - }, - // Format a name, short or long as requested - formatName = function(match, value, shortNames, longNames) { - return (lookAhead(match) ? longNames[value] : shortNames[value]); - }, - output = "", - literal = false; - - if (date) { - for (iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !lookAhead("'")) { - literal = false; - } else { - output += format.charAt(iFormat); - } - } else { - switch (format.charAt(iFormat)) { - case "d": - output += formatNumber("d", date.getDate(), 2); - break; - case "D": - output += formatName("D", date.getDay(), dayNamesShort, dayNames); - break; - case "o": - output += formatNumber("o", - Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); - break; - case "m": - output += formatNumber("m", date.getMonth() + 1, 2); - break; - case "M": - output += formatName("M", date.getMonth(), monthNamesShort, monthNames); - break; - case "y": - output += (lookAhead("y") ? date.getFullYear() : - (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); - break; - case "@": - output += date.getTime(); - break; - case "!": - output += date.getTime() * 10000 + this._ticksTo1970; - break; - case "'": - if (lookAhead("'")) { - output += "'"; - } else { - literal = true; - } - break; - default: - output += format.charAt(iFormat); - } - } - } - } - return output; - }, - - /* Extract all possible characters from the date format. */ - _possibleChars: function (format) { - var iFormat, - chars = "", - literal = false, - // Check whether a format character is doubled - lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); - if (matches) { - iFormat++; - } - return matches; - }; - - for (iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !lookAhead("'")) { - literal = false; - } else { - chars += format.charAt(iFormat); - } - } else { - switch (format.charAt(iFormat)) { - case "d": case "m": case "y": case "@": - chars += "0123456789"; - break; - case "D": case "M": - return null; // Accept anything - case "'": - if (lookAhead("'")) { - chars += "'"; - } else { - literal = true; - } - break; - default: - chars += format.charAt(iFormat); - } - } - } - return chars; - }, - - /* Get a setting value, defaulting if necessary. */ - _get: function(inst, name) { - return inst.settings[name] !== undefined ? - inst.settings[name] : this._defaults[name]; - }, - - /* Parse existing date and initialise date picker. */ - _setDateFromField: function(inst, noDefault) { - if (inst.input.val() === inst.lastVal) { - return; - } - - var dateFormat = this._get(inst, "dateFormat"), - dates = inst.lastVal = inst.input ? inst.input.val() : null, - defaultDate = this._getDefaultDate(inst), - date = defaultDate, - settings = this._getFormatConfig(inst); - - try { - date = this.parseDate(dateFormat, dates, settings) || defaultDate; - } catch (event) { - dates = (noDefault ? "" : dates); - } - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - inst.currentDay = (dates ? date.getDate() : 0); - inst.currentMonth = (dates ? date.getMonth() : 0); - inst.currentYear = (dates ? date.getFullYear() : 0); - this._adjustInstDate(inst); - }, - - /* Retrieve the default date shown on opening. */ - _getDefaultDate: function(inst) { - return this._restrictMinMax(inst, - this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); - }, - - /* A date may be specified as an exact value or a relative one. */ - _determineDate: function(inst, date, defaultDate) { - var offsetNumeric = function(offset) { - var date = new Date(); - date.setDate(date.getDate() + offset); - return date; - }, - offsetString = function(offset) { - try { - return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), - offset, $.datepicker._getFormatConfig(inst)); - } - catch (e) { - // Ignore - } - - var date = (offset.toLowerCase().match(/^c/) ? - $.datepicker._getDate(inst) : null) || new Date(), - year = date.getFullYear(), - month = date.getMonth(), - day = date.getDate(), - pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, - matches = pattern.exec(offset); - - while (matches) { - switch (matches[2] || "d") { - case "d" : case "D" : - day += parseInt(matches[1],10); break; - case "w" : case "W" : - day += parseInt(matches[1],10) * 7; break; - case "m" : case "M" : - month += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - case "y": case "Y" : - year += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - } - matches = pattern.exec(offset); - } - return new Date(year, month, day); - }, - newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : - (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); - - newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); - if (newDate) { - newDate.setHours(0); - newDate.setMinutes(0); - newDate.setSeconds(0); - newDate.setMilliseconds(0); - } - return this._daylightSavingAdjust(newDate); - }, - - /* Handle switch to/from daylight saving. - * Hours may be non-zero on daylight saving cut-over: - * > 12 when midnight changeover, but then cannot generate - * midnight datetime, so jump to 1AM, otherwise reset. - * @param date (Date) the date to check - * @return (Date) the corrected date - */ - _daylightSavingAdjust: function(date) { - if (!date) { - return null; - } - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); - return date; - }, - - /* Set the date(s) directly. */ - _setDate: function(inst, date, noChange) { - var clear = !date, - origMonth = inst.selectedMonth, - origYear = inst.selectedYear, - newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); - - inst.selectedDay = inst.currentDay = newDate.getDate(); - inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); - inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); - if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { - this._notifyChange(inst); - } - this._adjustInstDate(inst); - if (inst.input) { - inst.input.val(clear ? "" : this._formatDate(inst)); - } - }, - - /* Retrieve the date(s) directly. */ - _getDate: function(inst) { - var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : - this._daylightSavingAdjust(new Date( - inst.currentYear, inst.currentMonth, inst.currentDay))); - return startDate; - }, - - /* Attach the onxxx handlers. These are declared statically so - * they work with static code transformers like Caja. - */ - _attachHandlers: function(inst) { - var stepMonths = this._get(inst, "stepMonths"), - id = "#" + inst.id.replace( /\\\\/g, "\\" ); - inst.dpDiv.find("[data-handler]").map(function () { - var handler = { - prev: function () { - $.datepicker._adjustDate(id, -stepMonths, "M"); - }, - next: function () { - $.datepicker._adjustDate(id, +stepMonths, "M"); - }, - hide: function () { - $.datepicker._hideDatepicker(); - }, - today: function () { - $.datepicker._gotoToday(id); - }, - selectDay: function () { - $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); - return false; - }, - selectMonth: function () { - $.datepicker._selectMonthYear(id, this, "M"); - return false; - }, - selectYear: function () { - $.datepicker._selectMonthYear(id, this, "Y"); - return false; - } - }; - $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); - }); - }, - - /* Generate the HTML for the current state of the date picker. */ - _generateHTML: function(inst) { - var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, - controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, - monthNames, monthNamesShort, beforeShowDay, showOtherMonths, - selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, - cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, - printDate, dRow, tbody, daySettings, otherMonth, unselectable, - tempDate = new Date(), - today = this._daylightSavingAdjust( - new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time - isRTL = this._get(inst, "isRTL"), - showButtonPanel = this._get(inst, "showButtonPanel"), - hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), - navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), - numMonths = this._getNumberOfMonths(inst), - showCurrentAtPos = this._get(inst, "showCurrentAtPos"), - stepMonths = this._get(inst, "stepMonths"), - isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), - currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : - new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), - minDate = this._getMinMaxDate(inst, "min"), - maxDate = this._getMinMaxDate(inst, "max"), - drawMonth = inst.drawMonth - showCurrentAtPos, - drawYear = inst.drawYear; - - if (drawMonth < 0) { - drawMonth += 12; - drawYear--; - } - if (maxDate) { - maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), - maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); - maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); - while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { - drawMonth--; - if (drawMonth < 0) { - drawMonth = 11; - drawYear--; - } - } - } - inst.drawMonth = drawMonth; - inst.drawYear = drawYear; - - prevText = this._get(inst, "prevText"); - prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), - this._getFormatConfig(inst))); - - prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - "" + prevText + "" : - (hideIfNoPrevNext ? "" : "" + prevText + "")); - - nextText = this._get(inst, "nextText"); - nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), - this._getFormatConfig(inst))); - - next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - "" + nextText + "" : - (hideIfNoPrevNext ? "" : "" + nextText + "")); - - currentText = this._get(inst, "currentText"); - gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); - currentText = (!navigationAsDateFormat ? currentText : - this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - - controls = (!inst.inline ? "" : ""); - - buttonPanel = (showButtonPanel) ? "
      " + (isRTL ? controls : "") + - (this._isInRange(inst, gotoDate) ? "" : "") + (isRTL ? "" : controls) + "
      " : ""; - - firstDay = parseInt(this._get(inst, "firstDay"),10); - firstDay = (isNaN(firstDay) ? 0 : firstDay); - - showWeek = this._get(inst, "showWeek"); - dayNames = this._get(inst, "dayNames"); - dayNamesMin = this._get(inst, "dayNamesMin"); - monthNames = this._get(inst, "monthNames"); - monthNamesShort = this._get(inst, "monthNamesShort"); - beforeShowDay = this._get(inst, "beforeShowDay"); - showOtherMonths = this._get(inst, "showOtherMonths"); - selectOtherMonths = this._get(inst, "selectOtherMonths"); - defaultDate = this._getDefaultDate(inst); - html = ""; - dow; - for (row = 0; row < numMonths[0]; row++) { - group = ""; - this.maxRows = 4; - for (col = 0; col < numMonths[1]; col++) { - selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); - cornerClass = " ui-corner-all"; - calender = ""; - if (isMultiMonth) { - calender += "
      "; - } - calender += "
      " + - (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + - (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + - this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, - row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers - "
      " + - ""; - thead = (showWeek ? "" : ""); - for (dow = 0; dow < 7; dow++) { // days of the week - day = (dow + firstDay) % 7; - thead += ""; - } - calender += thead + ""; - daysInMonth = this._getDaysInMonth(drawYear, drawMonth); - if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { - inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); - } - leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; - curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate - numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) - this.maxRows = numRows; - printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); - for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows - calender += ""; - tbody = (!showWeek ? "" : ""); - for (dow = 0; dow < 7; dow++) { // create date picker days - daySettings = (beforeShowDay ? - beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); - otherMonth = (printDate.getMonth() !== drawMonth); - unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || - (minDate && printDate < minDate) || (maxDate && printDate > maxDate); - tbody += ""; // display selectable date - printDate.setDate(printDate.getDate() + 1); - printDate = this._daylightSavingAdjust(printDate); - } - calender += tbody + ""; - } - drawMonth++; - if (drawMonth > 11) { - drawMonth = 0; - drawYear++; - } - calender += "
      " + this._get(inst, "weekHeader") + "= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + - "" + dayNamesMin[day] + "
      " + - this._get(inst, "calculateWeek")(printDate) + "" + // actions - (otherMonth && !showOtherMonths ? " " : // display for other months - (unselectable ? "" + printDate.getDate() + "" : "" + printDate.getDate() + "")) + "
      " + (isMultiMonth ? "
      " + - ((numMonths[0] > 0 && col === numMonths[1]-1) ? "
      " : "") : ""); - group += calender; - } - html += group; - } - html += buttonPanel; - inst._keyEvent = false; - return html; - }, - - /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { - - var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, - changeMonth = this._get(inst, "changeMonth"), - changeYear = this._get(inst, "changeYear"), - showMonthAfterYear = this._get(inst, "showMonthAfterYear"), - html = "
      ", - monthHtml = ""; - - // month selection - if (secondary || !changeMonth) { - monthHtml += "" + monthNames[drawMonth] + ""; - } else { - inMinYear = (minDate && minDate.getFullYear() === drawYear); - inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); - monthHtml += ""; - } - - if (!showMonthAfterYear) { - html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); - } - - // year selection - if ( !inst.yearshtml ) { - inst.yearshtml = ""; - if (secondary || !changeYear) { - html += "" + drawYear + ""; - } else { - // determine range of years to display - years = this._get(inst, "yearRange").split(":"); - thisYear = new Date().getFullYear(); - determineYear = function(value) { - var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); - }; - year = determineYear(years[0]); - endYear = Math.max(year, determineYear(years[1] || "")); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += ""; - - html += inst.yearshtml; - inst.yearshtml = null; - } - } - - html += this._get(inst, "yearSuffix"); - if (showMonthAfterYear) { - html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; - } - html += "
      "; // Close datepicker_header - return html; - }, - - /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period === "Y" ? offset : 0), - month = inst.drawMonth + (period === "M" ? offset : 0), - day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), - date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); - - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period === "M" || period === "Y") { - this._notifyChange(inst); - } - }, - - /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, "min"), - maxDate = this._getMinMaxDate(inst, "max"), - newDate = (minDate && date < minDate ? minDate : date); - return (maxDate && newDate > maxDate ? maxDate : newDate); - }, - - /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, "onChangeMonthYear"); - if (onChange) { - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); - } - }, - - /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, "numberOfMonths"); - return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); - }, - - /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + "Date"), null); - }, - - /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); - }, - - /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); - }, - - /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst), - date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - - if (offset < 0) { - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); - } - return this._isInRange(inst, date); - }, - - /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { - var yearSplit, currentYear, - minDate = this._getMinMaxDate(inst, "min"), - maxDate = this._getMinMaxDate(inst, "max"), - minYear = null, - maxYear = null, - years = this._get(inst, "yearRange"); - if (years){ - yearSplit = years.split(":"); - currentYear = new Date().getFullYear(); - minYear = parseInt(yearSplit[0], 10); - maxYear = parseInt(yearSplit[1], 10); - if ( yearSplit[0].match(/[+\-].*/) ) { - minYear += currentYear; - } - if ( yearSplit[1].match(/[+\-].*/) ) { - maxYear += currentYear; - } - } - - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime()) && - (!minYear || date.getFullYear() >= minYear) && - (!maxYear || date.getFullYear() <= maxYear)); - }, - - /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, "shortYearCutoff"); - shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), - monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")}; - }, - - /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { - inst.currentDay = inst.selectedDay; - inst.currentMonth = inst.selectedMonth; - inst.currentYear = inst.selectedYear; - } - var date = (day ? (typeof day === "object" ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); - } -}); - -/* - * Bind hover events for datepicker elements. - * Done via delegate so the binding only occurs once in the lifetime of the parent div. - * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. - */ -function datepicker_bindHover(dpDiv) { - var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; - return dpDiv.delegate(selector, "mouseout", function() { - $(this).removeClass("ui-state-hover"); - if (this.className.indexOf("ui-datepicker-prev") !== -1) { - $(this).removeClass("ui-datepicker-prev-hover"); - } - if (this.className.indexOf("ui-datepicker-next") !== -1) { - $(this).removeClass("ui-datepicker-next-hover"); - } - }) - .delegate( selector, "mouseover", datepicker_handleMouseover ); -} - -function datepicker_handleMouseover() { - if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { - $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); - $(this).addClass("ui-state-hover"); - if (this.className.indexOf("ui-datepicker-prev") !== -1) { - $(this).addClass("ui-datepicker-prev-hover"); - } - if (this.className.indexOf("ui-datepicker-next") !== -1) { - $(this).addClass("ui-datepicker-next-hover"); - } - } -} - -/* jQuery extend now ignores nulls! */ -function datepicker_extendRemove(target, props) { - $.extend(target, props); - for (var name in props) { - if (props[name] == null) { - target[name] = props[name]; - } - } - return target; -} - -/* Invoke the datepicker functionality. + function Datepicker () { + this._curInst = null // The current instance in use + this._keyEvent = false // If the last event was a key event + this._disabledInputs = [] // List of date picker inputs that have been disabled + this._datepickerShowing = false // True if the popup picker is showing , false if not + this._inDialog = false // True if showing within a "dialog", false if not + this._mainDivId = 'ui-datepicker-div' // The ID of the main datepicker division + this._inlineClass = 'ui-datepicker-inline' // The name of the inline marker class + this._appendClass = 'ui-datepicker-append' // The name of the append marker class + this._triggerClass = 'ui-datepicker-trigger' // The name of the trigger marker class + this._dialogClass = 'ui-datepicker-dialog' // The name of the dialog marker class + this._disableClass = 'ui-datepicker-disabled' // The name of the disabled covering marker class + this._unselectableClass = 'ui-datepicker-unselectable' // The name of the unselectable cell marker class + this._currentClass = 'ui-datepicker-current-day' // The name of the current day marker class + this._dayOverClass = 'ui-datepicker-days-cell-over' // The name of the day hover marker class + this.regional = [] // Available regional settings, indexed by language code + this.regional[''] = { + // Default regional settings + closeText: 'Done', // Display text for close link + prevText: 'Prev', // Display text for previous month link + nextText: 'Next', // Display text for next month link + currentText: 'Today', // Display text for current month link + monthNames: [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December' + ], // Names of months for drop-down and formatting + monthNamesShort: [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec' + ], // For formatting + dayNames: [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday' + ], // For formatting + dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting + dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], // Column headings for days starting at Sunday + weekHeader: 'Wk', // Column header for week of the year + dateFormat: 'mm/dd/yy', // See format options on parseDate + firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... + isRTL: false, // True if right-to-left language, false if left-to-right + showMonthAfterYear: false, // True if the year select precedes month, false for month then year + yearSuffix: '' // Additional text to append to the year in the month headers + } + this._defaults = { + // Global defaults for all the date picker instances + showOn: 'focus', // "focus" for popup on focus, + // "button" for trigger button, or "both" for either + showAnim: 'fadeIn', // Name of jQuery animation for popup + showOptions: {}, // Options for enhanced animations + defaultDate: null, // Used when field is blank: actual date, + // +/-number for offset from today, null for today + appendText: '', // Display text following the input box, e.g. showing the format + buttonText: '...', // Text for trigger button + buttonImage: '', // URL for trigger button image + buttonImageOnly: false, // True if the image appears alone, false if it appears on a button + hideIfNoPrevNext: false, // True to hide next/previous month links + // if not applicable, false to just disable them + navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links + gotoCurrent: false, // True if today link goes back to current selection instead + changeMonth: false, // True if month can be selected directly, false if only prev/next + changeYear: false, // True if year can be selected directly, false if only prev/next + yearRange: 'c-10:c+10', // Range of years to display in drop-down, + // either relative to today's year (-nn:+nn), relative to currently displayed year + // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) + showOtherMonths: false, // True to show dates in other months, false to leave blank + selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable + showWeek: false, // True to show week of the year, false to not show it + calculateWeek: this.iso8601Week, // How to calculate the week of the year, + // takes a Date and returns the number of the week for it + shortYearCutoff: '+10', // Short year values < this are in the current century, + // > this are in the previous century, + // string value starting with "+" for current year + value + minDate: null, // The earliest selectable date, or null for no limit + maxDate: null, // The latest selectable date, or null for no limit + duration: 'fast', // Duration of display/closure + beforeShowDay: null, // Function that takes a date and returns an array with + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", + // [2] = cell title (optional), e.g. $.datepicker.noWeekends + beforeShow: null, // Function that takes an input field and + // returns a set of custom settings for the date picker + onSelect: null, // Define a callback function when a date is selected + onChangeMonthYear: null, // Define a callback function when the month or year is changed + onClose: null, // Define a callback function when the datepicker is closed + numberOfMonths: 1, // Number of months to show at a time + showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) + stepMonths: 1, // Number of months to step back/forward + stepBigMonths: 12, // Number of months to step back/forward for the big links + altField: '', // Selector for an alternate field to store selected dates into + altFormat: '', // The date format to use for the alternate field + constrainInput: true, // The input is constrained by the current date format + showButtonPanel: false, // True to show button panel, false to not show it + autoSize: false, // True to size the input for the date format, false to leave as is + disabled: false // The initial disabled state + } + $.extend(this._defaults, this.regional['']) + this.regional.en = $.extend(true, {}, this.regional['']) + this.regional['en-US'] = $.extend(true, {}, this.regional.en) + this.dpDiv = datepicker_bindHover( + $( + "
      " + ) + ) + } + + $.extend(Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ + markerClassName: 'hasDatepicker', + + // Keep track of the maximum number of rows displayed (see #7043) + maxRows: 4, + + // TODO rename to "widget" when switching to widget factory + _widgetDatepicker: function () { + return this.dpDiv + }, + + /* Override the default settings for all instances of the date picker. + * @param settings object - the new settings to use as defaults (anonymous object) + * @return the manager object + */ + setDefaults: function (settings) { + datepicker_extendRemove(this._defaults, settings || {}) + return this + }, + + /* Attach the date picker to a jQuery selection. + * @param target element - the target input field or division or span + * @param settings object - the new settings to use for this date picker instance (anonymous) + */ + _attachDatepicker: function (target, settings) { + let nodeName, inline, inst + nodeName = target.nodeName.toLowerCase() + inline = nodeName === 'div' || nodeName === 'span' + if (!target.id) { + this.uuid += 1 + target.id = 'dp' + this.uuid + } + inst = this._newInst($(target), inline) + inst.settings = $.extend({}, settings || {}) + if (nodeName === 'input') { + this._connectDatepicker(target, inst) + } else if (inline) { + this._inlineDatepicker(target, inst) + } + }, + + /* Create a new instance object. */ + _newInst: function (target, inline) { + const id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, '\\\\$1') // escape jQuery meta chars + return { + id, + input: target, // associated target + selectedDay: 0, + selectedMonth: 0, + selectedYear: 0, // current selection + drawMonth: 0, + drawYear: 0, // month being drawn + inline, // is datepicker inline or not + dpDiv: !inline + ? this.dpDiv // presentation div + : datepicker_bindHover( + $( + "
      " + ) + ) + } + }, + + /* Attach the date picker to an input field. */ + _connectDatepicker: function (target, inst) { + const input = $(target) + inst.append = $([]) + inst.trigger = $([]) + if (input.hasClass(this.markerClassName)) { + return + } + this._attachments(input, inst) + input + .addClass(this.markerClassName) + .keydown(this._doKeyDown) + .keypress(this._doKeyPress) + .keyup(this._doKeyUp) + this._autoSize(inst) + $.data(target, 'datepicker', inst) + // If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) + if (inst.settings.disabled) { + this._disableDatepicker(target) + } + }, + + /* Make attachments based on settings. */ + _attachments: function (input, inst) { + let showOn + let buttonText + let buttonImage + const appendText = this._get(inst, 'appendText') + const isRTL = this._get(inst, 'isRTL') + + if (inst.append) { + inst.append.remove() + } + if (appendText) { + inst.append = $( + "" + appendText + '' + ) + input[isRTL ? 'before' : 'after'](inst.append) + } + + input.unbind('focus', this._showDatepicker) + + if (inst.trigger) { + inst.trigger.remove() + } + + showOn = this._get(inst, 'showOn') + if (showOn === 'focus' || showOn === 'both') { + // pop-up date picker when in the marked field + input.focus(this._showDatepicker) + } + if (showOn === 'button' || showOn === 'both') { + // pop-up date picker when button clicked + buttonText = this._get(inst, 'buttonText') + buttonImage = this._get(inst, 'buttonImage') + inst.trigger = $( + this._get(inst, 'buttonImageOnly') + ? $('') + .addClass(this._triggerClass) + .attr({ src: buttonImage, alt: buttonText, title: buttonText }) + : $("") + .addClass(this._triggerClass) + .html( + !buttonImage + ? buttonText + : $('').attr({ + src: buttonImage, + alt: buttonText, + title: buttonText + }) + ) + ) + input[isRTL ? 'before' : 'after'](inst.trigger) + inst.trigger.click(function () { + if ( + $.datepicker._datepickerShowing && + $.datepicker._lastInput === input[0] + ) { + $.datepicker._hideDatepicker() + } else if ( + $.datepicker._datepickerShowing && + $.datepicker._lastInput !== input[0] + ) { + $.datepicker._hideDatepicker() + $.datepicker._showDatepicker(input[0]) + } else { + $.datepicker._showDatepicker(input[0]) + } + return false + }) + } + }, + + /* Apply the maximum length for the date format. */ + _autoSize: function (inst) { + if (this._get(inst, 'autoSize') && !inst.inline) { + let findMax + let max + let maxI + let i + const date = new Date(2009, 12 - 1, 20) // Ensure double digits + const dateFormat = this._get(inst, 'dateFormat') + + if (dateFormat.match(/[DM]/)) { + findMax = function (names) { + max = 0 + maxI = 0 + for (i = 0; i < names.length; i++) { + if (names[i].length > max) { + max = names[i].length + maxI = i + } + } + return maxI + } + date.setMonth( + findMax( + this._get( + inst, + dateFormat.match(/MM/) ? 'monthNames' : 'monthNamesShort' + ) + ) + ) + date.setDate( + findMax( + this._get( + inst, + dateFormat.match(/DD/) ? 'dayNames' : 'dayNamesShort' + ) + ) + + 20 - + date.getDay() + ) + } + inst.input.attr('size', this._formatDate(inst, date).length) + } + }, + + /* Attach an inline date picker to a div. */ + _inlineDatepicker: function (target, inst) { + const divSpan = $(target) + if (divSpan.hasClass(this.markerClassName)) { + return + } + divSpan.addClass(this.markerClassName).append(inst.dpDiv) + $.data(target, 'datepicker', inst) + this._setDate(inst, this._getDefaultDate(inst), true) + this._updateDatepicker(inst) + this._updateAlternate(inst) + // If disabled option is true, disable the datepicker before showing it (see ticket #5665) + if (inst.settings.disabled) { + this._disableDatepicker(target) + } + // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements + // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height + inst.dpDiv.css('display', 'block') + }, + + /* Pop-up the date picker in a "dialog" box. + * @param input element - ignored + * @param date string or Date - the initial date to display + * @param onSelect function - the function to call when a date is selected + * @param settings object - update the dialog date picker instance's settings (anonymous object) + * @param pos int[2] - coordinates for the dialog's position within the screen or + * event - with x/y coordinates or + * leave empty for default (screen centre) + * @return the manager object + */ + _dialogDatepicker: function (input, date, onSelect, settings, pos) { + let id + let browserWidth + let browserHeight + let scrollX + let scrollY + let inst = this._dialogInst // internal instance + + if (!inst) { + this.uuid += 1 + id = 'dp' + this.uuid + this._dialogInput = $( + "" + ) + this._dialogInput.keydown(this._doKeyDown) + $('body').append(this._dialogInput) + inst = this._dialogInst = this._newInst(this._dialogInput, false) + inst.settings = {} + $.data(this._dialogInput[0], 'datepicker', inst) + } + datepicker_extendRemove(inst.settings, settings || {}) + date = + date && date.constructor === Date ? this._formatDate(inst, date) : date + this._dialogInput.val(date) + + this._pos = pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null + if (!this._pos) { + browserWidth = document.documentElement.clientWidth + browserHeight = document.documentElement.clientHeight + scrollX = + document.documentElement.scrollLeft || document.body.scrollLeft + scrollY = document.documentElement.scrollTop || document.body.scrollTop + this._pos = + // should use actual width/height below + [browserWidth / 2 - 100 + scrollX, browserHeight / 2 - 150 + scrollY] + } + + // move input on screen for focus, but hidden behind dialog + this._dialogInput + .css('left', this._pos[0] + 20 + 'px') + .css('top', this._pos[1] + 'px') + inst.settings.onSelect = onSelect + this._inDialog = true + this.dpDiv.addClass(this._dialogClass) + this._showDatepicker(this._dialogInput[0]) + if ($.blockUI) { + $.blockUI(this.dpDiv) + } + $.data(this._dialogInput[0], 'datepicker', inst) + return this + }, + + /* Detach a datepicker from its control. + * @param target element - the target input field or division or span + */ + _destroyDatepicker: function (target) { + let nodeName + const $target = $(target) + const inst = $.data(target, 'datepicker') + + if (!$target.hasClass(this.markerClassName)) { + return + } + + nodeName = target.nodeName.toLowerCase() + $.removeData(target, 'datepicker') + if (nodeName === 'input') { + inst.append.remove() + inst.trigger.remove() + $target + .removeClass(this.markerClassName) + .unbind('focus', this._showDatepicker) + .unbind('keydown', this._doKeyDown) + .unbind('keypress', this._doKeyPress) + .unbind('keyup', this._doKeyUp) + } else if (nodeName === 'div' || nodeName === 'span') { + $target.removeClass(this.markerClassName).empty() + } + + if (datepicker_instActive === inst) { + datepicker_instActive = null + } + }, + + /* Enable the date picker to a jQuery selection. + * @param target element - the target input field or division or span + */ + _enableDatepicker: function (target) { + let nodeName + let inline + const $target = $(target) + const inst = $.data(target, 'datepicker') + + if (!$target.hasClass(this.markerClassName)) { + return + } + + nodeName = target.nodeName.toLowerCase() + if (nodeName === 'input') { + target.disabled = false + inst.trigger + .filter('button') + .each(function () { + this.disabled = false + }) + .end() + .filter('img') + .css({ opacity: '1.0', cursor: '' }) + } else if (nodeName === 'div' || nodeName === 'span') { + inline = $target.children('.' + this._inlineClass) + inline.children().removeClass('ui-state-disabled') + inline + .find('select.ui-datepicker-month, select.ui-datepicker-year') + .prop('disabled', false) + } + this._disabledInputs = $.map(this._disabledInputs, function (value) { + return value === target ? null : value + }) // delete entry + }, + + /* Disable the date picker to a jQuery selection. + * @param target element - the target input field or division or span + */ + _disableDatepicker: function (target) { + let nodeName + let inline + const $target = $(target) + const inst = $.data(target, 'datepicker') + + if (!$target.hasClass(this.markerClassName)) { + return + } + + nodeName = target.nodeName.toLowerCase() + if (nodeName === 'input') { + target.disabled = true + inst.trigger + .filter('button') + .each(function () { + this.disabled = true + }) + .end() + .filter('img') + .css({ opacity: '0.5', cursor: 'default' }) + } else if (nodeName === 'div' || nodeName === 'span') { + inline = $target.children('.' + this._inlineClass) + inline.children().addClass('ui-state-disabled') + inline + .find('select.ui-datepicker-month, select.ui-datepicker-year') + .prop('disabled', true) + } + this._disabledInputs = $.map(this._disabledInputs, function (value) { + return value === target ? null : value + }) // delete entry + this._disabledInputs[this._disabledInputs.length] = target + }, + + /* Is the first field in a jQuery collection disabled as a datepicker? + * @param target element - the target input field or division or span + * @return boolean - true if disabled, false if enabled + */ + _isDisabledDatepicker: function (target) { + if (!target) { + return false + } + for (let i = 0; i < this._disabledInputs.length; i++) { + if (this._disabledInputs[i] === target) { + return true + } + } + return false + }, + + /* Retrieve the instance data for the target control. + * @param target element - the target input field or division or span + * @return object - the associated instance data + * @throws error if a jQuery problem getting data + */ + _getInst: function (target) { + try { + return $.data(target, 'datepicker') + } catch (err) { + throw 'Missing instance data for this datepicker' + } + }, + + /* Update or retrieve the settings for a date picker attached to an input field or division. + * @param target element - the target input field or division or span + * @param name object - the new settings to update or + * string - the name of the setting to change or retrieve, + * when retrieving also "all" for all instance settings or + * "defaults" for all global defaults + * @param value any - the new value for the setting + * (omit if above is an object or to retrieve a value) + */ + _optionDatepicker: function (target, name, value) { + let settings + let date + let minDate + let maxDate + const inst = this._getInst(target) + + if (arguments.length === 2 && typeof name === 'string') { + return name === 'defaults' + ? $.extend({}, $.datepicker._defaults) + : inst + ? name === 'all' + ? $.extend({}, inst.settings) + : this._get(inst, name) + : null + } + + settings = name || {} + if (typeof name === 'string') { + settings = {} + settings[name] = value + } + + if (inst) { + if (this._curInst === inst) { + this._hideDatepicker() + } + + date = this._getDateDatepicker(target, true) + minDate = this._getMinMaxDate(inst, 'min') + maxDate = this._getMinMaxDate(inst, 'max') + datepicker_extendRemove(inst.settings, settings) + // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided + if ( + minDate !== null && + settings.dateFormat !== undefined && + settings.minDate === undefined + ) { + inst.settings.minDate = this._formatDate(inst, minDate) + } + if ( + maxDate !== null && + settings.dateFormat !== undefined && + settings.maxDate === undefined + ) { + inst.settings.maxDate = this._formatDate(inst, maxDate) + } + if ('disabled' in settings) { + if (settings.disabled) { + this._disableDatepicker(target) + } else { + this._enableDatepicker(target) + } + } + this._attachments($(target), inst) + this._autoSize(inst) + this._setDate(inst, date) + this._updateAlternate(inst) + this._updateDatepicker(inst) + } + }, + + // change method deprecated + _changeDatepicker: function (target, name, value) { + this._optionDatepicker(target, name, value) + }, + + /* Redraw the date picker attached to an input field or division. + * @param target element - the target input field or division or span + */ + _refreshDatepicker: function (target) { + const inst = this._getInst(target) + if (inst) { + this._updateDatepicker(inst) + } + }, + + /* Set the dates for a jQuery selection. + * @param target element - the target input field or division or span + * @param date Date - the new date + */ + _setDateDatepicker: function (target, date) { + const inst = this._getInst(target) + if (inst) { + this._setDate(inst, date) + this._updateDatepicker(inst) + this._updateAlternate(inst) + } + }, + + /* Get the date(s) for the first entry in a jQuery selection. + * @param target element - the target input field or division or span + * @param noDefault boolean - true if no default date is to be used + * @return Date - the current date + */ + _getDateDatepicker: function (target, noDefault) { + const inst = this._getInst(target) + if (inst && !inst.inline) { + this._setDateFromField(inst, noDefault) + } + return inst ? this._getDate(inst) : null + }, + + /* Handle keystrokes. */ + _doKeyDown: function (event) { + let onSelect + let dateStr + let sel + const inst = $.datepicker._getInst(event.target) + let handled = true + const isRTL = inst.dpDiv.is('.ui-datepicker-rtl') + + inst._keyEvent = true + if ($.datepicker._datepickerShowing) { + switch (event.keyCode) { + case 9: + $.datepicker._hideDatepicker() + handled = false + break // hide on tab out + case 13: + sel = $( + 'td.' + + $.datepicker._dayOverClass + + ':not(.' + + $.datepicker._currentClass + + ')', + inst.dpDiv + ) + if (sel[0]) { + $.datepicker._selectDay( + event.target, + inst.selectedMonth, + inst.selectedYear, + sel[0] + ) + } + + onSelect = $.datepicker._get(inst, 'onSelect') + if (onSelect) { + dateStr = $.datepicker._formatDate(inst) + + // trigger custom callback + onSelect.apply(inst.input ? inst.input[0] : null, [ + dateStr, + inst + ]) + } else { + $.datepicker._hideDatepicker() + } + + return false // don't submit the form + case 27: + $.datepicker._hideDatepicker() + break // hide on escape + case 33: + $.datepicker._adjustDate( + event.target, + event.ctrlKey + ? -$.datepicker._get(inst, 'stepBigMonths') + : -$.datepicker._get(inst, 'stepMonths'), + 'M' + ) + break // previous month/year on page up/+ ctrl + case 34: + $.datepicker._adjustDate( + event.target, + event.ctrlKey + ? +$.datepicker._get(inst, 'stepBigMonths') + : +$.datepicker._get(inst, 'stepMonths'), + 'M' + ) + break // next month/year on page down/+ ctrl + case 35: + if (event.ctrlKey || event.metaKey) { + $.datepicker._clearDate(event.target) + } + handled = event.ctrlKey || event.metaKey + break // clear on ctrl or command +end + case 36: + if (event.ctrlKey || event.metaKey) { + $.datepicker._gotoToday(event.target) + } + handled = event.ctrlKey || event.metaKey + break // current on ctrl or command +home + case 37: + if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, isRTL ? +1 : -1, 'D') + } + handled = event.ctrlKey || event.metaKey + // -1 day on ctrl or command +left + if (event.originalEvent.altKey) { + $.datepicker._adjustDate( + event.target, + event.ctrlKey + ? -$.datepicker._get(inst, 'stepBigMonths') + : -$.datepicker._get(inst, 'stepMonths'), + 'M' + ) + } + // next month/year on alt +left on Mac + break + case 38: + if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, -7, 'D') + } + handled = event.ctrlKey || event.metaKey + break // -1 week on ctrl or command +up + case 39: + if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, isRTL ? -1 : +1, 'D') + } + handled = event.ctrlKey || event.metaKey + // +1 day on ctrl or command +right + if (event.originalEvent.altKey) { + $.datepicker._adjustDate( + event.target, + event.ctrlKey + ? +$.datepicker._get(inst, 'stepBigMonths') + : +$.datepicker._get(inst, 'stepMonths'), + 'M' + ) + } + // next month/year on alt +right + break + case 40: + if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, +7, 'D') + } + handled = event.ctrlKey || event.metaKey + break // +1 week on ctrl or command +down + default: + handled = false + } + } else if (event.keyCode === 36 && event.ctrlKey) { + // display the date picker on ctrl+home + $.datepicker._showDatepicker(this) + } else { + handled = false + } + + if (handled) { + event.preventDefault() + event.stopPropagation() + } + }, + + /* Filter entered characters - based on date format. */ + _doKeyPress: function (event) { + let chars + let chr + const inst = $.datepicker._getInst(event.target) + + if ($.datepicker._get(inst, 'constrainInput')) { + chars = $.datepicker._possibleChars( + $.datepicker._get(inst, 'dateFormat') + ) + chr = String.fromCharCode( + event.charCode == null ? event.keyCode : event.charCode + ) + return ( + event.ctrlKey || + event.metaKey || + chr < ' ' || + !chars || + chars.indexOf(chr) > -1 + ) + } + }, + + /* Synchronise manual entry and field/alternate field. */ + _doKeyUp: function (event) { + let date + const inst = $.datepicker._getInst(event.target) + + if (inst.input.val() !== inst.lastVal) { + try { + date = $.datepicker.parseDate( + $.datepicker._get(inst, 'dateFormat'), + inst.input ? inst.input.val() : null, + $.datepicker._getFormatConfig(inst) + ) + + if (date) { + // only if valid + $.datepicker._setDateFromField(inst) + $.datepicker._updateAlternate(inst) + $.datepicker._updateDatepicker(inst) + } + } catch (err) {} + } + return true + }, + + /* Pop-up the date picker for a given input field. + * If false returned from beforeShow event handler do not show. + * @param input element - the input field attached to the date picker or + * event - if triggered by focus + */ + _showDatepicker: function (input) { + input = input.target || input + if (input.nodeName.toLowerCase() !== 'input') { + // find from button/image trigger + input = $('input', input.parentNode)[0] + } + + if ( + $.datepicker._isDisabledDatepicker(input) || + $.datepicker._lastInput === input + ) { + // already here + return + } + + let inst, + beforeShow, + beforeShowSettings, + isFixed, + offset, + showAnim, + duration + + inst = $.datepicker._getInst(input) + if ($.datepicker._curInst && $.datepicker._curInst !== inst) { + $.datepicker._curInst.dpDiv.stop(true, true) + if (inst && $.datepicker._datepickerShowing) { + $.datepicker._hideDatepicker($.datepicker._curInst.input[0]) + } + } + + beforeShow = $.datepicker._get(inst, 'beforeShow') + beforeShowSettings = beforeShow + ? beforeShow.apply(input, [input, inst]) + : {} + if (beforeShowSettings === false) { + return + } + datepicker_extendRemove(inst.settings, beforeShowSettings) + + inst.lastVal = null + $.datepicker._lastInput = input + $.datepicker._setDateFromField(inst) + + if ($.datepicker._inDialog) { + // hide cursor + input.value = '' + } + if (!$.datepicker._pos) { + // position below input + $.datepicker._pos = $.datepicker._findPos(input) + $.datepicker._pos[1] += input.offsetHeight // add the height + } + + isFixed = false + $(input) + .parents() + .each(function () { + isFixed |= $(this).css('position') === 'fixed' + return !isFixed + }) + + offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] } + $.datepicker._pos = null + // to avoid flashes on Firefox + inst.dpDiv.empty() + // determine sizing offscreen + inst.dpDiv.css({ + position: 'absolute', + display: 'block', + top: '-1000px' + }) + $.datepicker._updateDatepicker(inst) + // fix width for dynamic number of date pickers + // and adjust position before showing + offset = $.datepicker._checkOffset(inst, offset, isFixed) + inst.dpDiv.css({ + position: + $.datepicker._inDialog && $.blockUI + ? 'static' + : isFixed + ? 'fixed' + : 'absolute', + display: 'none', + left: offset.left + 'px', + top: offset.top + 'px' + }) + + if (!inst.inline) { + showAnim = $.datepicker._get(inst, 'showAnim') + duration = $.datepicker._get(inst, 'duration') + inst.dpDiv.css('z-index', datepicker_getZindex($(input)) + 1) + $.datepicker._datepickerShowing = true + + if ($.effects && $.effects.effect[showAnim]) { + inst.dpDiv.show( + showAnim, + $.datepicker._get(inst, 'showOptions'), + duration + ) + } else { + inst.dpDiv[showAnim || 'show'](showAnim ? duration : null) + } + + if ($.datepicker._shouldFocusInput(inst)) { + inst.input.focus() + } + + $.datepicker._curInst = inst + } + }, + + /* Generate the date picker content. */ + _updateDatepicker: function (inst) { + this.maxRows = 4 // Reset the max number of rows being displayed (see #7043) + datepicker_instActive = inst // for delegate hover events + inst.dpDiv.empty().append(this._generateHTML(inst)) + this._attachHandlers(inst) + + let origyearshtml + const numMonths = this._getNumberOfMonths(inst) + const cols = numMonths[1] + const width = 17 + const activeCell = inst.dpDiv.find('.' + this._dayOverClass + ' a') + + if (activeCell.length > 0) { + datepicker_handleMouseover.apply(activeCell.get(0)) + } + + inst.dpDiv + .removeClass( + 'ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4' + ) + .width('') + if (cols > 1) { + inst.dpDiv + .addClass('ui-datepicker-multi-' + cols) + .css('width', width * cols + 'em') + } + inst.dpDiv[ + (numMonths[0] !== 1 || numMonths[1] !== 1 ? 'add' : 'remove') + 'Class' + ]('ui-datepicker-multi') + inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 'Class']( + 'ui-datepicker-rtl' + ) + + if ( + inst === $.datepicker._curInst && + $.datepicker._datepickerShowing && + $.datepicker._shouldFocusInput(inst) + ) { + inst.input.focus() + } + + // deffered render of the years select (to avoid flashes on Firefox) + if (inst.yearshtml) { + origyearshtml = inst.yearshtml + setTimeout(function () { + // assure that inst.yearshtml didn't change. + if (origyearshtml === inst.yearshtml && inst.yearshtml) { + inst.dpDiv + .find('select.ui-datepicker-year:first') + .replaceWith(inst.yearshtml) + } + origyearshtml = inst.yearshtml = null + }, 0) + } + }, + + // #6694 - don't focus the input if it's already focused + // this breaks the change event in IE + // Support: IE and jQuery <1.9 + _shouldFocusInput: function (inst) { + return ( + inst.input && + inst.input.is(':visible') && + !inst.input.is(':disabled') && + !inst.input.is(':focus') + ) + }, + + /* Check positioning to remain on screen. */ + _checkOffset: function (inst, offset, isFixed) { + const dpWidth = inst.dpDiv.outerWidth() + const dpHeight = inst.dpDiv.outerHeight() + const inputWidth = inst.input ? inst.input.outerWidth() : 0 + const inputHeight = inst.input ? inst.input.outerHeight() : 0 + const viewWidth = + document.documentElement.clientWidth + + (isFixed ? 0 : $(document).scrollLeft()) + const viewHeight = + document.documentElement.clientHeight + + (isFixed ? 0 : $(document).scrollTop()) + + offset.left -= this._get(inst, 'isRTL') ? dpWidth - inputWidth : 0 + offset.left -= + isFixed && offset.left === inst.input.offset().left + ? $(document).scrollLeft() + : 0 + offset.top -= + isFixed && offset.top === inst.input.offset().top + inputHeight + ? $(document).scrollTop() + : 0 + + // now check if datepicker is showing outside window viewport - move to a better place if so. + offset.left -= Math.min( + offset.left, + offset.left + dpWidth > viewWidth && viewWidth > dpWidth + ? Math.abs(offset.left + dpWidth - viewWidth) + : 0 + ) + offset.top -= Math.min( + offset.top, + offset.top + dpHeight > viewHeight && viewHeight > dpHeight + ? Math.abs(dpHeight + inputHeight) + : 0 + ) + + return offset + }, + + /* Find an object's position on the screen. */ + _findPos: function (obj) { + let position + const inst = this._getInst(obj) + const isRTL = this._get(inst, 'isRTL') + + while ( + obj && + (obj.type === 'hidden' || + obj.nodeType !== 1 || + $.expr.filters.hidden(obj)) + ) { + obj = obj[isRTL ? 'previousSibling' : 'nextSibling'] + } + + position = $(obj).offset() + return [position.left, position.top] + }, + + /* Hide the date picker from view. + * @param input element - the input field attached to the date picker + */ + _hideDatepicker: function (input) { + let showAnim + let duration + let postProcess + let onClose + const inst = this._curInst + + if (!inst || (input && inst !== $.data(input, 'datepicker'))) { + return + } + + if (this._datepickerShowing) { + showAnim = this._get(inst, 'showAnim') + duration = this._get(inst, 'duration') + postProcess = function () { + $.datepicker._tidyDialog(inst) + } + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { + inst.dpDiv.hide( + showAnim, + $.datepicker._get(inst, 'showOptions'), + duration, + postProcess + ) + } else { + inst.dpDiv[ + showAnim === 'slideDown' + ? 'slideUp' + : showAnim === 'fadeIn' + ? 'fadeOut' + : 'hide' + ](showAnim ? duration : null, postProcess) + } + + if (!showAnim) { + postProcess() + } + this._datepickerShowing = false + + onClose = this._get(inst, 'onClose') + if (onClose) { + onClose.apply(inst.input ? inst.input[0] : null, [ + inst.input ? inst.input.val() : '', + inst + ]) + } + + this._lastInput = null + if (this._inDialog) { + this._dialogInput.css({ + position: 'absolute', + left: '0', + top: '-100px' + }) + if ($.blockUI) { + $.unblockUI() + $('body').append(this.dpDiv) + } + } + this._inDialog = false + } + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function (inst) { + inst.dpDiv + .removeClass(this._dialogClass) + .unbind('.ui-datepicker-calendar') + }, + + /* Close date picker if clicked elsewhere. */ + _checkExternalClick: function (event) { + if (!$.datepicker._curInst) { + return + } + + const $target = $(event.target) + const inst = $.datepicker._getInst($target[0]) + + if ( + ($target[0].id !== $.datepicker._mainDivId && + $target.parents('#' + $.datepicker._mainDivId).length === 0 && + !$target.hasClass($.datepicker.markerClassName) && + !$target.closest('.' + $.datepicker._triggerClass).length && + $.datepicker._datepickerShowing && + !($.datepicker._inDialog && $.blockUI)) || + ($target.hasClass($.datepicker.markerClassName) && + $.datepicker._curInst !== inst) + ) { + $.datepicker._hideDatepicker() + } + }, + + /* Adjust one of the date sub-fields. */ + _adjustDate: function (id, offset, period) { + const target = $(id) + const inst = this._getInst(target[0]) + + if (this._isDisabledDatepicker(target[0])) { + return + } + this._adjustInstDate( + inst, + offset + (period === 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning + period + ) + this._updateDatepicker(inst) + }, + + /* Action for current link. */ + _gotoToday: function (id) { + let date + const target = $(id) + const inst = this._getInst(target[0]) + + if (this._get(inst, 'gotoCurrent') && inst.currentDay) { + inst.selectedDay = inst.currentDay + inst.drawMonth = inst.selectedMonth = inst.currentMonth + inst.drawYear = inst.selectedYear = inst.currentYear + } else { + date = new Date() + inst.selectedDay = date.getDate() + inst.drawMonth = inst.selectedMonth = date.getMonth() + inst.drawYear = inst.selectedYear = date.getFullYear() + } + this._notifyChange(inst) + this._adjustDate(target) + }, + + /* Action for selecting a new month/year. */ + _selectMonthYear: function (id, select, period) { + const target = $(id) + const inst = this._getInst(target[0]) + + inst['selected' + (period === 'M' ? 'Month' : 'Year')] = inst[ + 'draw' + (period === 'M' ? 'Month' : 'Year') + ] = parseInt(select.options[select.selectedIndex].value, 10) + + this._notifyChange(inst) + this._adjustDate(target) + }, + + /* Action for selecting a day. */ + _selectDay: function (id, month, year, td) { + let inst + const target = $(id) + + if ( + $(td).hasClass(this._unselectableClass) || + this._isDisabledDatepicker(target[0]) + ) { + return + } + + inst = this._getInst(target[0]) + inst.selectedDay = inst.currentDay = $('a', td).html() + inst.selectedMonth = inst.currentMonth = month + inst.selectedYear = inst.currentYear = year + this._selectDate( + id, + this._formatDate( + inst, + inst.currentDay, + inst.currentMonth, + inst.currentYear + ) + ) + }, + + /* Erase the input field and hide the date picker. */ + _clearDate: function (id) { + const target = $(id) + this._selectDate(target, '') + }, + + /* Update the input field with the selected date. */ + _selectDate: function (id, dateStr) { + let onSelect + const target = $(id) + const inst = this._getInst(target[0]) + + dateStr = dateStr != null ? dateStr : this._formatDate(inst) + if (inst.input) { + inst.input.val(dateStr) + } + this._updateAlternate(inst) + + onSelect = this._get(inst, 'onSelect') + if (onSelect) { + onSelect.apply(inst.input ? inst.input[0] : null, [dateStr, inst]) // trigger custom callback + } else if (inst.input) { + inst.input.trigger('change') // fire the change event + } + + if (inst.inline) { + this._updateDatepicker(inst) + } else { + this._hideDatepicker() + this._lastInput = inst.input[0] + if (typeof inst.input[0] !== 'object') { + inst.input.focus() // restore focus + } + this._lastInput = null + } + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function (inst) { + let altFormat + let date + let dateStr + const altField = this._get(inst, 'altField') + + if (altField) { + // update alternate field too + altFormat = + this._get(inst, 'altFormat') || this._get(inst, 'dateFormat') + date = this._getDate(inst) + dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)) + $(altField).each(function () { + $(this).val(dateStr) + }) + } + }, + + /* Set as beforeShowDay function to prevent selection of weekends. + * @param date Date - the date to customise + * @return [boolean, string] - is this date selectable?, what is its CSS class? + */ + noWeekends: function (date) { + const day = date.getDay() + return [day > 0 && day < 6, ''] + }, + + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. + * @param date Date - the date to get the week for + * @return number - the number of the week within the year that contains this date + */ + iso8601Week: function (date) { + let time + const checkDate = new Date(date.getTime()) + + // Find Thursday of this week starting on Monday + checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)) + + time = checkDate.getTime() + checkDate.setMonth(0) // Compare with Jan 1 + checkDate.setDate(1) + return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1 + }, + + /* Parse a string value into a date object. + * See formatDate below for the possible formats. + * + * @param format string - the expected format of the date + * @param value string - the date in the above format + * @param settings Object - attributes include: + * shortYearCutoff number - the cutoff year for determining the century (optional) + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return Date - the extracted date value or null if value is blank + */ + parseDate: function (format, value, settings) { + if (format == null || value == null) { + throw 'Invalid arguments' + } + + value = typeof value === 'object' ? value.toString() : value + '' + if (value === '') { + return null + } + + let iFormat + let dim + let extra + let iValue = 0 + const shortYearCutoffTemp = + (settings ? settings.shortYearCutoff : null) || + this._defaults.shortYearCutoff + const shortYearCutoff = + typeof shortYearCutoffTemp !== 'string' + ? shortYearCutoffTemp + : (new Date().getFullYear() % 100) + + parseInt(shortYearCutoffTemp, 10) + const dayNamesShort = + (settings ? settings.dayNamesShort : null) || + this._defaults.dayNamesShort + const dayNames = + (settings ? settings.dayNames : null) || this._defaults.dayNames + const monthNamesShort = + (settings ? settings.monthNamesShort : null) || + this._defaults.monthNamesShort + const monthNames = + (settings ? settings.monthNames : null) || this._defaults.monthNames + let year = -1 + let month = -1 + let day = -1 + let doy = -1 + let literal = false + let date + // Check whether a format character is doubled + const lookAhead = function (match) { + const matches = + iFormat + 1 < format.length && format.charAt(iFormat + 1) === match + if (matches) { + iFormat++ + } + return matches + } + // Extract a number from the string value + const getNumber = function (match) { + const isDoubled = lookAhead(match) + const size = + match === '@' + ? 14 + : match === '!' + ? 20 + : match === 'y' && isDoubled + ? 4 + : match === 'o' + ? 3 + : 2 + const minSize = match === 'y' ? size : 1 + const digits = new RegExp('^\\d{' + minSize + ',' + size + '}') + const num = value.substring(iValue).match(digits) + if (!num) { + throw 'Missing number at position ' + iValue + } + iValue += num[0].length + return parseInt(num[0], 10) + } + // Extract a name from the string value and convert to an index + const getName = function (match, shortNames, longNames) { + let index = -1 + const names = $.map( + lookAhead(match) ? longNames : shortNames, + function (v, k) { + return [[k, v]] + } + ).sort(function (a, b) { + return -(a[1].length - b[1].length) + }) + + $.each(names, function (i, pair) { + const name = pair[1] + if ( + value.substr(iValue, name.length).toLowerCase() === + name.toLowerCase() + ) { + index = pair[0] + iValue += name.length + return false + } + }) + if (index !== -1) { + return index + 1 + } else { + throw 'Unknown name at position ' + iValue + } + } + // Confirm that a literal character matches the string value + const checkLiteral = function () { + if (value.charAt(iValue) !== format.charAt(iFormat)) { + throw 'Unexpected literal at position ' + iValue + } + iValue++ + } + + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false + } else { + checkLiteral() + } + } else { + switch (format.charAt(iFormat)) { + case 'd': + day = getNumber('d') + break + case 'D': + getName('D', dayNamesShort, dayNames) + break + case 'o': + doy = getNumber('o') + break + case 'm': + month = getNumber('m') + break + case 'M': + month = getName('M', monthNamesShort, monthNames) + break + case 'y': + year = getNumber('y') + break + case '@': + date = new Date(getNumber('@')) + year = date.getFullYear() + month = date.getMonth() + 1 + day = date.getDate() + break + case '!': + date = new Date((getNumber('!') - this._ticksTo1970) / 10000) + year = date.getFullYear() + month = date.getMonth() + 1 + day = date.getDate() + break + case "'": + if (lookAhead("'")) { + checkLiteral() + } else { + literal = true + } + break + default: + checkLiteral() + } + } + } + + if (iValue < value.length) { + extra = value.substr(iValue) + if (!/^\s+/.test(extra)) { + throw 'Extra/unparsed characters found in date: ' + extra + } + } + + if (year === -1) { + year = new Date().getFullYear() + } else if (year < 100) { + year += + new Date().getFullYear() - + (new Date().getFullYear() % 100) + + (year <= shortYearCutoff ? 0 : -100) + } + + if (doy > -1) { + month = 1 + day = doy + do { + dim = this._getDaysInMonth(year, month - 1) + if (day <= dim) { + break + } + month++ + day -= dim + } while (true) + } + + date = this._daylightSavingAdjust(new Date(year, month - 1, day)) + if ( + date.getFullYear() !== year || + date.getMonth() + 1 !== month || + date.getDate() !== day + ) { + throw 'Invalid date' // E.g. 31/02/00 + } + return date + }, + + /* Standard date formats. */ + ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) + COOKIE: 'D, dd M yy', + ISO_8601: 'yy-mm-dd', + RFC_822: 'D, d M y', + RFC_850: 'DD, dd-M-y', + RFC_1036: 'D, d M y', + RFC_1123: 'D, d M yy', + RFC_2822: 'D, d M yy', + RSS: 'D, d M y', // RFC 822 + TICKS: '!', + TIMESTAMP: '@', + W3C: 'yy-mm-dd', // ISO 8601 + + _ticksTo1970: + ((1970 - 1) * 365 + + Math.floor(1970 / 4) - + Math.floor(1970 / 100) + + Math.floor(1970 / 400)) * + 24 * + 60 * + 60 * + 10000000, + + /* Format a date object into a string value. + * The format can be combinations of the following: + * d - day of month (no leading zero) + * dd - day of month (two digit) + * o - day of year (no leading zeros) + * oo - day of year (three digit) + * D - day name short + * DD - day name long + * m - month of year (no leading zero) + * mm - month of year (two digit) + * M - month name short + * MM - month name long + * y - year (two digit) + * yy - year (four digit) + * @ - Unix timestamp (ms since 01/01/1970) + * ! - Windows ticks (100ns since 01/01/0001) + * "..." - literal text + * '' - single quote + * + * @param format string - the desired format of the date + * @param date Date - the date value to format + * @param settings Object - attributes include: + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return string - the date in the above format + */ + formatDate: function (format, date, settings) { + if (!date) { + return '' + } + + let iFormat + const dayNamesShort = + (settings ? settings.dayNamesShort : null) || + this._defaults.dayNamesShort + const dayNames = + (settings ? settings.dayNames : null) || this._defaults.dayNames + const monthNamesShort = + (settings ? settings.monthNamesShort : null) || + this._defaults.monthNamesShort + const monthNames = + (settings ? settings.monthNames : null) || this._defaults.monthNames + // Check whether a format character is doubled + const lookAhead = function (match) { + const matches = + iFormat + 1 < format.length && format.charAt(iFormat + 1) === match + if (matches) { + iFormat++ + } + return matches + } + // Format a number, with leading zero if necessary + const formatNumber = function (match, value, len) { + let num = '' + value + if (lookAhead(match)) { + while (num.length < len) { + num = '0' + num + } + } + return num + } + // Format a name, short or long as requested + const formatName = function (match, value, shortNames, longNames) { + return lookAhead(match) ? longNames[value] : shortNames[value] + } + let output = '' + let literal = false + + if (date) { + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false + } else { + output += format.charAt(iFormat) + } + } else { + switch (format.charAt(iFormat)) { + case 'd': + output += formatNumber('d', date.getDate(), 2) + break + case 'D': + output += formatName( + 'D', + date.getDay(), + dayNamesShort, + dayNames + ) + break + case 'o': + output += formatNumber( + 'o', + Math.round( + (new Date( + date.getFullYear(), + date.getMonth(), + date.getDate() + ).getTime() - + new Date(date.getFullYear(), 0, 0).getTime()) / + 86400000 + ), + 3 + ) + break + case 'm': + output += formatNumber('m', date.getMonth() + 1, 2) + break + case 'M': + output += formatName( + 'M', + date.getMonth(), + monthNamesShort, + monthNames + ) + break + case 'y': + output += lookAhead('y') + ? date.getFullYear() + : (date.getYear() % 100 < 10 ? '0' : '') + + (date.getYear() % 100) + break + case '@': + output += date.getTime() + break + case '!': + output += date.getTime() * 10000 + this._ticksTo1970 + break + case "'": + if (lookAhead("'")) { + output += "'" + } else { + literal = true + } + break + default: + output += format.charAt(iFormat) + } + } + } + } + return output + }, + + /* Extract all possible characters from the date format. */ + _possibleChars: function (format) { + let iFormat + let chars = '' + let literal = false + // Check whether a format character is doubled + const lookAhead = function (match) { + const matches = + iFormat + 1 < format.length && format.charAt(iFormat + 1) === match + if (matches) { + iFormat++ + } + return matches + } + + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false + } else { + chars += format.charAt(iFormat) + } + } else { + switch (format.charAt(iFormat)) { + case 'd': + case 'm': + case 'y': + case '@': + chars += '0123456789' + break + case 'D': + case 'M': + return null // Accept anything + case "'": + if (lookAhead("'")) { + chars += "'" + } else { + literal = true + } + break + default: + chars += format.charAt(iFormat) + } + } + } + return chars + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function (inst, name) { + return inst.settings[name] !== undefined + ? inst.settings[name] + : this._defaults[name] + }, + + /* Parse existing date and initialise date picker. */ + _setDateFromField: function (inst, noDefault) { + if (inst.input.val() === inst.lastVal) { + return + } + + const dateFormat = this._get(inst, 'dateFormat') + let dates = (inst.lastVal = inst.input ? inst.input.val() : null) + const defaultDate = this._getDefaultDate(inst) + let date = defaultDate + const settings = this._getFormatConfig(inst) + + try { + date = this.parseDate(dateFormat, dates, settings) || defaultDate + } catch (event) { + dates = noDefault ? '' : dates + } + inst.selectedDay = date.getDate() + inst.drawMonth = inst.selectedMonth = date.getMonth() + inst.drawYear = inst.selectedYear = date.getFullYear() + inst.currentDay = dates ? date.getDate() : 0 + inst.currentMonth = dates ? date.getMonth() : 0 + inst.currentYear = dates ? date.getFullYear() : 0 + this._adjustInstDate(inst) + }, + + /* Retrieve the default date shown on opening. */ + _getDefaultDate: function (inst) { + return this._restrictMinMax( + inst, + this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()) + ) + }, + + /* A date may be specified as an exact value or a relative one. */ + _determineDate: function (inst, date, defaultDate) { + const offsetNumeric = function (offset) { + const date = new Date() + date.setDate(date.getDate() + offset) + return date + } + const offsetString = function (offset) { + try { + return $.datepicker.parseDate( + $.datepicker._get(inst, 'dateFormat'), + offset, + $.datepicker._getFormatConfig(inst) + ) + } catch (e) { + // Ignore + } + + const date = + (offset.toLowerCase().match(/^c/) + ? $.datepicker._getDate(inst) + : null) || new Date() + let year = date.getFullYear() + let month = date.getMonth() + let day = date.getDate() + const pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g + let matches = pattern.exec(offset) + + while (matches) { + switch (matches[2] || 'd') { + case 'd': + case 'D': + day += parseInt(matches[1], 10) + break + case 'w': + case 'W': + day += parseInt(matches[1], 10) * 7 + break + case 'm': + case 'M': + month += parseInt(matches[1], 10) + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)) + break + case 'y': + case 'Y': + year += parseInt(matches[1], 10) + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)) + break + } + matches = pattern.exec(offset) + } + return new Date(year, month, day) + } + let newDate = + date == null || date === '' + ? defaultDate + : typeof date === 'string' + ? offsetString(date) + : typeof date === 'number' + ? isNaN(date) + ? defaultDate + : offsetNumeric(date) + : new Date(date.getTime()) + + newDate = + newDate && newDate.toString() === 'Invalid Date' + ? defaultDate + : newDate + if (newDate) { + newDate.setHours(0) + newDate.setMinutes(0) + newDate.setSeconds(0) + newDate.setMilliseconds(0) + } + return this._daylightSavingAdjust(newDate) + }, + + /* Handle switch to/from daylight saving. + * Hours may be non-zero on daylight saving cut-over: + * > 12 when midnight changeover, but then cannot generate + * midnight datetime, so jump to 1AM, otherwise reset. + * @param date (Date) the date to check + * @return (Date) the corrected date + */ + _daylightSavingAdjust: function (date) { + if (!date) { + return null + } + date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0) + return date + }, + + /* Set the date(s) directly. */ + _setDate: function (inst, date, noChange) { + const clear = !date + const origMonth = inst.selectedMonth + const origYear = inst.selectedYear + const newDate = this._restrictMinMax( + inst, + this._determineDate(inst, date, new Date()) + ) + + inst.selectedDay = inst.currentDay = newDate.getDate() + inst.drawMonth = + inst.selectedMonth = + inst.currentMonth = + newDate.getMonth() + inst.drawYear = + inst.selectedYear = + inst.currentYear = + newDate.getFullYear() + if ( + (origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && + !noChange + ) { + this._notifyChange(inst) + } + this._adjustInstDate(inst) + if (inst.input) { + inst.input.val(clear ? '' : this._formatDate(inst)) + } + }, + + /* Retrieve the date(s) directly. */ + _getDate: function (inst) { + const startDate = + !inst.currentYear || (inst.input && inst.input.val() === '') + ? null + : this._daylightSavingAdjust( + new Date(inst.currentYear, inst.currentMonth, inst.currentDay) + ) + return startDate + }, + + /* Attach the onxxx handlers. These are declared statically so + * they work with static code transformers like Caja. + */ + _attachHandlers: function (inst) { + const stepMonths = this._get(inst, 'stepMonths') + const id = '#' + inst.id.replace(/\\\\/g, '\\') + inst.dpDiv.find('[data-handler]').map(function () { + const handler = { + prev: function () { + $.datepicker._adjustDate(id, -stepMonths, 'M') + }, + next: function () { + $.datepicker._adjustDate(id, +stepMonths, 'M') + }, + hide: function () { + $.datepicker._hideDatepicker() + }, + today: function () { + $.datepicker._gotoToday(id) + }, + selectDay: function () { + $.datepicker._selectDay( + id, + +this.getAttribute('data-month'), + +this.getAttribute('data-year'), + this + ) + return false + }, + selectMonth: function () { + $.datepicker._selectMonthYear(id, this, 'M') + return false + }, + selectYear: function () { + $.datepicker._selectMonthYear(id, this, 'Y') + return false + } + } + $(this).bind( + this.getAttribute('data-event'), + handler[this.getAttribute('data-handler')] + ) + }) + }, + + /* Generate the HTML for the current state of the date picker. */ + _generateHTML: function (inst) { + let maxDraw + let prevText + let prev + let nextText + let next + let currentText + let gotoDate + let controls + let buttonPanel + let firstDay + let showWeek + let dayNames + let dayNamesMin + let monthNames + let monthNamesShort + let beforeShowDay + let showOtherMonths + let selectOtherMonths + let defaultDate + let html + let dow + let row + let group + let col + let selectedDate + let cornerClass + let calender + let thead + let day + let daysInMonth + let leadDays + let curRows + let numRows + let printDate + let dRow + let tbody + let daySettings + let otherMonth + let unselectable + const tempDate = new Date() + const today = this._daylightSavingAdjust( + new Date( + tempDate.getFullYear(), + tempDate.getMonth(), + tempDate.getDate() + ) + ) // clear time + const isRTL = this._get(inst, 'isRTL') + const showButtonPanel = this._get(inst, 'showButtonPanel') + const hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext') + const navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat') + const numMonths = this._getNumberOfMonths(inst) + const showCurrentAtPos = this._get(inst, 'showCurrentAtPos') + const stepMonths = this._get(inst, 'stepMonths') + const isMultiMonth = numMonths[0] !== 1 || numMonths[1] !== 1 + const currentDate = this._daylightSavingAdjust( + !inst.currentDay + ? new Date(9999, 9, 9) + : new Date(inst.currentYear, inst.currentMonth, inst.currentDay) + ) + const minDate = this._getMinMaxDate(inst, 'min') + const maxDate = this._getMinMaxDate(inst, 'max') + let drawMonth = inst.drawMonth - showCurrentAtPos + let drawYear = inst.drawYear + + if (drawMonth < 0) { + drawMonth += 12 + drawYear-- + } + if (maxDate) { + maxDraw = this._daylightSavingAdjust( + new Date( + maxDate.getFullYear(), + maxDate.getMonth() - numMonths[0] * numMonths[1] + 1, + maxDate.getDate() + ) + ) + maxDraw = minDate && maxDraw < minDate ? minDate : maxDraw + while ( + this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw + ) { + drawMonth-- + if (drawMonth < 0) { + drawMonth = 11 + drawYear-- + } + } + } + inst.drawMonth = drawMonth + inst.drawYear = drawYear + + prevText = this._get(inst, 'prevText') + prevText = !navigationAsDateFormat + ? prevText + : this.formatDate( + prevText, + this._daylightSavingAdjust( + new Date(drawYear, drawMonth - stepMonths, 1) + ), + this._getFormatConfig(inst) + ) + + prev = this._canAdjustMonth(inst, -1, drawYear, drawMonth) + ? "" + + prevText + + '' + : hideIfNoPrevNext + ? '' + : "" + + prevText + + '' + + nextText = this._get(inst, 'nextText') + nextText = !navigationAsDateFormat + ? nextText + : this.formatDate( + nextText, + this._daylightSavingAdjust( + new Date(drawYear, drawMonth + stepMonths, 1) + ), + this._getFormatConfig(inst) + ) + + next = this._canAdjustMonth(inst, +1, drawYear, drawMonth) + ? "" + + nextText + + '' + : hideIfNoPrevNext + ? '' + : "" + + nextText + + '' + + currentText = this._get(inst, 'currentText') + gotoDate = + this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today + currentText = !navigationAsDateFormat + ? currentText + : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)) + + controls = !inst.inline + ? "' + : '' + + buttonPanel = showButtonPanel + ? "
      " + + (isRTL ? controls : '') + + (this._isInRange(inst, gotoDate) + ? "' + : '') + + (isRTL ? '' : controls) + + '
      ' + : '' + + firstDay = parseInt(this._get(inst, 'firstDay'), 10) + firstDay = isNaN(firstDay) ? 0 : firstDay + + showWeek = this._get(inst, 'showWeek') + dayNames = this._get(inst, 'dayNames') + dayNamesMin = this._get(inst, 'dayNamesMin') + monthNames = this._get(inst, 'monthNames') + monthNamesShort = this._get(inst, 'monthNamesShort') + beforeShowDay = this._get(inst, 'beforeShowDay') + showOtherMonths = this._get(inst, 'showOtherMonths') + selectOtherMonths = this._get(inst, 'selectOtherMonths') + defaultDate = this._getDefaultDate(inst) + html = '' + dow + for (row = 0; row < numMonths[0]; row++) { + group = '' + this.maxRows = 4 + for (col = 0; col < numMonths[1]; col++) { + selectedDate = this._daylightSavingAdjust( + new Date(drawYear, drawMonth, inst.selectedDay) + ) + cornerClass = ' ui-corner-all' + calender = '' + if (isMultiMonth) { + calender += "
      " + + (/all|left/.test(cornerClass) && row === 0 + ? isRTL + ? next + : prev + : '') + + (/all|right/.test(cornerClass) && row === 0 + ? isRTL + ? prev + : next + : '') + + this._generateMonthYearHeader( + inst, + drawMonth, + drawYear, + minDate, + maxDate, + row > 0 || col > 0, + monthNames, + monthNamesShort + ) + // draw month headers + "
      " + + '' + thead = showWeek + ? "' + : '' + for (dow = 0; dow < 7; dow++) { + // days of the week + day = (dow + firstDay) % 7 + thead += + "' + } + calender += thead + '' + daysInMonth = this._getDaysInMonth(drawYear, drawMonth) + if ( + drawYear === inst.selectedYear && + drawMonth === inst.selectedMonth + ) { + inst.selectedDay = Math.min(inst.selectedDay, daysInMonth) + } + leadDays = + (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7 + curRows = Math.ceil((leadDays + daysInMonth) / 7) // calculate the number of rows to generate + numRows = isMultiMonth + ? this.maxRows > curRows + ? this.maxRows + : curRows + : curRows // If multiple months, use the higher number of rows (see #7043) + this.maxRows = numRows + printDate = this._daylightSavingAdjust( + new Date(drawYear, drawMonth, 1 - leadDays) + ) + for (dRow = 0; dRow < numRows; dRow++) { + // create date picker rows + calender += '' + tbody = !showWeek + ? '' + : "' + for (dow = 0; dow < 7; dow++) { + // create date picker days + daySettings = beforeShowDay + ? beforeShowDay.apply(inst.input ? inst.input[0] : null, [ + printDate + ]) + : [true, ''] + otherMonth = printDate.getMonth() !== drawMonth + unselectable = + (otherMonth && !selectOtherMonths) || + !daySettings[0] || + (minDate && printDate < minDate) || + (maxDate && printDate > maxDate) + tbody += + "' // display selectable date + printDate.setDate(printDate.getDate() + 1) + printDate = this._daylightSavingAdjust(printDate) + } + calender += tbody + '' + } + drawMonth++ + if (drawMonth > 11) { + drawMonth = 0 + drawYear++ + } + calender += + '
      " + + this._get(inst, 'weekHeader') + + '= 5 + ? " class='ui-datepicker-week-end'" + : '') + + '>' + + "" + + dayNamesMin[day] + + '
      " + + this._get(inst, 'calculateWeek')(printDate) + + '' + // actions + (otherMonth && !showOtherMonths + ? ' ' // display for other months + : unselectable + ? "" + + printDate.getDate() + + '' + : "" + + printDate.getDate() + + '') + + '
      ' + + (isMultiMonth + ? '
      ' + + (numMonths[0] > 0 && col === numMonths[1] - 1 + ? "
      " + : '') + : '') + group += calender + } + html += group + } + html += buttonPanel + inst._keyEvent = false + return html + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function ( + inst, + drawMonth, + drawYear, + minDate, + maxDate, + secondary, + monthNames, + monthNamesShort + ) { + let inMinYear + let inMaxYear + let month + let years + let thisYear + let determineYear + let year + let endYear + const changeMonth = this._get(inst, 'changeMonth') + const changeYear = this._get(inst, 'changeYear') + const showMonthAfterYear = this._get(inst, 'showMonthAfterYear') + let html = "
      " + let monthHtml = '' + + // month selection + if (secondary || !changeMonth) { + monthHtml += + "" + + monthNames[drawMonth] + + '' + } else { + inMinYear = minDate && minDate.getFullYear() === drawYear + inMaxYear = maxDate && maxDate.getFullYear() === drawYear + monthHtml += + "' + } + + if (!showMonthAfterYear) { + html += + monthHtml + + (secondary || !(changeMonth && changeYear) ? ' ' : '') + } + + // year selection + if (!inst.yearshtml) { + inst.yearshtml = '' + if (secondary || !changeYear) { + html += "" + drawYear + '' + } else { + // determine range of years to display + years = this._get(inst, 'yearRange').split(':') + thisYear = new Date().getFullYear() + determineYear = function (value) { + const year = value.match(/c[+\-].*/) + ? drawYear + parseInt(value.substring(1), 10) + : value.match(/[+\-].*/) + ? thisYear + parseInt(value, 10) + : parseInt(value, 10) + return isNaN(year) ? thisYear : year + } + year = determineYear(years[0]) + endYear = Math.max(year, determineYear(years[1] || '')) + year = minDate ? Math.max(year, minDate.getFullYear()) : year + endYear = maxDate + ? Math.min(endYear, maxDate.getFullYear()) + : endYear + inst.yearshtml += + "' + + html += inst.yearshtml + inst.yearshtml = null + } + } + + html += this._get(inst, 'yearSuffix') + if (showMonthAfterYear) { + html += + (secondary || !(changeMonth && changeYear) ? ' ' : '') + + monthHtml + } + html += '
      ' // Close datepicker_header + return html + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function (inst, offset, period) { + const year = inst.drawYear + (period === 'Y' ? offset : 0) + const month = inst.drawMonth + (period === 'M' ? offset : 0) + const day = + Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period === 'D' ? offset : 0) + const date = this._restrictMinMax( + inst, + this._daylightSavingAdjust(new Date(year, month, day)) + ) + + inst.selectedDay = date.getDate() + inst.drawMonth = inst.selectedMonth = date.getMonth() + inst.drawYear = inst.selectedYear = date.getFullYear() + if (period === 'M' || period === 'Y') { + this._notifyChange(inst) + } + }, + + /* Ensure a date is within any min/max bounds. */ + _restrictMinMax: function (inst, date) { + const minDate = this._getMinMaxDate(inst, 'min') + const maxDate = this._getMinMaxDate(inst, 'max') + const newDate = minDate && date < minDate ? minDate : date + return maxDate && newDate > maxDate ? maxDate : newDate + }, + + /* Notify change of month/year. */ + _notifyChange: function (inst) { + const onChange = this._get(inst, 'onChangeMonthYear') + if (onChange) { + onChange.apply(inst.input ? inst.input[0] : null, [ + inst.selectedYear, + inst.selectedMonth + 1, + inst + ]) + } + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function (inst) { + const numMonths = this._get(inst, 'numberOfMonths') + return numMonths == null + ? [1, 1] + : typeof numMonths === 'number' + ? [1, numMonths] + : numMonths + }, + + /* Determine the current maximum date - ensure no time components are set. */ + _getMinMaxDate: function (inst, minMax) { + return this._determineDate(inst, this._get(inst, minMax + 'Date'), null) + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function (year, month) { + return ( + 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate() + ) + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function (year, month) { + return new Date(year, month, 1).getDay() + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function (inst, offset, curYear, curMonth) { + const numMonths = this._getNumberOfMonths(inst) + const date = this._daylightSavingAdjust( + new Date( + curYear, + curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), + 1 + ) + ) + + if (offset < 0) { + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())) + } + return this._isInRange(inst, date) + }, + + /* Is the given date in the accepted range? */ + _isInRange: function (inst, date) { + let yearSplit + let currentYear + const minDate = this._getMinMaxDate(inst, 'min') + const maxDate = this._getMinMaxDate(inst, 'max') + let minYear = null + let maxYear = null + const years = this._get(inst, 'yearRange') + if (years) { + yearSplit = years.split(':') + currentYear = new Date().getFullYear() + minYear = parseInt(yearSplit[0], 10) + maxYear = parseInt(yearSplit[1], 10) + if (yearSplit[0].match(/[+\-].*/)) { + minYear += currentYear + } + if (yearSplit[1].match(/[+\-].*/)) { + maxYear += currentYear + } + } + + return ( + (!minDate || date.getTime() >= minDate.getTime()) && + (!maxDate || date.getTime() <= maxDate.getTime()) && + (!minYear || date.getFullYear() >= minYear) && + (!maxYear || date.getFullYear() <= maxYear) + ) + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function (inst) { + let shortYearCutoff = this._get(inst, 'shortYearCutoff') + shortYearCutoff = + typeof shortYearCutoff !== 'string' + ? shortYearCutoff + : (new Date().getFullYear() % 100) + parseInt(shortYearCutoff, 10) + return { + shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), + dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), + monthNames: this._get(inst, 'monthNames') + } + }, + + /* Format the given date for display. */ + _formatDate: function (inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay + inst.currentMonth = inst.selectedMonth + inst.currentYear = inst.selectedYear + } + const date = day + ? typeof day === 'object' + ? day + : this._daylightSavingAdjust(new Date(year, month, day)) + : this._daylightSavingAdjust( + new Date(inst.currentYear, inst.currentMonth, inst.currentDay) + ) + return this.formatDate( + this._get(inst, 'dateFormat'), + date, + this._getFormatConfig(inst) + ) + } + }) + + /* + * Bind hover events for datepicker elements. + * Done via delegate so the binding only occurs once in the lifetime of the parent div. + * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. + */ + function datepicker_bindHover (dpDiv) { + const selector = + 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a' + return dpDiv + .delegate(selector, 'mouseout', function () { + $(this).removeClass('ui-state-hover') + if (this.className.indexOf('ui-datepicker-prev') !== -1) { + $(this).removeClass('ui-datepicker-prev-hover') + } + if (this.className.indexOf('ui-datepicker-next') !== -1) { + $(this).removeClass('ui-datepicker-next-hover') + } + }) + .delegate(selector, 'mouseover', datepicker_handleMouseover) + } + + function datepicker_handleMouseover () { + if ( + !$.datepicker._isDisabledDatepicker( + datepicker_instActive.inline + ? datepicker_instActive.dpDiv.parent()[0] + : datepicker_instActive.input[0] + ) + ) { + $(this) + .parents('.ui-datepicker-calendar') + .find('a') + .removeClass('ui-state-hover') + $(this).addClass('ui-state-hover') + if (this.className.indexOf('ui-datepicker-prev') !== -1) { + $(this).addClass('ui-datepicker-prev-hover') + } + if (this.className.indexOf('ui-datepicker-next') !== -1) { + $(this).addClass('ui-datepicker-next-hover') + } + } + } + + /* jQuery extend now ignores nulls! */ + function datepicker_extendRemove (target, props) { + $.extend(target, props) + for (const name in props) { + if (props[name] == null) { + target[name] = props[name] + } + } + return target + } + + /* Invoke the datepicker functionality. @param options string - a command, optionally followed by additional parameters or Object - settings for attaching new datepicker functionality @return jQuery object */ -$.fn.datepicker = function(options){ - - /* Verify an empty collection wasn't passed - Fixes #6976 */ - if ( !this.length ) { - return this; - } - - /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick); - $.datepicker.initialized = true; - } - - /* Append datepicker main container to body if not exist. */ - if ($("#"+$.datepicker._mainDivId).length === 0) { - $("body").append($.datepicker.dpDiv); - } - - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { - return $.datepicker["_" + options + "Datepicker"]. - apply($.datepicker, [this[0]].concat(otherArgs)); - } - if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { - return $.datepicker["_" + options + "Datepicker"]. - apply($.datepicker, [this[0]].concat(otherArgs)); - } - return this.each(function() { - typeof options === "string" ? - $.datepicker["_" + options + "Datepicker"]. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); -}; - -$.datepicker = new Datepicker(); // singleton instance -$.datepicker.initialized = false; -$.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.11.4"; - -var datepicker = $.datepicker; - - -/*! - * jQuery UI Draggable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/draggable/ - */ - - -$.widget("ui.draggable", $.ui.mouse, { - version: "1.11.4", - widgetEventPrefix: "drag", - options: { - addClasses: true, - appendTo: "parent", - axis: false, - connectToSortable: false, - containment: false, - cursor: "auto", - cursorAt: false, - grid: false, - handle: false, - helper: "original", - iframeFix: false, - opacity: false, - refreshPositions: false, - revert: false, - revertDuration: 500, - scope: "default", - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - snap: false, - snapMode: "both", - snapTolerance: 20, - stack: false, - zIndex: false, - - // callbacks - drag: null, - start: null, - stop: null - }, - _create: function() { - - if ( this.options.helper === "original" ) { - this._setPositionRelative(); - } - if (this.options.addClasses){ - this.element.addClass("ui-draggable"); - } - if (this.options.disabled){ - this.element.addClass("ui-draggable-disabled"); - } - this._setHandleClassName(); - - this._mouseInit(); - }, - - _setOption: function( key, value ) { - this._super( key, value ); - if ( key === "handle" ) { - this._removeHandleClassName(); - this._setHandleClassName(); - } - }, - - _destroy: function() { - if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { - this.destroyOnClear = true; - return; - } - this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); - this._removeHandleClassName(); - this._mouseDestroy(); - }, - - _mouseCapture: function(event) { - var o = this.options; - - this._blurActiveElement( event ); - - // among others, prevent a drag on a resizable-handle - if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { - return false; - } - - //Quit if we're not on a valid handle - this.handle = this._getHandle(event); - if (!this.handle) { - return false; - } - - this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); - - return true; - - }, - - _blockFrames: function( selector ) { - this.iframeBlocks = this.document.find( selector ).map(function() { - var iframe = $( this ); - - return $( "
      " ) - .css( "position", "absolute" ) - .appendTo( iframe.parent() ) - .outerWidth( iframe.outerWidth() ) - .outerHeight( iframe.outerHeight() ) - .offset( iframe.offset() )[ 0 ]; - }); - }, - - _unblockFrames: function() { - if ( this.iframeBlocks ) { - this.iframeBlocks.remove(); - delete this.iframeBlocks; - } - }, - - _blurActiveElement: function( event ) { - var document = this.document[ 0 ]; - - // Only need to blur if the event occurred on the draggable itself, see #10527 - if ( !this.handleElement.is( event.target ) ) { - return; - } - - // support: IE9 - // IE9 throws an "Unspecified error" accessing document.activeElement from an