├── themes └── centraldedados │ ├── static │ ├── js │ │ ├── put_js_here.txt │ │ ├── search.js │ │ ├── underscore-min.js │ │ └── jquery-3.0.0.min.js │ ├── fonts │ │ ├── put_fonts_here.txt │ │ └── CommeSans │ │ │ ├── Comme-Bold.ttf │ │ │ ├── Comme-Heavy.ttf │ │ │ ├── Comme-Light.ttf │ │ │ ├── Comme-Thin.ttf │ │ │ ├── Comme-Medium.ttf │ │ │ ├── Comme-Regular.ttf │ │ │ ├── Comme-SemiBold.ttf │ │ │ ├── Comme-ExtraBold.ttf │ │ │ ├── Comme-ExtraLight.ttf │ │ │ └── CommeMono-Regular.ttf │ ├── img │ │ ├── put_images_here.txt │ │ ├── okfn.png │ │ ├── favicon.ico │ │ ├── favicon.png │ │ ├── okfn-pt.png │ │ ├── ajax-loader.gif │ │ ├── jplusplus.png │ │ ├── share-image.png │ │ ├── thackdaypt.png │ │ ├── datewithdata.png │ │ ├── thackdaypt_px.png │ │ ├── centraldedados.png │ │ └── centraldedados.svg │ ├── htaccess │ └── css │ │ └── main.css │ └── templates │ ├── page.html │ ├── contact.html │ ├── list.html │ ├── dataset.html │ └── base.html ├── .gitignore ├── requirements.txt ├── content ├── welcome_text.md └── pages │ └── about.md ├── Pipfile ├── settings.conf.sample ├── plugins └── ods.py ├── tests.py ├── utils.py ├── Makefile ├── README.md ├── Pipfile.lock └── datacentral.py /themes/centraldedados/static/js/put_js_here.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/put_fonts_here.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/centraldedados/static/img/put_images_here.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/centraldedados/static/img/okfn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/okfn.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/favicon.ico -------------------------------------------------------------------------------- /themes/centraldedados/static/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/favicon.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/okfn-pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/okfn-pt.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/ajax-loader.gif -------------------------------------------------------------------------------- /themes/centraldedados/static/img/jplusplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/jplusplus.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/share-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/share-image.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/thackdaypt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/thackdaypt.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/datewithdata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/datewithdata.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/thackdaypt_px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/thackdaypt_px.png -------------------------------------------------------------------------------- /themes/centraldedados/static/img/centraldedados.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/img/centraldedados.png -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-Bold.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-Heavy.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-Heavy.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-Light.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-Thin.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-Medium.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-Regular.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-SemiBold.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-ExtraBold.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/Comme-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/Comme-ExtraLight.ttf -------------------------------------------------------------------------------- /themes/centraldedados/static/fonts/CommeSans/CommeMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centraldedados/datacentral/HEAD/themes/centraldedados/static/fonts/CommeSans/CommeMono-Regular.ttf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # don't track the output dir 2 | _output/ 3 | # repos are automatically cloned 4 | repos/ 5 | # settings file is private 6 | settings.conf 7 | # virtualenv is local 8 | .env/ 9 | 10 | # cruft files 11 | *.pyc 12 | *.swp 13 | *~ 14 | *.orig 15 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | argparse==1.4.0 2 | 3 | Click==7.0 4 | colorlog==4.0.2 5 | csvkit==1.0.3 6 | GitPython==2.1.11 7 | Jinja2==2.10 8 | livereload==2.6.0 9 | Markdown==3.0.1 10 | MarkupSafe==1.1.0 11 | nose==1.3.7 12 | requests==2.21.0 13 | zenlog==1.1 14 | -------------------------------------------------------------------------------- /content/welcome_text.md: -------------------------------------------------------------------------------- 1 | Hey -- You just got Datacentral working! 2 | 3 | If you haven't already, copy the `settings.conf.sample` file to `settings.conf`, and edit the new file to edit the datasets to be listed. 4 | 5 | This sidebar is a good place to tell your visitors what this site is about in a few paragraphs. You can edit this in `content/welcome_text.md`. 6 | 7 | Have fun with data! 8 | -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | name = "pypi" 3 | url = "https://pypi.org/simple" 4 | verify_ssl = true 5 | 6 | [dev-packages] 7 | 8 | [packages] 9 | argparse = "*" 10 | click = "*" 11 | colorlog = "*" 12 | zenlog = "*" 13 | livereload = "*" 14 | csvkit = "*" 15 | nose = "*" 16 | requests = "*" 17 | GitPython = "*" 18 | Jinja2 = "*" 19 | Markdown = "*" 20 | MarkupSafe = "*" 21 | 22 | [requires] 23 | python_version = "3.7" 24 | -------------------------------------------------------------------------------- /themes/centraldedados/templates/page.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %} 4 | {{ pagename }} — Datacentral 5 | {% endblock %} 6 | 7 | {% block content %} 8 | 9 |
10 |
11 |
12 | {{ welcome_text }} 13 |
14 |
15 |
16 | {{ content }} 17 |
18 |
19 |
20 |
21 | 22 | {% endblock content %} 23 | -------------------------------------------------------------------------------- /themes/centraldedados/static/htaccess: -------------------------------------------------------------------------------- 1 | # Apache Rewrite Rules 2 | 3 | Options +FollowSymLinks 4 | RewriteEngine On 5 | RewriteBase / 6 | 7 | # Add trailing slash to url 8 | RewriteCond %{REQUEST_FILENAME} !-f 9 | RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$ 10 | RewriteRule ^(.*)$ $1/ [R=301,L] 11 | 12 | # Remove .html-extension from url 13 | # RewriteCond %{REQUEST_FILENAME} !-d 14 | # RewriteCond %{REQUEST_FILENAME}\.html -f 15 | # RewriteRule ^([^\.]+)/$ $1.html 16 | 17 | # End of Apache Rewrite Rules 18 | 19 | 20 | # Fix JSON encoding 21 | AddDefaultCharset utf-8 22 | AddType 'application/json; charset=UTF-8' .json 23 | -------------------------------------------------------------------------------- /settings.conf.sample: -------------------------------------------------------------------------------- 1 | # This is the sample configuration file for Datacentral. 2 | # Running `make install` will create a copy called `settings.conf` which 3 | # should be tweaked for your own installation. 4 | 5 | [ui] 6 | # The theme to use. For the moment there's only one. 7 | theme = centraldedados 8 | 9 | [credentials] 10 | # E-mail to use for the contact form. Uses Formspree.io to send email, 11 | # see their site to learn how it works. 12 | contact_email = johndoe@dummydomain.net 13 | 14 | [repositories] 15 | # Place all data package repos, one per line, on this section. 16 | # We recommend that you use the repo name as the first string before `=` 17 | # for consistency. 18 | population = https://github.com/datasets/population.git 19 | gold-prices = https://github.com/datasets/gold-prices.git 20 | gdp = https://github.com/datasets/gdp.git 21 | -------------------------------------------------------------------------------- /plugins/ods.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | ''' 4 | # PLACEHOLDER CODE 5 | # copy pasted straight from the example at https://github.com/mmulqueen/odswriter 6 | 7 | TODO: 8 | * Parse datapackage.json and read the JSON table schema 9 | * Lint and store rows 10 | ''' 11 | 12 | import datetime 13 | import decimal 14 | import odswriter as ods 15 | 16 | with ods.writer(open("test.ods","wb")) as odsfile: 17 | odsfile.writerow(["String", "ABCDEF123456", "123456"]) 18 | # Lose the 2L below if you want to run this example code on Python 3, Python 3 has no long type. 19 | odsfile.writerow(["Float", 1, 123, 123.123, 2L, decimal.Decimal("10.321")]) 20 | odsfile.writerow(["Date/DateTime", datetime.datetime.now(), datetime.date(1989,11,9)]) 21 | odsfile.writerow(["Time",datetime.time(13,37),datetime.time(16,17,18)]) 22 | odsfile.writerow(["Bool",True,False,True]) 23 | odsfile.writerow(["Formula",1,2,3,ods.Formula("IF(A1=2,B1,C1)")]) 24 | 25 | -------------------------------------------------------------------------------- /tests.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | TEST_OUTPUT_PATH = "_testoutput" 5 | TEST_REPO_PATH = "_testrepos" 6 | theme_dir = 'themes/centraldedados/' 7 | 8 | 9 | def setup_module(): 10 | from datacentral import generate 11 | generate(False, False, TEST_OUTPUT_PATH, theme_dir, TEST_REPO_PATH) 12 | 13 | 14 | def teardown_module(): 15 | shutil.rmtree(TEST_OUTPUT_PATH) 16 | shutil.rmtree(TEST_REPO_PATH) 17 | 18 | 19 | def test_output_dir_created(): 20 | assert os.path.exists(TEST_OUTPUT_PATH) 21 | 22 | 23 | def test_api_created(): 24 | assert os.path.exists(os.path.join(TEST_OUTPUT_PATH, 'api.json')) 25 | 26 | 27 | def test_staticfiles_created(): 28 | # only checks for one file in each asset dir, lazy :p 29 | assert os.path.exists(os.path.join(TEST_OUTPUT_PATH, 'css/main.css')) 30 | assert os.path.exists(os.path.join(TEST_OUTPUT_PATH, 'js/search.js')) 31 | assert os.path.exists(os.path.join(TEST_OUTPUT_PATH, 'img/ajax-loader.gif')) 32 | -------------------------------------------------------------------------------- /themes/centraldedados/templates/contact.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 |
7 | {{ welcome_text }} 8 |
9 |
10 |
11 | 12 |

Contact

13 |
14 | 18 | 22 |

