├── salt_dashboard
├── __init__.py
├── api
│ ├── __init__.py
│ ├── salt_api.py
│ └── common.py
├── views
│ ├── __init__.py
│ └── index.py
├── templates
│ ├── css.html
│ ├── js.html
│ ├── auto_execute.html
│ ├── auto_service_table.html
│ ├── auto_detail.html
│ ├── base.html
│ ├── footer.html
│ ├── auto_minions.html
│ ├── auto_service.html
│ ├── header.html
│ ├── auto_minion.html
│ ├── auto_overview.html
│ └── auto_sidebar.html
├── models.py
├── urls.py
├── wsgi.py
└── settings.py
├── screenshot
├── index.png
├── execute.png
└── minions.png
├── static
├── extra
│ ├── img
│ │ ├── loading.gif
│ │ ├── loadings.gif
│ │ └── saltstack_logo.png
│ └── js
│ │ └── extra.js
└── bootstrap
│ ├── img
│ ├── glyphicons-halflings.png
│ └── glyphicons-halflings-white.png
│ ├── css
│ ├── bootstrap-responsive.min.css
│ └── docs.css
│ └── js
│ ├── bootstrap.min.js
│ └── bootstrap.js
├── manage.py
├── .gitignore
├── README.md
└── salt.sql
/salt_dashboard/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/salt_dashboard/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/salt_dashboard/views/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/screenshot/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/screenshot/index.png
--------------------------------------------------------------------------------
/screenshot/execute.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/screenshot/execute.png
--------------------------------------------------------------------------------
/screenshot/minions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/screenshot/minions.png
--------------------------------------------------------------------------------
/static/extra/img/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/static/extra/img/loading.gif
--------------------------------------------------------------------------------
/static/extra/img/loadings.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/static/extra/img/loadings.gif
--------------------------------------------------------------------------------
/static/extra/img/saltstack_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/static/extra/img/saltstack_logo.png
--------------------------------------------------------------------------------
/static/bootstrap/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/static/bootstrap/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/static/bootstrap/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cssug/salt-dashboard/HEAD/static/bootstrap/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "salt_dashboard.settings")
7 |
8 | from django.core.management import execute_from_command_line
9 |
10 | execute_from_command_line(sys.argv)
11 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/css.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_execute.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.py[cod]
2 |
3 | # C extensions
4 | *.so
5 |
6 | # Packages
7 | *.egg
8 | *.egg-info
9 | dist
10 | build
11 | eggs
12 | parts
13 | bin
14 | var
15 | sdist
16 | develop-eggs
17 | .installed.cfg
18 | lib
19 | lib64
20 |
21 | # Installer logs
22 | pip-log.txt
23 |
24 | # Unit test / coverage reports
25 | .coverage
26 | .tox
27 | nosetests.xml
28 |
29 | # Translations
30 | *.mo
31 |
32 | # Mr Developer
33 | .mr.developer.cfg
34 | .project
35 | .pydevproject
36 |
37 |
--------------------------------------------------------------------------------
/salt_dashboard/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | class Service(models.Model):
4 | name = models.CharField(max_length=50)
5 | target = models.TextField()
6 |
7 | class Meta:
8 | db_table = 'service'
9 |
10 | class Script(models.Model):
11 | user_id = models.CharField(max_length=50)
12 | name = models.CharField(max_length=30)
13 | args = models.CharField(max_length=100)
14 | public = models.CharField(max_length=5)
15 | status = models.CharField(max_length=10)
16 |
17 | class Meta:
18 | db_table = 'script'
19 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_service_table.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Service Name
5 | target
6 | action
7 |
8 |
9 |
10 | {% for service in services %}
11 |
12 | {{service.name}}
13 | {{service.target}}
14 | 删除
15 |
16 | {% endfor %}
17 |
18 |
19 |
--------------------------------------------------------------------------------
/salt_dashboard/api/salt_api.py:
--------------------------------------------------------------------------------
1 | #coding=utf8
2 | import salt.client
3 | client = salt.client.LocalClient()
4 |
5 | def overview(request):
6 | target = request.GET.get("target",'*')
7 | try:
8 | grains = client.cmd(target, 'grains.items')
9 | except:
10 | grains = {}
11 | return grains
12 |
13 | def execute(**kwargs):
14 | return client.cmd_async(**kwargs)
15 |
16 | def get_state(target):
17 | try:
18 | states = client.cmd(target,'state.show_top')
19 | except:
20 | states = {}
21 | return states
22 |
23 |
24 |
25 | if __name__ =="__main__":
26 | print get_state('60_12_201_27.nb_compute1.lightcloud.cn')
27 |
28 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_detail.html:
--------------------------------------------------------------------------------
1 |
11 |
12 |
16 |
17 | {{value|safe}}
18 |
19 |
22 |
23 |
--------------------------------------------------------------------------------
/salt_dashboard/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls import patterns, include, url
2 | from views.index import *
3 |
4 | # Uncomment the next two lines to enable the admin:
5 | # from django.contrib import admin
6 | # admin.autodiscover()
7 |
8 | urlpatterns = patterns('',
9 | # Examples:
10 | # url(r'^$', 'salt_dashboard.views.home', name='home'),
11 | # url(r'^salt_dashboard/', include('salt_dashboard.foo.urls')),
12 |
13 | # Uncomment the admin/doc line below to enable admin documentation:
14 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
15 |
16 | # Uncomment the next line to enable the admin:
17 | # url(r'^admin/', include(admin.site.urls)),
18 | url(r'^$',auto),
19 | url(r'^overview$',overview),
20 | url(r'^minions$',minions),
21 | url(r'^execute$',execute),
22 | url(r'^detail$',detail),
23 | url(r'^getjobinfo$',getjobinfo),
24 | url(r'^service$',service),
25 | url(r'^minion$',minion),
26 | )
27 |
--------------------------------------------------------------------------------
/salt_dashboard/api/common.py:
--------------------------------------------------------------------------------
1 | def my_page(request,paging_len):
2 | current_page = int(request.GET.get("page",0))
3 | page_sum = 10
4 | page_extra = 3
5 | context = {}
6 | if current_page < 0:
7 | current_page = 0
8 | if ((current_page+1) * page_sum) >= paging_len:
9 | if paging_len%page_sum:
10 | current_page = paging_len/page_sum
11 | else:
12 | current_page = paging_len/page_sum-1
13 | if (page_extra*2+1) > paging_len/page_sum:
14 | context["page_num"] = range(paging_len/page_sum)
15 | elif (current_page-page_extra) < 0:
16 | context["page_num"] = range(page_extra*2+1)
17 | elif (current_page+page_extra)*page_sum >= paging_len:
18 | context["page_num"] = range((paging_len/page_sum-7),paging_len/page_sum)
19 | else:
20 | context["page_num"] = range(current_page-page_extra,current_page+page_extra)
21 | context["current_page"] = current_page
22 | context['page_tables'] = []
23 | return context
24 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
salt dashboard
7 |
8 | {% include 'css.html' %}
9 | {% include 'js.html' %}
10 |
11 |
12 |
13 |
14 | {% include 'header.html' %}
15 |
16 |
17 |
18 |
19 |
20 | {% block sidebar %}
21 | {% endblock %}
22 |
23 |
24 |
25 | {% block body %}{% endblock %}
26 |
27 |
28 |
29 |
30 | {% include 'footer.html' %}
31 |
32 |
33 | {% block extrajs %}{% endblock %}
34 | {% block extracss %}{% endblock %}
35 |
36 |
37 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/footer.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 | {{test}}
11 | {% for message in messages %}
12 | {% if "info" in message.tags %}
13 |
14 |
×
15 |
提示: {{ message }}
16 |
17 | {% endif %}
18 | {% if "warning" in message.tags %}
19 |
20 |
×
21 |
警告: {{ message }}
22 |
23 | {% endif %}
24 | {% if "success" in message.tags %}
25 |
26 |
×
27 |
成功了: {{ message }}
28 |
29 | {% endif %}
30 | {% if "error" in message.tags %}
31 |
32 |
×
33 |
出错了: {{ message }}
34 |
35 | {% endif %}
36 | {% endfor %}
37 |
38 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_minions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Host
5 | Model
6 | flavor
7 | OS
8 | Uptime
9 | action
10 |
11 |
12 |
13 | {% for grain in page_tables %}
14 |
15 | {{grain.id}}
16 | {{grain.manufacturer}}/{{grain.productname}}
17 | {{grain.num_cpus}}U/{{grain.mem_total}}M RAM
18 | {{grain.os}}-{{grain.osrelease}}
19 | {{grain.time_diff}}
20 | detail
21 |
22 | {% endfor %}
23 |
24 |
25 |
26 |
35 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_service.html:
--------------------------------------------------------------------------------
1 |
26 |
27 |
31 |
32 |
33 | {% include "auto_service_table.html" %}
34 |
35 |
40 |
41 |
42 |
45 |
46 |
--------------------------------------------------------------------------------
/salt_dashboard/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for salt_dashboard project.
3 |
4 | This module contains the WSGI application used by Django's development server
5 | and any production WSGI deployments. It should expose a module-level variable
6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7 | this application via the ``WSGI_APPLICATION`` setting.
8 |
9 | Usually you will have the standard Django WSGI application here, but it also
10 | might make sense to replace the whole Django WSGI application with a custom one
11 | that later delegates to the Django one. For example, you could introduce WSGI
12 | middleware here, or combine a Django application with an application of another
13 | framework.
14 |
15 | """
16 | import os
17 |
18 | # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
19 | # if running multiple sites in the same mod_wsgi process. To fix this, use
20 | # mod_wsgi daemon mode with each site in its own daemon process, or use
21 | # os.environ["DJANGO_SETTINGS_MODULE"] = "salt_dashboard.settings"
22 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "salt_dashboard.settings")
23 |
24 | # This application object is used by any WSGI server configured to use this
25 | # file. This includes Django's development server, if the WSGI_APPLICATION
26 | # setting points here.
27 | from django.core.wsgi import get_wsgi_application
28 | application = get_wsgi_application()
29 |
30 | # Apply WSGI middleware here.
31 | # from helloworld.wsgi import HelloWorldApplication
32 | # application = HelloWorldApplication(application)
33 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/header.html:
--------------------------------------------------------------------------------
1 |
28 |
30 |
31 |
32 |
36 |
37 |
R U sure you are logout?
38 |
39 |
42 |
43 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_minion.html:
--------------------------------------------------------------------------------
1 |
24 |
25 |
54 |
55 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #salt dashboard
2 |
3 |
4 | salt-dashboard is based on salt-client(so deploy this on salt master server),and use mysql returner as result backend
5 |
6 |
7 | ---------------------------------------
8 |
9 |
10 |
11 | #requirement
12 |
13 |
14 | pip install django mysql-python
15 |
16 |
17 |
18 |
19 | #1:returner:
20 |
21 |
22 | ## salt [mysql returner ](http://docs.saltstack.com/ref/returners/all/salt.returners.mysql.html#module-salt.returners.mysql "Title")
23 |
24 | add time to salt_returns:
25 |
26 | alter table salt_returns add time timestamp;
27 |
28 |
29 | the auth sql like this:
30 |
31 | grant all on salt.* to 'salt'@'localhost' identified by 'salt';
32 |
33 |
34 | there is a bug when schedule use mysql return,fixed by this [schedule return by mysql ](https://github.com/halfss/salt/commit/3f5805f7b38fc867a3d12b8c36efd023b4957792)
35 |
36 | ##salt minion config:
37 |
38 | vim /etc/salt/minion
39 | mysql.host: 'localhost'
40 | mysql.user: 'salt'
41 | mysql.pass: 'salt'
42 | mysql.db: 'salt'
43 | mysql.port: 3306
44 |
45 |
46 | ##salt-dashboard sync db
47 |
48 | cd salt-dashboard/
49 | python manage.py syncdb
50 |
51 |
52 | #2:scheduler:
53 | [[
]]
54 | /srv/pillar/top.sls
55 |
56 | base:
57 | "*":
58 | - schedule
59 |
60 | /srv/pillar/schedule.sls
61 |
62 | schedule:
63 | highstate:
64 | function: state.highstate
65 | minutes: 30
66 | returner: mysql
67 |
68 |
69 |
70 | then waiting minions update scheduler info by himself or run this command:
71 |
72 | salt '*' saltutil.refresh_pillar
73 |
74 |
75 | #3:salt-dashboard
76 | this dashboard is based on django+bootstrap+amcharts
77 |
78 | demo screen like this:
79 | here just on minion, so is seems very simple
80 |
81 |
82 | 
83 | 
84 | 
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/static/extra/js/extra.js:
--------------------------------------------------------------------------------
1 | function my_ajax_replace(url,id){
2 | $('#loading-img').show();
3 | $.ajax({
4 | url: url,
5 | cache: false,
6 | success: function(html){
7 | var box = $( '#' + id );
8 | if( box.length && /input/i.test( box[0].nodeName ) ){
9 | box.val( html );
10 | }else{
11 | box.html( html );
12 | }
13 | $('#loading-img').hide();
14 | }
15 | });
16 | }
17 |
18 | function ajaxCommand(url,option,id){
19 | var _interVal, commonAjaxXhr,urlRex = /where=(\d+)/ , ajaxWhere = 0, count = 0,
20 | commonAjax = function(config){//发起ajax请求
21 | config = $.extend({
22 | type:'post',
23 | dataType:'json'
24 | },config);
25 | commonAjaxXhr = $.ajax(config);
26 | },
27 | _exportCommand = function(url){
28 | var resultBox = document.getElementById('result');
29 | if ( 'number' !== typeof ajaxWhere ) return;
30 | url = url.replace( urlRex,'where=' + ajaxWhere );
31 | commonAjax({
32 | url: url,
33 | type:'get',
34 | success: function(data){
35 | ajaxWhere = data.where;
36 | if ( data.result.length ){
37 | count = 0;
38 | var commandHtml = data.result.join('');
39 | document.getElementById(id).innerHTML += commandHtml ;
40 | _exportCommand(url);
41 | }else{
42 | count++;
43 | if(count >= 15) return;
44 | setTimeout(function(){ _exportCommand(url) }, 1000);
45 | }
46 | resultBox.scrollTop = resultBox.scrollHeight;
47 | }
48 | });
49 | };
50 | commonAjax({
51 | url: url+'&option='+option,
52 | type:'get',
53 | dataType: 'text',
54 | success: function(data){
55 | _exportCommand(data);
56 | }
57 | })
58 | }
59 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_overview.html:
--------------------------------------------------------------------------------
1 |
5 |
53 |
54 |
state error host in the lastest
55 |
56 |
57 |
58 | Host
59 | module
60 | time
61 | success
62 |
63 |
64 |
65 | {% for host in error_host %}
66 |
67 | {{host.id}}
68 | {{host.fun}}
69 | {{host.time}}
70 | {{host.success}}
71 |
72 | {% endfor %}
73 |
74 |
75 |
--------------------------------------------------------------------------------
/salt_dashboard/templates/auto_sidebar.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 | {# coding=utf8 #}
3 | {% load i18n %}
4 | {% block sidebar%}
5 |
8 |
9 |
10 | salt
11 | {% for service in services %}
12 | {{service.name}}
13 | {% endfor %}
14 |
15 | {% endblock %}
16 | {% block body %}
17 |
18 |
51 |
67 |
68 |
69 |
74 |
75 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {% endblock %}
89 |
--------------------------------------------------------------------------------
/salt_dashboard/settings.py:
--------------------------------------------------------------------------------
1 | # Django settings for salt_dashboard project.
2 | import os
3 |
4 | DEBUG = True
5 | TEMPLATE_DEBUG = DEBUG
6 |
7 | CURRENT_DIR=os.getcwd()
8 |
9 | ADMINS = (
10 | # ('Your Name', 'your_email@example.com'),
11 | )
12 |
13 | MANAGERS = ADMINS
14 |
15 | DATABASES = {
16 | 'default': {
17 | 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
18 | 'NAME': 'salt', # Or path to database file if using sqlite3.
19 | # The following settings are not used with sqlite3:
20 | 'USER': 'salt',
21 | 'PASSWORD': 'salt',
22 | 'HOST': 'localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
23 | 'PORT': '3306', # Set to empty string for default.
24 | }
25 | }
26 |
27 | # Hosts/domain names that are valid for this site; required if DEBUG is False
28 | # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
29 | ALLOWED_HOSTS = []
30 |
31 | # Local time zone for this installation. Choices can be found here:
32 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
33 | # although not all choices may be available on all operating systems.
34 | # In a Windows environment this must be set to your system time zone.
35 | TIME_ZONE = 'America/Chicago'
36 |
37 | # Language code for this installation. All choices can be found here:
38 | # http://www.i18nguy.com/unicode/language-identifiers.html
39 | LANGUAGE_CODE = 'en-us'
40 |
41 | SITE_ID = 1
42 |
43 | # If you set this to False, Django will make some optimizations so as not
44 | # to load the internationalization machinery.
45 | USE_I18N = True
46 |
47 | # If you set this to False, Django will not format dates, numbers and
48 | # calendars according to the current locale.
49 | USE_L10N = True
50 |
51 | # If you set this to False, Django will not use timezone-aware datetimes.
52 | USE_TZ = True
53 |
54 | # Absolute filesystem path to the directory that will hold user-uploaded files.
55 | # Example: "/var/www/example.com/media/"
56 | MEDIA_ROOT = ''
57 |
58 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a
59 | # trailing slash.
60 | # Examples: "http://example.com/media/", "http://media.example.com/"
61 | MEDIA_URL = ''
62 |
63 | # Absolute path to the directory static files should be collected to.
64 | # Don't put anything in this directory yourself; store your static files
65 | # in apps' "static/" subdirectories and in STATICFILES_DIRS.
66 | # Example: "/var/www/example.com/static/"
67 | STATIC_ROOT = ''
68 |
69 | # URL prefix for static files.
70 | # Example: "http://example.com/static/", "http://static.example.com/"
71 | STATIC_URL = '/static/'
72 |
73 | # Additional locations of static files
74 | STATICFILES_DIRS = (
75 | CURRENT_DIR+'/static',
76 | # Put strings here, like "/home/html/static" or "C:/www/django/static".
77 | # Always use forward slashes, even on Windows.
78 | # Don't forget to use absolute paths, not relative paths.
79 | )
80 |
81 | # List of finder classes that know how to find static files in
82 | # various locations.
83 | STATICFILES_FINDERS = (
84 | 'django.contrib.staticfiles.finders.FileSystemFinder',
85 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
86 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
87 | )
88 |
89 | # Make this unique, and don't share it with anybody.
90 | SECRET_KEY = '1+k7k0f6#ri9b7#pay#sfii7u%n%e&3)y1ljmh5+us9*l*u4=='
91 |
92 | # List of callables that know how to import templates from various sources.
93 | TEMPLATE_LOADERS = (
94 | 'django.template.loaders.filesystem.Loader',
95 | 'django.template.loaders.app_directories.Loader',
96 | # 'django.template.loaders.eggs.Loader',
97 | )
98 |
99 | MIDDLEWARE_CLASSES = (
100 | 'django.middleware.common.CommonMiddleware',
101 | 'django.contrib.sessions.middleware.SessionMiddleware',
102 | 'django.middleware.csrf.CsrfViewMiddleware',
103 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
104 | 'django.contrib.messages.middleware.MessageMiddleware',
105 | # Uncomment the next line for simple clickjacking protection:
106 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
107 | )
108 |
109 | ROOT_URLCONF = 'salt_dashboard.urls'
110 |
111 | # Python dotted path to the WSGI application used by Django's runserver.
112 | WSGI_APPLICATION = 'salt_dashboard.wsgi.application'
113 |
114 | TEMPLATE_DIRS = (
115 | CURRENT_DIR+'/salt_dashboard/templates',
116 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
117 | # Always use forward slashes, even on Windows.
118 | # Don't forget to use absolute paths, not relative paths.
119 | )
120 |
121 | INSTALLED_APPS = (
122 | 'salt_dashboard',
123 | 'django.contrib.auth',
124 | 'django.contrib.contenttypes',
125 | 'django.contrib.sessions',
126 | 'django.contrib.sites',
127 | 'django.contrib.messages',
128 | 'django.contrib.staticfiles',
129 | # Uncomment the next line to enable the admin:
130 | # 'django.contrib.admin',
131 | # Uncomment the next line to enable admin documentation:
132 | # 'django.contrib.admindocs',
133 | )
134 |
135 | # A sample logging configuration. The only tangible logging
136 | # performed by this configuration is to send an email to
137 | # the site admins on every HTTP 500 error when DEBUG=False.
138 | # See http://docs.djangoproject.com/en/dev/topics/logging for
139 | # more details on how to customize your logging configuration.
140 | LOGGING = {
141 | 'version': 1,
142 | 'disable_existing_loggers': False,
143 | 'filters': {
144 | 'require_debug_false': {
145 | '()': 'django.utils.log.RequireDebugFalse'
146 | }
147 | },
148 | 'handlers': {
149 | 'mail_admins': {
150 | 'level': 'ERROR',
151 | 'filters': ['require_debug_false'],
152 | 'class': 'django.utils.log.AdminEmailHandler'
153 | }
154 | },
155 | 'loggers': {
156 | 'django.request': {
157 | 'handlers': ['mail_admins'],
158 | 'level': 'ERROR',
159 | 'propagate': True,
160 | },
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/salt_dashboard/views/index.py:
--------------------------------------------------------------------------------
1 | #coding=UTF-8
2 | import datetime
3 | import os
4 | import re
5 | import md5
6 | import json
7 |
8 |
9 |
10 | from django.http import HttpResponse, Http404
11 | from django.shortcuts import render_to_response
12 | from django.core.context_processors import csrf
13 | from django.template import RequestContext
14 | from django.db import connection
15 |
16 | from salt_dashboard.api import salt_api,common
17 | from salt_dashboard.models import *
18 |
19 |
20 | def auto(request):
21 | context = {}
22 | context.update(csrf(request))
23 | services = Service.objects.all()
24 | context['services'] = services
25 | return render_to_response('auto_sidebar.html', context)
26 |
27 |
28 | def overview(request):
29 | context = {}
30 | context.update(csrf(request))
31 | grains = salt_api.overview(request).values()
32 | minions_os = {}
33 | minions_virtual = {}
34 | for grain in grains:
35 | try:
36 | minions_os[grain['osfullname']+grain['osrelease']] += 1
37 | minions_virtual[grain['virtual']] += 1
38 | except KeyError:
39 | minions_os[grain['osfullname']+grain['osrelease']] = 1
40 | minions_virtual[grain['virtual']] = 1
41 | try:
42 | cursor = connection.cursor()
43 | host_num = cursor.execute("select id,fun,time,success from \
44 | (select id,fun,time,success from salt.salt_returns where \
45 | success='0' order by id desc) as b group by id limit 10;")
46 | hosts = cursor.fetchall()
47 | error_host = []
48 | for host in hosts:
49 | error_host.append({
50 | 'id':host[0],
51 | 'fun':host[1],
52 | 'time':host[2],
53 | 'success':host[3]
54 | })
55 | except:
56 | error_host = []
57 |
58 |
59 | context['minions_os'] = minions_os
60 | context['minions_virtual'] = minions_virtual
61 | context['minions_num'] = len(grains)
62 | context['error_host'] = error_host
63 | return render_to_response('auto_overview.html', context)
64 |
65 | def minions(request):
66 | current_page = int(request.GET.get("page",0))
67 | page_sum = 15
68 | page_extra = 3
69 | grains = salt_api.overview(request).values()
70 | try:
71 | cursor = connection.cursor()
72 | host_num = cursor.execute('select host_id,time from \
73 | (select host_id,time from fluent.salt_result order \
74 | by id desc ) as b group by host_id;')
75 | hosts_time = cursor.fetchall()
76 | now = datetime.datetime.now()
77 | times_diff = {}
78 | for host_time in hosts_time:
79 | time_dist = now - host_time[1]
80 | times_diff[host_time[0]] = str(time_dist).split('.')[0]
81 | except:
82 | times_diff = {}
83 | for grain in grains:
84 | grain['IP'] = grain['id'].split('.')[0].replace('_','.')
85 | grain['time_diff'] = times_diff.get(grain['id'],'无')
86 | context = common.my_page(request,len(grains))
87 | context['page_tables'] = grains[current_page*page_sum:(current_page+1)*page_sum]
88 | return render_to_response('auto_minions.html', context)
89 |
90 | def execute(request):
91 | context = {'jid':''}
92 | tgt = request.POST.get('tgt','*')
93 | fun = request.POST.get('fun','cmd.run')
94 | arg = request.POST.get('arg','')
95 | if arg:
96 | kwargs = {'tgt': tgt,
97 | 'ret': 'mysql',
98 | 'expr_form': 'glob',
99 | 'timeout': 15,
100 | 'arg': [arg],
101 | 'fun': fun
102 | }
103 | jid = salt_api.execute(**kwargs)
104 | context['jid'] = jid
105 | return render_to_response('auto_execute.html', context)
106 |
107 | def detail(request):
108 | target = request.GET.get('target','')
109 | if target:
110 | grain = salt_api.overview(request)
111 | state = salt_api.get_state(target)
112 | state = repr(json.dumps(state,sort_keys=True, indent=4))
113 | state = state.replace('\\n','
').replace(' ',' ')
114 | context = {
115 | 'grain':grain,
116 | 'state':state
117 | }
118 | return render_to_response('auto_detail.html', context)
119 |
120 | def getjobinfo(request):
121 | context = {}
122 | jid = request.GET.get('jid','')
123 | where = int(request.GET.get('where','12376894567235'))
124 | if where == 12376894567235:
125 | result = '/getjobinfo?jid=%s&where=%s' % (jid,0)
126 | return HttpResponse(result)
127 | else:
128 | cursor = connection.cursor()
129 | host_result = cursor.execute("select id,success,`return` from salt.salt_returns \
130 | where jid='%s' limit %s,10000;" % (jid,where) )
131 | hosts_result = cursor.fetchall()
132 | where = len(hosts_result) + where
133 | result = []
134 | for host_result in hosts_result:
135 | result.append(u'host:%s state:%s
return:%s
' % (host_result[0],host_result[1],host_result[2]))
136 | context = {
137 | "where":where,
138 | "result":result
139 | }
140 | return HttpResponse(json.dumps(context))
141 |
142 | def service(request):
143 | context = {}
144 | context.update(csrf(request))
145 | if request.method == 'GET':
146 | id = request.GET.get('id','')
147 | if id:
148 | Service.objects.get(id=id).delete()
149 | services = Service.objects.all()
150 | context['services'] = services
151 | return render_to_response('auto_service.html', context)
152 | else:
153 | service_name = u'%s' % request.POST.get('name','')
154 | service_tgt = request.POST.get('tgt','')
155 | if service_name and service_tgt:
156 | try:
157 | new_service = Service(name=service_name,target=service_tgt)
158 | new_service.save()
159 | except:
160 | raise
161 | return render_to_response('auto_service_table.html', context)
162 |
163 | def minion(request):
164 | os_dict = {
165 | "pillar":{'fun':'pillar.data'},
166 | "grains":{'fun':'grains.items'},
167 | "cron":{'fun':'cron.list_tab','arg':['root']},
168 | "hosts":{'fun':'hosts.list_hosts'},
169 | "iptables":{'fun':'iptables.get_rules'},
170 | "sysctl":{'fun':'sysctl.show'},
171 | "highstate":{'fun':'state.highstate'},
172 | "sls":{'fun':'state.sls'},
173 | "script":{'fun':'cmd.script'}
174 | }
175 | context = {}
176 | context.update(csrf(request))
177 | tgt = request.GET.get('tgt','')
178 | cmd_type = request.GET.get('type')
179 | arg = request.GET.get('arg','').split(',')
180 | ext_arg = request.GET.get('ext_arg','').split(',')
181 | if cmd_type in os_dict.keys():
182 | kwargs = {'tgt': tgt,
183 | 'expr_form': 'glob',
184 | 'ret': salt_returner,
185 | 'timeout': 60,
186 | 'arg':arg
187 | }
188 | kwargs.update(os_dict[cmd_type])
189 | users.privilege(request,kwargs)
190 | if cmd_type in ['highstate','sls','script']:
191 | jid = salt_api.execute(kwargs)
192 | context['jid'] = jid
193 | return render_to_response('auto_execute.html', context)
194 | else:
195 | value = salt_api.execute_sync(kwargs)
196 | value = repr(json.dumps(value,sort_keys=True, indent=4))
197 | value = value.replace('\\n','
').replace(' ',' ')
198 | context['key'] = cmd_type
199 | context['value'] = value
200 | return render_to_response('auto_detail.html', context)
201 | scripts_info = []
202 | context['id'] = tgt
203 | return render_to_response('auto_minion.html', context)
204 |
--------------------------------------------------------------------------------
/static/bootstrap/css/bootstrap-responsive.min.css:
--------------------------------------------------------------------------------
1 | .clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";}
2 | .clearfix:after{clear:both;}
3 | .hide-text{overflow:hidden;text-indent:100%;white-space:nowrap;}
4 | .input-block-level{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;}
5 | .hidden{display:none;visibility:hidden;}
6 | .visible-phone{display:none;}
7 | .visible-tablet{display:none;}
8 | .visible-desktop{display:block;}
9 | .hidden-phone{display:block;}
10 | .hidden-tablet{display:block;}
11 | .hidden-desktop{display:none;}
12 | @media (max-width:767px){.visible-phone{display:block;} .hidden-phone{display:none;} .hidden-desktop{display:block;} .visible-desktop{display:none;}}@media (min-width:768px) and (max-width:979px){.visible-tablet{display:block;} .hidden-tablet{display:none;} .hidden-desktop{display:block;} .visible-desktop{display:none;}}@media (max-width:480px){.nav-collapse{-webkit-transform:translate3d(0, 0, 0);} .page-header h1 small{display:block;line-height:18px;} input[type="checkbox"],input[type="radio"]{border:1px solid #ccc;} .form-horizontal .control-group>label{float:none;width:auto;padding-top:0;text-align:left;} .form-horizontal .controls{margin-left:0;} .form-horizontal .control-list{padding-top:0;} .form-horizontal .form-actions{padding-left:10px;padding-right:10px;} .modal{position:absolute;top:10px;left:10px;right:10px;width:auto;margin:0;}.modal.fade.in{top:auto;} .modal-header .close{padding:10px;margin:-10px;} .carousel-caption{position:static;}}@media (max-width:767px){body{padding-left:20px;padding-right:20px;} .navbar-fixed-top{margin-left:-20px;margin-right:-20px;} .container{width:auto;} .row-fluid{width:100%;} .row{margin-left:0;} .row>[class*="span"],.row-fluid>[class*="span"]{float:none;display:block;width:auto;margin:0;} .thumbnails [class*="span"]{width:auto;} input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;} .input-prepend input[class*="span"],.input-append input[class*="span"]{width:auto;}}@media (min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";} .row:after{clear:both;} [class*="span"]{float:left;margin-left:20px;} .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px;} .span12{width:724px;} .span11{width:662px;} .span10{width:600px;} .span9{width:538px;} .span8{width:476px;} .span7{width:414px;} .span6{width:352px;} .span5{width:290px;} .span4{width:228px;} .span3{width:166px;} .span2{width:104px;} .span1{width:42px;} .offset12{margin-left:764px;} .offset11{margin-left:702px;} .offset10{margin-left:640px;} .offset9{margin-left:578px;} .offset8{margin-left:516px;} .offset7{margin-left:454px;} .offset6{margin-left:392px;} .offset5{margin-left:330px;} .offset4{margin-left:268px;} .offset3{margin-left:206px;} .offset2{margin-left:144px;} .offset1{margin-left:82px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";} .row-fluid:after{clear:both;} .row-fluid>[class*="span"]{float:left;margin-left:2.762430939%;} .row-fluid>[class*="span"]:first-child{margin-left:0;} .row-fluid > .span12{width:99.999999993%;} .row-fluid > .span11{width:91.436464082%;} .row-fluid > .span10{width:82.87292817100001%;} .row-fluid > .span9{width:74.30939226%;} .row-fluid > .span8{width:65.74585634900001%;} .row-fluid > .span7{width:57.182320438000005%;} .row-fluid > .span6{width:48.618784527%;} .row-fluid > .span5{width:40.055248616%;} .row-fluid > .span4{width:31.491712705%;} .row-fluid > .span3{width:22.928176794%;} .row-fluid > .span2{width:14.364640883%;} .row-fluid > .span1{width:5.801104972%;} input,textarea,.uneditable-input{margin-left:0;} input.span12, textarea.span12, .uneditable-input.span12{width:714px;} input.span11, textarea.span11, .uneditable-input.span11{width:652px;} input.span10, textarea.span10, .uneditable-input.span10{width:590px;} input.span9, textarea.span9, .uneditable-input.span9{width:528px;} input.span8, textarea.span8, .uneditable-input.span8{width:466px;} input.span7, textarea.span7, .uneditable-input.span7{width:404px;} input.span6, textarea.span6, .uneditable-input.span6{width:342px;} input.span5, textarea.span5, .uneditable-input.span5{width:280px;} input.span4, textarea.span4, .uneditable-input.span4{width:218px;} input.span3, textarea.span3, .uneditable-input.span3{width:156px;} input.span2, textarea.span2, .uneditable-input.span2{width:94px;} input.span1, textarea.span1, .uneditable-input.span1{width:32px;}}@media (max-width:979px){body{padding-top:0;} .navbar-fixed-top{position:static;margin-bottom:18px;} .navbar-fixed-top .navbar-inner{padding:5px;} .navbar .container{width:auto;padding:0;} .navbar .brand{padding-left:10px;padding-right:10px;margin:0 0 0 -5px;} .navbar .nav-collapse{clear:left;} .navbar .nav{float:none;margin:0 0 9px;} .navbar .nav>li{float:none;} .navbar .nav>li>a{margin-bottom:2px;} .navbar .nav>.divider-vertical{display:none;} .navbar .nav .nav-header{color:#999999;text-shadow:none;} .navbar .nav>li>a,.navbar .dropdown-menu a{padding:6px 15px;font-weight:bold;color:#999999;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .navbar .dropdown-menu li+li a{margin-bottom:2px;} .navbar .nav>li>a:hover,.navbar .dropdown-menu a:hover{background-color:#222222;} .navbar .dropdown-menu{position:static;top:auto;left:auto;float:none;display:block;max-width:none;margin:0 15px;padding:0;background-color:transparent;border:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} .navbar .dropdown-menu:before,.navbar .dropdown-menu:after{display:none;} .navbar .dropdown-menu .divider{display:none;} .navbar-form,.navbar-search{float:none;padding:9px 15px;margin:9px 0;border-top:1px solid #222222;border-bottom:1px solid #222222;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1),0 1px 0 rgba(255, 255, 255, 0.1);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1),0 1px 0 rgba(255, 255, 255, 0.1);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1),0 1px 0 rgba(255, 255, 255, 0.1);} .navbar .nav.pull-right{float:none;margin-left:0;} .navbar-static .navbar-inner{padding-left:10px;padding-right:10px;} .btn-navbar{display:block;} .nav-collapse{overflow:hidden;height:0;}}@media (min-width:980px){.nav-collapse.collapse{height:auto !important;overflow:visible !important;}}@media (min-width:1200px){.row{margin-left:-30px;*zoom:1;}.row:before,.row:after{display:table;content:"";} .row:after{clear:both;} [class*="span"]{float:left;margin-left:30px;} .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px;} .span12{width:1170px;} .span11{width:1070px;} .span10{width:970px;} .span9{width:870px;} .span8{width:770px;} .span7{width:670px;} .span6{width:570px;} .span5{width:470px;} .span4{width:370px;} .span3{width:270px;} .span2{width:170px;} .span1{width:70px;} .offset12{margin-left:1230px;} .offset11{margin-left:1130px;} .offset10{margin-left:1030px;} .offset9{margin-left:930px;} .offset8{margin-left:830px;} .offset7{margin-left:730px;} .offset6{margin-left:630px;} .offset5{margin-left:530px;} .offset4{margin-left:430px;} .offset3{margin-left:330px;} .offset2{margin-left:230px;} .offset1{margin-left:130px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";} .row-fluid:after{clear:both;} .row-fluid>[class*="span"]{float:left;margin-left:2.564102564%;} .row-fluid>[class*="span"]:first-child{margin-left:0;} .row-fluid > .span12{width:100%;} .row-fluid > .span11{width:91.45299145300001%;} .row-fluid > .span10{width:82.905982906%;} .row-fluid > .span9{width:74.358974359%;} .row-fluid > .span8{width:65.81196581200001%;} .row-fluid > .span7{width:57.264957265%;} .row-fluid > .span6{width:48.717948718%;} .row-fluid > .span5{width:40.170940171000005%;} .row-fluid > .span4{width:31.623931624%;} .row-fluid > .span3{width:23.076923077%;} .row-fluid > .span2{width:14.529914530000001%;} .row-fluid > .span1{width:5.982905983%;} input,textarea,.uneditable-input{margin-left:0;} input.span12, textarea.span12, .uneditable-input.span12{width:1160px;} input.span11, textarea.span11, .uneditable-input.span11{width:1060px;} input.span10, textarea.span10, .uneditable-input.span10{width:960px;} input.span9, textarea.span9, .uneditable-input.span9{width:860px;} input.span8, textarea.span8, .uneditable-input.span8{width:760px;} input.span7, textarea.span7, .uneditable-input.span7{width:660px;} input.span6, textarea.span6, .uneditable-input.span6{width:560px;} input.span5, textarea.span5, .uneditable-input.span5{width:460px;} input.span4, textarea.span4, .uneditable-input.span4{width:360px;} input.span3, textarea.span3, .uneditable-input.span3{width:260px;} input.span2, textarea.span2, .uneditable-input.span2{width:160px;} input.span1, textarea.span1, .uneditable-input.span1{width:60px;} .thumbnails{margin-left:-30px;} .thumbnails>li{margin-left:30px;}}
13 |
--------------------------------------------------------------------------------
/salt.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
2 | --
3 | -- Host: localhost Database: salt
4 | -- ------------------------------------------------------
5 | -- Server version 5.1.69
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `auth_group`
20 | --
21 |
22 | DROP TABLE IF EXISTS `auth_group`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `auth_group` (
26 | `id` int(11) NOT NULL AUTO_INCREMENT,
27 | `name` varchar(80) NOT NULL,
28 | PRIMARY KEY (`id`),
29 | UNIQUE KEY `name` (`name`)
30 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
31 | /*!40101 SET character_set_client = @saved_cs_client */;
32 |
33 | --
34 | -- Table structure for table `auth_group_permissions`
35 | --
36 |
37 | DROP TABLE IF EXISTS `auth_group_permissions`;
38 | /*!40101 SET @saved_cs_client = @@character_set_client */;
39 | /*!40101 SET character_set_client = utf8 */;
40 | CREATE TABLE `auth_group_permissions` (
41 | `id` int(11) NOT NULL AUTO_INCREMENT,
42 | `group_id` int(11) NOT NULL,
43 | `permission_id` int(11) NOT NULL,
44 | PRIMARY KEY (`id`),
45 | UNIQUE KEY `group_id` (`group_id`,`permission_id`),
46 | KEY `auth_group_permissions_5f412f9a` (`group_id`),
47 | KEY `auth_group_permissions_83d7f98b` (`permission_id`)
48 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
49 | /*!40101 SET character_set_client = @saved_cs_client */;
50 |
51 | --
52 | -- Table structure for table `auth_permission`
53 | --
54 |
55 | DROP TABLE IF EXISTS `auth_permission`;
56 | /*!40101 SET @saved_cs_client = @@character_set_client */;
57 | /*!40101 SET character_set_client = utf8 */;
58 | CREATE TABLE `auth_permission` (
59 | `id` int(11) NOT NULL AUTO_INCREMENT,
60 | `name` varchar(50) NOT NULL,
61 | `content_type_id` int(11) NOT NULL,
62 | `codename` varchar(100) NOT NULL,
63 | PRIMARY KEY (`id`),
64 | UNIQUE KEY `content_type_id` (`content_type_id`,`codename`),
65 | KEY `auth_permission_37ef4eb4` (`content_type_id`)
66 | ) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
67 | /*!40101 SET character_set_client = @saved_cs_client */;
68 |
69 | --
70 | -- Table structure for table `auth_user`
71 | --
72 |
73 | DROP TABLE IF EXISTS `auth_user`;
74 | /*!40101 SET @saved_cs_client = @@character_set_client */;
75 | /*!40101 SET character_set_client = utf8 */;
76 | CREATE TABLE `auth_user` (
77 | `id` int(11) NOT NULL AUTO_INCREMENT,
78 | `password` varchar(128) NOT NULL,
79 | `last_login` datetime NOT NULL,
80 | `is_superuser` tinyint(1) NOT NULL,
81 | `username` varchar(30) NOT NULL,
82 | `first_name` varchar(30) NOT NULL,
83 | `last_name` varchar(30) NOT NULL,
84 | `email` varchar(75) NOT NULL,
85 | `is_staff` tinyint(1) NOT NULL,
86 | `is_active` tinyint(1) NOT NULL,
87 | `date_joined` datetime NOT NULL,
88 | PRIMARY KEY (`id`),
89 | UNIQUE KEY `username` (`username`)
90 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
91 | /*!40101 SET character_set_client = @saved_cs_client */;
92 |
93 | --
94 | -- Table structure for table `auth_user_groups`
95 | --
96 |
97 | DROP TABLE IF EXISTS `auth_user_groups`;
98 | /*!40101 SET @saved_cs_client = @@character_set_client */;
99 | /*!40101 SET character_set_client = utf8 */;
100 | CREATE TABLE `auth_user_groups` (
101 | `id` int(11) NOT NULL AUTO_INCREMENT,
102 | `user_id` int(11) NOT NULL,
103 | `group_id` int(11) NOT NULL,
104 | PRIMARY KEY (`id`),
105 | UNIQUE KEY `user_id` (`user_id`,`group_id`),
106 | KEY `auth_user_groups_6340c63c` (`user_id`),
107 | KEY `auth_user_groups_5f412f9a` (`group_id`)
108 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
109 | /*!40101 SET character_set_client = @saved_cs_client */;
110 |
111 | --
112 | -- Table structure for table `auth_user_user_permissions`
113 | --
114 |
115 | DROP TABLE IF EXISTS `auth_user_user_permissions`;
116 | /*!40101 SET @saved_cs_client = @@character_set_client */;
117 | /*!40101 SET character_set_client = utf8 */;
118 | CREATE TABLE `auth_user_user_permissions` (
119 | `id` int(11) NOT NULL AUTO_INCREMENT,
120 | `user_id` int(11) NOT NULL,
121 | `permission_id` int(11) NOT NULL,
122 | PRIMARY KEY (`id`),
123 | UNIQUE KEY `user_id` (`user_id`,`permission_id`),
124 | KEY `auth_user_user_permissions_6340c63c` (`user_id`),
125 | KEY `auth_user_user_permissions_83d7f98b` (`permission_id`)
126 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
127 | /*!40101 SET character_set_client = @saved_cs_client */;
128 |
129 | --
130 | -- Table structure for table `django_content_type`
131 | --
132 |
133 | DROP TABLE IF EXISTS `django_content_type`;
134 | /*!40101 SET @saved_cs_client = @@character_set_client */;
135 | /*!40101 SET character_set_client = utf8 */;
136 | CREATE TABLE `django_content_type` (
137 | `id` int(11) NOT NULL AUTO_INCREMENT,
138 | `name` varchar(100) NOT NULL,
139 | `app_label` varchar(100) NOT NULL,
140 | `model` varchar(100) NOT NULL,
141 | PRIMARY KEY (`id`),
142 | UNIQUE KEY `app_label` (`app_label`,`model`)
143 | ) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
144 | /*!40101 SET character_set_client = @saved_cs_client */;
145 |
146 | --
147 | -- Table structure for table `django_session`
148 | --
149 |
150 | DROP TABLE IF EXISTS `django_session`;
151 | /*!40101 SET @saved_cs_client = @@character_set_client */;
152 | /*!40101 SET character_set_client = utf8 */;
153 | CREATE TABLE `django_session` (
154 | `session_key` varchar(40) NOT NULL,
155 | `session_data` longtext NOT NULL,
156 | `expire_date` datetime NOT NULL,
157 | PRIMARY KEY (`session_key`),
158 | KEY `django_session_b7b81f0c` (`expire_date`)
159 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
160 | /*!40101 SET character_set_client = @saved_cs_client */;
161 |
162 | --
163 | -- Table structure for table `django_site`
164 | --
165 |
166 | DROP TABLE IF EXISTS `django_site`;
167 | /*!40101 SET @saved_cs_client = @@character_set_client */;
168 | /*!40101 SET character_set_client = utf8 */;
169 | CREATE TABLE `django_site` (
170 | `id` int(11) NOT NULL AUTO_INCREMENT,
171 | `domain` varchar(100) NOT NULL,
172 | `name` varchar(50) NOT NULL,
173 | PRIMARY KEY (`id`)
174 | ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
175 | /*!40101 SET character_set_client = @saved_cs_client */;
176 |
177 | --
178 | -- Table structure for table `jids`
179 | --
180 |
181 | DROP TABLE IF EXISTS `jids`;
182 | /*!40101 SET @saved_cs_client = @@character_set_client */;
183 | /*!40101 SET character_set_client = utf8 */;
184 | CREATE TABLE `jids` (
185 | `jid` varchar(255) NOT NULL,
186 | `load` mediumtext NOT NULL,
187 | UNIQUE KEY `jid` (`jid`)
188 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
189 | /*!40101 SET character_set_client = @saved_cs_client */;
190 |
191 | --
192 | -- Table structure for table `salt_returns`
193 | --
194 |
195 | DROP TABLE IF EXISTS `salt_returns`;
196 | /*!40101 SET @saved_cs_client = @@character_set_client */;
197 | /*!40101 SET character_set_client = utf8 */;
198 | CREATE TABLE `salt_returns` (
199 | `fun` varchar(50) NOT NULL,
200 | `jid` varchar(255) NOT NULL,
201 | `return` mediumtext NOT NULL,
202 | `id` varchar(255) NOT NULL,
203 | `success` varchar(10) NOT NULL,
204 | `full_ret` mediumtext NOT NULL,
205 | `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
206 | KEY `id` (`id`),
207 | KEY `jid` (`jid`),
208 | KEY `fun` (`fun`)
209 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
210 | /*!40101 SET character_set_client = @saved_cs_client */;
211 |
212 | --
213 | -- Table structure for table `script`
214 | --
215 |
216 | DROP TABLE IF EXISTS `script`;
217 | /*!40101 SET @saved_cs_client = @@character_set_client */;
218 | /*!40101 SET character_set_client = utf8 */;
219 | CREATE TABLE `script` (
220 | `id` int(11) NOT NULL AUTO_INCREMENT,
221 | `user_id` varchar(50) NOT NULL,
222 | `name` varchar(30) NOT NULL,
223 | `args` varchar(100) NOT NULL,
224 | `public` varchar(5) NOT NULL,
225 | `status` varchar(10) NOT NULL,
226 | PRIMARY KEY (`id`)
227 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
228 | /*!40101 SET character_set_client = @saved_cs_client */;
229 |
230 | --
231 | -- Table structure for table `service`
232 | --
233 |
234 | DROP TABLE IF EXISTS `service`;
235 | /*!40101 SET @saved_cs_client = @@character_set_client */;
236 | /*!40101 SET character_set_client = utf8 */;
237 | CREATE TABLE `service` (
238 | `id` int(11) NOT NULL AUTO_INCREMENT,
239 | `name` varchar(50) NOT NULL,
240 | `target` longtext NOT NULL,
241 | PRIMARY KEY (`id`)
242 | ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
243 | /*!40101 SET character_set_client = @saved_cs_client */;
244 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
245 |
246 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
247 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
248 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
249 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
250 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
251 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
252 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
253 |
254 | -- Dump completed on 2013-09-03 21:52:14
255 |
--------------------------------------------------------------------------------
/static/bootstrap/css/docs.css:
--------------------------------------------------------------------------------
1 |
2 | body {
3 | background-color: #FFFFFF;
4 | background-image: url("../img/grid-18px-masked.png");
5 | background-position: 0 40px;
6 | background-repeat: repeat-x;
7 | padding-top: 90px;
8 | position: relative;
9 | }
10 | .navbar-fixed-top .brand {
11 | -moz-transition: all 0.2s linear 0s;
12 | color: #000000;
13 | float: right;
14 | font-weight: bold;
15 | margin-left: 20px;
16 | padding-left: 0;
17 | padding-right: 0;
18 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.125);
19 | }
20 | .navbar-fixed-top .brand:hover {
21 | text-decoration: none;
22 | }
23 | section {
24 | padding-top: 60px;
25 | }
26 | hr.soften {
27 | background-image: -moz-linear-gradient(left center , transparent, rgba(0, 0, 0, 0.1), transparent);
28 | border: 0 none;
29 | height: 1px;
30 | margin: 54px 0;
31 | }
32 | .jumbotron {
33 | position: relative;
34 | }
35 | .jumbotron h1 {
36 | font-size: 81px;
37 | font-weight: bold;
38 | letter-spacing: -1px;
39 | line-height: 1;
40 | margin-bottom: 9px;
41 | }
42 | .jumbotron p {
43 | font-weight: 300;
44 | margin-bottom: 18px;
45 | }
46 | .jumbotron .btn-large {
47 | border-radius: 6px 6px 6px 6px;
48 | font-size: 20px;
49 | font-weight: normal;
50 | margin-right: 10px;
51 | padding: 14px 24px;
52 | }
53 | .jumbotron .btn-large small {
54 | font-size: 14px;
55 | }
56 | .masthead {
57 | margin-bottom: 72px;
58 | padding-top: 36px;
59 | }
60 | .masthead h1, .masthead p {
61 | text-align: center;
62 | }
63 | .masthead h1 {
64 | margin-bottom: 18px;
65 | }
66 | .masthead p {
67 | font-size: 30px;
68 | line-height: 36px;
69 | margin-left: 5%;
70 | margin-right: 5%;
71 | }
72 | .subhead {
73 | margin-bottom: 9px;
74 | padding-bottom: 0;
75 | }
76 | .subhead h1 {
77 | font-size: 54px;
78 | }
79 | .subnav {
80 | background-color: #EEEEEE;
81 | background-image: -moz-linear-gradient(center top , #F5F5F5 0%, #EEEEEE 100%);
82 | background-repeat: repeat-x;
83 | border: 1px solid #E5E5E5;
84 | border-radius: 4px 4px 4px 4px;
85 | height: 36px;
86 | width: 100%;
87 | }
88 | .subnav .nav {
89 | margin-bottom: 0;
90 | }
91 | .subnav .nav > li > a {
92 | border-left: 1px solid #F5F5F5;
93 | border-radius: 0 0 0 0;
94 | border-right: 1px solid #E5E5E5;
95 | margin: 0;
96 | padding-bottom: 11px;
97 | padding-top: 11px;
98 | }
99 | .subnav .nav > .active > a, .subnav .nav > .active > a:hover {
100 | background-color: #E9E9E9;
101 | border-left: 0 none;
102 | border-right-color: #DDDDDD;
103 | box-shadow: 0 3px 5px rgba(0, 0, 0, 0.05) inset;
104 | color: #777777;
105 | padding-left: 13px;
106 | }
107 | .subnav .nav > .active > a .caret, .subnav .nav > .active > a:hover .caret {
108 | border-top-color: #777777;
109 | }
110 | .subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
111 | border-left: 0 none;
112 | border-radius: 4px 0 0 4px;
113 | padding-left: 12px;
114 | }
115 | .subnav .nav > li:last-child > a {
116 | border-right: 0 none;
117 | }
118 | .subnav .dropdown-menu {
119 | border-radius: 0 0 4px 4px;
120 | }
121 | .subnav-fixed {
122 | border-color: #D5D5D5;
123 | border-radius: 0 0 0 0;
124 | border-width: 0 0 1px;
125 | box-shadow: 0 1px 0 #FFFFFF inset, 0 1px 5px rgba(0, 0, 0, 0.1);
126 | left: 0;
127 | position: fixed;
128 | right: 0;
129 | top: 40px;
130 | z-index: 1020;
131 | }
132 | .subnav-fixed .nav {
133 | margin: 0 auto;
134 | padding: 0 1px;
135 | width: 938px;
136 | }
137 | .subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
138 | border-radius: 0 0 0 0;
139 | }
140 | .bs-links {
141 | margin: 36px 0;
142 | }
143 | .quick-links {
144 | list-style: none outside none;
145 | margin: 0;
146 | min-height: 30px;
147 | overflow: hidden;
148 | padding: 5px 20px;
149 | text-align: center;
150 | }
151 | .quick-links:first-child {
152 | min-height: 0;
153 | }
154 | .quick-links li {
155 | color: #999999;
156 | display: inline;
157 | margin: 0 5px;
158 | }
159 | .quick-links .github-btn, .quick-links .tweet-btn, .quick-links .follow-btn {
160 | position: relative;
161 | top: 5px;
162 | }
163 | .marketing .row {
164 | margin-bottom: 9px;
165 | }
166 | .marketing h1 {
167 | font-size: 40px;
168 | font-weight: 300;
169 | margin: 36px 0 27px;
170 | text-align: center;
171 | }
172 | .marketing h2, .marketing h3 {
173 | font-weight: 300;
174 | }
175 | .marketing h2 {
176 | font-size: 22px;
177 | }
178 | .marketing p {
179 | margin-right: 10px;
180 | }
181 | .marketing .bs-icon {
182 | float: left;
183 | margin: 7px 10px 0 0;
184 | opacity: 0.8;
185 | }
186 | .marketing .small-bs-icon {
187 | float: left;
188 | margin: 4px 5px 0 0;
189 | }
190 | .footer {
191 | border-top: 1px solid #E5E5E5;
192 | margin-top: 45px;
193 | padding: 35px 0 36px;
194 | }
195 | .footer p {
196 | color: #555555;
197 | margin-bottom: 0;
198 | }
199 | .show-grid {
200 | margin-bottom: 20px;
201 | margin-top: 10px;
202 | }
203 | .show-grid [class*="span"] {
204 | background-color: #EEEEEE;
205 | border-radius: 3px 3px 3px 3px;
206 | line-height: 30px;
207 | min-height: 30px;
208 | text-align: center;
209 | }
210 | .show-grid:hover [class*="span"] {
211 | background: none repeat scroll 0 0 #DDDDDD;
212 | }
213 | .show-grid .show-grid {
214 | margin-bottom: 0;
215 | margin-top: 0;
216 | }
217 | .show-grid .show-grid [class*="span"] {
218 | background-color: #CCCCCC;
219 | }
220 | .mini-layout {
221 | border: 1px solid #DDDDDD;
222 | border-radius: 6px 6px 6px 6px;
223 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
224 | }
225 | .mini-layout {
226 | height: 240px;
227 | margin-bottom: 20px;
228 | padding: 9px;
229 | }
230 | .mini-layout div {
231 | border-radius: 3px 3px 3px 3px;
232 | }
233 | .mini-layout .mini-layout-body {
234 | background-color: #DCEAF4;
235 | height: 240px;
236 | margin: 0 auto;
237 | width: 70%;
238 | }
239 | .mini-layout.fluid .mini-layout-sidebar, .mini-layout.fluid .mini-layout-header, .mini-layout.fluid .mini-layout-body {
240 | float: left;
241 | }
242 | .mini-layout.fluid .mini-layout-sidebar {
243 | background-color: #BBD8E9;
244 | height: 240px;
245 | width: 20%;
246 | }
247 | .mini-layout.fluid .mini-layout-body {
248 | margin-left: 2.5%;
249 | width: 77.5%;
250 | }
251 | .popover-well {
252 | min-height: 160px;
253 | }
254 | .popover-well .popover {
255 | display: block;
256 | }
257 | .popover-well .popover-wrapper {
258 | float: left;
259 | height: 160px;
260 | margin-left: 55px;
261 | position: relative;
262 | width: 50%;
263 | }
264 | .popover-well .popover-menu-wrapper {
265 | height: 80px;
266 | }
267 | .large-bird {
268 | margin: 5px 0 0 310px;
269 | opacity: 0.1;
270 | }
271 | .download .page-header {
272 | margin-top: 36px;
273 | }
274 | .page-header .toggle-all {
275 | margin-top: 5px;
276 | }
277 | .download h3 {
278 | margin-bottom: 5px;
279 | }
280 | .download-builder input + h3, .download-builder .checkbox + h3 {
281 | margin-top: 9px;
282 | }
283 | .download-builder input[type="text"] {
284 | color: #DD1144;
285 | font-family: Menlo,Monaco,"Courier New",monospace;
286 | font-size: 12px;
287 | margin-bottom: 9px;
288 | }
289 | .download-builder input[type="text"]:focus {
290 | background-color: #FFFFFF;
291 | }
292 | .download .checkbox {
293 | background-color: #F9F9F9;
294 | border-radius: 3px 3px 3px 3px;
295 | color: #555555;
296 | cursor: pointer;
297 | padding: 6px 10px 6px 25px;
298 | }
299 | .download .checkbox:hover {
300 | background-color: #F5F5F5;
301 | color: #333333;
302 | }
303 | .download .checkbox small {
304 | color: #777777;
305 | font-size: 12px;
306 | }
307 | #variables label {
308 | margin-bottom: 0;
309 | }
310 | .download-btn {
311 | margin: 36px 0 108px;
312 | }
313 | #download p, #download h4 {
314 | color: #999999;
315 | margin: 0 auto;
316 | max-width: 50%;
317 | text-align: center;
318 | }
319 | #download h4 {
320 | margin-bottom: 0;
321 | }
322 | #download p {
323 | margin-bottom: 18px;
324 | }
325 | .download-btn .btn {
326 | border-radius: 6px 6px 6px 6px;
327 | display: block;
328 | font-size: 30px;
329 | line-height: 1;
330 | margin-bottom: 27px;
331 | padding: 19px 24px;
332 | text-align: center;
333 | width: auto;
334 | }
335 | .swatch-col {
336 | width: 30px;
337 | }
338 | .swatch {
339 | border-radius: 3px 3px 3px 3px;
340 | display: inline-block;
341 | height: 20px;
342 | margin: -6px 0;
343 | width: 30px;
344 | }
345 | .swatch-bordered {
346 | border: 1px solid #EEEEEE;
347 | height: 18px;
348 | width: 28px;
349 | }
350 | img {
351 | max-width: 100%;
352 | }
353 | h2 + table, h3 + table, h4 + table, h2 + .row {
354 | margin-top: 5px;
355 | }
356 | .example-sites img {
357 | margin: 0 auto;
358 | max-width: 100%;
359 | }
360 | .marketing-byline {
361 | color: #999999;
362 | font-size: 18px;
363 | font-weight: 300;
364 | line-height: 24px;
365 | margin: -18px 0 27px;
366 | text-align: center;
367 | }
368 | .scrollspy-example {
369 | height: 200px;
370 | overflow: auto;
371 | position: relative;
372 | }
373 | form.well {
374 | padding: 14px;
375 | }
376 | .well hr {
377 | margin: 18px 0;
378 | }
379 | .focused {
380 | border-color: rgba(82, 168, 236, 0.8);
381 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(82, 168, 236, 0.6);
382 | outline: 0 none;
383 | }
384 | .docs-input-sizes select, .docs-input-sizes input[type="text"] {
385 | display: block;
386 | margin-bottom: 9px;
387 | }
388 | .the-icons {
389 | list-style: none outside none;
390 | margin-left: 0;
391 | }
392 | .the-icons i:hover {
393 | background-color: rgba(255, 0, 0, 0.25);
394 | }
395 | .bootstrap-examples .thumbnail {
396 | background-color: #FFFFFF;
397 | margin-bottom: 9px;
398 | }
399 | .responsive-utilities th small {
400 | color: #999999;
401 | display: block;
402 | font-weight: normal;
403 | }
404 | .responsive-utilities tbody th {
405 | font-weight: normal;
406 | }
407 | .responsive-utilities td {
408 | text-align: center;
409 | }
410 | .responsive-utilities td.is-visible {
411 | background-color: #DFF0D8 !important;
412 | color: #468847;
413 | }
414 | .responsive-utilities td.is-hidden {
415 | background-color: #F9F9F9 !important;
416 | color: #CCCCCC;
417 | }
418 | .responsive-utilities-test {
419 | list-style: none outside none;
420 | margin-left: 0;
421 | margin-top: 5px;
422 | overflow: hidden;
423 | }
424 | .responsive-utilities-test li {
425 | border: 1px solid #DDDDDD;
426 | border-radius: 4px 4px 4px 4px;
427 | color: #999999;
428 | float: left;
429 | font-size: 14px;
430 | font-weight: bold;
431 | height: 43px;
432 | line-height: 43px;
433 | position: relative;
434 | text-align: center;
435 | width: 25%;
436 | }
437 | .responsive-utilities-test li + li {
438 | margin-left: 10px;
439 | }
440 | .responsive-utilities-test span {
441 | border-radius: 4px 4px 4px 4px;
442 | bottom: -1px;
443 | left: -1px;
444 | position: absolute;
445 | right: -1px;
446 | top: -1px;
447 | }
448 | .responsive-utilities-test span {
449 | background-color: #DFF0D8;
450 | border: 1px solid #D6E9C6;
451 | color: #468847;
452 | }
453 | body {
454 | padding-top: 70px;
455 | }
456 | h2 {
457 | margin-top: 27px;
458 | }
459 | h2 small {
460 | display: block;
461 | line-height: 18px;
462 | }
463 | h3 {
464 | margin-top: 18px;
465 | }
466 | .jumbotron h1, .jumbotron p {
467 | margin-right: 0;
468 | text-align: center;
469 | }
470 | .jumbotron h1 {
471 | font-size: 45px;
472 | margin-right: 0;
473 | }
474 | .jumbotron p {
475 | font-size: 18px;
476 | line-height: 24px;
477 | margin-left: 0;
478 | margin-right: 0;
479 | }
480 | .jumbotron .btn {
481 | display: block;
482 | font-size: 18px;
483 | margin: 0 auto 10px;
484 | padding: 10px 14px;
485 | }
486 | .masthead {
487 | padding-top: 0;
488 | }
489 | .quick-links {
490 | margin: 40px 0 0;
491 | }
492 | .quick-links .divider {
493 | display: none;
494 | }
495 | .example-sites {
496 | margin-left: 0;
497 | }
498 | .example-sites > li {
499 | display: block;
500 | float: none;
501 | margin: 0 auto 18px;
502 | max-width: 280px;
503 | text-align: center;
504 | }
505 | .example-sites .thumbnail > img {
506 | max-width: 270px;
507 | }
508 | table code {
509 | white-space: normal;
510 | word-wrap: break-word;
511 | }
512 | .modal-example .modal {
513 | bottom: auto;
514 | left: auto;
515 | position: relative;
516 | right: auto;
517 | top: auto;
518 | }
519 | body {
520 | padding-top: 0;
521 | }
522 | .jumbotron .btn {
523 | margin-bottom: 10px;
524 | }
525 | .subnav {
526 | background: none repeat scroll 0 0 #FFFFFF;
527 | box-shadow: none;
528 | height: auto;
529 | position: static;
530 | top: auto;
531 | width: auto;
532 | z-index: auto;
533 | }
534 | .subnav .nav > li {
535 | float: none;
536 | }
537 | .subnav .nav > li > a {
538 | border: 0 none;
539 | }
540 | .subnav .nav > li + li > a {
541 | border-top: 1px solid #E5E5E5;
542 | }
543 | .subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
544 | border-radius: 4px 4px 0 0;
545 | }
546 | .large-bird {
547 | display: none;
548 | }
549 | .popover-well .popover-wrapper {
550 | margin-left: 0;
551 | }
552 | .show-grid [class*="span"] {
553 | margin-bottom: 5px;
554 | }
555 | .footer .pull-right {
556 | float: none;
557 | }
558 | .footer p {
559 | margin-bottom: 9px;
560 | }
561 | .jumbotron h1 {
562 | font-size: 54px;
563 | }
564 | .jumbotron p {
565 | margin-left: 0;
566 | margin-right: 0;
567 | }
568 | body {
569 | padding-top: 0;
570 | }
571 | .jumbotron h1 {
572 | font-size: 72px;
573 | }
574 | .navbar-fixed-top .brand {
575 | float: left;
576 | margin-left: 0;
577 | padding-left: 10px;
578 | padding-right: 10px;
579 | }
580 | .quick-links li {
581 | display: inline-block;
582 | margin: 5px;
583 | }
584 | .subnav-fixed .nav {
585 | width: 1168px;
586 | }
587 |
--------------------------------------------------------------------------------
/static/bootstrap/js/bootstrap.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Bootstrap.js by @fat & @mdo
3 | * Copyright 2012 Twitter, Inc.
4 | * http://www.apache.org/licenses/LICENSE-2.0.txt
5 | */
6 | !function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger("close").removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;return!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('
').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=(a||"").toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'
'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'
'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.$element.change(),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"
"+b+" "})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'',item:'
'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
--------------------------------------------------------------------------------
/static/bootstrap/js/bootstrap.js:
--------------------------------------------------------------------------------
1 | /* ===================================================
2 | * bootstrap-transition.js v2.0.1
3 | * http://twitter.github.com/bootstrap/javascript.html#transitions
4 | * ===================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ========================================================== */
19 |
20 | !function( $ ) {
21 |
22 | $(function () {
23 |
24 | "use strict"
25 |
26 | /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27 | * ======================================================= */
28 |
29 | $.support.transition = (function () {
30 | var thisBody = document.body || document.documentElement
31 | , thisStyle = thisBody.style
32 | , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
33 |
34 | return support && {
35 | end: (function () {
36 | var transitionEnd = "TransitionEnd"
37 | if ( $.browser.webkit ) {
38 | transitionEnd = "webkitTransitionEnd"
39 | } else if ( $.browser.mozilla ) {
40 | transitionEnd = "transitionend"
41 | } else if ( $.browser.opera ) {
42 | transitionEnd = "oTransitionEnd"
43 | }
44 | return transitionEnd
45 | }())
46 | }
47 | })()
48 |
49 | })
50 |
51 | }( window.jQuery );/* ==========================================================
52 | * bootstrap-alert.js v2.0.1
53 | * http://twitter.github.com/bootstrap/javascript.html#alerts
54 | * ==========================================================
55 | * Copyright 2012 Twitter, Inc.
56 | *
57 | * Licensed under the Apache License, Version 2.0 (the "License");
58 | * you may not use this file except in compliance with the License.
59 | * You may obtain a copy of the License at
60 | *
61 | * http://www.apache.org/licenses/LICENSE-2.0
62 | *
63 | * Unless required by applicable law or agreed to in writing, software
64 | * distributed under the License is distributed on an "AS IS" BASIS,
65 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66 | * See the License for the specific language governing permissions and
67 | * limitations under the License.
68 | * ========================================================== */
69 |
70 |
71 | !function( $ ){
72 |
73 | "use strict"
74 |
75 | /* ALERT CLASS DEFINITION
76 | * ====================== */
77 |
78 | var dismiss = '[data-dismiss="alert"]'
79 | , Alert = function ( el ) {
80 | $(el).on('click', dismiss, this.close)
81 | }
82 |
83 | Alert.prototype = {
84 |
85 | constructor: Alert
86 |
87 | , close: function ( e ) {
88 | var $this = $(this)
89 | , selector = $this.attr('data-target')
90 | , $parent
91 |
92 | if (!selector) {
93 | selector = $this.attr('href')
94 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
95 | }
96 |
97 | $parent = $(selector)
98 | $parent.trigger('close')
99 |
100 | e && e.preventDefault()
101 |
102 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
103 |
104 | $parent
105 | .trigger('close')
106 | .removeClass('in')
107 |
108 | function removeElement() {
109 | $parent
110 | .trigger('closed')
111 | .remove()
112 | }
113 |
114 | $.support.transition && $parent.hasClass('fade') ?
115 | $parent.on($.support.transition.end, removeElement) :
116 | removeElement()
117 | }
118 |
119 | }
120 |
121 |
122 | /* ALERT PLUGIN DEFINITION
123 | * ======================= */
124 |
125 | $.fn.alert = function ( option ) {
126 | return this.each(function () {
127 | var $this = $(this)
128 | , data = $this.data('alert')
129 | if (!data) $this.data('alert', (data = new Alert(this)))
130 | if (typeof option == 'string') data[option].call($this)
131 | })
132 | }
133 |
134 | $.fn.alert.Constructor = Alert
135 |
136 |
137 | /* ALERT DATA-API
138 | * ============== */
139 |
140 | $(function () {
141 | $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
142 | })
143 |
144 | }( window.jQuery );/* ============================================================
145 | * bootstrap-button.js v2.0.1
146 | * http://twitter.github.com/bootstrap/javascript.html#buttons
147 | * ============================================================
148 | * Copyright 2012 Twitter, Inc.
149 | *
150 | * Licensed under the Apache License, Version 2.0 (the "License");
151 | * you may not use this file except in compliance with the License.
152 | * You may obtain a copy of the License at
153 | *
154 | * http://www.apache.org/licenses/LICENSE-2.0
155 | *
156 | * Unless required by applicable law or agreed to in writing, software
157 | * distributed under the License is distributed on an "AS IS" BASIS,
158 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159 | * See the License for the specific language governing permissions and
160 | * limitations under the License.
161 | * ============================================================ */
162 |
163 | !function( $ ){
164 |
165 | "use strict"
166 |
167 | /* BUTTON PUBLIC CLASS DEFINITION
168 | * ============================== */
169 |
170 | var Button = function ( element, options ) {
171 | this.$element = $(element)
172 | this.options = $.extend({}, $.fn.button.defaults, options)
173 | }
174 |
175 | Button.prototype = {
176 |
177 | constructor: Button
178 |
179 | , setState: function ( state ) {
180 | var d = 'disabled'
181 | , $el = this.$element
182 | , data = $el.data()
183 | , val = $el.is('input') ? 'val' : 'html'
184 |
185 | state = state + 'Text'
186 | data.resetText || $el.data('resetText', $el[val]())
187 |
188 | $el[val](data[state] || this.options[state])
189 |
190 | // push to event loop to allow forms to submit
191 | setTimeout(function () {
192 | state == 'loadingText' ?
193 | $el.addClass(d).attr(d, d) :
194 | $el.removeClass(d).removeAttr(d)
195 | }, 0)
196 | }
197 |
198 | , toggle: function () {
199 | var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
200 |
201 | $parent && $parent
202 | .find('.active')
203 | .removeClass('active')
204 |
205 | this.$element.toggleClass('active')
206 | }
207 |
208 | }
209 |
210 |
211 | /* BUTTON PLUGIN DEFINITION
212 | * ======================== */
213 |
214 | $.fn.button = function ( option ) {
215 | return this.each(function () {
216 | var $this = $(this)
217 | , data = $this.data('button')
218 | , options = typeof option == 'object' && option
219 | if (!data) $this.data('button', (data = new Button(this, options)))
220 | if (option == 'toggle') data.toggle()
221 | else if (option) data.setState(option)
222 | })
223 | }
224 |
225 | $.fn.button.defaults = {
226 | loadingText: 'loading...'
227 | }
228 |
229 | $.fn.button.Constructor = Button
230 |
231 |
232 | /* BUTTON DATA-API
233 | * =============== */
234 |
235 | $(function () {
236 | $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
237 | var $btn = $(e.target)
238 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
239 | $btn.button('toggle')
240 | })
241 | })
242 |
243 | }( window.jQuery );/* ==========================================================
244 | * bootstrap-carousel.js v2.0.1
245 | * http://twitter.github.com/bootstrap/javascript.html#carousel
246 | * ==========================================================
247 | * Copyright 2012 Twitter, Inc.
248 | *
249 | * Licensed under the Apache License, Version 2.0 (the "License");
250 | * you may not use this file except in compliance with the License.
251 | * You may obtain a copy of the License at
252 | *
253 | * http://www.apache.org/licenses/LICENSE-2.0
254 | *
255 | * Unless required by applicable law or agreed to in writing, software
256 | * distributed under the License is distributed on an "AS IS" BASIS,
257 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258 | * See the License for the specific language governing permissions and
259 | * limitations under the License.
260 | * ========================================================== */
261 |
262 |
263 | !function( $ ){
264 |
265 | "use strict"
266 |
267 | /* CAROUSEL CLASS DEFINITION
268 | * ========================= */
269 |
270 | var Carousel = function (element, options) {
271 | this.$element = $(element)
272 | this.options = $.extend({}, $.fn.carousel.defaults, options)
273 | this.options.slide && this.slide(this.options.slide)
274 | this.options.pause == 'hover' && this.$element
275 | .on('mouseenter', $.proxy(this.pause, this))
276 | .on('mouseleave', $.proxy(this.cycle, this))
277 | }
278 |
279 | Carousel.prototype = {
280 |
281 | cycle: function () {
282 | this.interval = setInterval($.proxy(this.next, this), this.options.interval)
283 | return this
284 | }
285 |
286 | , to: function (pos) {
287 | var $active = this.$element.find('.active')
288 | , children = $active.parent().children()
289 | , activePos = children.index($active)
290 | , that = this
291 |
292 | if (pos > (children.length - 1) || pos < 0) return
293 |
294 | if (this.sliding) {
295 | return this.$element.one('slid', function () {
296 | that.to(pos)
297 | })
298 | }
299 |
300 | if (activePos == pos) {
301 | return this.pause().cycle()
302 | }
303 |
304 | return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
305 | }
306 |
307 | , pause: function () {
308 | clearInterval(this.interval)
309 | this.interval = null
310 | return this
311 | }
312 |
313 | , next: function () {
314 | if (this.sliding) return
315 | return this.slide('next')
316 | }
317 |
318 | , prev: function () {
319 | if (this.sliding) return
320 | return this.slide('prev')
321 | }
322 |
323 | , slide: function (type, next) {
324 | var $active = this.$element.find('.active')
325 | , $next = next || $active[type]()
326 | , isCycling = this.interval
327 | , direction = type == 'next' ? 'left' : 'right'
328 | , fallback = type == 'next' ? 'first' : 'last'
329 | , that = this
330 |
331 | this.sliding = true
332 |
333 | isCycling && this.pause()
334 |
335 | $next = $next.length ? $next : this.$element.find('.item')[fallback]()
336 |
337 | if ($next.hasClass('active')) return
338 |
339 | if (!$.support.transition && this.$element.hasClass('slide')) {
340 | this.$element.trigger('slide')
341 | $active.removeClass('active')
342 | $next.addClass('active')
343 | this.sliding = false
344 | this.$element.trigger('slid')
345 | } else {
346 | $next.addClass(type)
347 | $next[0].offsetWidth // force reflow
348 | $active.addClass(direction)
349 | $next.addClass(direction)
350 | this.$element.trigger('slide')
351 | this.$element.one($.support.transition.end, function () {
352 | $next.removeClass([type, direction].join(' ')).addClass('active')
353 | $active.removeClass(['active', direction].join(' '))
354 | that.sliding = false
355 | setTimeout(function () { that.$element.trigger('slid') }, 0)
356 | })
357 | }
358 |
359 | isCycling && this.cycle()
360 |
361 | return this
362 | }
363 |
364 | }
365 |
366 |
367 | /* CAROUSEL PLUGIN DEFINITION
368 | * ========================== */
369 |
370 | $.fn.carousel = function ( option ) {
371 | return this.each(function () {
372 | var $this = $(this)
373 | , data = $this.data('carousel')
374 | , options = typeof option == 'object' && option
375 | if (!data) $this.data('carousel', (data = new Carousel(this, options)))
376 | if (typeof option == 'number') data.to(option)
377 | else if (typeof option == 'string' || (option = options.slide)) data[option]()
378 | else data.cycle()
379 | })
380 | }
381 |
382 | $.fn.carousel.defaults = {
383 | interval: 5000
384 | , pause: 'hover'
385 | }
386 |
387 | $.fn.carousel.Constructor = Carousel
388 |
389 |
390 | /* CAROUSEL DATA-API
391 | * ================= */
392 |
393 | $(function () {
394 | $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
395 | var $this = $(this), href
396 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
397 | , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
398 | $target.carousel(options)
399 | e.preventDefault()
400 | })
401 | })
402 |
403 | }( window.jQuery );/* =============================================================
404 | * bootstrap-collapse.js v2.0.1
405 | * http://twitter.github.com/bootstrap/javascript.html#collapse
406 | * =============================================================
407 | * Copyright 2012 Twitter, Inc.
408 | *
409 | * Licensed under the Apache License, Version 2.0 (the "License");
410 | * you may not use this file except in compliance with the License.
411 | * You may obtain a copy of the License at
412 | *
413 | * http://www.apache.org/licenses/LICENSE-2.0
414 | *
415 | * Unless required by applicable law or agreed to in writing, software
416 | * distributed under the License is distributed on an "AS IS" BASIS,
417 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
418 | * See the License for the specific language governing permissions and
419 | * limitations under the License.
420 | * ============================================================ */
421 |
422 | !function( $ ){
423 |
424 | "use strict"
425 |
426 | var Collapse = function ( element, options ) {
427 | this.$element = $(element)
428 | this.options = $.extend({}, $.fn.collapse.defaults, options)
429 |
430 | if (this.options["parent"]) {
431 | this.$parent = $(this.options["parent"])
432 | }
433 |
434 | this.options.toggle && this.toggle()
435 | }
436 |
437 | Collapse.prototype = {
438 |
439 | constructor: Collapse
440 |
441 | , dimension: function () {
442 | var hasWidth = this.$element.hasClass('width')
443 | return hasWidth ? 'width' : 'height'
444 | }
445 |
446 | , show: function () {
447 | var dimension = this.dimension()
448 | , scroll = $.camelCase(['scroll', dimension].join('-'))
449 | , actives = this.$parent && this.$parent.find('.in')
450 | , hasData
451 |
452 | if (actives && actives.length) {
453 | hasData = actives.data('collapse')
454 | actives.collapse('hide')
455 | hasData || actives.data('collapse', null)
456 | }
457 |
458 | this.$element[dimension](0)
459 | this.transition('addClass', 'show', 'shown')
460 | this.$element[dimension](this.$element[0][scroll])
461 |
462 | }
463 |
464 | , hide: function () {
465 | var dimension = this.dimension()
466 | this.reset(this.$element[dimension]())
467 | this.transition('removeClass', 'hide', 'hidden')
468 | this.$element[dimension](0)
469 | }
470 |
471 | , reset: function ( size ) {
472 | var dimension = this.dimension()
473 |
474 | this.$element
475 | .removeClass('collapse')
476 | [dimension](size || 'auto')
477 | [0].offsetWidth
478 |
479 | this.$element[size ? 'addClass' : 'removeClass']('collapse')
480 |
481 | return this
482 | }
483 |
484 | , transition: function ( method, startEvent, completeEvent ) {
485 | var that = this
486 | , complete = function () {
487 | if (startEvent == 'show') that.reset()
488 | that.$element.trigger(completeEvent)
489 | }
490 |
491 | this.$element
492 | .trigger(startEvent)
493 | [method]('in')
494 |
495 | $.support.transition && this.$element.hasClass('collapse') ?
496 | this.$element.one($.support.transition.end, complete) :
497 | complete()
498 | }
499 |
500 | , toggle: function () {
501 | this[this.$element.hasClass('in') ? 'hide' : 'show']()
502 | }
503 |
504 | }
505 |
506 | /* COLLAPSIBLE PLUGIN DEFINITION
507 | * ============================== */
508 |
509 | $.fn.collapse = function ( option ) {
510 | return this.each(function () {
511 | var $this = $(this)
512 | , data = $this.data('collapse')
513 | , options = typeof option == 'object' && option
514 | if (!data) $this.data('collapse', (data = new Collapse(this, options)))
515 | if (typeof option == 'string') data[option]()
516 | })
517 | }
518 |
519 | $.fn.collapse.defaults = {
520 | toggle: true
521 | }
522 |
523 | $.fn.collapse.Constructor = Collapse
524 |
525 |
526 | /* COLLAPSIBLE DATA-API
527 | * ==================== */
528 |
529 | $(function () {
530 | $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
531 | var $this = $(this), href
532 | , target = $this.attr('data-target')
533 | || e.preventDefault()
534 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
535 | , option = $(target).data('collapse') ? 'toggle' : $this.data()
536 | $(target).collapse(option)
537 | })
538 | })
539 |
540 | }( window.jQuery );/* ============================================================
541 | * bootstrap-dropdown.js v2.0.1
542 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns
543 | * ============================================================
544 | * Copyright 2012 Twitter, Inc.
545 | *
546 | * Licensed under the Apache License, Version 2.0 (the "License");
547 | * you may not use this file except in compliance with the License.
548 | * You may obtain a copy of the License at
549 | *
550 | * http://www.apache.org/licenses/LICENSE-2.0
551 | *
552 | * Unless required by applicable law or agreed to in writing, software
553 | * distributed under the License is distributed on an "AS IS" BASIS,
554 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
555 | * See the License for the specific language governing permissions and
556 | * limitations under the License.
557 | * ============================================================ */
558 |
559 |
560 | !function( $ ){
561 |
562 | "use strict"
563 |
564 | /* DROPDOWN CLASS DEFINITION
565 | * ========================= */
566 |
567 | var toggle = '[data-toggle="dropdown"]'
568 | , Dropdown = function ( element ) {
569 | var $el = $(element).on('click.dropdown.data-api', this.toggle)
570 | $('html').on('click.dropdown.data-api', function () {
571 | $el.parent().removeClass('open')
572 | })
573 | }
574 |
575 | Dropdown.prototype = {
576 |
577 | constructor: Dropdown
578 |
579 | , toggle: function ( e ) {
580 | var $this = $(this)
581 | , selector = $this.attr('data-target')
582 | , $parent
583 | , isActive
584 |
585 | if (!selector) {
586 | selector = $this.attr('href')
587 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
588 | }
589 |
590 | $parent = $(selector)
591 | $parent.length || ($parent = $this.parent())
592 |
593 | isActive = $parent.hasClass('open')
594 |
595 | clearMenus()
596 | !isActive && $parent.toggleClass('open')
597 |
598 | return false
599 | }
600 |
601 | }
602 |
603 | function clearMenus() {
604 | $(toggle).parent().removeClass('open')
605 | }
606 |
607 |
608 | /* DROPDOWN PLUGIN DEFINITION
609 | * ========================== */
610 |
611 | $.fn.dropdown = function ( option ) {
612 | return this.each(function () {
613 | var $this = $(this)
614 | , data = $this.data('dropdown')
615 | if (!data) $this.data('dropdown', (data = new Dropdown(this)))
616 | if (typeof option == 'string') data[option].call($this)
617 | })
618 | }
619 |
620 | $.fn.dropdown.Constructor = Dropdown
621 |
622 |
623 | /* APPLY TO STANDARD DROPDOWN ELEMENTS
624 | * =================================== */
625 |
626 | $(function () {
627 | $('html').on('click.dropdown.data-api', clearMenus)
628 | $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
629 | })
630 |
631 | }( window.jQuery );/* =========================================================
632 | * bootstrap-modal.js v2.0.1
633 | * http://twitter.github.com/bootstrap/javascript.html#modals
634 | * =========================================================
635 | * Copyright 2012 Twitter, Inc.
636 | *
637 | * Licensed under the Apache License, Version 2.0 (the "License");
638 | * you may not use this file except in compliance with the License.
639 | * You may obtain a copy of the License at
640 | *
641 | * http://www.apache.org/licenses/LICENSE-2.0
642 | *
643 | * Unless required by applicable law or agreed to in writing, software
644 | * distributed under the License is distributed on an "AS IS" BASIS,
645 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
646 | * See the License for the specific language governing permissions and
647 | * limitations under the License.
648 | * ========================================================= */
649 |
650 |
651 | !function( $ ){
652 |
653 | "use strict"
654 |
655 | /* MODAL CLASS DEFINITION
656 | * ====================== */
657 |
658 | var Modal = function ( content, options ) {
659 | this.options = options
660 | this.$element = $(content)
661 | .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
662 | }
663 |
664 | Modal.prototype = {
665 |
666 | constructor: Modal
667 |
668 | , toggle: function () {
669 | return this[!this.isShown ? 'show' : 'hide']()
670 | }
671 |
672 | , show: function () {
673 | var that = this
674 |
675 | if (this.isShown) return
676 |
677 | $('body').addClass('modal-open')
678 |
679 | this.isShown = true
680 | this.$element.trigger('show')
681 |
682 | escape.call(this)
683 | backdrop.call(this, function () {
684 | var transition = $.support.transition && that.$element.hasClass('fade')
685 |
686 | !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
687 |
688 | that.$element
689 | .show()
690 |
691 | if (transition) {
692 | that.$element[0].offsetWidth // force reflow
693 | }
694 |
695 | that.$element.addClass('in')
696 |
697 | transition ?
698 | that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
699 | that.$element.trigger('shown')
700 |
701 | })
702 | }
703 |
704 | , hide: function ( e ) {
705 | e && e.preventDefault()
706 |
707 | if (!this.isShown) return
708 |
709 | var that = this
710 | this.isShown = false
711 |
712 | $('body').removeClass('modal-open')
713 |
714 | escape.call(this)
715 |
716 | this.$element
717 | .trigger('hide')
718 | .removeClass('in')
719 |
720 | $.support.transition && this.$element.hasClass('fade') ?
721 | hideWithTransition.call(this) :
722 | hideModal.call(this)
723 | }
724 |
725 | }
726 |
727 |
728 | /* MODAL PRIVATE METHODS
729 | * ===================== */
730 |
731 | function hideWithTransition() {
732 | var that = this
733 | , timeout = setTimeout(function () {
734 | that.$element.off($.support.transition.end)
735 | hideModal.call(that)
736 | }, 500)
737 |
738 | this.$element.one($.support.transition.end, function () {
739 | clearTimeout(timeout)
740 | hideModal.call(that)
741 | })
742 | }
743 |
744 | function hideModal( that ) {
745 | this.$element
746 | .hide()
747 | .trigger('hidden')
748 |
749 | backdrop.call(this)
750 | }
751 |
752 | function backdrop( callback ) {
753 | var that = this
754 | , animate = this.$element.hasClass('fade') ? 'fade' : ''
755 |
756 | if (this.isShown && this.options.backdrop) {
757 | var doAnimate = $.support.transition && animate
758 |
759 | this.$backdrop = $('
')
760 | .appendTo(document.body)
761 |
762 | if (this.options.backdrop != 'static') {
763 | this.$backdrop.click($.proxy(this.hide, this))
764 | }
765 |
766 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
767 |
768 | this.$backdrop.addClass('in')
769 |
770 | doAnimate ?
771 | this.$backdrop.one($.support.transition.end, callback) :
772 | callback()
773 |
774 | } else if (!this.isShown && this.$backdrop) {
775 | this.$backdrop.removeClass('in')
776 |
777 | $.support.transition && this.$element.hasClass('fade')?
778 | this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
779 | removeBackdrop.call(this)
780 |
781 | } else if (callback) {
782 | callback()
783 | }
784 | }
785 |
786 | function removeBackdrop() {
787 | this.$backdrop.remove()
788 | this.$backdrop = null
789 | }
790 |
791 | function escape() {
792 | var that = this
793 | if (this.isShown && this.options.keyboard) {
794 | $(document).on('keyup.dismiss.modal', function ( e ) {
795 | e.which == 27 && that.hide()
796 | })
797 | } else if (!this.isShown) {
798 | $(document).off('keyup.dismiss.modal')
799 | }
800 | }
801 |
802 |
803 | /* MODAL PLUGIN DEFINITION
804 | * ======================= */
805 |
806 | $.fn.modal = function ( option ) {
807 | return this.each(function () {
808 | var $this = $(this)
809 | , data = $this.data('modal')
810 | , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
811 | if (!data) $this.data('modal', (data = new Modal(this, options)))
812 | if (typeof option == 'string') data[option]()
813 | else if (options.show) data.show()
814 | })
815 | }
816 |
817 | $.fn.modal.defaults = {
818 | backdrop: true
819 | , keyboard: true
820 | , show: true
821 | }
822 |
823 | $.fn.modal.Constructor = Modal
824 |
825 |
826 | /* MODAL DATA-API
827 | * ============== */
828 |
829 | $(function () {
830 | $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
831 | var $this = $(this), href
832 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
833 | , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
834 |
835 | e.preventDefault()
836 | $target.modal(option)
837 | })
838 | })
839 |
840 | }( window.jQuery );/* ===========================================================
841 | * bootstrap-tooltip.js v2.0.1
842 | * http://twitter.github.com/bootstrap/javascript.html#tooltips
843 | * Inspired by the original jQuery.tipsy by Jason Frame
844 | * ===========================================================
845 | * Copyright 2012 Twitter, Inc.
846 | *
847 | * Licensed under the Apache License, Version 2.0 (the "License");
848 | * you may not use this file except in compliance with the License.
849 | * You may obtain a copy of the License at
850 | *
851 | * http://www.apache.org/licenses/LICENSE-2.0
852 | *
853 | * Unless required by applicable law or agreed to in writing, software
854 | * distributed under the License is distributed on an "AS IS" BASIS,
855 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
856 | * See the License for the specific language governing permissions and
857 | * limitations under the License.
858 | * ========================================================== */
859 |
860 | !function( $ ) {
861 |
862 | "use strict"
863 |
864 | /* TOOLTIP PUBLIC CLASS DEFINITION
865 | * =============================== */
866 |
867 | var Tooltip = function ( element, options ) {
868 | this.init('tooltip', element, options)
869 | }
870 |
871 | Tooltip.prototype = {
872 |
873 | constructor: Tooltip
874 |
875 | , init: function ( type, element, options ) {
876 | var eventIn
877 | , eventOut
878 |
879 | this.type = type
880 | this.$element = $(element)
881 | this.options = this.getOptions(options)
882 | this.enabled = true
883 |
884 | if (this.options.trigger != 'manual') {
885 | eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
886 | eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
887 | this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
888 | this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
889 | }
890 |
891 | this.options.selector ?
892 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
893 | this.fixTitle()
894 | }
895 |
896 | , getOptions: function ( options ) {
897 | options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
898 |
899 | if (options.delay && typeof options.delay == 'number') {
900 | options.delay = {
901 | show: options.delay
902 | , hide: options.delay
903 | }
904 | }
905 |
906 | return options
907 | }
908 |
909 | , enter: function ( e ) {
910 | var self = $(e.currentTarget)[this.type](this._options).data(this.type)
911 |
912 | if (!self.options.delay || !self.options.delay.show) {
913 | self.show()
914 | } else {
915 | self.hoverState = 'in'
916 | setTimeout(function() {
917 | if (self.hoverState == 'in') {
918 | self.show()
919 | }
920 | }, self.options.delay.show)
921 | }
922 | }
923 |
924 | , leave: function ( e ) {
925 | var self = $(e.currentTarget)[this.type](this._options).data(this.type)
926 |
927 | if (!self.options.delay || !self.options.delay.hide) {
928 | self.hide()
929 | } else {
930 | self.hoverState = 'out'
931 | setTimeout(function() {
932 | if (self.hoverState == 'out') {
933 | self.hide()
934 | }
935 | }, self.options.delay.hide)
936 | }
937 | }
938 |
939 | , show: function () {
940 | var $tip
941 | , inside
942 | , pos
943 | , actualWidth
944 | , actualHeight
945 | , placement
946 | , tp
947 |
948 | if (this.hasContent() && this.enabled) {
949 | $tip = this.tip()
950 | this.setContent()
951 |
952 | if (this.options.animation) {
953 | $tip.addClass('fade')
954 | }
955 |
956 | placement = typeof this.options.placement == 'function' ?
957 | this.options.placement.call(this, $tip[0], this.$element[0]) :
958 | this.options.placement
959 |
960 | inside = /in/.test(placement)
961 |
962 | $tip
963 | .remove()
964 | .css({ top: 0, left: 0, display: 'block' })
965 | .appendTo(inside ? this.$element : document.body)
966 |
967 | pos = this.getPosition(inside)
968 |
969 | actualWidth = $tip[0].offsetWidth
970 | actualHeight = $tip[0].offsetHeight
971 |
972 | switch (inside ? placement.split(' ')[1] : placement) {
973 | case 'bottom':
974 | tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
975 | break
976 | case 'top':
977 | tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
978 | break
979 | case 'left':
980 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
981 | break
982 | case 'right':
983 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
984 | break
985 | }
986 |
987 | $tip
988 | .css(tp)
989 | .addClass(placement)
990 | .addClass('in')
991 | }
992 | }
993 |
994 | , setContent: function () {
995 | var $tip = this.tip()
996 | $tip.find('.tooltip-inner').html(this.getTitle())
997 | $tip.removeClass('fade in top bottom left right')
998 | }
999 |
1000 | , hide: function () {
1001 | var that = this
1002 | , $tip = this.tip()
1003 |
1004 | $tip.removeClass('in')
1005 |
1006 | function removeWithAnimation() {
1007 | var timeout = setTimeout(function () {
1008 | $tip.off($.support.transition.end).remove()
1009 | }, 500)
1010 |
1011 | $tip.one($.support.transition.end, function () {
1012 | clearTimeout(timeout)
1013 | $tip.remove()
1014 | })
1015 | }
1016 |
1017 | $.support.transition && this.$tip.hasClass('fade') ?
1018 | removeWithAnimation() :
1019 | $tip.remove()
1020 | }
1021 |
1022 | , fixTitle: function () {
1023 | var $e = this.$element
1024 | if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1025 | $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1026 | }
1027 | }
1028 |
1029 | , hasContent: function () {
1030 | return this.getTitle()
1031 | }
1032 |
1033 | , getPosition: function (inside) {
1034 | return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1035 | width: this.$element[0].offsetWidth
1036 | , height: this.$element[0].offsetHeight
1037 | })
1038 | }
1039 |
1040 | , getTitle: function () {
1041 | var title
1042 | , $e = this.$element
1043 | , o = this.options
1044 |
1045 | title = $e.attr('data-original-title')
1046 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1047 |
1048 | title = (title || '').toString().replace(/(^\s*|\s*$)/, "")
1049 |
1050 | return title
1051 | }
1052 |
1053 | , tip: function () {
1054 | return this.$tip = this.$tip || $(this.options.template)
1055 | }
1056 |
1057 | , validate: function () {
1058 | if (!this.$element[0].parentNode) {
1059 | this.hide()
1060 | this.$element = null
1061 | this.options = null
1062 | }
1063 | }
1064 |
1065 | , enable: function () {
1066 | this.enabled = true
1067 | }
1068 |
1069 | , disable: function () {
1070 | this.enabled = false
1071 | }
1072 |
1073 | , toggleEnabled: function () {
1074 | this.enabled = !this.enabled
1075 | }
1076 |
1077 | , toggle: function () {
1078 | this[this.tip().hasClass('in') ? 'hide' : 'show']()
1079 | }
1080 |
1081 | }
1082 |
1083 |
1084 | /* TOOLTIP PLUGIN DEFINITION
1085 | * ========================= */
1086 |
1087 | $.fn.tooltip = function ( option ) {
1088 | return this.each(function () {
1089 | var $this = $(this)
1090 | , data = $this.data('tooltip')
1091 | , options = typeof option == 'object' && option
1092 | if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
1093 | if (typeof option == 'string') data[option]()
1094 | })
1095 | }
1096 |
1097 | $.fn.tooltip.Constructor = Tooltip
1098 |
1099 | $.fn.tooltip.defaults = {
1100 | animation: true
1101 | , delay: 0
1102 | , selector: false
1103 | , placement: 'top'
1104 | , trigger: 'hover'
1105 | , title: ''
1106 | , template: '
'
1107 | }
1108 |
1109 | }( window.jQuery );/* ===========================================================
1110 | * bootstrap-popover.js v2.0.1
1111 | * http://twitter.github.com/bootstrap/javascript.html#popovers
1112 | * ===========================================================
1113 | * Copyright 2012 Twitter, Inc.
1114 | *
1115 | * Licensed under the Apache License, Version 2.0 (the "License");
1116 | * you may not use this file except in compliance with the License.
1117 | * You may obtain a copy of the License at
1118 | *
1119 | * http://www.apache.org/licenses/LICENSE-2.0
1120 | *
1121 | * Unless required by applicable law or agreed to in writing, software
1122 | * distributed under the License is distributed on an "AS IS" BASIS,
1123 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1124 | * See the License for the specific language governing permissions and
1125 | * limitations under the License.
1126 | * =========================================================== */
1127 |
1128 |
1129 | !function( $ ) {
1130 |
1131 | "use strict"
1132 |
1133 | var Popover = function ( element, options ) {
1134 | this.init('popover', element, options)
1135 | }
1136 |
1137 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1138 | ========================================== */
1139 |
1140 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
1141 |
1142 | constructor: Popover
1143 |
1144 | , setContent: function () {
1145 | var $tip = this.tip()
1146 | , title = this.getTitle()
1147 | , content = this.getContent()
1148 |
1149 | $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
1150 | $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
1151 |
1152 | $tip.removeClass('fade top bottom left right in')
1153 | }
1154 |
1155 | , hasContent: function () {
1156 | return this.getTitle() || this.getContent()
1157 | }
1158 |
1159 | , getContent: function () {
1160 | var content
1161 | , $e = this.$element
1162 | , o = this.options
1163 |
1164 | content = $e.attr('data-content')
1165 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1166 |
1167 | content = content.toString().replace(/(^\s*|\s*$)/, "")
1168 |
1169 | return content
1170 | }
1171 |
1172 | , tip: function() {
1173 | if (!this.$tip) {
1174 | this.$tip = $(this.options.template)
1175 | }
1176 | return this.$tip
1177 | }
1178 |
1179 | })
1180 |
1181 |
1182 | /* POPOVER PLUGIN DEFINITION
1183 | * ======================= */
1184 |
1185 | $.fn.popover = function ( option ) {
1186 | return this.each(function () {
1187 | var $this = $(this)
1188 | , data = $this.data('popover')
1189 | , options = typeof option == 'object' && option
1190 | if (!data) $this.data('popover', (data = new Popover(this, options)))
1191 | if (typeof option == 'string') data[option]()
1192 | })
1193 | }
1194 |
1195 | $.fn.popover.Constructor = Popover
1196 |
1197 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
1198 | placement: 'right'
1199 | , content: ''
1200 | , template: '
'
1201 | })
1202 |
1203 | }( window.jQuery );/* =============================================================
1204 | * bootstrap-scrollspy.js v2.0.1
1205 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1206 | * =============================================================
1207 | * Copyright 2012 Twitter, Inc.
1208 | *
1209 | * Licensed under the Apache License, Version 2.0 (the "License");
1210 | * you may not use this file except in compliance with the License.
1211 | * You may obtain a copy of the License at
1212 | *
1213 | * http://www.apache.org/licenses/LICENSE-2.0
1214 | *
1215 | * Unless required by applicable law or agreed to in writing, software
1216 | * distributed under the License is distributed on an "AS IS" BASIS,
1217 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1218 | * See the License for the specific language governing permissions and
1219 | * limitations under the License.
1220 | * ============================================================== */
1221 |
1222 | !function ( $ ) {
1223 |
1224 | "use strict"
1225 |
1226 | /* SCROLLSPY CLASS DEFINITION
1227 | * ========================== */
1228 |
1229 | function ScrollSpy( element, options) {
1230 | var process = $.proxy(this.process, this)
1231 | , $element = $(element).is('body') ? $(window) : $(element)
1232 | , href
1233 | this.options = $.extend({}, $.fn.scrollspy.defaults, options)
1234 | this.$scrollElement = $element.on('scroll.scroll.data-api', process)
1235 | this.selector = (this.options.target
1236 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1237 | || '') + ' .nav li > a'
1238 | this.$body = $('body').on('click.scroll.data-api', this.selector, process)
1239 | this.refresh()
1240 | this.process()
1241 | }
1242 |
1243 | ScrollSpy.prototype = {
1244 |
1245 | constructor: ScrollSpy
1246 |
1247 | , refresh: function () {
1248 | this.targets = this.$body
1249 | .find(this.selector)
1250 | .map(function () {
1251 | var href = $(this).attr('href')
1252 | return /^#\w/.test(href) && $(href).length ? href : null
1253 | })
1254 |
1255 | this.offsets = $.map(this.targets, function (id) {
1256 | return $(id).position().top
1257 | })
1258 | }
1259 |
1260 | , process: function () {
1261 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1262 | , offsets = this.offsets
1263 | , targets = this.targets
1264 | , activeTarget = this.activeTarget
1265 | , i
1266 |
1267 | for (i = offsets.length; i--;) {
1268 | activeTarget != targets[i]
1269 | && scrollTop >= offsets[i]
1270 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1271 | && this.activate( targets[i] )
1272 | }
1273 | }
1274 |
1275 | , activate: function (target) {
1276 | var active
1277 |
1278 | this.activeTarget = target
1279 |
1280 | this.$body
1281 | .find(this.selector).parent('.active')
1282 | .removeClass('active')
1283 |
1284 | active = this.$body
1285 | .find(this.selector + '[href="' + target + '"]')
1286 | .parent('li')
1287 | .addClass('active')
1288 |
1289 | if ( active.parent('.dropdown-menu') ) {
1290 | active.closest('li.dropdown').addClass('active')
1291 | }
1292 | }
1293 |
1294 | }
1295 |
1296 |
1297 | /* SCROLLSPY PLUGIN DEFINITION
1298 | * =========================== */
1299 |
1300 | $.fn.scrollspy = function ( option ) {
1301 | return this.each(function () {
1302 | var $this = $(this)
1303 | , data = $this.data('scrollspy')
1304 | , options = typeof option == 'object' && option
1305 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
1306 | if (typeof option == 'string') data[option]()
1307 | })
1308 | }
1309 |
1310 | $.fn.scrollspy.Constructor = ScrollSpy
1311 |
1312 | $.fn.scrollspy.defaults = {
1313 | offset: 10
1314 | }
1315 |
1316 |
1317 | /* SCROLLSPY DATA-API
1318 | * ================== */
1319 |
1320 | $(function () {
1321 | $('[data-spy="scroll"]').each(function () {
1322 | var $spy = $(this)
1323 | $spy.scrollspy($spy.data())
1324 | })
1325 | })
1326 |
1327 | }( window.jQuery );/* ========================================================
1328 | * bootstrap-tab.js v2.0.1
1329 | * http://twitter.github.com/bootstrap/javascript.html#tabs
1330 | * ========================================================
1331 | * Copyright 2012 Twitter, Inc.
1332 | *
1333 | * Licensed under the Apache License, Version 2.0 (the "License");
1334 | * you may not use this file except in compliance with the License.
1335 | * You may obtain a copy of the License at
1336 | *
1337 | * http://www.apache.org/licenses/LICENSE-2.0
1338 | *
1339 | * Unless required by applicable law or agreed to in writing, software
1340 | * distributed under the License is distributed on an "AS IS" BASIS,
1341 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1342 | * See the License for the specific language governing permissions and
1343 | * limitations under the License.
1344 | * ======================================================== */
1345 |
1346 |
1347 | !function( $ ){
1348 |
1349 | "use strict"
1350 |
1351 | /* TAB CLASS DEFINITION
1352 | * ==================== */
1353 |
1354 | var Tab = function ( element ) {
1355 | this.element = $(element)
1356 | }
1357 |
1358 | Tab.prototype = {
1359 |
1360 | constructor: Tab
1361 |
1362 | , show: function () {
1363 | var $this = this.element
1364 | , $ul = $this.closest('ul:not(.dropdown-menu)')
1365 | , selector = $this.attr('data-target')
1366 | , previous
1367 | , $target
1368 |
1369 | if (!selector) {
1370 | selector = $this.attr('href')
1371 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1372 | }
1373 |
1374 | if ( $this.parent('li').hasClass('active') ) return
1375 |
1376 | previous = $ul.find('.active a').last()[0]
1377 |
1378 | $this.trigger({
1379 | type: 'show'
1380 | , relatedTarget: previous
1381 | })
1382 |
1383 | $target = $(selector)
1384 |
1385 | this.activate($this.parent('li'), $ul)
1386 | this.activate($target, $target.parent(), function () {
1387 | $this.trigger({
1388 | type: 'shown'
1389 | , relatedTarget: previous
1390 | })
1391 | })
1392 | }
1393 |
1394 | , activate: function ( element, container, callback) {
1395 | var $active = container.find('> .active')
1396 | , transition = callback
1397 | && $.support.transition
1398 | && $active.hasClass('fade')
1399 |
1400 | function next() {
1401 | $active
1402 | .removeClass('active')
1403 | .find('> .dropdown-menu > .active')
1404 | .removeClass('active')
1405 |
1406 | element.addClass('active')
1407 |
1408 | if (transition) {
1409 | element[0].offsetWidth // reflow for transition
1410 | element.addClass('in')
1411 | } else {
1412 | element.removeClass('fade')
1413 | }
1414 |
1415 | if ( element.parent('.dropdown-menu') ) {
1416 | element.closest('li.dropdown').addClass('active')
1417 | }
1418 |
1419 | callback && callback()
1420 | }
1421 |
1422 | transition ?
1423 | $active.one($.support.transition.end, next) :
1424 | next()
1425 |
1426 | $active.removeClass('in')
1427 | }
1428 | }
1429 |
1430 |
1431 | /* TAB PLUGIN DEFINITION
1432 | * ===================== */
1433 |
1434 | $.fn.tab = function ( option ) {
1435 | return this.each(function () {
1436 | var $this = $(this)
1437 | , data = $this.data('tab')
1438 | if (!data) $this.data('tab', (data = new Tab(this)))
1439 | if (typeof option == 'string') data[option]()
1440 | })
1441 | }
1442 |
1443 | $.fn.tab.Constructor = Tab
1444 |
1445 |
1446 | /* TAB DATA-API
1447 | * ============ */
1448 |
1449 | $(function () {
1450 | $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1451 | e.preventDefault()
1452 | $(this).tab('show')
1453 | })
1454 | })
1455 |
1456 | }( window.jQuery );/* =============================================================
1457 | * bootstrap-typeahead.js v2.0.1
1458 | * http://twitter.github.com/bootstrap/javascript.html#typeahead
1459 | * =============================================================
1460 | * Copyright 2012 Twitter, Inc.
1461 | *
1462 | * Licensed under the Apache License, Version 2.0 (the "License");
1463 | * you may not use this file except in compliance with the License.
1464 | * You may obtain a copy of the License at
1465 | *
1466 | * http://www.apache.org/licenses/LICENSE-2.0
1467 | *
1468 | * Unless required by applicable law or agreed to in writing, software
1469 | * distributed under the License is distributed on an "AS IS" BASIS,
1470 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1471 | * See the License for the specific language governing permissions and
1472 | * limitations under the License.
1473 | * ============================================================ */
1474 |
1475 | !function( $ ){
1476 |
1477 | "use strict"
1478 |
1479 | var Typeahead = function ( element, options ) {
1480 | this.$element = $(element)
1481 | this.options = $.extend({}, $.fn.typeahead.defaults, options)
1482 | this.matcher = this.options.matcher || this.matcher
1483 | this.sorter = this.options.sorter || this.sorter
1484 | this.highlighter = this.options.highlighter || this.highlighter
1485 | this.$menu = $(this.options.menu).appendTo('body')
1486 | this.source = this.options.source
1487 | this.shown = false
1488 | this.listen()
1489 | }
1490 |
1491 | Typeahead.prototype = {
1492 |
1493 | constructor: Typeahead
1494 |
1495 | , select: function () {
1496 | var val = this.$menu.find('.active').attr('data-value')
1497 | this.$element.val(val)
1498 | this.$element.change();
1499 | return this.hide()
1500 | }
1501 |
1502 | , show: function () {
1503 | var pos = $.extend({}, this.$element.offset(), {
1504 | height: this.$element[0].offsetHeight
1505 | })
1506 |
1507 | this.$menu.css({
1508 | top: pos.top + pos.height
1509 | , left: pos.left
1510 | })
1511 |
1512 | this.$menu.show()
1513 | this.shown = true
1514 | return this
1515 | }
1516 |
1517 | , hide: function () {
1518 | this.$menu.hide()
1519 | this.shown = false
1520 | return this
1521 | }
1522 |
1523 | , lookup: function (event) {
1524 | var that = this
1525 | , items
1526 | , q
1527 |
1528 | this.query = this.$element.val()
1529 |
1530 | if (!this.query) {
1531 | return this.shown ? this.hide() : this
1532 | }
1533 |
1534 | items = $.grep(this.source, function (item) {
1535 | if (that.matcher(item)) return item
1536 | })
1537 |
1538 | items = this.sorter(items)
1539 |
1540 | if (!items.length) {
1541 | return this.shown ? this.hide() : this
1542 | }
1543 |
1544 | return this.render(items.slice(0, this.options.items)).show()
1545 | }
1546 |
1547 | , matcher: function (item) {
1548 | return ~item.toLowerCase().indexOf(this.query.toLowerCase())
1549 | }
1550 |
1551 | , sorter: function (items) {
1552 | var beginswith = []
1553 | , caseSensitive = []
1554 | , caseInsensitive = []
1555 | , item
1556 |
1557 | while (item = items.shift()) {
1558 | if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
1559 | else if (~item.indexOf(this.query)) caseSensitive.push(item)
1560 | else caseInsensitive.push(item)
1561 | }
1562 |
1563 | return beginswith.concat(caseSensitive, caseInsensitive)
1564 | }
1565 |
1566 | , highlighter: function (item) {
1567 | return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) {
1568 | return '
' + match + ' '
1569 | })
1570 | }
1571 |
1572 | , render: function (items) {
1573 | var that = this
1574 |
1575 | items = $(items).map(function (i, item) {
1576 | i = $(that.options.item).attr('data-value', item)
1577 | i.find('a').html(that.highlighter(item))
1578 | return i[0]
1579 | })
1580 |
1581 | items.first().addClass('active')
1582 | this.$menu.html(items)
1583 | return this
1584 | }
1585 |
1586 | , next: function (event) {
1587 | var active = this.$menu.find('.active').removeClass('active')
1588 | , next = active.next()
1589 |
1590 | if (!next.length) {
1591 | next = $(this.$menu.find('li')[0])
1592 | }
1593 |
1594 | next.addClass('active')
1595 | }
1596 |
1597 | , prev: function (event) {
1598 | var active = this.$menu.find('.active').removeClass('active')
1599 | , prev = active.prev()
1600 |
1601 | if (!prev.length) {
1602 | prev = this.$menu.find('li').last()
1603 | }
1604 |
1605 | prev.addClass('active')
1606 | }
1607 |
1608 | , listen: function () {
1609 | this.$element
1610 | .on('blur', $.proxy(this.blur, this))
1611 | .on('keypress', $.proxy(this.keypress, this))
1612 | .on('keyup', $.proxy(this.keyup, this))
1613 |
1614 | if ($.browser.webkit || $.browser.msie) {
1615 | this.$element.on('keydown', $.proxy(this.keypress, this))
1616 | }
1617 |
1618 | this.$menu
1619 | .on('click', $.proxy(this.click, this))
1620 | .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
1621 | }
1622 |
1623 | , keyup: function (e) {
1624 | switch(e.keyCode) {
1625 | case 40: // down arrow
1626 | case 38: // up arrow
1627 | break
1628 |
1629 | case 9: // tab
1630 | case 13: // enter
1631 | if (!this.shown) return
1632 | this.select()
1633 | break
1634 |
1635 | case 27: // escape
1636 | if (!this.shown) return
1637 | this.hide()
1638 | break
1639 |
1640 | default:
1641 | this.lookup()
1642 | }
1643 |
1644 | e.stopPropagation()
1645 | e.preventDefault()
1646 | }
1647 |
1648 | , keypress: function (e) {
1649 | if (!this.shown) return
1650 |
1651 | switch(e.keyCode) {
1652 | case 9: // tab
1653 | case 13: // enter
1654 | case 27: // escape
1655 | e.preventDefault()
1656 | break
1657 |
1658 | case 38: // up arrow
1659 | e.preventDefault()
1660 | this.prev()
1661 | break
1662 |
1663 | case 40: // down arrow
1664 | e.preventDefault()
1665 | this.next()
1666 | break
1667 | }
1668 |
1669 | e.stopPropagation()
1670 | }
1671 |
1672 | , blur: function (e) {
1673 | var that = this
1674 | setTimeout(function () { that.hide() }, 150)
1675 | }
1676 |
1677 | , click: function (e) {
1678 | e.stopPropagation()
1679 | e.preventDefault()
1680 | this.select()
1681 | }
1682 |
1683 | , mouseenter: function (e) {
1684 | this.$menu.find('.active').removeClass('active')
1685 | $(e.currentTarget).addClass('active')
1686 | }
1687 |
1688 | }
1689 |
1690 |
1691 | /* TYPEAHEAD PLUGIN DEFINITION
1692 | * =========================== */
1693 |
1694 | $.fn.typeahead = function ( option ) {
1695 | return this.each(function () {
1696 | var $this = $(this)
1697 | , data = $this.data('typeahead')
1698 | , options = typeof option == 'object' && option
1699 | if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
1700 | if (typeof option == 'string') data[option]()
1701 | })
1702 | }
1703 |
1704 | $.fn.typeahead.defaults = {
1705 | source: []
1706 | , items: 8
1707 | , menu: ''
1708 | , item: '
'
1709 | }
1710 |
1711 | $.fn.typeahead.Constructor = Typeahead
1712 |
1713 |
1714 | /* TYPEAHEAD DATA-API
1715 | * ================== */
1716 |
1717 | $(function () {
1718 | $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1719 | var $this = $(this)
1720 | if ($this.data('typeahead')) return
1721 | e.preventDefault()
1722 | $this.typeahead($this.data())
1723 | })
1724 | })
1725 |
1726 | }( window.jQuery );
--------------------------------------------------------------------------------