23 | 24 | 25 |
26 | 27 |
28 |
29 |
30 |
31 | 32 | {% endblock content %} 33 | -------------------------------------------------------------------------------- /content/pages/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | **Datacentral** is a lightweight platform to easily publish and distribute datasets. It uses the [Data Packages](http://frictionlessdata.io/data-packages/) specification as a common format. By collecting datasets on this portal, we make it easier for developers to plug data into projects. See the [Frictionless Data vision](http://frictionlessdata.io/about/) for more background. 4 | 5 | For example data packages, browse the [github.com/datasets](https://github.com/datasets) organisation. 6 | 7 | There is an [online authoring](http://datapackagist.okfnlabs.org/) and [validation tool](http://data.okfn.org/tools/validate) for data packages developed by Open Knowledge. On CKAN portals, the [datapackager extension](https://github.com/ckan/ckanext-datapackager) allows exporting datasets as data packages. 8 | 9 | The Datacentral platform was initially developed for [Central de dados](http://centraldedados.pt/) project by [Open Knowledge Portugal](https://okfn.org/network/portugal/), [Journalism++](http://jplusplus.org/), and other open-source [contributors](https://github.com/centraldedados/datacentral/graphs/contributors). 10 | -------------------------------------------------------------------------------- /themes/centraldedados/templates/list.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 |
7 | {{ welcome_text }} 8 |
9 |
10 | 14 | 35 |
36 |
37 |
38 | {% endblock content %} 39 | 40 | -------------------------------------------------------------------------------- /themes/centraldedados/static/js/search.js: -------------------------------------------------------------------------------- 1 | var data = null; 2 | 3 | $.ajax('/api.json') 4 | .done(function(response) { 5 | data = response; 6 | }); 7 | 8 | $('#search').on('change paste keyup', function() { 9 | var term = $(this).val(); 10 | var results; 11 | $('.datasets > li').show(); 12 | $(".notfound").hide(); 13 | if (term.length >= 2) { 14 | $('#spinner').css('visibility', 'visible'); 15 | results = _.map(search(term), function(result) { 16 | return '.dataset-' + result; 17 | }); 18 | setTimeout(function() { 19 | $('#spinner').css('visibility', 'hidden'); 20 | }, 1000); 21 | 22 | console.log(results); 23 | console.log(results.length); 24 | $(".datasets > li:not('" + results.toString() + "')").hide(); 25 | if (results.length === 0) { 26 | $(".notfound").show(); 27 | } 28 | } 29 | }); 30 | 31 | function search(term) { 32 | if (!data) { 33 | console.error('Data not yet set'); 34 | return; 35 | } 36 | 37 | var result = _.filter(data, function(dataset) { 38 | return (dataset.title.toLowerCase().indexOf(term.toLowerCase()) > -1); 39 | }); 40 | 41 | return _.pluck(result, 'name'); 42 | } -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | # Utility functions for data packages 2 | import os, json, requests 3 | from zenlog import log 4 | 5 | def csv2json(sourcepath, targetpath): 6 | # csvkit magic 7 | import subprocess 8 | subprocess.call('csvjson %s > %s' % (sourcepath, targetpath), shell=True) 9 | 10 | def download_file(folder, url, filename=None): 11 | if filename is None: 12 | filename = url.split('/')[-1] 13 | r = requests.get(url, stream=True) 14 | with open(os.path.join(folder, filename), 'wb') as f: 15 | for chunk in r.iter_content(chunk_size=1024): 16 | if chunk: # filter out keep-alive new chunks 17 | f.write(chunk) 18 | #f.flush() 19 | return filename 20 | 21 | def fetch_data_package(url, dir_name): 22 | rq = requests.get(url) 23 | if (rq.status_code != 200): 24 | log.warn("Not authorized %d at %s" % (rq.status_code, url)) 25 | return False 26 | spec = rq.json() 27 | # check for update 28 | dp_filename = os.path.join(dir_name, 'datapackage.json') 29 | if os.path.isfile(dp_filename): 30 | with open(dp_filename) as f: 31 | cached = json.load(f) 32 | if cached == spec: 33 | log.debug("No updates") 34 | return False 35 | # create a data folder 36 | data_folder = os.path.join(dir_name, 'data') 37 | if not os.path.isdir(dir_name): 38 | os.makedirs(data_folder) 39 | # download a copy of the datapackage 40 | download_file(dir_name, url, 'datapackage.json') 41 | for res in spec['resources']: 42 | if 'path' in res: 43 | # paths override urls, for local mirrors 44 | basepath = "/".join(url.split('/')[:-1]) + '/' 45 | fn = download_file(data_folder, basepath + res['path']) 46 | elif 'url' in res: 47 | # download resource from url 48 | fn = download_file(data_folder, res['url']) 49 | else: 50 | # skip this resource 51 | log.debug("Skipping: %s" % res) 52 | continue 53 | if 'title' in res: 54 | log.debug('Downloaded: %s - %s' % (res['title'], fn)) 55 | return True 56 | -------------------------------------------------------------------------------- /themes/centraldedados/templates/dataset.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %} 4 | {{ datapkg.title }} — Datacentral 5 | 6 | {% endblock %} 7 | 8 | {% block content %} 9 | 10 |
11 |
12 |
13 |
14 |

Detalhes

15 |

Versão {{ datapkg.version }}

16 |

Licença {{ datapkg.license }}

17 |

Última atualização {{ datapkg.last_updated }}

18 |

Arquivo de origem

19 |
20 |
21 |

Downloads

22 | {% for d in datapkg.datafiles %} 23 |
24 |

{{ d.title|upper }}CSVJSON

25 | {% if d.schema.fields %} 26 |
27 |
Campos
28 |
    29 | {% for f in d.schema.fields %} 30 |
  • {{ f.name }} – {{ f.description }}
  • 31 | {% endfor %} 32 |
33 |
34 | {% endif %} 35 |
36 | {% endfor %} 37 |
38 |
39 |
40 |

Fontes

41 |
    42 | {% for s in datapkg.sources %} 43 |
  • {{ s.name }}
  • 44 | {% endfor %} 45 |
46 |
47 |
48 |
49 |

{{ datapkg.title }}

50 | {% if datapkg.description %} 51 |

{{ datapkg.description }}

52 | {% endif %} 53 | {{ datapkg.readme }} 54 |
55 | 56 |
57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | {% endblock content %} 69 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Project : Data Central 2 | # ----------------------------------------------------------------------------- 3 | # Author : Ricardo Lafuente 4 | # ----------------------------------------------------------------------------- 5 | # License : GNU General Public License 6 | # ----------------------------------------------------------------------------- 7 | # This file is part of the Data Central package. 8 | # 9 | # Data Central is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Data Central is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Data Central. If not, see . 21 | 22 | # This is *heavily* based on Edouard Richard's excellent Makefiles. 23 | # See https://github.com/jplusplus/resonate2014/blob/master/Makefile for 24 | # the basis from where this file was created. 25 | 26 | # your SSH target dir for rsync (set this in the environment) 27 | #SSH_PATH = "wf:~/webapps/centraldedados/" 28 | 29 | # server port for local server 30 | SERVER_PORT = 8002 31 | MAIN_SCRIPT = $(wildcard datacentral.py) 32 | OFFLINE_FLAG = "--offline" 33 | OUTPUT = "_output" 34 | 35 | 36 | all: build 37 | 38 | build: 39 | if [ -d .env ]; then . `pwd`/.env/bin/activate; fi; \ 40 | python $(MAIN_SCRIPT) 41 | 42 | build-offline: 43 | if [ -d .env ]; then . `pwd`/.env/bin/activate; fi; \ 44 | python $(MAIN_SCRIPT) $(OFFLINE_FLAG) 45 | 46 | install: 47 | if ! [ -x "$(pyvenv -h)" ]; then virtualenv .env --no-site-packages --distribute --prompt=\(datacentral\); else pyvenv .env; fi 48 | . `pwd`/.env/bin/activate; pip install -r requirements.txt 49 | if [ ! -f settings.conf ]; then cp settings.conf.sample settings.conf; fi 50 | 51 | serve: 52 | if [ -d .env ]; then . `pwd`/.env/bin/activate; fi; \ 53 | livereload -p $(SERVER_PORT) $(OUTPUT) 54 | 55 | deploy: 56 | rsync --checksum --compress --progress --recursive --delete $(OUTPUT)/ $(SSH_PATH) 57 | 58 | deploy-dry: 59 | rsync --dry-run --checksum --compress --progress --recursive --delete $(OUTPUT)/ $(SSH_PATH) 60 | 61 | clean: 62 | rm -fr repos $(OUTPUT) 63 | 64 | test: 65 | if [ -d .env ]; then . `pwd`/.env/bin/activate; fi; \ 66 | nosetests tests.py 67 | -------------------------------------------------------------------------------- /themes/centraldedados/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% block title %} 7 | Datacentral 8 | {% endblock %} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 29 |
30 |
31 |

32 | 33 | Central de Dados 34 |

35 |
36 |
37 | {% block content %}{% endblock %} 38 | 70 | 71 | 72 | 73 | 74 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Data Central 2 | ============ 3 | 4 | This is a lightweight platform to easily publish and distribute datasets. It was created to be the base for [Central de Dados](http://centraldedados.pt), a repository of data packages related to Portugal. It also used for Data Expeditions and hackathons of [Opendata.ch](https://opendata.ch/). 5 | 6 | It uses Open Knowledge's excellent [Data Package](http://frictionlessdata.io/specs/data-package/) specification as a 7 | common format to provide datasets. See the [Frictionless Data 8 | vision](http://frictionlessdata.io) document to understand why it's 9 | crucial to think about dataset packaging and distribution. 10 | 11 | The main design principle when coming up with Data Central was 12 | portability and simplicity of deployment. It is a framework-less 13 | approach, using Python scripts to gather and compile all datasets, 14 | creating a static HTML web site. Static sites might not be terribly 15 | sexy, but they're extremely useful for some purposes: 16 | 17 | * data workshops 18 | * offline work 19 | * easy deployment 20 | * portability and replication 21 | 22 | We informally refer to this project as "the poor man's 23 | [CKAN](http://ckan.org)". 24 | 25 | Data Central even exposes a static JSON 'API', so that developers 26 | have an easy access to the available datasets and their metadata 27 | on the portal. 28 | 29 | Installation and Usage 30 | ------------ 31 | 32 | 1. **Install dependencies**. After cloning the repository, ensure that 33 | you have virtualenv installed with this command: 34 | 35 | $ pip show virtualenv 36 | 37 | If it's not there, you can install it with: 38 | 39 | $ pip install --user virtualenv 40 | 41 | Now, change 42 | to the project directory and run `make install`. This will 43 | create a local virtualenv and install the necessary 44 | dependencies; it shouldn't be necessary to create a virtualenv 45 | since the `make` commands are all set to work with the venv 46 | that `make install` creates inside the Data Central dir. 47 | 48 | (A) **Alternative installation** 49 | 50 | It is also possible to use the more modern [pipenv](https://pipenv.readthedocs.io/en/latest/) tool to create the environment instead of running `make install`. You will need to copy `settings.conf.sample` to `settings.conf` by hand. 51 | 52 | 2. **Edit settings**. Edit the newly created `settings.conf` 53 | to set your options and point to your data package 54 | repositories. 55 | 56 | 3. **Add content**. The sidebar is a good place to tell your visitors 57 | what this site is about in a few paragraphs. You can edit this in 58 | `content/welcome_text.md`. There is also a dedicated About page you 59 | can modify. Look and feel can be customised by editing the default 60 | theme or adding your own to the `themes` folder and changing settings. 61 | 62 | 4. **Generate the HTML output**. Just run `make build`! 63 | 64 | 5. **Push the static HTML output somewhere!**. The generated 65 | site is placed at the `_output` directory. Just copy the contents 66 | to your webserver, everything's included. 67 | 68 | 6. **Run a web server to see the output**. While developing, you 69 | can also run `make serve` to run a simple webserver, and then 70 | open the site by pointing your browser to `localhost:8002`. 71 | 72 | 7. **Upload to a remote web server to publish.** Using *rsync*, your 73 | portal contents are compressed and uploaded to a remote server with a 74 | command like `SSH_PATH="my.server.org:/my/remote/path" make deploy`. 75 | 76 | Running tests 77 | ------------- 78 | 79 | Datacentral uses Nose for testing. After installing it on your system or virtualenv, just run 80 | 81 | nosetests tests.py 82 | 83 | 84 | TODO 85 | ---- 86 | 87 | * Set up an English language base theme for the HTML output 88 | * Use [Hyde](http://pypi.python.org/pypi/hyde/) or 89 | [Pelican](http://getpelican.com) for a more solid static generator back-end 90 | -------------------------------------------------------------------------------- /themes/centraldedados/static/img/centraldedados.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 27 | 30 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /themes/centraldedados/static/js/underscore-min.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.5.0 2 | // http://underscorejs.org 3 | // (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc. 4 | // (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 5 | // Underscore may be freely distributed under the MIT license. 6 | !function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,v=e.reduce,h=e.reduceRight,d=e.filter,g=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,w=i.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.0";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(j.has(n,a)&&t.call(e,n[a],a,n)===r)return};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduce===v)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduceRight===h)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:g&&n.every===g?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;ae||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.indexi;){var o=i+a>>>1;r.call(e,n[o])=0})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){return j.unzip.apply(j,o.call(arguments))},j.unzip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var M=function(){};j.bind=function(n,t){var r,e;if(w&&n.bind===w)return w.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));M.prototype=n.prototype;var u=new M;M.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u=null;return function(){var i=this,a=arguments,o=function(){u=null,r||(e=n.apply(i,a))},c=r&&!u;return clearTimeout(u),u=setTimeout(o,t),c&&(e=n.apply(i,a)),e}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){var t=[];for(var r in n)j.has(n,r)&&t.push(n[r]);return t},j.pairs=function(n){var t=[];for(var r in n)j.has(n,r)&&t.push([r,n[r]]);return t},j.invert=function(n){var t={};for(var r in n)j.has(n,r)&&(t[n[r]]=r);return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};I.unescape=j.invert(I.escape);var T={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return I[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(z,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var D=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this); 7 | //# sourceMappingURL=underscore-min.map -------------------------------------------------------------------------------- /Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "f41ccfa41aef562839d1abafcd0537531e8db933cc121f8c17c88bc28b9d4c35" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": { 8 | "python_version": "3.7" 9 | }, 10 | "sources": [ 11 | { 12 | "name": "pypi", 13 | "url": "https://pypi.org/simple", 14 | "verify_ssl": true 15 | } 16 | ] 17 | }, 18 | "default": { 19 | "agate": { 20 | "hashes": [ 21 | "sha256:48d6f80b35611c1ba25a642cbc5b90fcbdeeb2a54711c4a8d062ee2809334d1c", 22 | "sha256:c93aaa500b439d71e4a5cf088d0006d2ce2c76f1950960c8843114e5f361dfd3" 23 | ], 24 | "version": "==1.6.1" 25 | }, 26 | "agate-dbf": { 27 | "hashes": [ 28 | "sha256:0666c1ad06cd4b2860351cebbd88bd4b05b2d1abd41b25cf91f8f6715035735e", 29 | "sha256:e445f17ebd0ab31cd0c2d086d79e95d9924deb251f733ea283161e3c8181333c" 30 | ], 31 | "version": "==0.2.0" 32 | }, 33 | "agate-excel": { 34 | "hashes": [ 35 | "sha256:8923f71ee2b5b7b21e52fb314a769b28fb902f647534f5cbbb41991d8710f4c7" 36 | ], 37 | "version": "==0.2.2" 38 | }, 39 | "agate-sql": { 40 | "hashes": [ 41 | "sha256:877b7b85adb5f0325455bba8d50a1623fa32af33680b554feca7c756a15ad9b4" 42 | ], 43 | "version": "==0.5.3" 44 | }, 45 | "argparse": { 46 | "hashes": [ 47 | "sha256:62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4", 48 | "sha256:c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314" 49 | ], 50 | "index": "pypi", 51 | "version": "==1.4.0" 52 | }, 53 | "babel": { 54 | "hashes": [ 55 | "sha256:6778d85147d5d85345c14a26aada5e478ab04e39b078b0745ee6870c2b5cf669", 56 | "sha256:8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23" 57 | ], 58 | "version": "==2.6.0" 59 | }, 60 | "certifi": { 61 | "hashes": [ 62 | "sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7", 63 | "sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033" 64 | ], 65 | "version": "==2018.11.29" 66 | }, 67 | "chardet": { 68 | "hashes": [ 69 | "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", 70 | "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" 71 | ], 72 | "version": "==3.0.4" 73 | }, 74 | "click": { 75 | "hashes": [ 76 | "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", 77 | "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" 78 | ], 79 | "index": "pypi", 80 | "version": "==7.0" 81 | }, 82 | "colorlog": { 83 | "hashes": [ 84 | "sha256:3cf31b25cbc8f86ec01fef582ef3b840950dea414084ed19ab922c8b493f9b42", 85 | "sha256:450f52ea2a2b6ebb308f034ea9a9b15cea51e65650593dca1da3eb792e4e4981" 86 | ], 87 | "index": "pypi", 88 | "version": "==4.0.2" 89 | }, 90 | "csvkit": { 91 | "hashes": [ 92 | "sha256:a6c859c1321d4697dc41252877249091681297f093e08d9c1e1828a6d52c260c" 93 | ], 94 | "index": "pypi", 95 | "version": "==1.0.3" 96 | }, 97 | "dbfread": { 98 | "hashes": [ 99 | "sha256:07c8a9af06ffad3f6f03e8fe91ad7d2733e31a26d2b72c4dd4cfbae07ee3b73d", 100 | "sha256:f604def58c59694fa0160d7be5d0b8d594467278d2bb6a47d46daf7162c84cec" 101 | ], 102 | "version": "==2.0.7" 103 | }, 104 | "et-xmlfile": { 105 | "hashes": [ 106 | "sha256:614d9722d572f6246302c4491846d2c393c199cfa4edc9af593437691683335b" 107 | ], 108 | "version": "==1.0.1" 109 | }, 110 | "future": { 111 | "hashes": [ 112 | "sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8" 113 | ], 114 | "version": "==0.17.1" 115 | }, 116 | "gitdb2": { 117 | "hashes": [ 118 | "sha256:83361131a1836661a155172932a13c08bda2db3674e4caa32368aa6eb02f38c2", 119 | "sha256:e3a0141c5f2a3f635c7209d56c496ebe1ad35da82fe4d3ec4aaa36278d70648a" 120 | ], 121 | "version": "==2.0.5" 122 | }, 123 | "gitpython": { 124 | "hashes": [ 125 | "sha256:563221e5a44369c6b79172f455584c9ebbb122a13368cc82cb4b5addff788f82", 126 | "sha256:8237dc5bfd6f1366abeee5624111b9d6879393d84745a507de0fda86043b65a8" 127 | ], 128 | "index": "pypi", 129 | "version": "==2.1.11" 130 | }, 131 | "idna": { 132 | "hashes": [ 133 | "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", 134 | "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" 135 | ], 136 | "version": "==2.8" 137 | }, 138 | "isodate": { 139 | "hashes": [ 140 | "sha256:2e364a3d5759479cdb2d37cce6b9376ea504db2ff90252a2e5b7cc89cc9ff2d8", 141 | "sha256:aa4d33c06640f5352aca96e4b81afd8ab3b47337cc12089822d6f322ac772c81" 142 | ], 143 | "version": "==0.6.0" 144 | }, 145 | "jdcal": { 146 | "hashes": [ 147 | "sha256:948fb8d079e63b4be7a69dd5f0cd618a0a57e80753de8248fd786a8a20658a07", 148 | "sha256:ea0a5067c5f0f50ad4c7bdc80abad3d976604f6fb026b0b3a17a9d84bb9046c9" 149 | ], 150 | "version": "==1.4" 151 | }, 152 | "jinja2": { 153 | "hashes": [ 154 | "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", 155 | "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" 156 | ], 157 | "index": "pypi", 158 | "version": "==2.10" 159 | }, 160 | "leather": { 161 | "hashes": [ 162 | "sha256:076d1603b5281488285718ce1a5ce78cf1027fe1e76adf9c548caf83c519b988", 163 | "sha256:e0bb36a6d5f59fbf3c1a6e75e7c8bee29e67f06f5b48c0134407dde612eba5e2" 164 | ], 165 | "version": "==0.3.3" 166 | }, 167 | "livereload": { 168 | "hashes": [ 169 | "sha256:29cadfabcedd12eed792e0131991235b9d4764d4474bed75cf525f57109ec0a2", 170 | "sha256:e632a6cd1d349155c1d7f13a65be873b38f43ef02961804a1bba8d817fa649a7" 171 | ], 172 | "index": "pypi", 173 | "version": "==2.6.0" 174 | }, 175 | "markdown": { 176 | "hashes": [ 177 | "sha256:c00429bd503a47ec88d5e30a751e147dcb4c6889663cd3e2ba0afe858e009baa", 178 | "sha256:d02e0f9b04c500cde6637c11ad7c72671f359b87b9fe924b2383649d8841db7c" 179 | ], 180 | "index": "pypi", 181 | "version": "==3.0.1" 182 | }, 183 | "markupsafe": { 184 | "hashes": [ 185 | "sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432", 186 | "sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b", 187 | "sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9", 188 | "sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af", 189 | "sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834", 190 | "sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd", 191 | "sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d", 192 | "sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7", 193 | "sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b", 194 | "sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3", 195 | "sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c", 196 | "sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2", 197 | "sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7", 198 | "sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36", 199 | "sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1", 200 | "sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e", 201 | "sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1", 202 | "sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c", 203 | "sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856", 204 | "sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550", 205 | "sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492", 206 | "sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672", 207 | "sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401", 208 | "sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6", 209 | "sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6", 210 | "sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c", 211 | "sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd", 212 | "sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1" 213 | ], 214 | "index": "pypi", 215 | "version": "==1.1.0" 216 | }, 217 | "nose": { 218 | "hashes": [ 219 | "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac", 220 | "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a", 221 | "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98" 222 | ], 223 | "index": "pypi", 224 | "version": "==1.3.7" 225 | }, 226 | "openpyxl": { 227 | "hashes": [ 228 | "sha256:a5285901fff7b99a011462f18506a4fbfe4055191149ff42f59345828f8cf7b2" 229 | ], 230 | "version": "==2.5.14" 231 | }, 232 | "parsedatetime": { 233 | "hashes": [ 234 | "sha256:3d817c58fb9570d1eec1dd46fa9448cd644eeed4fb612684b02dfda3a79cb84b", 235 | "sha256:9ee3529454bf35c40a77115f5a596771e59e1aee8c53306f346c461b8e913094" 236 | ], 237 | "version": "==2.4" 238 | }, 239 | "python-slugify": { 240 | "hashes": [ 241 | "sha256:d3e034397236020498e677a35e5c05dcc6ba1624b608b9ef7e5fe3090ccbd5a8" 242 | ], 243 | "version": "==2.0.1" 244 | }, 245 | "pytimeparse": { 246 | "hashes": [ 247 | "sha256:04b7be6cc8bd9f5647a6325444926c3ac34ee6bc7e69da4367ba282f076036bd", 248 | "sha256:e86136477be924d7e670646a98561957e8ca7308d44841e21f5ddea757556a0a" 249 | ], 250 | "version": "==1.1.8" 251 | }, 252 | "pytz": { 253 | "hashes": [ 254 | "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", 255 | "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" 256 | ], 257 | "version": "==2018.9" 258 | }, 259 | "requests": { 260 | "hashes": [ 261 | "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", 262 | "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b" 263 | ], 264 | "index": "pypi", 265 | "version": "==2.21.0" 266 | }, 267 | "six": { 268 | "hashes": [ 269 | "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", 270 | "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" 271 | ], 272 | "version": "==1.12.0" 273 | }, 274 | "smmap2": { 275 | "hashes": [ 276 | "sha256:0555a7bf4df71d1ef4218e4807bbf9b201f910174e6e08af2e138d4e517b4dde", 277 | "sha256:29a9ffa0497e7f2be94ca0ed1ca1aa3cd4cf25a1f6b4f5f87f74b46ed91d609a" 278 | ], 279 | "version": "==2.0.5" 280 | }, 281 | "sqlalchemy": { 282 | "hashes": [ 283 | "sha256:52a42dbf02d0562d6e90e7af59f177f1cc027e72833cc29c3a821eefa009c71d" 284 | ], 285 | "version": "==1.2.17" 286 | }, 287 | "tornado": { 288 | "hashes": [ 289 | "sha256:0662d28b1ca9f67108c7e3b77afabfb9c7e87bde174fbda78186ecedc2499a9d", 290 | "sha256:4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409", 291 | "sha256:732e836008c708de2e89a31cb2fa6c0e5a70cb60492bee6f1ea1047500feaf7f", 292 | "sha256:8154ec22c450df4e06b35f131adc4f2f3a12ec85981a203301d310abf580500f", 293 | "sha256:8e9d728c4579682e837c92fdd98036bd5cdefa1da2aaf6acf26947e6dd0c01c5", 294 | "sha256:d4b3e5329f572f055b587efc57d29bd051589fb5a43ec8898c77a47ec2fa2bbb", 295 | "sha256:e5f2585afccbff22390cddac29849df463b252b711aa2ce7c5f3f342a5b3b444" 296 | ], 297 | "version": "==5.1.1" 298 | }, 299 | "unidecode": { 300 | "hashes": [ 301 | "sha256:092cdf7ad9d1052c50313426a625b717dab52f7ac58f859e09ea020953b1ad8f", 302 | "sha256:8b85354be8fd0c0e10adbf0675f6dc2310e56fda43fa8fe049123b6c475e52fb" 303 | ], 304 | "version": "==1.0.23" 305 | }, 306 | "urllib3": { 307 | "hashes": [ 308 | "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", 309 | "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22" 310 | ], 311 | "version": "==1.24.1" 312 | }, 313 | "xlrd": { 314 | "hashes": [ 315 | "sha256:546eb36cee8db40c3eaa46c351e67ffee6eeb5fa2650b71bc4c758a29a1b29b2", 316 | "sha256:e551fb498759fa3a5384a94ccd4c3c02eb7c00ea424426e212ac0c57be9dfbde" 317 | ], 318 | "version": "==1.2.0" 319 | }, 320 | "zenlog": { 321 | "hashes": [ 322 | "sha256:83460a85fa7249b8007c03681a6a0b575ce6fe044349389d3d3d43f58d4687de" 323 | ], 324 | "index": "pypi", 325 | "version": "==1.1" 326 | } 327 | }, 328 | "develop": {} 329 | } 330 | -------------------------------------------------------------------------------- /datacentral.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | Options: 6 | 7 | -c Clear local repos and clone everything again 8 | -o Offline, don't clone or pull remote repos 9 | 10 | TODO: 11 | - read scripts/ dir and run the preparation scripts 12 | 13 | ''' 14 | 15 | try: 16 | from configparser import SafeConfigParser 17 | except ImportError: 18 | from ConfigParser import SafeConfigParser 19 | 20 | import jinja2 21 | import git 22 | import sys 23 | import os 24 | import shutil 25 | import markdown 26 | import json 27 | import codecs 28 | import click 29 | import zipfile 30 | import glob 31 | import time 32 | 33 | from utils import csv2json, download_file, fetch_data_package 34 | from zenlog import log 35 | 36 | CONFIG_FILE = "settings.conf" 37 | OUTPUT_DIR = "_output" 38 | REPO_DIR = "repos" 39 | datasets_dir = "datasets" 40 | files_dir = "download" 41 | THEMES_DIR = "themes" 42 | 43 | # init global vars 44 | env = None 45 | packages = [] 46 | 47 | # set logging level 48 | log.level('info') 49 | 50 | 51 | def local_and_remote_are_at_same_commit(repo, remote): 52 | local_commit = repo.commit() 53 | remote_commit = remote.fetch()[0].commit 54 | return local_commit.hexsha == remote_commit.hexsha 55 | 56 | 57 | def create_index_page(packages, output_dir): 58 | '''Generates the index page with the list of available packages. 59 | Accepts a list of pkg_info dicts, which are generated with the 60 | process_datapackage function.''' 61 | template = env.get_template("list.html") 62 | target = "index.html" 63 | context = {"datapackages": packages, 64 | "welcome_text": markdown.markdown(codecs.open("content/welcome_text.md", 'r', 'utf-8').read(), output_format="html5", encoding="UTF-8"), 65 | } 66 | contents = template.render(**context) 67 | f = codecs.open(os.path.join(output_dir, target), 'w', 'utf-8') 68 | f.write(contents) 69 | f.close() 70 | log.debug("Created index.html.") 71 | 72 | 73 | def create_contact_page(output_dir, contact_email=""): 74 | '''Creates a contact form page.''' 75 | template = env.get_template("contact.html") 76 | target_dir = os.path.join(output_dir, "contact/") 77 | if not os.path.exists(target_dir): 78 | os.makedirs(target_dir) 79 | target = os.path.join(target_dir, "index.html") 80 | context = {} 81 | context["contact_email"] = contact_email 82 | contents = template.render(**context) 83 | f = codecs.open(target, 'w', 'utf-8') 84 | f.write(contents) 85 | f.close() 86 | log.debug("Created contact page.") 87 | 88 | 89 | def create_static_pages(output_dir): 90 | '''Generates a static page from each of the files contained in 91 | `content/pages/`.''' 92 | template = env.get_template("page.html") 93 | for f in glob.glob("content/pages/*.md"): 94 | page_name = f.split("/")[-1].replace(".md", "") 95 | target_dir = os.path.join(output_dir, "%s/" % page_name) 96 | if not os.path.exists(target_dir): 97 | os.makedirs(target_dir) 98 | target = os.path.join(target_dir, "index.html") 99 | context = {} 100 | md_content = codecs.open(f, 'r', 'utf-8').read() 101 | context["content"] = markdown.markdown(md_content, output_format="html5", encoding="UTF-8") 102 | contents = template.render(**context) 103 | f = codecs.open(target, 'w', 'utf-8') 104 | f.write(contents) 105 | f.close() 106 | log.debug("Created static page '%s'." % page_name) 107 | 108 | # Content images 109 | if os.path.exists("content/media"): 110 | media_dir = os.path.join(output_dir, "media") 111 | if os.path.exists(media_dir): 112 | shutil.rmtree(media_dir) 113 | shutil.copytree("content/media", media_dir) 114 | 115 | 116 | def create_api(packages, output_dir, repo_dir): 117 | '''Generates a static API containing all the datapackage.json of the containing datasets. 118 | Accepts a list of pkg_info dicts, which are generated with the 119 | process_datapackage function.''' 120 | all_metadata = [] 121 | for pkg_info in packages: 122 | pkg_dir = os.path.join(repo_dir, pkg_info['name']) 123 | all_metadata.append(json.loads(open(os.path.join(pkg_dir, "datapackage.json")).read())) 124 | with open(os.path.join(output_dir, 'api.json'), 'w') as api_file: 125 | json.dump(all_metadata, api_file) 126 | log.debug("Created api.json.") 127 | 128 | 129 | def create_dataset_page(pkg_info, output_dir): 130 | '''Generate a single dataset page.''' 131 | template = env.get_template("dataset.html") 132 | name = pkg_info["name"] 133 | if not os.path.exists(os.path.join(output_dir, name)): 134 | os.makedirs(os.path.join(output_dir, name)) 135 | 136 | target = "%s/index.html" % (name) 137 | 138 | context = {"datapkg": pkg_info} 139 | context['welcome_text'] = markdown.markdown(codecs.open("content/welcome_text.md", 'r', 'utf-8').read(), output_format="html5", encoding="UTF-8") 140 | contents = template.render(**context) 141 | 142 | f = codecs.open(os.path.join(output_dir, target), 'w', 'utf-8') 143 | f.write(contents) 144 | f.close() 145 | log.debug("Created %s." % target) 146 | 147 | class ParseException(Exception): 148 | pass 149 | 150 | def process_datapackage(pkg_name, repo_dir, repo_url): 151 | '''Reads a data package and returns a dict with its metadata. The 152 | items in the dict are: 153 | - name 154 | - title 155 | - license 156 | - description 157 | - sources 158 | - readme: in HTML, processed with python-markdown from README.md, 159 | empty if README.md does not exist) 160 | - datafiles: a dict that contains the contents of the "resources" 161 | attribute. Each resource also contains the "basename" property, 162 | which is the resource base filename (without preceding 163 | directory) 164 | ''' 165 | pkg_dir = os.path.join(repo_dir, pkg_name) 166 | pkg_info = {} 167 | try: 168 | metadata = json.loads(open(os.path.join(pkg_dir, "datapackage.json")).read()) 169 | except IOError: 170 | raise ParseException("datapackage.json not found") 171 | 172 | # get main attributes 173 | pkg_info['name'] = pkg_name 174 | pkg_info['homepage'] = repo_url 175 | pkg_info['original_name'] = metadata['name'] 176 | pkg_info['title'] = metadata['title'] 177 | pkg_info['license'] = metadata.get('license') 178 | if pkg_info['license'] and 'title' in pkg_info['license']: 179 | pkg_info['license'] = pkg_info['license']['title'] 180 | if not 'description' in metadata: 181 | pkg_info['description'] = "" 182 | else: 183 | pkg_info['description'] = metadata['description'] 184 | pkg_info['sources'] = metadata.get('sources') or [] 185 | # process README 186 | readme = "" 187 | readme_path = os.path.join(pkg_dir, "README.md") 188 | if not os.path.exists(readme_path): 189 | readme_path = os.path.join(pkg_dir, "README.markdown") 190 | if not os.path.exists(readme_path): 191 | if len(pkg_info['description']) > 140: 192 | readme = markdown.markdown(pkg_info['description'], output_format="html5", encoding="UTF-8") 193 | pkg_info['description'] = "" 194 | else: 195 | log.warn("No README.md or description found in the data package.") 196 | else: 197 | pkg_info['readme_path'] = readme_path 198 | contents = codecs.open(readme_path, 'r', 'utf-8').read() 199 | try: 200 | readme = markdown.markdown(contents, output_format="html5", encoding="UTF-8") 201 | except UnicodeDecodeError: 202 | raise ParseException("README.md has invalid encoding, maybe the datapackage is not UTF-8?") 203 | pkg_info['readme'] = readme 204 | # process resource/datafiles list 205 | for r in metadata['resources']: 206 | if not r.get('schema'): 207 | log.warn("Schema missing in resource, adding blank") 208 | r['schema'] = { 'fields': [] } 209 | if not r.get('path'): 210 | r['path'] = 'data/%s' % r['url'].split('/')[-1] 211 | r['basename'] = os.path.basename(r['path']) 212 | if not r.get('title'): 213 | if r.get('name'): 214 | title = os.path.basename(r['name']) 215 | else: 216 | # no resource name, use capitalised filename 217 | title = os.path.basename(r['path']).split('.')[0] 218 | title = title[:1].upper() + title[1:] 219 | r['title'] = title 220 | 221 | pkg_info['datafiles'] = metadata['resources'] 222 | 223 | return pkg_info 224 | 225 | 226 | def generate(offline=False, 227 | fetch_only=False, 228 | output_dir=OUTPUT_DIR, 229 | theme_dir=os.path.join(THEMES_DIR, 'centraldedados'), 230 | repo_dir=REPO_DIR, 231 | config_file=CONFIG_FILE): 232 | '''Main function that takes care of the whole process.''' 233 | global env, packages 234 | # Read the config file 235 | parser = SafeConfigParser() 236 | parser.read(config_file) 237 | # Load the theme and set up Jinja 238 | theme_name = parser.get('ui', 'theme') 239 | theme_dir = os.path.join(THEMES_DIR, theme_name) 240 | template_dir = os.path.join(theme_dir, "templates") 241 | env = jinja2.Environment(loader=jinja2.FileSystemLoader([template_dir])) 242 | 243 | # Set up the output directory 244 | if not os.path.exists(output_dir): 245 | os.mkdir(output_dir) 246 | # Set up the dir for storing repositories 247 | if not os.path.exists(repo_dir): 248 | log.debug("Directory %s doesn't exist, creating it." % repo_dir) 249 | os.mkdir(repo_dir) 250 | # Copy htaccess file 251 | shutil.copyfile(os.path.join(theme_dir, 'static/htaccess'), os.path.join(output_dir, ".htaccess")) 252 | # Create static dirs 253 | # TODO: only update changed files -- right now we regenerate the whole static dir 254 | 255 | # Static CSS files 256 | css_dir = os.path.join(output_dir, "css") 257 | if os.path.exists(css_dir): 258 | shutil.rmtree(css_dir) 259 | shutil.copytree(os.path.join(theme_dir, "static/css"), css_dir) 260 | # Static JavaScript files 261 | js_dir = os.path.join(output_dir, "js") 262 | if os.path.exists(js_dir): 263 | shutil.rmtree(js_dir) 264 | shutil.copytree(os.path.join(theme_dir, "static/js"), js_dir) 265 | # Theme images 266 | img_dir = os.path.join(output_dir, "img") 267 | if os.path.exists(img_dir): 268 | shutil.rmtree(img_dir) 269 | shutil.copytree(os.path.join(theme_dir, "static/img"), img_dir) 270 | # Fonts 271 | fonts_dir = os.path.join(output_dir, "fonts") 272 | if os.path.exists(fonts_dir): 273 | shutil.rmtree(fonts_dir) 274 | shutil.copytree(os.path.join(theme_dir, "static/fonts"), fonts_dir) 275 | 276 | if not parser.items('repositories'): 277 | log.critical('No repository data in settings.conf (does it even exist?). Cannot proceed :(') 278 | sys.exit() 279 | # go through each specified dataset 280 | for r in parser.items('repositories'): 281 | name, url = r 282 | dir_name = os.path.join(repo_dir, name) 283 | repo = None 284 | 285 | # do we have a local copy? 286 | if os.path.isdir(dir_name): 287 | if not os.path.isdir(os.path.join(dir_name, '.git')): 288 | if url.endswith(".json"): 289 | log.info("%s: Data package, refreshing" % name) 290 | updated = fetch_data_package(url, dir_name) 291 | else: 292 | log.info('%s: Unsupported repo, skipping update' % name) 293 | continue 294 | 295 | elif not offline: 296 | repo = git.Repo(dir_name) 297 | origin = repo.remotes.origin 298 | try: 299 | origin.fetch() 300 | except AssertionError: 301 | # usually this fails on the first run, try again 302 | origin.fetch() 303 | except git.exc.GitCommandError: 304 | log.critical("%s: Fetch error, this dataset will be left out." % name) 305 | continue 306 | # see if we have updates 307 | if not local_and_remote_are_at_same_commit(repo, origin): 308 | log.debug("%s: Repo has new commits, updating local copy." % name) 309 | updated = True 310 | # connection errors can also happen if fetch succeeds but pull fails 311 | try: 312 | result = origin.pull()[0] 313 | except git.exc.GitCommandError: 314 | log.critical("%s: Pull error, this dataset will be left out." % name) 315 | continue 316 | if result.flags & result.ERROR: 317 | log.error("%s: Pull error, but going ahead." % name) 318 | updated = False 319 | else: 320 | log.info("%s: No changes." % name) 321 | updated = False 322 | else: 323 | log.debug("%s: Offline mode, using cached version." % name) 324 | # we set updated to True in order to re-generate everything 325 | # FIXME: See checksum of CSV files to make sure they're new before 326 | # marking updated as true 327 | updated = True 328 | repo = git.Repo(dir_name) 329 | if fetch_only: 330 | # if the --fetch-only flag was set, skip to the next dataset 331 | continue 332 | else: 333 | if offline: 334 | log.warn("%s: No local cache, skipping." % name) 335 | continue 336 | else: 337 | if url.endswith(".git"): 338 | # Handle GIT Repository URL 339 | log.info("%s: New repo, cloning." % name) 340 | try: 341 | repo = git.Repo.clone_from(url, dir_name) 342 | # For faster checkouts, one file at a time: 343 | #repo = git.Repo.clone_from(url, dir_name, n=True, depth=1) 344 | #repo.git.checkout("HEAD", "datapackage.json") 345 | except git.exc.GitCommandError as inst: 346 | log.warn("%s: skipping %s" % (inst, name)) 347 | continue 348 | updated = True 349 | 350 | elif url.endswith(".json"): 351 | # Handle Data Package URL 352 | log.info("%s: New data package, fetching." % name) 353 | updated = fetch_data_package(url, dir_name) 354 | else: 355 | log.warn("Unsupported repository: %s" % url) 356 | 357 | # get datapackage metadata 358 | try: 359 | pkg_info = process_datapackage(name, repo_dir, url) 360 | except ParseException as inst: 361 | log.warn("%s: skipping %s" % (inst, name)) 362 | continue 363 | 364 | # set last updated time based on last commit, comes in Unix timestamp format so we convert 365 | import datetime 366 | if repo is not None: 367 | d = repo.head.commit.committed_date 368 | else: 369 | d = int(time.mktime(time.localtime())) 370 | last_updated = datetime.datetime.fromtimestamp(int(d)).strftime('%Y-%m-%d %H:%M:%S') 371 | pkg_info['last_updated'] = last_updated 372 | # add it to the packages list for index page generation after the loop ends 373 | packages.append(pkg_info) 374 | # re-generate the dataset HTML pages 375 | create_dataset_page(pkg_info, output_dir) 376 | # if repo was updated, copy over CSV/JSON/* and ZIP files to the download dir 377 | # (we always generate them if offline) 378 | if updated or offline: 379 | create_dataset_page(pkg_info, output_dir) 380 | datafiles = pkg_info['datafiles'] 381 | zipf = zipfile.ZipFile(os.path.join(output_dir, name + '.zip'), 'w') 382 | for d in datafiles: 383 | log.info("Copying %s" % d['path']) 384 | # copy file 385 | target = os.path.join(output_dir, os.path.basename(d['path'])) 386 | shutil.copyfile(os.path.join(dir_name, d['path']), target) 387 | # generate JSON version of CSV 388 | # if target.endswith('.csv'): 389 | # csv2json(target, target.replace(".csv", ".json")) 390 | # make zip file 391 | zipf.write(os.path.join(dir_name, d['path']), d['basename'], compress_type=zipfile.ZIP_DEFLATED) 392 | if 'readme_path' in pkg_info: 393 | try: 394 | zipf.write(pkg_info['readme_path'], 'README.md') 395 | except OSError: 396 | pass 397 | zipf.close() 398 | 399 | # HTML index with the list of available packages 400 | create_index_page(packages, output_dir) 401 | # Static JSON API of the data packages 402 | create_api(packages, output_dir, repo_dir) 403 | # Static pages 404 | create_static_pages(output_dir) 405 | # Contact page 406 | create_contact_page(output_dir, parser.get('credentials', 'contact_email')) 407 | 408 | log.info("All static content is ready inside '%s'." % OUTPUT_DIR) 409 | 410 | 411 | @click.command() 412 | @click.option('-f', '--fetch-only', help='Only clone or pull repos, do not generate HTML output.', is_flag=True, default=False) 413 | @click.option('-x', '--offline', help='Offline mode, do not clone or pull.', is_flag=True, default=False) 414 | @click.option('-o', '--output-dir', help='Output directory (default is _output)', type=click.Path(), default=OUTPUT_DIR) 415 | def main(offline, fetch_only, output_dir): 416 | generate(offline, fetch_only, output_dir) 417 | 418 | 419 | if __name__ == "__main__": 420 | main() 421 | -------------------------------------------------------------------------------- /themes/centraldedados/static/css/main.css: -------------------------------------------------------------------------------- 1 | /* Reset 2 | */ 3 | /* http://meyerweb.com/eric/tools/css/reset/ 4 | v2.0 | 20110126 5 | License: none (public domain) 6 | */ 7 | 8 | html, body, div, span, applet, object, iframe, 9 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 10 | a, abbr, acronym, address, big, cite, code, 11 | del, dfn, em, img, ins, kbd, q, s, samp, 12 | small, strike, strong, sub, sup, tt, var, 13 | b, u, i, center, 14 | dl, dt, dd, ol, ul, li, 15 | fieldset, form, label, legend, 16 | table, caption, tbody, tfoot, thead, tr, th, td, 17 | article, aside, canvas, details, embed, 18 | figure, figcaption, footer, header, hgroup, 19 | menu, nav, output, ruby, section, summary, 20 | time, mark, audio, video { 21 | margin: 0; 22 | padding: 0; 23 | border: 0; 24 | font-size: 100%; 25 | font: inherit; 26 | vertical-align: baseline; 27 | } 28 | /* HTML5 display-role reset for older browsers */ 29 | article, aside, details, figcaption, figure, 30 | footer, header, hgroup, menu, nav, section { 31 | display: block; 32 | } 33 | body { 34 | line-height: 1; 35 | } 36 | ol, ul { 37 | list-style: none; 38 | } 39 | blockquote, q { 40 | quotes: none; 41 | } 42 | blockquote:before, blockquote:after, 43 | q:before, q:after { 44 | content: ""; 45 | content: none; 46 | } 47 | table { 48 | border-collapse: collapse; 49 | border-spacing: 0; 50 | } 51 | 52 | html { 53 | font-family: sans-serif; 54 | -ms-text-size-adjust: 100%; 55 | -webkit-text-size-adjust: 100%; 56 | } 57 | 58 | a { background-color: transparent; } 59 | 60 | a:active, 61 | a:hover { outline: 0; } 62 | 63 | hr { 64 | box-sizing: content-box; 65 | height: 0; } 66 | 67 | pre { overflow: auto; } 68 | 69 | code, 70 | kbd, 71 | pre, 72 | samp { 73 | font-family: monospace, monospace; 74 | font-size: 1em; } 75 | 76 | button, 77 | input, 78 | optgroup, 79 | select, 80 | textarea { 81 | color: inherit; 82 | font: inherit; 83 | margin: 0; 84 | } 85 | 86 | button { overflow: visible; } 87 | 88 | button, 89 | select { 90 | text-transform: none; } 91 | 92 | button, 93 | html input[type="button"], 94 | input[type="reset"], 95 | input[type="submit"] { 96 | -webkit-appearance: button; 97 | cursor: pointer; 98 | } 99 | 100 | button[disabled], 101 | html input[disabled] { 102 | cursor: not-allowed; } 103 | 104 | button::-moz-focus-inner, 105 | input::-moz-focus-inner { 106 | border: 0; 107 | padding: 0; } 108 | 109 | input { 110 | line-height: normal; } 111 | 112 | optgroup { 113 | font-weight: bold; } 114 | 115 | button { 116 | -webkit-appearance: none; 117 | -moz-appearance: none; 118 | background: transparent; 119 | padding: 0; 120 | border: 0; 121 | border-radius: 4px; 122 | line-height: 1; 123 | outline: 0; } 124 | 125 | html { 126 | box-sizing: border-box; 127 | } 128 | 129 | *, 130 | *::before, 131 | *::after { 132 | box-sizing: inherit; } 133 | 134 | 135 | /*! HTML5 Boilerplate v4.3.0 | MIT License | http://h5bp.com/ */ 136 | 137 | html, 138 | button, 139 | input, 140 | select, 141 | textarea { 142 | color: #222; 143 | } 144 | 145 | html { 146 | font-size: 100%; 147 | line-height: 1.4; 148 | } 149 | 150 | ::-moz-selection { 151 | background: #b3d4fc; 152 | text-shadow: none; 153 | } 154 | 155 | ::selection { 156 | background: #b3d4fc; 157 | text-shadow: none; 158 | } 159 | 160 | hr { 161 | display: block; 162 | height: 1px; 163 | border: 0; 164 | border-top: 1px solid #ccc; 165 | margin: 1rem 0; 166 | padding: 0; 167 | } 168 | 169 | audio, 170 | canvas, 171 | img, 172 | video { 173 | vertical-align: middle; 174 | } 175 | 176 | fieldset { 177 | border: 0; 178 | margin: 0; 179 | padding: 0; 180 | } 181 | 182 | textarea { 183 | resize: vertical; 184 | } 185 | 186 | 187 | /* ========================================================================== 188 | Author's custom styles 189 | ========================================================================== */ 190 | 191 | /* Typography 192 | */ 193 | 194 | @font-face { 195 | font-family: "Comme"; 196 | font-weight: 400; 197 | font-style: normal; 198 | src: local("Comme"), url("/fonts/CommeSans/Comme-Regular.ttf") format("truetype"); 199 | } 200 | 201 | @font-face { 202 | font-family: "Comme"; 203 | font-weight: 300; 204 | font-style: normal; 205 | src: local("Comme Thin"), url("/fonts/CommeSans/Comme-Thin.ttf") format("truetype"); 206 | } 207 | 208 | @font-face { 209 | font-family: "Comme"; 210 | font-weight: 700; 211 | font-style: normal; 212 | src: local("Comme Bold"), url("/fonts/CommeSans/Comme-Bold.ttf") format("truetype"); 213 | } 214 | 215 | @font-face { 216 | font-family: "Comme"; 217 | font-weight: 500; 218 | font-style: normal; 219 | src: local("Comme Medium"), url("/fonts/CommeSans/Comme-Medium.ttf") format("truetype"); 220 | } 221 | 222 | @font-face { 223 | font-family: "Comme Mono"; 224 | font-weight: 400; 225 | font-style: normal; 226 | src: local("Comme Mono"), url("/fonts/CommeSans/CommeMono-Regular.ttf") format("truetype"); 227 | } 228 | 229 | body { 230 | font-family: "Comme", DejaVu Sans, Arial, sans-serif; 231 | font-weight: 400; 232 | line-height: 1.4; 233 | } 234 | 235 | h1 { 236 | font-size: 2.25rem; 237 | font-family: "Comme"; 238 | font-weight: 300; 239 | margin-bottom: 0.5rem; 240 | } 241 | 242 | h2 { 243 | font-size: 1.85rem; 244 | font-family: "Comme"; 245 | font-weight: 300; 246 | color: #888; 247 | margin-top: 0.625rem; 248 | margin-bottom: 0.375rem; 249 | } 250 | 251 | h3 { 252 | font-size: 1.625rem; 253 | font-family: "Comme"; 254 | font-weight: 500; 255 | color: #888; 256 | margin-top: 0.625rem; 257 | margin-bottom: 0.1rem; 258 | } 259 | 260 | h4 { 261 | font-size: 1.375rem; 262 | font-family: "Comme"; 263 | font-weight: 500; 264 | color: #888; 265 | margin-top: 0.625rem; 266 | margin-bottom: 0.375rem; 267 | } 268 | 269 | h5 { 270 | font-size: 0.8rem; 271 | font-family: "Comme"; 272 | font-weight: 700; 273 | color: #aaa; 274 | text-transform: uppercase; 275 | margin-top: 0.375rem; 276 | } 277 | 278 | h6 { 279 | font-size: 0.7rem; 280 | font-family: "Comme"; 281 | font-weight: 500; 282 | text-transform: uppercase; 283 | } 284 | 285 | strong, 286 | .footer li a { 287 | font-family: "Comme"; 288 | font-weight: 700; 289 | } 290 | 291 | .datafiles > .box span { 292 | font-family: "Comme Mono"; 293 | } 294 | 295 | .nav, 296 | .footer, 297 | small { 298 | font-size: 0.75rem; 299 | } 300 | 301 | code, 302 | pre, 303 | kbd { 304 | font-family: Consolas, "Liberation Mono", Courier, monospace; 305 | font-weight: normal; 306 | white-space: pre-wrap; 307 | word-wrap: normal; 308 | word-break: keep-all; 309 | background-color: #e6e6e6; 310 | padding: 0.125rem 0.3125rem 0.0625rem; 311 | } 312 | 313 | /* Colours 314 | */ 315 | 316 | body { 317 | background: #d8d6c9; 318 | color: #2c373a; 319 | } 320 | 321 | a { 322 | color: #de1b1b; 323 | text-decoration: none; 324 | outline: 0; 325 | } 326 | 327 | a:hover, 328 | a:focus, 329 | a:active { 330 | color: #c91313; 331 | } 332 | 333 | 334 | /* Helper classes 335 | */ 336 | 337 | .hide { display: none; } 338 | 339 | 340 | /* Layout 341 | */ 342 | 343 | .row:before, .row:after, 344 | .header:before, .header:after, 345 | .nav:before, .nav:after, 346 | .datafiles:before, .datafiles:after { 347 | content: " "; 348 | display: table; 349 | } 350 | 351 | *, *:before, *:after { 352 | -moz-box-sizing: border-box; 353 | } 354 | 355 | .row:after, 356 | .header:after 357 | .nav:after, 358 | .datafiles:after { 359 | clear: both; 360 | } 361 | 362 | .row > div { 363 | width: 96%; 364 | margin: 1rem auto; 365 | } 366 | 367 | .nav, .header, .row { 368 | background: #f7f8f2; 369 | } 370 | 371 | .nav > div { 372 | width: 96%; 373 | margin: 0 auto; 374 | } 375 | 376 | .nav li { 377 | text-transform: uppercase; 378 | } 379 | 380 | .nav > div > ul { 381 | text-align: right; 382 | } 383 | 384 | .nav li { 385 | display: inline-block; 386 | } 387 | 388 | .nav li a { 389 | display: block; 390 | padding: .75rem .5rem; 391 | } 392 | 393 | .header > div { 394 | width: 96%; 395 | clear: both; 396 | margin: 0 auto 1rem; 397 | padding-bottom: 1rem; 398 | border-bottom: 1px solid #b9bdc5; 399 | } 400 | 401 | .header a { 402 | display: block; 403 | width: 100%; 404 | color: #2c373a; 405 | padding: .5rem 0; 406 | } 407 | 408 | .header a:hover { 409 | color: #de1b1b; 410 | } 411 | 412 | .header h1 { 413 | line-height: 1; 414 | margin: 0; 415 | } 416 | 417 | .header h1 #sitename { 418 | font-size: 6.5vw; 419 | display: inline-block; 420 | vertical-align: bottom; 421 | } 422 | 423 | .header h1 #logo { 424 | display: inline-block; 425 | width: 20%; 426 | margin-right: 2%; 427 | } 428 | 429 | .header h1 #logo img { 430 | display: inline-block; 431 | width: 80%; 432 | height: auto; 433 | vertical-align: bottom; 434 | } 435 | 436 | .row .description { 437 | padding-top: 2rem; 438 | } 439 | 440 | .row .description p, 441 | .row .description code { 442 | font-size: 0.875rem; 443 | } 444 | 445 | .row .main { 446 | padding-top: 1rem; 447 | margin-bottom: 2.5rem; 448 | } 449 | 450 | .description p, 451 | .main .readme p, 452 | .row .main p { 453 | margin-bottom: .75rem; 454 | } 455 | 456 | .row .main-dataset .readme ul, 457 | .row .static-page ul { 458 | line-height: 1.4; 459 | margin-bottom: 1rem; 460 | margin-left: 0; 461 | } 462 | 463 | .row .main-dataset .readme ul li::before, 464 | .row .static-page ul li::before { 465 | content: "— "; 466 | display: inline-block; 467 | padding-right: 0.45rem; 468 | } 469 | 470 | .row .main-dataset ul li, 471 | .row .static-page ul li { 472 | margin-bottom: 0.45rem; 473 | } 474 | 475 | .search { 476 | padding: 0 0 1rem; 477 | position: relative; 478 | } 479 | 480 | #search { 481 | box-sizing: border-box; 482 | display: block; 483 | font-size: 1rem; 484 | font-family: "Comme"; 485 | font-weight: 400; 486 | width: 100%; 487 | border: 2px solid #ccc; 488 | padding: 0.5em 0 0.5em 0.5em; 489 | border-radius: 4px; 490 | } 491 | 492 | ::-webkit-input-placeholder { color: #969ba6; } 493 | ::-moz-placeholder { color: #969ba6; } 494 | :-ms-input-placeholder { color: #969ba6; } 495 | 496 | #search:focus { 497 | color: #2c373a; 498 | border: 2px solid #de1b1b; 499 | } 500 | 501 | #spinner { 502 | display: inline; 503 | visibility: hidden; 504 | position: absolute; 505 | top: 0.5rem; 506 | right: 0.35rem; 507 | z-index: 100; 508 | } 509 | 510 | .notfound { 511 | display: none; 512 | padding-top: 1em; 513 | } 514 | 515 | /* homepage dataset list 516 | */ 517 | 518 | .datasets > li { 519 | border-top: 1px solid #b9bdc5; 520 | padding-bottom: 0.75rem; 521 | margin-top: 0.45rem; 522 | margin-bottom: 0.45rem; 523 | } 524 | 525 | .datasets > li:nth-child(2) { 526 | margin-top: 0; 527 | } 528 | 529 | .datasets > li a { 530 | display: block; 531 | color: #2c373a; 532 | } 533 | 534 | .datasets > li a h3 { color: #de1b1b; } 535 | .datasets > li a span { color: #2c373a; } 536 | .datasets > li a span.source { color: #969ba6; } 537 | 538 | 539 | .datasets > li a:hover h3, 540 | .datasets > li a:focus h3, 541 | .datasets > li a:active h3 { color: #c91313; } 542 | 543 | .datasets > li span { 544 | display: block; 545 | } 546 | 547 | .datasets > li span.source { 548 | display: block; 549 | font-size: 0.875rem; 550 | color: #969ba6; 551 | } 552 | 553 | /* dataset page 554 | */ 555 | 556 | .main-dataset .details h4:first-child { 557 | padding-top: 0; 558 | } 559 | 560 | .datafile-box { 561 | margin-top: 1rem; 562 | } 563 | 564 | .datafile-box + .datafile-box { 565 | margin-top: 0.25rem; 566 | } 567 | 568 | .datafile-fieldlist ul { 569 | margin-left: 0.75rem; 570 | font-size: 0.8rem; 571 | } 572 | 573 | .sources ul { 574 | margin-left: 0.75rem; 575 | } 576 | 577 | .readme h1.title { 578 | font-size: 1.75rem; 579 | line-height: 1.3; 580 | margin-bottom: 0.45rem; 581 | } 582 | 583 | .readme h2.subtitle { 584 | font-size: 0.9rem; 585 | font-family: "Comme"; 586 | font-weight: 700; 587 | line-height: 1.3; 588 | color: #999; 589 | margin-bottom: 2rem; 590 | } 591 | 592 | .readme h1 { 593 | font-size: 1.5rem; 594 | } 595 | 596 | .readme h2 { 597 | font-size: 1.25rem; 598 | font-family: "Comme"; 599 | font-weight: 300; 600 | text-transform: uppercase; 601 | margin-top: 1rem; 602 | } 603 | 604 | .footer { 605 | background: #d8d6c9; 606 | padding-top: 1rem; 607 | } 608 | 609 | .footer h4 { 610 | margin-bottom: 1rem; 611 | } 612 | 613 | .footer h5 { 614 | color: #2c373a; 615 | margin-bottom: 1.75rem; 616 | text-transform: none; 617 | } 618 | 619 | .footer h5 a { 620 | display: inline-block; 621 | margin: 0 0.75rem; 622 | text-transform: uppercase; 623 | } 624 | 625 | .footer h5 img { 626 | display: inline-block; 627 | height: 18px; 628 | width: auto; 629 | vertical-align: bottom; 630 | } 631 | 632 | .footer li { 633 | margin: 1rem 1rem 0 0; 634 | } 635 | 636 | .footer ul img { 637 | display: inline-block; 638 | height: 32px; 639 | width: auto; 640 | } 641 | 642 | /* Forms -- contact form 643 | */ 644 | 645 | form { 646 | padding: 1.5rem 0; 647 | } 648 | 649 | form p { 650 | padding-top: 1rem; 651 | margin-bottom: 1rem; 652 | } 653 | 654 | form label { 655 | font-size: 0.875rem; 656 | font-family: "Comme Regular", DejaVu Sans, Arial, sans-serif; 657 | display: block; 658 | width: 100%; 659 | margin-bottom: 1rem; 660 | } 661 | 662 | form input { 663 | display: block; 664 | width: 100%; 665 | } 666 | 667 | input[type="text"], 668 | input[type="email"] { 669 | display: block; 670 | background-color: #fefefe; 671 | border: 1px solid #cacaca; 672 | border-radius: 4px; 673 | box-shadow: 0 1px 2px rgba(10, 10, 10, 0.1) inset; 674 | box-sizing: border-box; 675 | color: #2c373a; 676 | display: block; 677 | font-size: 1rem; 678 | height: 2.4375rem; 679 | margin: 0.45rem 0 1rem; 680 | padding: 0.5rem; 681 | transition: box-shadow 0.5s ease 0s, border-color 0.25s ease-in-out 0s; 682 | width: 100%; 683 | } 684 | 685 | 686 | textarea { 687 | display: block; 688 | height: auto; 689 | min-height: 50px; 690 | border-radius: 4px; 691 | overflow: auto; 692 | background-color: #fefefe; 693 | border: 1px solid #cacaca; 694 | box-shadow: 0 1px 2px rgba(10, 10, 10, 0.1) inset; 695 | box-sizing: border-box; 696 | color: #2c373a; 697 | display: block; 698 | font-size: 1rem; 699 | margin: 0.75rem 0 1rem; 700 | padding: 0.5rem; 701 | transition: box-shadow 0.5s ease 0s, border-color 0.25s ease-in-out 0s; 702 | width: 100%; 703 | } 704 | 705 | input[type="text"]:focus, 706 | input[type="email"]:focus, 707 | textarea:focus { 708 | background-color: #fefefe; 709 | border: 1px solid #888; 710 | box-shadow: 0 0 5px #cacaca; 711 | outline: medium none; 712 | transition: box-shadow 0.5s ease 0s, border-color 0.25s ease-in-out 0s; 713 | } 714 | 715 | .button { 716 | font-size: 0.875rem; 717 | font-family: "Comme", DejaVu Sans, Arial, sans-serif; 718 | font-weight: 500; 719 | line-height: 1; 720 | color: #2c373a; 721 | background-color: #cacaca; 722 | border: 1px solid transparent; 723 | border-radius: 4px; 724 | cursor: pointer; 725 | padding: 0.75rem 1rem; 726 | text-align: center; 727 | transition: background-color 0.25s ease-out 0s, color 0.25s ease-out 0s; 728 | vertical-align: middle; 729 | } 730 | 731 | .button:hover, .button:focus { 732 | background-color: #888; 733 | } 734 | 735 | 736 | /* ========================================================================== 737 | Media Queries 738 | ========================================================================== */ 739 | 740 | 741 | @media only screen and (max-width: 480px) { 742 | 743 | .header > div { 744 | padding-bottom: 0; 745 | } 746 | .header h1 #logo { 747 | width: 15%; 748 | margin-right: 1%; 749 | } 750 | .header h1 #logo img { 751 | width: 100%; 752 | } 753 | .header h1 #sitename { 754 | font-size: 8.5vw; 755 | } 756 | .row .description { 757 | padding-top: 0; 758 | } 759 | } 760 | 761 | @media only screen and (min-width: 480px) { 762 | 763 | .datafiles > ul { 764 | margin: 0 0 1.25rem; 765 | } 766 | } 767 | 768 | 769 | @media only screen and (min-width: 600px) { 770 | 771 | .row > div { 772 | width: 92%; 773 | margin: 1em auto; 774 | } 775 | 776 | .header > div { 777 | width: 92%; 778 | margin: 0 auto; 779 | } 780 | 781 | /*.header > div > a p { 782 | display: block; 783 | float: left; 784 | width: 20%; 785 | margin-right: 2%; 786 | } 787 | 788 | .header h1 { 789 | float: left; 790 | }*/ 791 | 792 | .nav > div { 793 | width: 92%; 794 | margin: 0 auto; 795 | } 796 | 797 | .datafiles > ul { 798 | margin: 0 0 1.25rem; 799 | } 800 | 801 | } 802 | 803 | 804 | @media only screen and (min-width: 900px) { 805 | 806 | .row > div { 807 | width: 86%; 808 | margin: 1rem auto; 809 | } 810 | 811 | .header > div { 812 | width: 86%; 813 | margin: 0 auto; 814 | } 815 | 816 | /*.header > div > a img { 817 | display: inline-block; 818 | width: 20%; 819 | margin-right: 2%; 820 | } 821 | 822 | .header h1 { 823 | float: left; 824 | font-size: 6.5rem; 825 | }*/ 826 | 827 | .nav > div { 828 | width: 86%; 829 | margin: 0 auto; 830 | } 831 | 832 | .nav > div > ul { 833 | float: right; 834 | width: 70%; 835 | } 836 | 837 | .header + .row > div { 838 | width: 86%; 839 | overflow: auto; 840 | clear: both; 841 | margin: 1rem auto 0; 842 | padding-bottom: 1.325rem; 843 | } 844 | 845 | .row > div > .description { 846 | float: left; 847 | width: 20%; 848 | margin-right: 2%; 849 | } 850 | 851 | .row div .main { 852 | float: left; 853 | width: 78%; 854 | } 855 | 856 | .row div .main-dataset { 857 | width: 100%; 858 | } 859 | /* Dataset page columns */ 860 | 861 | .details { 862 | float: left; 863 | width: 30%; 864 | margin-right: 5%; 865 | } 866 | 867 | .readme { 868 | float: left; 869 | width: 65%; 870 | } 871 | 872 | .footer li { 873 | display: inline-block; 874 | margin: 0 1rem 0 0; 875 | } 876 | 877 | .footer li a { 878 | display: inline-block; 879 | padding: .5rem .25rem; 880 | } 881 | 882 | } 883 | 884 | -------------------------------------------------------------------------------- /themes/centraldedados/static/js/jquery-3.0.0.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v3.0.0 | (c) jQuery Foundation | jquery.org/license */ 2 | !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.0.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return a&&"[object Object]"===k.call(a)?(b=e(a))?(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n):!0:!1},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;d>f;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a)?(d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e):void 0},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"===c||r.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\x00-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\x00"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[0>c?c+b:c]}),even:pa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,e>i&&ya(a.slice(i,e)),f>e&&ya(a=a.slice(e)),f>e&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;d>b;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;d>b;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(f>b)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(1>=b&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){ 3 | return j.call(r(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthf;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;g>f;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;d>c;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;o>n;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;cc;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;m>l;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;i>l;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;e>d;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;e>d;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),0>=d||null==d){if(d=Ma(a,b,f),(0>d||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){return c?!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)}):void 0},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){return b?(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;e>g;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function eb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ba(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],$a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ga([a],!0),j=a.style.display||j,k=r.css(a,"display"),ga([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ga([a],!0),m.done(function(){p||ga([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=db(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function fb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function gb(a,b,c){var d,e,f=0,g=gb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Ya||bb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Ya||bb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(fb(k,j.opts.specialEasing);g>f;f++)if(d=gb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,db,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(gb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return da(c.elem,a,_.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;e>d;d++)c=a[d],gb.tweeners[c]=gb.tweeners[c]||[],gb.tweeners[c].unshift(b)},prefilters:[eb],prefilter:function(a,b){b?gb.prefilters.unshift(a):gb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:e.duration="number"==typeof e.duration?e.duration:e.duration in r.fx.speeds?r.fx.speeds[e.duration]:r.fx.speeds._default,null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ba).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=gb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&_a.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(cb(b,!0),a,d,e)}}),r.each({slideDown:cb("show"),slideUp:cb("hide"),slideToggle:cb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Ya=r.now();b1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c); 4 | }}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){return r.isArray(b)?a.checked=r.inArray(r(a).val(),b)>-1:void 0}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?r.event.trigger(a,b,c,!0):void 0}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",0>b&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;return o.cors||Pb&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("