├── .gitattributes
├── .gitignore
├── DJangoHotel
├── __init__.py
├── admin.py
├── models.py
├── static
│ ├── css
│ │ ├── bootstrap.css
│ │ ├── responsive-nav.css
│ │ └── styles.css
│ ├── js
│ │ ├── bootstrap.js
│ │ ├── bootstrap.min.js
│ │ ├── jquery-2.1.1.js
│ │ ├── responsive-nav.js
│ │ └── unslider.js
│ └── pic
│ │ ├── 6240454_091935658000_2.jpg
│ │ ├── hotel-logo.png
│ │ ├── key_home_1.jpg
│ │ ├── key_home_2.jpg
│ │ ├── key_home_3.jpg
│ │ └── key_overview_1.jpg
├── tests.py
└── viewspackage
│ ├── __init__.py
│ ├── aboutView.py
│ ├── indexView.py
│ ├── orderResultView.py
│ ├── orderView.py
│ └── roomInfoView.py
├── README.md
├── kcsj
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
├── manage.py
└── templates
├── 404.html
├── about.html
├── base.html
├── index.html
├── order.html
├── orderresult.html
└── roominfo.html
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # =========================
18 | # Operating System Files
19 | # =========================
20 |
21 | # OSX
22 | # =========================
23 |
24 | .DS_Store
25 | .AppleDouble
26 | .LSOverride
27 |
28 | # Icon must ends with two \r.
29 | Icon
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
--------------------------------------------------------------------------------
/DJangoHotel/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/__init__.py
--------------------------------------------------------------------------------
/DJangoHotel/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 | from DJangoHotel.models import Hotel, Customer, RoomInfo,Order
5 |
6 |
7 | class HotelAdmin(admin.ModelAdmin):
8 | list_display = ('name', 'address', 'description')
9 |
10 | class RoomInfoAdmin(admin.ModelAdmin):
11 | list_display = ('name', 'price','total', 'description')
12 |
13 | class OrderAdmin(admin.ModelAdmin):
14 | list_display = ('id','name','tel','cardid','roomtype','begin','end','totalprice','state')
15 |
16 | class customerAdmin(admin.ModelAdmin):
17 | list_display = ('tel','name','cardid')
18 |
19 | admin.site.register(Hotel,HotelAdmin)
20 | admin.site.register(Customer,customerAdmin)
21 | admin.site.register(RoomInfo,RoomInfoAdmin)
22 | admin.site.register(Order,OrderAdmin)
--------------------------------------------------------------------------------
/DJangoHotel/models.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from django.db import models
3 |
4 | # Create your models here.
5 |
6 | ROOM_TPYE_CHOICES=(
7 | ('standard','标准间'),
8 | ('better','豪华间'),
9 | ('president','总统间')
10 | )
11 |
12 | ORDER_STATE_CHOICES=(
13 | ('will','预定中'),
14 | ('run','执行中'),
15 | ('end','已结束'),
16 | ('destroyed','已废弃'),
17 | )
18 |
19 |
20 | class Hotel(models.Model):
21 | name = models.CharField(max_length=30,primary_key=True)
22 | address = models.CharField(max_length=50)
23 | description = models.TextField()
24 |
25 |
26 | class Customer(models.Model):
27 | tel = models.CharField(max_length=50,primary_key=True)
28 | name = models.CharField(max_length=50)
29 | cardid=models.IntegerField(null=True,blank=True)
30 |
31 | class RoomInfo(models.Model):
32 | name = models.CharField(max_length=30,primary_key=True)
33 | price = models.IntegerField(null=True,blank=True)
34 | total = models.IntegerField(null=True,blank=True)
35 | description = models.TextField()
36 |
37 | def __unicode__(self):
38 | return self.name
39 |
40 |
41 | class Order(models.Model):
42 | #id
43 | name = models.CharField(max_length=45)
44 | tel = models.CharField(max_length=45)
45 | cardid = models.CharField(max_length=45)
46 | roomtype = models.CharField(max_length=45,choices= ROOM_TPYE_CHOICES)
47 | begin = models.DateField()
48 | end = models.DateField()
49 | totalprice = models.IntegerField()
50 | state=models.CharField(max_length=45,choices=ORDER_STATE_CHOICES)
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/DJangoHotel/static/css/responsive-nav.css:
--------------------------------------------------------------------------------
1 | /*! responsive-nav.js 1.0.32 by @viljamis */
2 |
3 | .nav-collapse ul {
4 | margin: 0;
5 | padding: 0;
6 | width: 100%;
7 | display: block;
8 | list-style: none;
9 | }
10 |
11 | .nav-collapse li {
12 | width: 100%;
13 | display: block;
14 | }
15 |
16 | .js .nav-collapse {
17 | clip: rect(0 0 0 0);
18 | max-height: 0;
19 | position: absolute;
20 | display: block;
21 | overflow: hidden;
22 | zoom: 1;
23 | }
24 |
25 | .nav-collapse.opened {
26 | max-height: 9999px;
27 | }
28 |
29 | .disable-pointer-events {
30 | pointer-events: none !important;
31 | }
32 |
33 | .nav-toggle {
34 | -webkit-tap-highlight-color: rgba(0,0,0,0);
35 | -webkit-touch-callout: none;
36 | -webkit-user-select: none;
37 | -moz-user-select: none;
38 | -ms-user-select: none;
39 | -o-user-select: none;
40 | user-select: none;
41 | }
42 |
43 | @media screen and (min-width: 40em) {
44 | .js .nav-collapse {
45 | position: relative;
46 | }
47 | .js .nav-collapse.closed {
48 | max-height: none;
49 | }
50 | .nav-toggle {
51 | display: none;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/DJangoHotel/static/css/styles.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 |
3 | /* ------------------------------------------
4 | RESET
5 | --------------------------------------------- */
6 |
7 | body, div,
8 | h1, h2, h3, h4, h5, h6,
9 | p, blockquote, pre, dl, dt, dd, ol, ul, li, hr,
10 | fieldset, form, label, legend, th, td,
11 | article, aside, figure, footer, header, hgroup, menu, nav, section,
12 | summary, hgroup {
13 | margin: 0;
14 | padding: 0;
15 | border: 0;
16 | }
17 |
18 | a:active,
19 | a:hover {
20 | outline: 0;
21 | }
22 |
23 | @-webkit-viewport { width: device-width; }
24 | @-moz-viewport { width: device-width; }
25 | @-ms-viewport { width: device-width; }
26 | @-o-viewport { width: device-width; }
27 | @viewport { width: device-width; }
28 |
29 |
30 | /* ------------------------------------------
31 | BASE DEMO STYLES
32 | --------------------------------------------- */
33 |
34 | body {
35 | -webkit-text-size-adjust: 100%;
36 | -ms-text-size-adjust: 100%;
37 | text-size-adjust: 100%;
38 | color: #37302a;
39 | background: #fff;
40 | font: normal 100%/1.4 sans-serif;
41 | }
42 |
43 | section {
44 | border-bottom: 1px solid #999;
45 | float: left;
46 | width: 100%;
47 | height: 800px;
48 | }
49 |
50 |
51 | /* ------------------------------------------
52 | NAVIGATION STYLES
53 | (+ responsive-nav.css file is loaded in the
)
54 | --------------------------------------------- */
55 |
56 | .fixed {
57 | position: fixed;
58 | width: 100%;
59 | top: 0;
60 | left: 0;
61 | }
62 |
63 | .nav-collapse,
64 | .nav-collapse * {
65 | -moz-box-sizing: border-box;
66 | -webkit-box-sizing: border-box;
67 | box-sizing: border-box;
68 | }
69 |
70 | .nav-collapse,
71 | .nav-collapse ul {
72 | list-style: none;
73 | width: 100%;
74 | float: left;
75 | }
76 |
77 | .nav-collapse li {
78 | float: left;
79 | width: 100%;
80 | }
81 |
82 | @media screen and (min-width: 40em) {
83 | .nav-collapse li {
84 | width: 25%;
85 | *width: 24.9%; /* IE7 Hack */
86 | _width: 19%; /* IE6 Hack */
87 | }
88 | }
89 |
90 | .nav-collapse a {
91 | color: #fff;
92 | text-decoration: none;
93 | width: 100%;
94 | background: #403D3A;
95 | border-bottom: 1px solid white;
96 | padding: 0.7em 1em;
97 | float: left;
98 | }
99 | .nav-collapse a:hover {
100 | background: #53514E;
101 | }
102 |
103 | @media screen and (min-width: 40em) {
104 | .nav-collapse a {
105 | margin: 0;
106 | padding: 1em;
107 | float: left;
108 | text-align: center;
109 | border-bottom: 0;
110 | border-right: 1px solid white;
111 | }
112 | }
113 |
114 | .nav-collapse ul ul a {
115 | background: #ca3716;
116 | padding-left: 2em;
117 | }
118 |
119 | @media screen and (min-width: 40em) {
120 | .nav-collapse ul ul a {
121 | display: none;
122 | }
123 | }
124 |
125 |
126 | /* ------------------------------------------
127 | NAV TOGGLE STYLES
128 | --------------------------------------------- */
129 |
130 | @font-face {
131 | font-family: "responsivenav";
132 | src:url("../icons/responsivenav.eot");
133 | src:url("../icons/responsivenav.eot?#iefix") format("embedded-opentype"),
134 | url("../icons/responsivenav.ttf") format("truetype"),
135 | url("../icons/responsivenav.woff") format("woff"),
136 | url("../icons/responsivenav.svg#responsivenav") format("svg");
137 | font-weight: normal;
138 | font-style: normal;
139 | }
140 |
141 | .nav-toggle {
142 | position: fixed;
143 | -webkit-font-smoothing: antialiased;
144 | -moz-osx-font-smoothing: grayscale;
145 | -webkit-touch-callout: none;
146 | -webkit-user-select: none;
147 | -moz-user-select: none;
148 | -ms-user-select: none;
149 | user-select: none;
150 | text-decoration: none;
151 | text-indent: -999px;
152 | position: relative;
153 | overflow: hidden;
154 | width: 70px;
155 | height: 55px;
156 | float: right;
157 | }
158 |
159 | .nav-toggle:before {
160 | color: #ffffff; /* Edit this to change the icon color */
161 | font-family: "responsivenav", sans-serif;
162 | font-style: normal;
163 | font-weight: normal;
164 | font-variant: normal;
165 | font-size: 28px;
166 | text-transform: none;
167 | position: absolute;
168 | content: "≡";
169 | text-indent: 0;
170 | text-align: center;
171 | line-height: 55px;
172 | speak: none;
173 | width: 100%;
174 | top: 0;
175 | left: 0;
176 | }
177 |
178 | .nav-toggle.active::before {
179 | font-size: 24px;
180 | content:"x";
181 | }
182 |
183 | .banner { position: relative; overflow: auto;}
184 | .banner li { list-style: none; }
185 | .banner ul li { float: left; }
186 |
187 |
188 | .banner .dots {
189 | position: absolute;
190 | left: 40px;
191 | right: 0;
192 | bottom: 20px;
193 | }
194 | .banner .dots li {
195 | display: inline-block;
196 | width: 30px;
197 | height: 8px;
198 | margin: 0 4px;
199 |
200 | text-indent: -999em;
201 |
202 | border: 2px solid #fff;
203 | box-shadow: 0 0 10px rgba(0,0,0,0.8);
204 |
205 |
206 | cursor: pointer;
207 | opacity: .4;
208 |
209 | -webkit-transition: background .5s, opacity .5s;
210 | -moz-transition: background .5s, opacity .5s;
211 | transition: background .5s, opacity .5s;
212 | }
213 | .banner .dots li.active {
214 | background: #fff;
215 | opacity: 1;
216 | }
217 |
218 |
219 | /* ------------------------------------------
220 | MAIN
221 | --------------------------------------------- */
222 |
223 | *:hover {
224 | transition: all .7s;
225 | -moz-transition: all .7s;
226 | -webkit-transition: all .7s;
227 | -o-transition: all .7s;
228 | }
229 |
230 | .container-fluid {
231 | margin: 0 !important;
232 | padding: 0 !important;
233 | }
234 | .wrap {
235 | width: 1080px;
236 | margin: 0px auto;
237 | padding: 0px 0px 0px 0px;
238 | font-family: Helvetica, Tahoma, Arial, STXihei, "华文细黑", "Microsoft YaHei", "微软雅黑", SimSun, "宋体", Heiti, "黑体" ,sans-serif !important;
239 | background: #fff;
240 | color: #403D3A;
241 | }
242 |
243 | .wrap .hotel-logo {
244 | padding: 40px 0px;
245 | text-align: center
246 | }
247 |
248 | .wrap .nav-collapse a {
249 | font-size: 1.6em
250 | }
251 |
252 | .wrap >.panel-default {
253 | width: 60%;
254 | line-height: 1.5;
255 | font-size: 1.6em;
256 | margin-top: 40px;
257 | }
258 | .wrap .banner {
259 | position: relative;
260 | }
261 |
262 |
263 | .wrap .order {
264 | position: absolute;
265 | right: 40px;
266 | bottom: 20px;
267 | text-align: center;
268 | color: #fff;
269 | border: 5px solid rgba(255,255,255,0.6);
270 |
271 | }
272 |
273 | .wrap .order a {
274 | display: block;
275 | background: rgba(0,0,0,0.8);
276 | padding: 20px 40px;
277 | color: #fff;
278 | text-decoration: none;
279 | }
280 | .wrap .order a:hover {
281 | background: #2ecc71;
282 | }
283 |
284 | .about .banner, .room .banner, .order .banner {
285 | float: left;
286 | overflow: hidden;
287 |
288 | }
289 | .about .banner #hotelDescription {
290 | position: absolute;
291 | background: rgba(255,255,255,0.6);
292 | width: 800px;
293 | right: 40px;
294 | bottom: 40px;
295 | padding: 40px;
296 | border: 5px solid rgba(255,255,255,0.4);
297 | font-size: 1.4em;
298 | color: #fff;
299 | text-shadow: 1px 1px rgba(0,0,0,0.2);
300 | }
301 | .about .banner #hotelDescription h2 {
302 | margin-bottom: 20px;
303 | border-bottom: 1px dashed rgba(255,255,255,0.4);
304 | padding-bottom: 10px;
305 | }
306 |
307 | .panel {
308 | border: none;
309 | }
310 | .panel-default > .panel-heading {
311 | border: none;
312 | background: #403D3A;
313 | color: #fff;
314 | }
315 | .panel-body {
316 | background: #eee;
317 | }
318 |
319 | .room #hotelDescription {
320 | padding: 60px 40px 20px 40px;
321 | overflow: hidden;
322 | background: #403D3A;
323 | color: #fff;
324 | }
325 | .room #hotelDescription article {
326 | overflow: hidden;
327 | margin-bottom: 40px;
328 | font-size: 1.3em;
329 | }
330 | .room #hotelDescription img {
331 | float: left;
332 | margin-right: 40px;
333 | }
334 | .room #hotelDescription h3 {
335 | display: inline-block;
336 | width: 10%;
337 | padding-bottom: 10px;
338 | border-bottom: 1px solid rgba(255,255,255,0.4);
339 | margin: 10px 0 10px 0px;
340 | }
341 | .order .banner #hotelDescription {
342 | width: 400px;
343 | bottom: 160px !important;
344 | overflow: hidden;
345 | }
346 | .order input {
347 | display: block;
348 | width: 300px;
349 | margin-bottom: 10px;
350 | padding: 10px 20px;
351 | border: none;
352 | font-size: 1.4em;
353 | color: #666
354 | }
355 | .order input[type=button] {
356 | background: #5cb85c;
357 | color: #fff;
358 | }
359 |
360 |
361 | #footer {
362 | margin-top: 40px;
363 | }
364 |
365 | #footer .panel-body {
366 | text-align: center;
367 | color: #666;
368 | font-size: 1.4em;
369 | }
370 |
371 | #footer #hoteldescription {
372 | border: none;
373 | background: #eee;
374 | border-radius: 0px;
375 | }
376 |
377 | .about #footer {
378 | margin-top: 500px;
379 | }
380 |
381 | #hotelDescription select { color: #333; }
382 |
--------------------------------------------------------------------------------
/DJangoHotel/static/js/bootstrap.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.2.0 (http://getbootstrap.com)
3 | * Copyright 2011-2014 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 |
7 | if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
8 |
9 | /* ========================================================================
10 | * Bootstrap: transition.js v3.2.0
11 | * http://getbootstrap.com/javascript/#transitions
12 | * ========================================================================
13 | * Copyright 2011-2014 Twitter, Inc.
14 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15 | * ======================================================================== */
16 |
17 |
18 | +function ($) {
19 | 'use strict';
20 |
21 | // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
22 | // ============================================================
23 |
24 | function transitionEnd() {
25 | var el = document.createElement('bootstrap')
26 |
27 | var transEndEventNames = {
28 | WebkitTransition : 'webkitTransitionEnd',
29 | MozTransition : 'transitionend',
30 | OTransition : 'oTransitionEnd otransitionend',
31 | transition : 'transitionend'
32 | }
33 |
34 | for (var name in transEndEventNames) {
35 | if (el.style[name] !== undefined) {
36 | return { end: transEndEventNames[name] }
37 | }
38 | }
39 |
40 | return false // explicit for ie8 ( ._.)
41 | }
42 |
43 | // http://blog.alexmaccaw.com/css-transitions
44 | $.fn.emulateTransitionEnd = function (duration) {
45 | var called = false
46 | var $el = this
47 | $(this).one('bsTransitionEnd', function () { called = true })
48 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
49 | setTimeout(callback, duration)
50 | return this
51 | }
52 |
53 | $(function () {
54 | $.support.transition = transitionEnd()
55 |
56 | if (!$.support.transition) return
57 |
58 | $.event.special.bsTransitionEnd = {
59 | bindType: $.support.transition.end,
60 | delegateType: $.support.transition.end,
61 | handle: function (e) {
62 | if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
63 | }
64 | }
65 | })
66 |
67 | }(jQuery);
68 |
69 | /* ========================================================================
70 | * Bootstrap: alert.js v3.2.0
71 | * http://getbootstrap.com/javascript/#alerts
72 | * ========================================================================
73 | * Copyright 2011-2014 Twitter, Inc.
74 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
75 | * ======================================================================== */
76 |
77 |
78 | +function ($) {
79 | 'use strict';
80 |
81 | // ALERT CLASS DEFINITION
82 | // ======================
83 |
84 | var dismiss = '[data-dismiss="alert"]'
85 | var Alert = function (el) {
86 | $(el).on('click', dismiss, this.close)
87 | }
88 |
89 | Alert.VERSION = '3.2.0'
90 |
91 | Alert.prototype.close = function (e) {
92 | var $this = $(this)
93 | var selector = $this.attr('data-target')
94 |
95 | if (!selector) {
96 | selector = $this.attr('href')
97 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
98 | }
99 |
100 | var $parent = $(selector)
101 |
102 | if (e) e.preventDefault()
103 |
104 | if (!$parent.length) {
105 | $parent = $this.hasClass('alert') ? $this : $this.parent()
106 | }
107 |
108 | $parent.trigger(e = $.Event('close.bs.alert'))
109 |
110 | if (e.isDefaultPrevented()) return
111 |
112 | $parent.removeClass('in')
113 |
114 | function removeElement() {
115 | // detach from parent, fire event then clean up data
116 | $parent.detach().trigger('closed.bs.alert').remove()
117 | }
118 |
119 | $.support.transition && $parent.hasClass('fade') ?
120 | $parent
121 | .one('bsTransitionEnd', removeElement)
122 | .emulateTransitionEnd(150) :
123 | removeElement()
124 | }
125 |
126 |
127 | // ALERT PLUGIN DEFINITION
128 | // =======================
129 |
130 | function Plugin(option) {
131 | return this.each(function () {
132 | var $this = $(this)
133 | var data = $this.data('bs.alert')
134 |
135 | if (!data) $this.data('bs.alert', (data = new Alert(this)))
136 | if (typeof option == 'string') data[option].call($this)
137 | })
138 | }
139 |
140 | var old = $.fn.alert
141 |
142 | $.fn.alert = Plugin
143 | $.fn.alert.Constructor = Alert
144 |
145 |
146 | // ALERT NO CONFLICT
147 | // =================
148 |
149 | $.fn.alert.noConflict = function () {
150 | $.fn.alert = old
151 | return this
152 | }
153 |
154 |
155 | // ALERT DATA-API
156 | // ==============
157 |
158 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
159 |
160 | }(jQuery);
161 |
162 | /* ========================================================================
163 | * Bootstrap: button.js v3.2.0
164 | * http://getbootstrap.com/javascript/#buttons
165 | * ========================================================================
166 | * Copyright 2011-2014 Twitter, Inc.
167 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
168 | * ======================================================================== */
169 |
170 |
171 | +function ($) {
172 | 'use strict';
173 |
174 | // BUTTON PUBLIC CLASS DEFINITION
175 | // ==============================
176 |
177 | var Button = function (element, options) {
178 | this.$element = $(element)
179 | this.options = $.extend({}, Button.DEFAULTS, options)
180 | this.isLoading = false
181 | }
182 |
183 | Button.VERSION = '3.2.0'
184 |
185 | Button.DEFAULTS = {
186 | loadingText: 'loading...'
187 | }
188 |
189 | Button.prototype.setState = function (state) {
190 | var d = 'disabled'
191 | var $el = this.$element
192 | var val = $el.is('input') ? 'val' : 'html'
193 | var data = $el.data()
194 |
195 | state = state + 'Text'
196 |
197 | if (data.resetText == null) $el.data('resetText', $el[val]())
198 |
199 | $el[val](data[state] == null ? this.options[state] : data[state])
200 |
201 | // push to event loop to allow forms to submit
202 | setTimeout($.proxy(function () {
203 | if (state == 'loadingText') {
204 | this.isLoading = true
205 | $el.addClass(d).attr(d, d)
206 | } else if (this.isLoading) {
207 | this.isLoading = false
208 | $el.removeClass(d).removeAttr(d)
209 | }
210 | }, this), 0)
211 | }
212 |
213 | Button.prototype.toggle = function () {
214 | var changed = true
215 | var $parent = this.$element.closest('[data-toggle="buttons"]')
216 |
217 | if ($parent.length) {
218 | var $input = this.$element.find('input')
219 | if ($input.prop('type') == 'radio') {
220 | if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
221 | else $parent.find('.active').removeClass('active')
222 | }
223 | if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
224 | }
225 |
226 | if (changed) this.$element.toggleClass('active')
227 | }
228 |
229 |
230 | // BUTTON PLUGIN DEFINITION
231 | // ========================
232 |
233 | function Plugin(option) {
234 | return this.each(function () {
235 | var $this = $(this)
236 | var data = $this.data('bs.button')
237 | var options = typeof option == 'object' && option
238 |
239 | if (!data) $this.data('bs.button', (data = new Button(this, options)))
240 |
241 | if (option == 'toggle') data.toggle()
242 | else if (option) data.setState(option)
243 | })
244 | }
245 |
246 | var old = $.fn.button
247 |
248 | $.fn.button = Plugin
249 | $.fn.button.Constructor = Button
250 |
251 |
252 | // BUTTON NO CONFLICT
253 | // ==================
254 |
255 | $.fn.button.noConflict = function () {
256 | $.fn.button = old
257 | return this
258 | }
259 |
260 |
261 | // BUTTON DATA-API
262 | // ===============
263 |
264 | $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
265 | var $btn = $(e.target)
266 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
267 | Plugin.call($btn, 'toggle')
268 | e.preventDefault()
269 | })
270 |
271 | }(jQuery);
272 |
273 | /* ========================================================================
274 | * Bootstrap: carousel.js v3.2.0
275 | * http://getbootstrap.com/javascript/#carousel
276 | * ========================================================================
277 | * Copyright 2011-2014 Twitter, Inc.
278 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
279 | * ======================================================================== */
280 |
281 |
282 | +function ($) {
283 | 'use strict';
284 |
285 | // CAROUSEL CLASS DEFINITION
286 | // =========================
287 |
288 | var Carousel = function (element, options) {
289 | this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
290 | this.$indicators = this.$element.find('.carousel-indicators')
291 | this.options = options
292 | this.paused =
293 | this.sliding =
294 | this.interval =
295 | this.$active =
296 | this.$items = null
297 |
298 | this.options.pause == 'hover' && this.$element
299 | .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
300 | .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
301 | }
302 |
303 | Carousel.VERSION = '3.2.0'
304 |
305 | Carousel.DEFAULTS = {
306 | interval: 5000,
307 | pause: 'hover',
308 | wrap: true
309 | }
310 |
311 | Carousel.prototype.keydown = function (e) {
312 | switch (e.which) {
313 | case 37: this.prev(); break
314 | case 39: this.next(); break
315 | default: return
316 | }
317 |
318 | e.preventDefault()
319 | }
320 |
321 | Carousel.prototype.cycle = function (e) {
322 | e || (this.paused = false)
323 |
324 | this.interval && clearInterval(this.interval)
325 |
326 | this.options.interval
327 | && !this.paused
328 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
329 |
330 | return this
331 | }
332 |
333 | Carousel.prototype.getItemIndex = function (item) {
334 | this.$items = item.parent().children('.item')
335 | return this.$items.index(item || this.$active)
336 | }
337 |
338 | Carousel.prototype.to = function (pos) {
339 | var that = this
340 | var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
341 |
342 | if (pos > (this.$items.length - 1) || pos < 0) return
343 |
344 | if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
345 | if (activeIndex == pos) return this.pause().cycle()
346 |
347 | return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
348 | }
349 |
350 | Carousel.prototype.pause = function (e) {
351 | e || (this.paused = true)
352 |
353 | if (this.$element.find('.next, .prev').length && $.support.transition) {
354 | this.$element.trigger($.support.transition.end)
355 | this.cycle(true)
356 | }
357 |
358 | this.interval = clearInterval(this.interval)
359 |
360 | return this
361 | }
362 |
363 | Carousel.prototype.next = function () {
364 | if (this.sliding) return
365 | return this.slide('next')
366 | }
367 |
368 | Carousel.prototype.prev = function () {
369 | if (this.sliding) return
370 | return this.slide('prev')
371 | }
372 |
373 | Carousel.prototype.slide = function (type, next) {
374 | var $active = this.$element.find('.item.active')
375 | var $next = next || $active[type]()
376 | var isCycling = this.interval
377 | var direction = type == 'next' ? 'left' : 'right'
378 | var fallback = type == 'next' ? 'first' : 'last'
379 | var that = this
380 |
381 | if (!$next.length) {
382 | if (!this.options.wrap) return
383 | $next = this.$element.find('.item')[fallback]()
384 | }
385 |
386 | if ($next.hasClass('active')) return (this.sliding = false)
387 |
388 | var relatedTarget = $next[0]
389 | var slideEvent = $.Event('slide.bs.carousel', {
390 | relatedTarget: relatedTarget,
391 | direction: direction
392 | })
393 | this.$element.trigger(slideEvent)
394 | if (slideEvent.isDefaultPrevented()) return
395 |
396 | this.sliding = true
397 |
398 | isCycling && this.pause()
399 |
400 | if (this.$indicators.length) {
401 | this.$indicators.find('.active').removeClass('active')
402 | var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
403 | $nextIndicator && $nextIndicator.addClass('active')
404 | }
405 |
406 | var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
407 | if ($.support.transition && this.$element.hasClass('slide')) {
408 | $next.addClass(type)
409 | $next[0].offsetWidth // force reflow
410 | $active.addClass(direction)
411 | $next.addClass(direction)
412 | $active
413 | .one('bsTransitionEnd', function () {
414 | $next.removeClass([type, direction].join(' ')).addClass('active')
415 | $active.removeClass(['active', direction].join(' '))
416 | that.sliding = false
417 | setTimeout(function () {
418 | that.$element.trigger(slidEvent)
419 | }, 0)
420 | })
421 | .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
422 | } else {
423 | $active.removeClass('active')
424 | $next.addClass('active')
425 | this.sliding = false
426 | this.$element.trigger(slidEvent)
427 | }
428 |
429 | isCycling && this.cycle()
430 |
431 | return this
432 | }
433 |
434 |
435 | // CAROUSEL PLUGIN DEFINITION
436 | // ==========================
437 |
438 | function Plugin(option) {
439 | return this.each(function () {
440 | var $this = $(this)
441 | var data = $this.data('bs.carousel')
442 | var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
443 | var action = typeof option == 'string' ? option : options.slide
444 |
445 | if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
446 | if (typeof option == 'number') data.to(option)
447 | else if (action) data[action]()
448 | else if (options.interval) data.pause().cycle()
449 | })
450 | }
451 |
452 | var old = $.fn.carousel
453 |
454 | $.fn.carousel = Plugin
455 | $.fn.carousel.Constructor = Carousel
456 |
457 |
458 | // CAROUSEL NO CONFLICT
459 | // ====================
460 |
461 | $.fn.carousel.noConflict = function () {
462 | $.fn.carousel = old
463 | return this
464 | }
465 |
466 |
467 | // CAROUSEL DATA-API
468 | // =================
469 |
470 | $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
471 | var href
472 | var $this = $(this)
473 | var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
474 | if (!$target.hasClass('carousel')) return
475 | var options = $.extend({}, $target.data(), $this.data())
476 | var slideIndex = $this.attr('data-slide-to')
477 | if (slideIndex) options.interval = false
478 |
479 | Plugin.call($target, options)
480 |
481 | if (slideIndex) {
482 | $target.data('bs.carousel').to(slideIndex)
483 | }
484 |
485 | e.preventDefault()
486 | })
487 |
488 | $(window).on('load', function () {
489 | $('[data-ride="carousel"]').each(function () {
490 | var $carousel = $(this)
491 | Plugin.call($carousel, $carousel.data())
492 | })
493 | })
494 |
495 | }(jQuery);
496 |
497 | /* ========================================================================
498 | * Bootstrap: collapse.js v3.2.0
499 | * http://getbootstrap.com/javascript/#collapse
500 | * ========================================================================
501 | * Copyright 2011-2014 Twitter, Inc.
502 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
503 | * ======================================================================== */
504 |
505 |
506 | +function ($) {
507 | 'use strict';
508 |
509 | // COLLAPSE PUBLIC CLASS DEFINITION
510 | // ================================
511 |
512 | var Collapse = function (element, options) {
513 | this.$element = $(element)
514 | this.options = $.extend({}, Collapse.DEFAULTS, options)
515 | this.transitioning = null
516 |
517 | if (this.options.parent) this.$parent = $(this.options.parent)
518 | if (this.options.toggle) this.toggle()
519 | }
520 |
521 | Collapse.VERSION = '3.2.0'
522 |
523 | Collapse.DEFAULTS = {
524 | toggle: true
525 | }
526 |
527 | Collapse.prototype.dimension = function () {
528 | var hasWidth = this.$element.hasClass('width')
529 | return hasWidth ? 'width' : 'height'
530 | }
531 |
532 | Collapse.prototype.show = function () {
533 | if (this.transitioning || this.$element.hasClass('in')) return
534 |
535 | var startEvent = $.Event('show.bs.collapse')
536 | this.$element.trigger(startEvent)
537 | if (startEvent.isDefaultPrevented()) return
538 |
539 | var actives = this.$parent && this.$parent.find('> .panel > .in')
540 |
541 | if (actives && actives.length) {
542 | var hasData = actives.data('bs.collapse')
543 | if (hasData && hasData.transitioning) return
544 | Plugin.call(actives, 'hide')
545 | hasData || actives.data('bs.collapse', null)
546 | }
547 |
548 | var dimension = this.dimension()
549 |
550 | this.$element
551 | .removeClass('collapse')
552 | .addClass('collapsing')[dimension](0)
553 |
554 | this.transitioning = 1
555 |
556 | var complete = function () {
557 | this.$element
558 | .removeClass('collapsing')
559 | .addClass('collapse in')[dimension]('')
560 | this.transitioning = 0
561 | this.$element
562 | .trigger('shown.bs.collapse')
563 | }
564 |
565 | if (!$.support.transition) return complete.call(this)
566 |
567 | var scrollSize = $.camelCase(['scroll', dimension].join('-'))
568 |
569 | this.$element
570 | .one('bsTransitionEnd', $.proxy(complete, this))
571 | .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
572 | }
573 |
574 | Collapse.prototype.hide = function () {
575 | if (this.transitioning || !this.$element.hasClass('in')) return
576 |
577 | var startEvent = $.Event('hide.bs.collapse')
578 | this.$element.trigger(startEvent)
579 | if (startEvent.isDefaultPrevented()) return
580 |
581 | var dimension = this.dimension()
582 |
583 | this.$element[dimension](this.$element[dimension]())[0].offsetHeight
584 |
585 | this.$element
586 | .addClass('collapsing')
587 | .removeClass('collapse')
588 | .removeClass('in')
589 |
590 | this.transitioning = 1
591 |
592 | var complete = function () {
593 | this.transitioning = 0
594 | this.$element
595 | .trigger('hidden.bs.collapse')
596 | .removeClass('collapsing')
597 | .addClass('collapse')
598 | }
599 |
600 | if (!$.support.transition) return complete.call(this)
601 |
602 | this.$element
603 | [dimension](0)
604 | .one('bsTransitionEnd', $.proxy(complete, this))
605 | .emulateTransitionEnd(350)
606 | }
607 |
608 | Collapse.prototype.toggle = function () {
609 | this[this.$element.hasClass('in') ? 'hide' : 'show']()
610 | }
611 |
612 |
613 | // COLLAPSE PLUGIN DEFINITION
614 | // ==========================
615 |
616 | function Plugin(option) {
617 | return this.each(function () {
618 | var $this = $(this)
619 | var data = $this.data('bs.collapse')
620 | var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
621 |
622 | if (!data && options.toggle && option == 'show') option = !option
623 | if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
624 | if (typeof option == 'string') data[option]()
625 | })
626 | }
627 |
628 | var old = $.fn.collapse
629 |
630 | $.fn.collapse = Plugin
631 | $.fn.collapse.Constructor = Collapse
632 |
633 |
634 | // COLLAPSE NO CONFLICT
635 | // ====================
636 |
637 | $.fn.collapse.noConflict = function () {
638 | $.fn.collapse = old
639 | return this
640 | }
641 |
642 |
643 | // COLLAPSE DATA-API
644 | // =================
645 |
646 | $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
647 | var href
648 | var $this = $(this)
649 | var target = $this.attr('data-target')
650 | || e.preventDefault()
651 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
652 | var $target = $(target)
653 | var data = $target.data('bs.collapse')
654 | var option = data ? 'toggle' : $this.data()
655 | var parent = $this.attr('data-parent')
656 | var $parent = parent && $(parent)
657 |
658 | if (!data || !data.transitioning) {
659 | if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
660 | $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
661 | }
662 |
663 | Plugin.call($target, option)
664 | })
665 |
666 | }(jQuery);
667 |
668 | /* ========================================================================
669 | * Bootstrap: dropdown.js v3.2.0
670 | * http://getbootstrap.com/javascript/#dropdowns
671 | * ========================================================================
672 | * Copyright 2011-2014 Twitter, Inc.
673 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
674 | * ======================================================================== */
675 |
676 |
677 | +function ($) {
678 | 'use strict';
679 |
680 | // DROPDOWN CLASS DEFINITION
681 | // =========================
682 |
683 | var backdrop = '.dropdown-backdrop'
684 | var toggle = '[data-toggle="dropdown"]'
685 | var Dropdown = function (element) {
686 | $(element).on('click.bs.dropdown', this.toggle)
687 | }
688 |
689 | Dropdown.VERSION = '3.2.0'
690 |
691 | Dropdown.prototype.toggle = function (e) {
692 | var $this = $(this)
693 |
694 | if ($this.is('.disabled, :disabled')) return
695 |
696 | var $parent = getParent($this)
697 | var isActive = $parent.hasClass('open')
698 |
699 | clearMenus()
700 |
701 | if (!isActive) {
702 | if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
703 | // if mobile we use a backdrop because click events don't delegate
704 | $('').insertAfter($(this)).on('click', clearMenus)
705 | }
706 |
707 | var relatedTarget = { relatedTarget: this }
708 | $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
709 |
710 | if (e.isDefaultPrevented()) return
711 |
712 | $this.trigger('focus')
713 |
714 | $parent
715 | .toggleClass('open')
716 | .trigger('shown.bs.dropdown', relatedTarget)
717 | }
718 |
719 | return false
720 | }
721 |
722 | Dropdown.prototype.keydown = function (e) {
723 | if (!/(38|40|27)/.test(e.keyCode)) return
724 |
725 | var $this = $(this)
726 |
727 | e.preventDefault()
728 | e.stopPropagation()
729 |
730 | if ($this.is('.disabled, :disabled')) return
731 |
732 | var $parent = getParent($this)
733 | var isActive = $parent.hasClass('open')
734 |
735 | if (!isActive || (isActive && e.keyCode == 27)) {
736 | if (e.which == 27) $parent.find(toggle).trigger('focus')
737 | return $this.trigger('click')
738 | }
739 |
740 | var desc = ' li:not(.divider):visible a'
741 | var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
742 |
743 | if (!$items.length) return
744 |
745 | var index = $items.index($items.filter(':focus'))
746 |
747 | if (e.keyCode == 38 && index > 0) index-- // up
748 | if (e.keyCode == 40 && index < $items.length - 1) index++ // down
749 | if (!~index) index = 0
750 |
751 | $items.eq(index).trigger('focus')
752 | }
753 |
754 | function clearMenus(e) {
755 | if (e && e.which === 3) return
756 | $(backdrop).remove()
757 | $(toggle).each(function () {
758 | var $parent = getParent($(this))
759 | var relatedTarget = { relatedTarget: this }
760 | if (!$parent.hasClass('open')) return
761 | $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
762 | if (e.isDefaultPrevented()) return
763 | $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
764 | })
765 | }
766 |
767 | function getParent($this) {
768 | var selector = $this.attr('data-target')
769 |
770 | if (!selector) {
771 | selector = $this.attr('href')
772 | selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
773 | }
774 |
775 | var $parent = selector && $(selector)
776 |
777 | return $parent && $parent.length ? $parent : $this.parent()
778 | }
779 |
780 |
781 | // DROPDOWN PLUGIN DEFINITION
782 | // ==========================
783 |
784 | function Plugin(option) {
785 | return this.each(function () {
786 | var $this = $(this)
787 | var data = $this.data('bs.dropdown')
788 |
789 | if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
790 | if (typeof option == 'string') data[option].call($this)
791 | })
792 | }
793 |
794 | var old = $.fn.dropdown
795 |
796 | $.fn.dropdown = Plugin
797 | $.fn.dropdown.Constructor = Dropdown
798 |
799 |
800 | // DROPDOWN NO CONFLICT
801 | // ====================
802 |
803 | $.fn.dropdown.noConflict = function () {
804 | $.fn.dropdown = old
805 | return this
806 | }
807 |
808 |
809 | // APPLY TO STANDARD DROPDOWN ELEMENTS
810 | // ===================================
811 |
812 | $(document)
813 | .on('click.bs.dropdown.data-api', clearMenus)
814 | .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
815 | .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
816 | .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
817 |
818 | }(jQuery);
819 |
820 | /* ========================================================================
821 | * Bootstrap: modal.js v3.2.0
822 | * http://getbootstrap.com/javascript/#modals
823 | * ========================================================================
824 | * Copyright 2011-2014 Twitter, Inc.
825 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
826 | * ======================================================================== */
827 |
828 |
829 | +function ($) {
830 | 'use strict';
831 |
832 | // MODAL CLASS DEFINITION
833 | // ======================
834 |
835 | var Modal = function (element, options) {
836 | this.options = options
837 | this.$body = $(document.body)
838 | this.$element = $(element)
839 | this.$backdrop =
840 | this.isShown = null
841 | this.scrollbarWidth = 0
842 |
843 | if (this.options.remote) {
844 | this.$element
845 | .find('.modal-content')
846 | .load(this.options.remote, $.proxy(function () {
847 | this.$element.trigger('loaded.bs.modal')
848 | }, this))
849 | }
850 | }
851 |
852 | Modal.VERSION = '3.2.0'
853 |
854 | Modal.DEFAULTS = {
855 | backdrop: true,
856 | keyboard: true,
857 | show: true
858 | }
859 |
860 | Modal.prototype.toggle = function (_relatedTarget) {
861 | return this.isShown ? this.hide() : this.show(_relatedTarget)
862 | }
863 |
864 | Modal.prototype.show = function (_relatedTarget) {
865 | var that = this
866 | var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
867 |
868 | this.$element.trigger(e)
869 |
870 | if (this.isShown || e.isDefaultPrevented()) return
871 |
872 | this.isShown = true
873 |
874 | this.checkScrollbar()
875 | this.$body.addClass('modal-open')
876 |
877 | this.setScrollbar()
878 | this.escape()
879 |
880 | this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
881 |
882 | this.backdrop(function () {
883 | var transition = $.support.transition && that.$element.hasClass('fade')
884 |
885 | if (!that.$element.parent().length) {
886 | that.$element.appendTo(that.$body) // don't move modals dom position
887 | }
888 |
889 | that.$element
890 | .show()
891 | .scrollTop(0)
892 |
893 | if (transition) {
894 | that.$element[0].offsetWidth // force reflow
895 | }
896 |
897 | that.$element
898 | .addClass('in')
899 | .attr('aria-hidden', false)
900 |
901 | that.enforceFocus()
902 |
903 | var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
904 |
905 | transition ?
906 | that.$element.find('.modal-dialog') // wait for modal to slide in
907 | .one('bsTransitionEnd', function () {
908 | that.$element.trigger('focus').trigger(e)
909 | })
910 | .emulateTransitionEnd(300) :
911 | that.$element.trigger('focus').trigger(e)
912 | })
913 | }
914 |
915 | Modal.prototype.hide = function (e) {
916 | if (e) e.preventDefault()
917 |
918 | e = $.Event('hide.bs.modal')
919 |
920 | this.$element.trigger(e)
921 |
922 | if (!this.isShown || e.isDefaultPrevented()) return
923 |
924 | this.isShown = false
925 |
926 | this.$body.removeClass('modal-open')
927 |
928 | this.resetScrollbar()
929 | this.escape()
930 |
931 | $(document).off('focusin.bs.modal')
932 |
933 | this.$element
934 | .removeClass('in')
935 | .attr('aria-hidden', true)
936 | .off('click.dismiss.bs.modal')
937 |
938 | $.support.transition && this.$element.hasClass('fade') ?
939 | this.$element
940 | .one('bsTransitionEnd', $.proxy(this.hideModal, this))
941 | .emulateTransitionEnd(300) :
942 | this.hideModal()
943 | }
944 |
945 | Modal.prototype.enforceFocus = function () {
946 | $(document)
947 | .off('focusin.bs.modal') // guard against infinite focus loop
948 | .on('focusin.bs.modal', $.proxy(function (e) {
949 | if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
950 | this.$element.trigger('focus')
951 | }
952 | }, this))
953 | }
954 |
955 | Modal.prototype.escape = function () {
956 | if (this.isShown && this.options.keyboard) {
957 | this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
958 | e.which == 27 && this.hide()
959 | }, this))
960 | } else if (!this.isShown) {
961 | this.$element.off('keyup.dismiss.bs.modal')
962 | }
963 | }
964 |
965 | Modal.prototype.hideModal = function () {
966 | var that = this
967 | this.$element.hide()
968 | this.backdrop(function () {
969 | that.$element.trigger('hidden.bs.modal')
970 | })
971 | }
972 |
973 | Modal.prototype.removeBackdrop = function () {
974 | this.$backdrop && this.$backdrop.remove()
975 | this.$backdrop = null
976 | }
977 |
978 | Modal.prototype.backdrop = function (callback) {
979 | var that = this
980 | var animate = this.$element.hasClass('fade') ? 'fade' : ''
981 |
982 | if (this.isShown && this.options.backdrop) {
983 | var doAnimate = $.support.transition && animate
984 |
985 | this.$backdrop = $('')
986 | .appendTo(this.$body)
987 |
988 | this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
989 | if (e.target !== e.currentTarget) return
990 | this.options.backdrop == 'static'
991 | ? this.$element[0].focus.call(this.$element[0])
992 | : this.hide.call(this)
993 | }, this))
994 |
995 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
996 |
997 | this.$backdrop.addClass('in')
998 |
999 | if (!callback) return
1000 |
1001 | doAnimate ?
1002 | this.$backdrop
1003 | .one('bsTransitionEnd', callback)
1004 | .emulateTransitionEnd(150) :
1005 | callback()
1006 |
1007 | } else if (!this.isShown && this.$backdrop) {
1008 | this.$backdrop.removeClass('in')
1009 |
1010 | var callbackRemove = function () {
1011 | that.removeBackdrop()
1012 | callback && callback()
1013 | }
1014 | $.support.transition && this.$element.hasClass('fade') ?
1015 | this.$backdrop
1016 | .one('bsTransitionEnd', callbackRemove)
1017 | .emulateTransitionEnd(150) :
1018 | callbackRemove()
1019 |
1020 | } else if (callback) {
1021 | callback()
1022 | }
1023 | }
1024 |
1025 | Modal.prototype.checkScrollbar = function () {
1026 | if (document.body.clientWidth >= window.innerWidth) return
1027 | this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
1028 | }
1029 |
1030 | Modal.prototype.setScrollbar = function () {
1031 | var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
1032 | if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
1033 | }
1034 |
1035 | Modal.prototype.resetScrollbar = function () {
1036 | this.$body.css('padding-right', '')
1037 | }
1038 |
1039 | Modal.prototype.measureScrollbar = function () { // thx walsh
1040 | var scrollDiv = document.createElement('div')
1041 | scrollDiv.className = 'modal-scrollbar-measure'
1042 | this.$body.append(scrollDiv)
1043 | var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
1044 | this.$body[0].removeChild(scrollDiv)
1045 | return scrollbarWidth
1046 | }
1047 |
1048 |
1049 | // MODAL PLUGIN DEFINITION
1050 | // =======================
1051 |
1052 | function Plugin(option, _relatedTarget) {
1053 | return this.each(function () {
1054 | var $this = $(this)
1055 | var data = $this.data('bs.modal')
1056 | var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
1057 |
1058 | if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
1059 | if (typeof option == 'string') data[option](_relatedTarget)
1060 | else if (options.show) data.show(_relatedTarget)
1061 | })
1062 | }
1063 |
1064 | var old = $.fn.modal
1065 |
1066 | $.fn.modal = Plugin
1067 | $.fn.modal.Constructor = Modal
1068 |
1069 |
1070 | // MODAL NO CONFLICT
1071 | // =================
1072 |
1073 | $.fn.modal.noConflict = function () {
1074 | $.fn.modal = old
1075 | return this
1076 | }
1077 |
1078 |
1079 | // MODAL DATA-API
1080 | // ==============
1081 |
1082 | $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1083 | var $this = $(this)
1084 | var href = $this.attr('href')
1085 | var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
1086 | var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1087 |
1088 | if ($this.is('a')) e.preventDefault()
1089 |
1090 | $target.one('show.bs.modal', function (showEvent) {
1091 | if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
1092 | $target.one('hidden.bs.modal', function () {
1093 | $this.is(':visible') && $this.trigger('focus')
1094 | })
1095 | })
1096 | Plugin.call($target, option, this)
1097 | })
1098 |
1099 | }(jQuery);
1100 |
1101 | /* ========================================================================
1102 | * Bootstrap: tooltip.js v3.2.0
1103 | * http://getbootstrap.com/javascript/#tooltip
1104 | * Inspired by the original jQuery.tipsy by Jason Frame
1105 | * ========================================================================
1106 | * Copyright 2011-2014 Twitter, Inc.
1107 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1108 | * ======================================================================== */
1109 |
1110 |
1111 | +function ($) {
1112 | 'use strict';
1113 |
1114 | // TOOLTIP PUBLIC CLASS DEFINITION
1115 | // ===============================
1116 |
1117 | var Tooltip = function (element, options) {
1118 | this.type =
1119 | this.options =
1120 | this.enabled =
1121 | this.timeout =
1122 | this.hoverState =
1123 | this.$element = null
1124 |
1125 | this.init('tooltip', element, options)
1126 | }
1127 |
1128 | Tooltip.VERSION = '3.2.0'
1129 |
1130 | Tooltip.DEFAULTS = {
1131 | animation: true,
1132 | placement: 'top',
1133 | selector: false,
1134 | template: '',
1135 | trigger: 'hover focus',
1136 | title: '',
1137 | delay: 0,
1138 | html: false,
1139 | container: false,
1140 | viewport: {
1141 | selector: 'body',
1142 | padding: 0
1143 | }
1144 | }
1145 |
1146 | Tooltip.prototype.init = function (type, element, options) {
1147 | this.enabled = true
1148 | this.type = type
1149 | this.$element = $(element)
1150 | this.options = this.getOptions(options)
1151 | this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
1152 |
1153 | var triggers = this.options.trigger.split(' ')
1154 |
1155 | for (var i = triggers.length; i--;) {
1156 | var trigger = triggers[i]
1157 |
1158 | if (trigger == 'click') {
1159 | this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1160 | } else if (trigger != 'manual') {
1161 | var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
1162 | var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1163 |
1164 | this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1165 | this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1166 | }
1167 | }
1168 |
1169 | this.options.selector ?
1170 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1171 | this.fixTitle()
1172 | }
1173 |
1174 | Tooltip.prototype.getDefaults = function () {
1175 | return Tooltip.DEFAULTS
1176 | }
1177 |
1178 | Tooltip.prototype.getOptions = function (options) {
1179 | options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1180 |
1181 | if (options.delay && typeof options.delay == 'number') {
1182 | options.delay = {
1183 | show: options.delay,
1184 | hide: options.delay
1185 | }
1186 | }
1187 |
1188 | return options
1189 | }
1190 |
1191 | Tooltip.prototype.getDelegateOptions = function () {
1192 | var options = {}
1193 | var defaults = this.getDefaults()
1194 |
1195 | this._options && $.each(this._options, function (key, value) {
1196 | if (defaults[key] != value) options[key] = value
1197 | })
1198 |
1199 | return options
1200 | }
1201 |
1202 | Tooltip.prototype.enter = function (obj) {
1203 | var self = obj instanceof this.constructor ?
1204 | obj : $(obj.currentTarget).data('bs.' + this.type)
1205 |
1206 | if (!self) {
1207 | self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1208 | $(obj.currentTarget).data('bs.' + this.type, self)
1209 | }
1210 |
1211 | clearTimeout(self.timeout)
1212 |
1213 | self.hoverState = 'in'
1214 |
1215 | if (!self.options.delay || !self.options.delay.show) return self.show()
1216 |
1217 | self.timeout = setTimeout(function () {
1218 | if (self.hoverState == 'in') self.show()
1219 | }, self.options.delay.show)
1220 | }
1221 |
1222 | Tooltip.prototype.leave = function (obj) {
1223 | var self = obj instanceof this.constructor ?
1224 | obj : $(obj.currentTarget).data('bs.' + this.type)
1225 |
1226 | if (!self) {
1227 | self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1228 | $(obj.currentTarget).data('bs.' + this.type, self)
1229 | }
1230 |
1231 | clearTimeout(self.timeout)
1232 |
1233 | self.hoverState = 'out'
1234 |
1235 | if (!self.options.delay || !self.options.delay.hide) return self.hide()
1236 |
1237 | self.timeout = setTimeout(function () {
1238 | if (self.hoverState == 'out') self.hide()
1239 | }, self.options.delay.hide)
1240 | }
1241 |
1242 | Tooltip.prototype.show = function () {
1243 | var e = $.Event('show.bs.' + this.type)
1244 |
1245 | if (this.hasContent() && this.enabled) {
1246 | this.$element.trigger(e)
1247 |
1248 | var inDom = $.contains(document.documentElement, this.$element[0])
1249 | if (e.isDefaultPrevented() || !inDom) return
1250 | var that = this
1251 |
1252 | var $tip = this.tip()
1253 |
1254 | var tipId = this.getUID(this.type)
1255 |
1256 | this.setContent()
1257 | $tip.attr('id', tipId)
1258 | this.$element.attr('aria-describedby', tipId)
1259 |
1260 | if (this.options.animation) $tip.addClass('fade')
1261 |
1262 | var placement = typeof this.options.placement == 'function' ?
1263 | this.options.placement.call(this, $tip[0], this.$element[0]) :
1264 | this.options.placement
1265 |
1266 | var autoToken = /\s?auto?\s?/i
1267 | var autoPlace = autoToken.test(placement)
1268 | if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1269 |
1270 | $tip
1271 | .detach()
1272 | .css({ top: 0, left: 0, display: 'block' })
1273 | .addClass(placement)
1274 | .data('bs.' + this.type, this)
1275 |
1276 | this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1277 |
1278 | var pos = this.getPosition()
1279 | var actualWidth = $tip[0].offsetWidth
1280 | var actualHeight = $tip[0].offsetHeight
1281 |
1282 | if (autoPlace) {
1283 | var orgPlacement = placement
1284 | var $parent = this.$element.parent()
1285 | var parentDim = this.getPosition($parent)
1286 |
1287 | placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
1288 | placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
1289 | placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
1290 | placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
1291 | placement
1292 |
1293 | $tip
1294 | .removeClass(orgPlacement)
1295 | .addClass(placement)
1296 | }
1297 |
1298 | var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1299 |
1300 | this.applyPlacement(calculatedOffset, placement)
1301 |
1302 | var complete = function () {
1303 | that.$element.trigger('shown.bs.' + that.type)
1304 | that.hoverState = null
1305 | }
1306 |
1307 | $.support.transition && this.$tip.hasClass('fade') ?
1308 | $tip
1309 | .one('bsTransitionEnd', complete)
1310 | .emulateTransitionEnd(150) :
1311 | complete()
1312 | }
1313 | }
1314 |
1315 | Tooltip.prototype.applyPlacement = function (offset, placement) {
1316 | var $tip = this.tip()
1317 | var width = $tip[0].offsetWidth
1318 | var height = $tip[0].offsetHeight
1319 |
1320 | // manually read margins because getBoundingClientRect includes difference
1321 | var marginTop = parseInt($tip.css('margin-top'), 10)
1322 | var marginLeft = parseInt($tip.css('margin-left'), 10)
1323 |
1324 | // we must check for NaN for ie 8/9
1325 | if (isNaN(marginTop)) marginTop = 0
1326 | if (isNaN(marginLeft)) marginLeft = 0
1327 |
1328 | offset.top = offset.top + marginTop
1329 | offset.left = offset.left + marginLeft
1330 |
1331 | // $.fn.offset doesn't round pixel values
1332 | // so we use setOffset directly with our own function B-0
1333 | $.offset.setOffset($tip[0], $.extend({
1334 | using: function (props) {
1335 | $tip.css({
1336 | top: Math.round(props.top),
1337 | left: Math.round(props.left)
1338 | })
1339 | }
1340 | }, offset), 0)
1341 |
1342 | $tip.addClass('in')
1343 |
1344 | // check to see if placing tip in new offset caused the tip to resize itself
1345 | var actualWidth = $tip[0].offsetWidth
1346 | var actualHeight = $tip[0].offsetHeight
1347 |
1348 | if (placement == 'top' && actualHeight != height) {
1349 | offset.top = offset.top + height - actualHeight
1350 | }
1351 |
1352 | var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
1353 |
1354 | if (delta.left) offset.left += delta.left
1355 | else offset.top += delta.top
1356 |
1357 | var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
1358 | var arrowPosition = delta.left ? 'left' : 'top'
1359 | var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
1360 |
1361 | $tip.offset(offset)
1362 | this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
1363 | }
1364 |
1365 | Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
1366 | this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
1367 | }
1368 |
1369 | Tooltip.prototype.setContent = function () {
1370 | var $tip = this.tip()
1371 | var title = this.getTitle()
1372 |
1373 | $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1374 | $tip.removeClass('fade in top bottom left right')
1375 | }
1376 |
1377 | Tooltip.prototype.hide = function () {
1378 | var that = this
1379 | var $tip = this.tip()
1380 | var e = $.Event('hide.bs.' + this.type)
1381 |
1382 | this.$element.removeAttr('aria-describedby')
1383 |
1384 | function complete() {
1385 | if (that.hoverState != 'in') $tip.detach()
1386 | that.$element.trigger('hidden.bs.' + that.type)
1387 | }
1388 |
1389 | this.$element.trigger(e)
1390 |
1391 | if (e.isDefaultPrevented()) return
1392 |
1393 | $tip.removeClass('in')
1394 |
1395 | $.support.transition && this.$tip.hasClass('fade') ?
1396 | $tip
1397 | .one('bsTransitionEnd', complete)
1398 | .emulateTransitionEnd(150) :
1399 | complete()
1400 |
1401 | this.hoverState = null
1402 |
1403 | return this
1404 | }
1405 |
1406 | Tooltip.prototype.fixTitle = function () {
1407 | var $e = this.$element
1408 | if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
1409 | $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1410 | }
1411 | }
1412 |
1413 | Tooltip.prototype.hasContent = function () {
1414 | return this.getTitle()
1415 | }
1416 |
1417 | Tooltip.prototype.getPosition = function ($element) {
1418 | $element = $element || this.$element
1419 | var el = $element[0]
1420 | var isBody = el.tagName == 'BODY'
1421 | return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
1422 | scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
1423 | width: isBody ? $(window).width() : $element.outerWidth(),
1424 | height: isBody ? $(window).height() : $element.outerHeight()
1425 | }, isBody ? { top: 0, left: 0 } : $element.offset())
1426 | }
1427 |
1428 | Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1429 | return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1430 | placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1431 | placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1432 | /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1433 |
1434 | }
1435 |
1436 | Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
1437 | var delta = { top: 0, left: 0 }
1438 | if (!this.$viewport) return delta
1439 |
1440 | var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
1441 | var viewportDimensions = this.getPosition(this.$viewport)
1442 |
1443 | if (/right|left/.test(placement)) {
1444 | var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
1445 | var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
1446 | if (topEdgeOffset < viewportDimensions.top) { // top overflow
1447 | delta.top = viewportDimensions.top - topEdgeOffset
1448 | } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
1449 | delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
1450 | }
1451 | } else {
1452 | var leftEdgeOffset = pos.left - viewportPadding
1453 | var rightEdgeOffset = pos.left + viewportPadding + actualWidth
1454 | if (leftEdgeOffset < viewportDimensions.left) { // left overflow
1455 | delta.left = viewportDimensions.left - leftEdgeOffset
1456 | } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
1457 | delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
1458 | }
1459 | }
1460 |
1461 | return delta
1462 | }
1463 |
1464 | Tooltip.prototype.getTitle = function () {
1465 | var title
1466 | var $e = this.$element
1467 | var o = this.options
1468 |
1469 | title = $e.attr('data-original-title')
1470 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1471 |
1472 | return title
1473 | }
1474 |
1475 | Tooltip.prototype.getUID = function (prefix) {
1476 | do prefix += ~~(Math.random() * 1000000)
1477 | while (document.getElementById(prefix))
1478 | return prefix
1479 | }
1480 |
1481 | Tooltip.prototype.tip = function () {
1482 | return (this.$tip = this.$tip || $(this.options.template))
1483 | }
1484 |
1485 | Tooltip.prototype.arrow = function () {
1486 | return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
1487 | }
1488 |
1489 | Tooltip.prototype.validate = function () {
1490 | if (!this.$element[0].parentNode) {
1491 | this.hide()
1492 | this.$element = null
1493 | this.options = null
1494 | }
1495 | }
1496 |
1497 | Tooltip.prototype.enable = function () {
1498 | this.enabled = true
1499 | }
1500 |
1501 | Tooltip.prototype.disable = function () {
1502 | this.enabled = false
1503 | }
1504 |
1505 | Tooltip.prototype.toggleEnabled = function () {
1506 | this.enabled = !this.enabled
1507 | }
1508 |
1509 | Tooltip.prototype.toggle = function (e) {
1510 | var self = this
1511 | if (e) {
1512 | self = $(e.currentTarget).data('bs.' + this.type)
1513 | if (!self) {
1514 | self = new this.constructor(e.currentTarget, this.getDelegateOptions())
1515 | $(e.currentTarget).data('bs.' + this.type, self)
1516 | }
1517 | }
1518 |
1519 | self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1520 | }
1521 |
1522 | Tooltip.prototype.destroy = function () {
1523 | clearTimeout(this.timeout)
1524 | this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1525 | }
1526 |
1527 |
1528 | // TOOLTIP PLUGIN DEFINITION
1529 | // =========================
1530 |
1531 | function Plugin(option) {
1532 | return this.each(function () {
1533 | var $this = $(this)
1534 | var data = $this.data('bs.tooltip')
1535 | var options = typeof option == 'object' && option
1536 |
1537 | if (!data && option == 'destroy') return
1538 | if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1539 | if (typeof option == 'string') data[option]()
1540 | })
1541 | }
1542 |
1543 | var old = $.fn.tooltip
1544 |
1545 | $.fn.tooltip = Plugin
1546 | $.fn.tooltip.Constructor = Tooltip
1547 |
1548 |
1549 | // TOOLTIP NO CONFLICT
1550 | // ===================
1551 |
1552 | $.fn.tooltip.noConflict = function () {
1553 | $.fn.tooltip = old
1554 | return this
1555 | }
1556 |
1557 | }(jQuery);
1558 |
1559 | /* ========================================================================
1560 | * Bootstrap: popover.js v3.2.0
1561 | * http://getbootstrap.com/javascript/#popovers
1562 | * ========================================================================
1563 | * Copyright 2011-2014 Twitter, Inc.
1564 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1565 | * ======================================================================== */
1566 |
1567 |
1568 | +function ($) {
1569 | 'use strict';
1570 |
1571 | // POPOVER PUBLIC CLASS DEFINITION
1572 | // ===============================
1573 |
1574 | var Popover = function (element, options) {
1575 | this.init('popover', element, options)
1576 | }
1577 |
1578 | if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1579 |
1580 | Popover.VERSION = '3.2.0'
1581 |
1582 | Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1583 | placement: 'right',
1584 | trigger: 'click',
1585 | content: '',
1586 | template: ''
1587 | })
1588 |
1589 |
1590 | // NOTE: POPOVER EXTENDS tooltip.js
1591 | // ================================
1592 |
1593 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1594 |
1595 | Popover.prototype.constructor = Popover
1596 |
1597 | Popover.prototype.getDefaults = function () {
1598 | return Popover.DEFAULTS
1599 | }
1600 |
1601 | Popover.prototype.setContent = function () {
1602 | var $tip = this.tip()
1603 | var title = this.getTitle()
1604 | var content = this.getContent()
1605 |
1606 | $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1607 | $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
1608 | this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1609 | ](content)
1610 |
1611 | $tip.removeClass('fade top bottom left right in')
1612 |
1613 | // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1614 | // this manually by checking the contents.
1615 | if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1616 | }
1617 |
1618 | Popover.prototype.hasContent = function () {
1619 | return this.getTitle() || this.getContent()
1620 | }
1621 |
1622 | Popover.prototype.getContent = function () {
1623 | var $e = this.$element
1624 | var o = this.options
1625 |
1626 | return $e.attr('data-content')
1627 | || (typeof o.content == 'function' ?
1628 | o.content.call($e[0]) :
1629 | o.content)
1630 | }
1631 |
1632 | Popover.prototype.arrow = function () {
1633 | return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
1634 | }
1635 |
1636 | Popover.prototype.tip = function () {
1637 | if (!this.$tip) this.$tip = $(this.options.template)
1638 | return this.$tip
1639 | }
1640 |
1641 |
1642 | // POPOVER PLUGIN DEFINITION
1643 | // =========================
1644 |
1645 | function Plugin(option) {
1646 | return this.each(function () {
1647 | var $this = $(this)
1648 | var data = $this.data('bs.popover')
1649 | var options = typeof option == 'object' && option
1650 |
1651 | if (!data && option == 'destroy') return
1652 | if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1653 | if (typeof option == 'string') data[option]()
1654 | })
1655 | }
1656 |
1657 | var old = $.fn.popover
1658 |
1659 | $.fn.popover = Plugin
1660 | $.fn.popover.Constructor = Popover
1661 |
1662 |
1663 | // POPOVER NO CONFLICT
1664 | // ===================
1665 |
1666 | $.fn.popover.noConflict = function () {
1667 | $.fn.popover = old
1668 | return this
1669 | }
1670 |
1671 | }(jQuery);
1672 |
1673 | /* ========================================================================
1674 | * Bootstrap: scrollspy.js v3.2.0
1675 | * http://getbootstrap.com/javascript/#scrollspy
1676 | * ========================================================================
1677 | * Copyright 2011-2014 Twitter, Inc.
1678 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1679 | * ======================================================================== */
1680 |
1681 |
1682 | +function ($) {
1683 | 'use strict';
1684 |
1685 | // SCROLLSPY CLASS DEFINITION
1686 | // ==========================
1687 |
1688 | function ScrollSpy(element, options) {
1689 | var process = $.proxy(this.process, this)
1690 |
1691 | this.$body = $('body')
1692 | this.$scrollElement = $(element).is('body') ? $(window) : $(element)
1693 | this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1694 | this.selector = (this.options.target || '') + ' .nav li > a'
1695 | this.offsets = []
1696 | this.targets = []
1697 | this.activeTarget = null
1698 | this.scrollHeight = 0
1699 |
1700 | this.$scrollElement.on('scroll.bs.scrollspy', process)
1701 | this.refresh()
1702 | this.process()
1703 | }
1704 |
1705 | ScrollSpy.VERSION = '3.2.0'
1706 |
1707 | ScrollSpy.DEFAULTS = {
1708 | offset: 10
1709 | }
1710 |
1711 | ScrollSpy.prototype.getScrollHeight = function () {
1712 | return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
1713 | }
1714 |
1715 | ScrollSpy.prototype.refresh = function () {
1716 | var offsetMethod = 'offset'
1717 | var offsetBase = 0
1718 |
1719 | if (!$.isWindow(this.$scrollElement[0])) {
1720 | offsetMethod = 'position'
1721 | offsetBase = this.$scrollElement.scrollTop()
1722 | }
1723 |
1724 | this.offsets = []
1725 | this.targets = []
1726 | this.scrollHeight = this.getScrollHeight()
1727 |
1728 | var self = this
1729 |
1730 | this.$body
1731 | .find(this.selector)
1732 | .map(function () {
1733 | var $el = $(this)
1734 | var href = $el.data('target') || $el.attr('href')
1735 | var $href = /^#./.test(href) && $(href)
1736 |
1737 | return ($href
1738 | && $href.length
1739 | && $href.is(':visible')
1740 | && [[$href[offsetMethod]().top + offsetBase, href]]) || null
1741 | })
1742 | .sort(function (a, b) { return a[0] - b[0] })
1743 | .each(function () {
1744 | self.offsets.push(this[0])
1745 | self.targets.push(this[1])
1746 | })
1747 | }
1748 |
1749 | ScrollSpy.prototype.process = function () {
1750 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1751 | var scrollHeight = this.getScrollHeight()
1752 | var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
1753 | var offsets = this.offsets
1754 | var targets = this.targets
1755 | var activeTarget = this.activeTarget
1756 | var i
1757 |
1758 | if (this.scrollHeight != scrollHeight) {
1759 | this.refresh()
1760 | }
1761 |
1762 | if (scrollTop >= maxScroll) {
1763 | return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
1764 | }
1765 |
1766 | if (activeTarget && scrollTop <= offsets[0]) {
1767 | return activeTarget != (i = targets[0]) && this.activate(i)
1768 | }
1769 |
1770 | for (i = offsets.length; i--;) {
1771 | activeTarget != targets[i]
1772 | && scrollTop >= offsets[i]
1773 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1774 | && this.activate(targets[i])
1775 | }
1776 | }
1777 |
1778 | ScrollSpy.prototype.activate = function (target) {
1779 | this.activeTarget = target
1780 |
1781 | $(this.selector)
1782 | .parentsUntil(this.options.target, '.active')
1783 | .removeClass('active')
1784 |
1785 | var selector = this.selector +
1786 | '[data-target="' + target + '"],' +
1787 | this.selector + '[href="' + target + '"]'
1788 |
1789 | var active = $(selector)
1790 | .parents('li')
1791 | .addClass('active')
1792 |
1793 | if (active.parent('.dropdown-menu').length) {
1794 | active = active
1795 | .closest('li.dropdown')
1796 | .addClass('active')
1797 | }
1798 |
1799 | active.trigger('activate.bs.scrollspy')
1800 | }
1801 |
1802 |
1803 | // SCROLLSPY PLUGIN DEFINITION
1804 | // ===========================
1805 |
1806 | function Plugin(option) {
1807 | return this.each(function () {
1808 | var $this = $(this)
1809 | var data = $this.data('bs.scrollspy')
1810 | var options = typeof option == 'object' && option
1811 |
1812 | if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1813 | if (typeof option == 'string') data[option]()
1814 | })
1815 | }
1816 |
1817 | var old = $.fn.scrollspy
1818 |
1819 | $.fn.scrollspy = Plugin
1820 | $.fn.scrollspy.Constructor = ScrollSpy
1821 |
1822 |
1823 | // SCROLLSPY NO CONFLICT
1824 | // =====================
1825 |
1826 | $.fn.scrollspy.noConflict = function () {
1827 | $.fn.scrollspy = old
1828 | return this
1829 | }
1830 |
1831 |
1832 | // SCROLLSPY DATA-API
1833 | // ==================
1834 |
1835 | $(window).on('load.bs.scrollspy.data-api', function () {
1836 | $('[data-spy="scroll"]').each(function () {
1837 | var $spy = $(this)
1838 | Plugin.call($spy, $spy.data())
1839 | })
1840 | })
1841 |
1842 | }(jQuery);
1843 |
1844 | /* ========================================================================
1845 | * Bootstrap: tab.js v3.2.0
1846 | * http://getbootstrap.com/javascript/#tabs
1847 | * ========================================================================
1848 | * Copyright 2011-2014 Twitter, Inc.
1849 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1850 | * ======================================================================== */
1851 |
1852 |
1853 | +function ($) {
1854 | 'use strict';
1855 |
1856 | // TAB CLASS DEFINITION
1857 | // ====================
1858 |
1859 | var Tab = function (element) {
1860 | this.element = $(element)
1861 | }
1862 |
1863 | Tab.VERSION = '3.2.0'
1864 |
1865 | Tab.prototype.show = function () {
1866 | var $this = this.element
1867 | var $ul = $this.closest('ul:not(.dropdown-menu)')
1868 | var selector = $this.data('target')
1869 |
1870 | if (!selector) {
1871 | selector = $this.attr('href')
1872 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
1873 | }
1874 |
1875 | if ($this.parent('li').hasClass('active')) return
1876 |
1877 | var previous = $ul.find('.active:last a')[0]
1878 | var e = $.Event('show.bs.tab', {
1879 | relatedTarget: previous
1880 | })
1881 |
1882 | $this.trigger(e)
1883 |
1884 | if (e.isDefaultPrevented()) return
1885 |
1886 | var $target = $(selector)
1887 |
1888 | this.activate($this.closest('li'), $ul)
1889 | this.activate($target, $target.parent(), function () {
1890 | $this.trigger({
1891 | type: 'shown.bs.tab',
1892 | relatedTarget: previous
1893 | })
1894 | })
1895 | }
1896 |
1897 | Tab.prototype.activate = function (element, container, callback) {
1898 | var $active = container.find('> .active')
1899 | var transition = callback
1900 | && $.support.transition
1901 | && $active.hasClass('fade')
1902 |
1903 | function next() {
1904 | $active
1905 | .removeClass('active')
1906 | .find('> .dropdown-menu > .active')
1907 | .removeClass('active')
1908 |
1909 | element.addClass('active')
1910 |
1911 | if (transition) {
1912 | element[0].offsetWidth // reflow for transition
1913 | element.addClass('in')
1914 | } else {
1915 | element.removeClass('fade')
1916 | }
1917 |
1918 | if (element.parent('.dropdown-menu')) {
1919 | element.closest('li.dropdown').addClass('active')
1920 | }
1921 |
1922 | callback && callback()
1923 | }
1924 |
1925 | transition ?
1926 | $active
1927 | .one('bsTransitionEnd', next)
1928 | .emulateTransitionEnd(150) :
1929 | next()
1930 |
1931 | $active.removeClass('in')
1932 | }
1933 |
1934 |
1935 | // TAB PLUGIN DEFINITION
1936 | // =====================
1937 |
1938 | function Plugin(option) {
1939 | return this.each(function () {
1940 | var $this = $(this)
1941 | var data = $this.data('bs.tab')
1942 |
1943 | if (!data) $this.data('bs.tab', (data = new Tab(this)))
1944 | if (typeof option == 'string') data[option]()
1945 | })
1946 | }
1947 |
1948 | var old = $.fn.tab
1949 |
1950 | $.fn.tab = Plugin
1951 | $.fn.tab.Constructor = Tab
1952 |
1953 |
1954 | // TAB NO CONFLICT
1955 | // ===============
1956 |
1957 | $.fn.tab.noConflict = function () {
1958 | $.fn.tab = old
1959 | return this
1960 | }
1961 |
1962 |
1963 | // TAB DATA-API
1964 | // ============
1965 |
1966 | $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1967 | e.preventDefault()
1968 | Plugin.call($(this), 'show')
1969 | })
1970 |
1971 | }(jQuery);
1972 |
1973 | /* ========================================================================
1974 | * Bootstrap: affix.js v3.2.0
1975 | * http://getbootstrap.com/javascript/#affix
1976 | * ========================================================================
1977 | * Copyright 2011-2014 Twitter, Inc.
1978 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1979 | * ======================================================================== */
1980 |
1981 |
1982 | +function ($) {
1983 | 'use strict';
1984 |
1985 | // AFFIX CLASS DEFINITION
1986 | // ======================
1987 |
1988 | var Affix = function (element, options) {
1989 | this.options = $.extend({}, Affix.DEFAULTS, options)
1990 |
1991 | this.$target = $(this.options.target)
1992 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1993 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1994 |
1995 | this.$element = $(element)
1996 | this.affixed =
1997 | this.unpin =
1998 | this.pinnedOffset = null
1999 |
2000 | this.checkPosition()
2001 | }
2002 |
2003 | Affix.VERSION = '3.2.0'
2004 |
2005 | Affix.RESET = 'affix affix-top affix-bottom'
2006 |
2007 | Affix.DEFAULTS = {
2008 | offset: 0,
2009 | target: window
2010 | }
2011 |
2012 | Affix.prototype.getPinnedOffset = function () {
2013 | if (this.pinnedOffset) return this.pinnedOffset
2014 | this.$element.removeClass(Affix.RESET).addClass('affix')
2015 | var scrollTop = this.$target.scrollTop()
2016 | var position = this.$element.offset()
2017 | return (this.pinnedOffset = position.top - scrollTop)
2018 | }
2019 |
2020 | Affix.prototype.checkPositionWithEventLoop = function () {
2021 | setTimeout($.proxy(this.checkPosition, this), 1)
2022 | }
2023 |
2024 | Affix.prototype.checkPosition = function () {
2025 | if (!this.$element.is(':visible')) return
2026 |
2027 | var scrollHeight = $(document).height()
2028 | var scrollTop = this.$target.scrollTop()
2029 | var position = this.$element.offset()
2030 | var offset = this.options.offset
2031 | var offsetTop = offset.top
2032 | var offsetBottom = offset.bottom
2033 |
2034 | if (typeof offset != 'object') offsetBottom = offsetTop = offset
2035 | if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
2036 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
2037 |
2038 | var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
2039 | offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
2040 | offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
2041 |
2042 | if (this.affixed === affix) return
2043 | if (this.unpin != null) this.$element.css('top', '')
2044 |
2045 | var affixType = 'affix' + (affix ? '-' + affix : '')
2046 | var e = $.Event(affixType + '.bs.affix')
2047 |
2048 | this.$element.trigger(e)
2049 |
2050 | if (e.isDefaultPrevented()) return
2051 |
2052 | this.affixed = affix
2053 | this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
2054 |
2055 | this.$element
2056 | .removeClass(Affix.RESET)
2057 | .addClass(affixType)
2058 | .trigger($.Event(affixType.replace('affix', 'affixed')))
2059 |
2060 | if (affix == 'bottom') {
2061 | this.$element.offset({
2062 | top: scrollHeight - this.$element.height() - offsetBottom
2063 | })
2064 | }
2065 | }
2066 |
2067 |
2068 | // AFFIX PLUGIN DEFINITION
2069 | // =======================
2070 |
2071 | function Plugin(option) {
2072 | return this.each(function () {
2073 | var $this = $(this)
2074 | var data = $this.data('bs.affix')
2075 | var options = typeof option == 'object' && option
2076 |
2077 | if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
2078 | if (typeof option == 'string') data[option]()
2079 | })
2080 | }
2081 |
2082 | var old = $.fn.affix
2083 |
2084 | $.fn.affix = Plugin
2085 | $.fn.affix.Constructor = Affix
2086 |
2087 |
2088 | // AFFIX NO CONFLICT
2089 | // =================
2090 |
2091 | $.fn.affix.noConflict = function () {
2092 | $.fn.affix = old
2093 | return this
2094 | }
2095 |
2096 |
2097 | // AFFIX DATA-API
2098 | // ==============
2099 |
2100 | $(window).on('load', function () {
2101 | $('[data-spy="affix"]').each(function () {
2102 | var $spy = $(this)
2103 | var data = $spy.data()
2104 |
2105 | data.offset = data.offset || {}
2106 |
2107 | if (data.offsetBottom) data.offset.bottom = data.offsetBottom
2108 | if (data.offsetTop) data.offset.top = data.offsetTop
2109 |
2110 | Plugin.call($spy, data)
2111 | })
2112 | })
2113 |
2114 | }(jQuery);
2115 |
--------------------------------------------------------------------------------
/DJangoHotel/static/js/bootstrap.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.2.0 (http://getbootstrap.com)
3 | * Copyright 2011-2014 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-kg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
--------------------------------------------------------------------------------
/DJangoHotel/static/js/responsive-nav.js:
--------------------------------------------------------------------------------
1 | /*! responsive-nav.js 1.0.32
2 | * https://github.com/viljamis/responsive-nav.js
3 | * http://responsive-nav.com
4 | *
5 | * Copyright (c) 2014 @viljamis
6 | * Available under the MIT license
7 | */
8 |
9 | (function (document, window, index) {
10 |
11 | "use strict";
12 |
13 | var responsiveNav = function (el, options) {
14 |
15 | var computed = !!window.getComputedStyle;
16 |
17 | // getComputedStyle polyfill
18 | if (!computed) {
19 | window.getComputedStyle = function(el) {
20 | this.el = el;
21 | this.getPropertyValue = function(prop) {
22 | var re = /(\-([a-z]){1})/g;
23 | if (prop === "float") {
24 | prop = "styleFloat";
25 | }
26 | if (re.test(prop)) {
27 | prop = prop.replace(re, function () {
28 | return arguments[2].toUpperCase();
29 | });
30 | }
31 | return el.currentStyle[prop] ? el.currentStyle[prop] : null;
32 | };
33 | return this;
34 | };
35 | }
36 | /* exported addEvent, removeEvent, getChildren, setAttributes, addClass, removeClass, forEach */
37 | // fn arg can be an object or a function, thanks to handleEvent
38 | // read more at: http://www.thecssninja.com/javascript/handleevent
39 | var addEvent = function (el, evt, fn, bubble) {
40 | if ("addEventListener" in el) {
41 | // BBOS6 doesn't support handleEvent, catch and polyfill
42 | try {
43 | el.addEventListener(evt, fn, bubble);
44 | } catch (e) {
45 | if (typeof fn === "object" && fn.handleEvent) {
46 | el.addEventListener(evt, function (e) {
47 | // Bind fn as this and set first arg as event object
48 | fn.handleEvent.call(fn, e);
49 | }, bubble);
50 | } else {
51 | throw e;
52 | }
53 | }
54 | } else if ("attachEvent" in el) {
55 | // check if the callback is an object and contains handleEvent
56 | if (typeof fn === "object" && fn.handleEvent) {
57 | el.attachEvent("on" + evt, function () {
58 | // Bind fn as this
59 | fn.handleEvent.call(fn);
60 | });
61 | } else {
62 | el.attachEvent("on" + evt, fn);
63 | }
64 | }
65 | },
66 |
67 | removeEvent = function (el, evt, fn, bubble) {
68 | if ("removeEventListener" in el) {
69 | try {
70 | el.removeEventListener(evt, fn, bubble);
71 | } catch (e) {
72 | if (typeof fn === "object" && fn.handleEvent) {
73 | el.removeEventListener(evt, function (e) {
74 | fn.handleEvent.call(fn, e);
75 | }, bubble);
76 | } else {
77 | throw e;
78 | }
79 | }
80 | } else if ("detachEvent" in el) {
81 | if (typeof fn === "object" && fn.handleEvent) {
82 | el.detachEvent("on" + evt, function () {
83 | fn.handleEvent.call(fn);
84 | });
85 | } else {
86 | el.detachEvent("on" + evt, fn);
87 | }
88 | }
89 | },
90 |
91 | getChildren = function (e) {
92 | if (e.children.length < 1) {
93 | throw new Error("The Nav container has no containing elements");
94 | }
95 | // Store all children in array
96 | var children = [];
97 | // Loop through children and store in array if child != TextNode
98 | for (var i = 0; i < e.children.length; i++) {
99 | if (e.children[i].nodeType === 1) {
100 | children.push(e.children[i]);
101 | }
102 | }
103 | return children;
104 | },
105 |
106 | setAttributes = function (el, attrs) {
107 | for (var key in attrs) {
108 | el.setAttribute(key, attrs[key]);
109 | }
110 | },
111 |
112 | addClass = function (el, cls) {
113 | if (el.className.indexOf(cls) !== 0) {
114 | el.className += " " + cls;
115 | el.className = el.className.replace(/(^\s*)|(\s*$)/g,"");
116 | }
117 | },
118 |
119 | removeClass = function (el, cls) {
120 | var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
121 | el.className = el.className.replace(reg, " ").replace(/(^\s*)|(\s*$)/g,"");
122 | },
123 |
124 | // forEach method that passes back the stuff we need
125 | forEach = function (array, callback, scope) {
126 | for (var i = 0; i < array.length; i++) {
127 | callback.call(scope, i, array[i]);
128 | }
129 | };
130 |
131 | var nav,
132 | opts,
133 | navToggle,
134 | styleElement = document.createElement("style"),
135 | htmlEl = document.documentElement,
136 | hasAnimFinished,
137 | isMobile,
138 | navOpen;
139 |
140 | var ResponsiveNav = function (el, options) {
141 | var i;
142 |
143 | // Default options
144 | this.options = {
145 | animate: true, // Boolean: Use CSS3 transitions, true or false
146 | transition: 284, // Integer: Speed of the transition, in milliseconds
147 | label: "Menu", // String: Label for the navigation toggle
148 | insert: "before", // String: Insert the toggle before or after the navigation
149 | customToggle: "", // Selector: Specify the ID of a custom toggle
150 | closeOnNavClick: false, // Boolean: Close the navigation when one of the links are clicked
151 | openPos: "relative", // String: Position of the opened nav, relative or static
152 | navClass: "nav-collapse", // String: Default CSS class. If changed, you need to edit the CSS too!
153 | navActiveClass: "js-nav-active", // String: Class that is added to element when nav is active
154 | jsClass: "js", // String: 'JS enabled' class which is added to element
155 | init: function(){}, // Function: Init callback
156 | open: function(){}, // Function: Open callback
157 | close: function(){} // Function: Close callback
158 | };
159 |
160 | // User defined options
161 | for (i in options) {
162 | this.options[i] = options[i];
163 | }
164 |
165 | // Adds "js" class for
166 | addClass(htmlEl, this.options.jsClass);
167 |
168 | // Wrapper
169 | this.wrapperEl = el.replace("#", "");
170 |
171 | // Try selecting ID first
172 | if (document.getElementById(this.wrapperEl)) {
173 | this.wrapper = document.getElementById(this.wrapperEl);
174 |
175 | // If element with an ID doesn't exist, use querySelector
176 | } else if (document.querySelector(this.wrapperEl)) {
177 | this.wrapper = document.querySelector(this.wrapperEl);
178 |
179 | // If element doesn't exists, stop here.
180 | } else {
181 | throw new Error("The nav element you are trying to select doesn't exist");
182 | }
183 |
184 | // Inner wrapper
185 | this.wrapper.inner = getChildren(this.wrapper);
186 |
187 | // For minification
188 | opts = this.options;
189 | nav = this.wrapper;
190 |
191 | // Init
192 | this._init(this);
193 | };
194 |
195 | ResponsiveNav.prototype = {
196 |
197 | // Public methods
198 | destroy: function () {
199 | this._removeStyles();
200 | removeClass(nav, "closed");
201 | removeClass(nav, "opened");
202 | removeClass(nav, opts.navClass);
203 | removeClass(nav, opts.navClass + "-" + this.index);
204 | removeClass(htmlEl, opts.navActiveClass);
205 | nav.removeAttribute("style");
206 | nav.removeAttribute("aria-hidden");
207 |
208 | removeEvent(window, "resize", this, false);
209 | removeEvent(document.body, "touchmove", this, false);
210 | removeEvent(navToggle, "touchstart", this, false);
211 | removeEvent(navToggle, "touchend", this, false);
212 | removeEvent(navToggle, "mouseup", this, false);
213 | removeEvent(navToggle, "keyup", this, false);
214 | removeEvent(navToggle, "click", this, false);
215 |
216 | if (!opts.customToggle) {
217 | navToggle.parentNode.removeChild(navToggle);
218 | } else {
219 | navToggle.removeAttribute("aria-hidden");
220 | }
221 | },
222 |
223 | toggle: function () {
224 | if (hasAnimFinished === true) {
225 | if (!navOpen) {
226 | this.open();
227 | } else {
228 | this.close();
229 | }
230 | }
231 | },
232 |
233 | open: function () {
234 | if (!navOpen) {
235 | removeClass(nav, "closed");
236 | addClass(nav, "opened");
237 | addClass(htmlEl, opts.navActiveClass);
238 | addClass(navToggle, "active");
239 | nav.style.position = opts.openPos;
240 | setAttributes(nav, {"aria-hidden": "false"});
241 | navOpen = true;
242 | opts.open();
243 | }
244 | },
245 |
246 | close: function () {
247 | if (navOpen) {
248 | addClass(nav, "closed");
249 | removeClass(nav, "opened");
250 | removeClass(htmlEl, opts.navActiveClass);
251 | removeClass(navToggle, "active");
252 | setAttributes(nav, {"aria-hidden": "true"});
253 |
254 | if (opts.animate) {
255 | hasAnimFinished = false;
256 | setTimeout(function () {
257 | nav.style.position = "absolute";
258 | hasAnimFinished = true;
259 | }, opts.transition + 10);
260 | } else {
261 | nav.style.position = "absolute";
262 | }
263 |
264 | navOpen = false;
265 | opts.close();
266 | }
267 | },
268 |
269 | resize: function () {
270 | if (window.getComputedStyle(navToggle, null).getPropertyValue("display") !== "none") {
271 |
272 | isMobile = true;
273 | setAttributes(navToggle, {"aria-hidden": "false"});
274 |
275 | // If the navigation is hidden
276 | if (nav.className.match(/(^|\s)closed(\s|$)/)) {
277 | setAttributes(nav, {"aria-hidden": "true"});
278 | nav.style.position = "absolute";
279 | }
280 |
281 | this._createStyles();
282 | this._calcHeight();
283 | } else {
284 |
285 | isMobile = false;
286 | setAttributes(navToggle, {"aria-hidden": "true"});
287 | setAttributes(nav, {"aria-hidden": "false"});
288 | nav.style.position = opts.openPos;
289 | this._removeStyles();
290 | }
291 | },
292 |
293 | handleEvent: function (e) {
294 | var evt = e || window.event;
295 |
296 | switch (evt.type) {
297 | case "touchstart":
298 | this._onTouchStart(evt);
299 | break;
300 | case "touchmove":
301 | this._onTouchMove(evt);
302 | break;
303 | case "touchend":
304 | case "mouseup":
305 | this._onTouchEnd(evt);
306 | break;
307 | case "click":
308 | this._preventDefault(evt);
309 | break;
310 | case "keyup":
311 | this._onKeyUp(evt);
312 | break;
313 | case "resize":
314 | this.resize(evt);
315 | break;
316 | }
317 | },
318 |
319 | // Private methods
320 | _init: function () {
321 | this.index = index++;
322 |
323 | addClass(nav, opts.navClass);
324 | addClass(nav, opts.navClass + "-" + this.index);
325 | addClass(nav, "closed");
326 | hasAnimFinished = true;
327 | navOpen = false;
328 |
329 | this._closeOnNavClick();
330 | this._createToggle();
331 | this._transitions();
332 | this.resize();
333 |
334 | // IE8 hack
335 | var self = this;
336 | setTimeout(function () {
337 | self.resize();
338 | }, 20);
339 |
340 | addEvent(window, "resize", this, false);
341 | addEvent(document.body, "touchmove", this, false);
342 | addEvent(navToggle, "touchstart", this, false);
343 | addEvent(navToggle, "touchend", this, false);
344 | addEvent(navToggle, "mouseup", this, false);
345 | addEvent(navToggle, "keyup", this, false);
346 | addEvent(navToggle, "click", this, false);
347 |
348 | // Init callback
349 | opts.init();
350 | },
351 |
352 | _createStyles: function () {
353 | if (!styleElement.parentNode) {
354 | styleElement.type = "text/css";
355 | document.getElementsByTagName("head")[0].appendChild(styleElement);
356 | }
357 | },
358 |
359 | _removeStyles: function () {
360 | if (styleElement.parentNode) {
361 | styleElement.parentNode.removeChild(styleElement);
362 | }
363 | },
364 |
365 | _createToggle: function () {
366 | if (!opts.customToggle) {
367 | var toggle = document.createElement("a");
368 | toggle.innerHTML = opts.label;
369 | setAttributes(toggle, {
370 | "href": "#",
371 | "class": "nav-toggle"
372 | });
373 |
374 | if (opts.insert === "after") {
375 | nav.parentNode.insertBefore(toggle, nav.nextSibling);
376 | } else {
377 | nav.parentNode.insertBefore(toggle, nav);
378 | }
379 |
380 | navToggle = toggle;
381 | } else {
382 | var toggleEl = opts.customToggle.replace("#", "");
383 |
384 | if (document.getElementById(toggleEl)) {
385 | navToggle = document.getElementById(toggleEl);
386 | } else if (document.querySelector(toggleEl)) {
387 | navToggle = document.querySelector(toggleEl);
388 | } else {
389 | throw new Error("The custom nav toggle you are trying to select doesn't exist");
390 | }
391 | }
392 | },
393 |
394 | _closeOnNavClick: function () {
395 | if (opts.closeOnNavClick && "querySelectorAll" in document) {
396 | var links = nav.querySelectorAll("a"),
397 | self = this;
398 | forEach(links, function (i, el) {
399 | addEvent(links[i], "click", function () {
400 | if (isMobile) {
401 | self.toggle();
402 | }
403 | }, false);
404 | });
405 | }
406 | },
407 |
408 | _preventDefault: function(e) {
409 | if (e.preventDefault) {
410 | e.preventDefault();
411 | e.stopPropagation();
412 | } else {
413 | e.returnValue = false;
414 | }
415 | },
416 |
417 | _onTouchStart: function (e) {
418 | e.stopPropagation();
419 | if (opts.insert === "after") {
420 | addClass(document.body, "disable-pointer-events");
421 | }
422 | this.startX = e.touches[0].clientX;
423 | this.startY = e.touches[0].clientY;
424 | this.touchHasMoved = false;
425 | removeEvent(navToggle, "mouseup", this, false);
426 | },
427 |
428 | _onTouchMove: function (e) {
429 | if (Math.abs(e.touches[0].clientX - this.startX) > 10 ||
430 | Math.abs(e.touches[0].clientY - this.startY) > 10) {
431 | this.touchHasMoved = true;
432 | }
433 | },
434 |
435 | _onTouchEnd: function (e) {
436 | this._preventDefault(e);
437 | if (!this.touchHasMoved) {
438 | if (e.type === "touchend") {
439 | this.toggle();
440 | if (opts.insert === "after") {
441 | setTimeout(function () {
442 | removeClass(document.body, "disable-pointer-events");
443 | }, opts.transition + 300);
444 | }
445 | return;
446 | } else {
447 | var evt = e || window.event;
448 | // If it isn't a right click
449 | if (!(evt.which === 3 || evt.button === 2)) {
450 | this.toggle();
451 | }
452 | }
453 | }
454 | },
455 |
456 | _onKeyUp: function (e) {
457 | var evt = e || window.event;
458 | if (evt.keyCode === 13) {
459 | this.toggle();
460 | }
461 | },
462 |
463 | _transitions: function () {
464 | if (opts.animate) {
465 | var objStyle = nav.style,
466 | transition = "max-height " + opts.transition + "ms";
467 |
468 | objStyle.WebkitTransition = transition;
469 | objStyle.MozTransition = transition;
470 | objStyle.OTransition = transition;
471 | objStyle.transition = transition;
472 | }
473 | },
474 |
475 | _calcHeight: function () {
476 | var savedHeight = 0;
477 | for (var i = 0; i < nav.inner.length; i++) {
478 | savedHeight += nav.inner[i].offsetHeight;
479 | }
480 | var innerStyles = "." + opts.jsClass + " ." + opts.navClass + "-" + this.index + ".opened{max-height:" + savedHeight + "px !important}";
481 |
482 | if (styleElement.styleSheet) {
483 | styleElement.styleSheet.cssText = innerStyles;
484 | } else {
485 | styleElement.innerHTML = innerStyles;
486 | }
487 |
488 | innerStyles = "";
489 | }
490 |
491 | };
492 |
493 | return new ResponsiveNav(el, options);
494 |
495 | };
496 |
497 | window.responsiveNav = responsiveNav;
498 |
499 | }(document, window, 0));
--------------------------------------------------------------------------------
/DJangoHotel/static/js/unslider.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Unslider by @idiot and @damirfoy
3 | * Contributors:
4 | * - @ShamoX
5 | *
6 | */
7 |
8 | (function($, f) {
9 | var Unslider = function() {
10 | // Object clone
11 | var _ = this;
12 |
13 | // Set some options
14 | _.o = {
15 | speed: 500, // animation speed, false for no transition (integer or boolean)
16 | delay: 3000, // delay between slides, false for no autoplay (integer or boolean)
17 | init: 0, // init delay, false for no delay (integer or boolean)
18 | pause: !f, // pause on hover (boolean)
19 | loop: !f, // infinitely looping (boolean)
20 | keys: f, // keyboard shortcuts (boolean)
21 | dots: f, // display dots pagination (boolean)
22 | arrows: f, // display prev/next arrows (boolean)
23 | prev: '←', // text or html inside prev button (string)
24 | next: '→', // same as for prev option
25 | fluid: f, // is it a percentage width? (boolean)
26 | starting: f, // invoke before animation (function with argument)
27 | complete: f, // invoke after animation (function with argument)
28 | items: '>ul', // slides container selector
29 | item: '>li', // slidable items selector
30 | easing: 'swing',// easing function to use for animation
31 | autoplay: true // enable autoplay on initialisation
32 | };
33 |
34 | _.init = function(el, o) {
35 | // Check whether we're passing any options in to Unslider
36 | _.o = $.extend(_.o, o);
37 |
38 | _.el = el;
39 | _.ul = el.find(_.o.items);
40 | _.max = [el.outerWidth() | 0, el.outerHeight() | 0];
41 | _.li = _.ul.find(_.o.item).each(function(index) {
42 | var me = $(this),
43 | width = me.outerWidth(),
44 | height = me.outerHeight();
45 |
46 | // Set the max values
47 | if (width > _.max[0]) _.max[0] = width;
48 | if (height > _.max[1]) _.max[1] = height;
49 | });
50 |
51 |
52 | // Cached vars
53 | var o = _.o,
54 | ul = _.ul,
55 | li = _.li,
56 | len = li.length;
57 |
58 | // Current indeed
59 | _.i = 0;
60 |
61 | // Set the main element
62 | el.css({width: _.max[0], height: li.first().outerHeight(), overflow: 'hidden'});
63 |
64 | // Set the relative widths
65 | ul.css({position: 'relative', left: 0, width: (len * 100) + '%'});
66 | if(o.fluid) {
67 | li.css({'float': 'left', width: (100 / len) + '%'});
68 | } else {
69 | li.css({'float': 'left', width: (_.max[0]) + 'px'});
70 | }
71 |
72 | // Autoslide
73 | o.autoplay && setTimeout(function() {
74 | if (o.delay | 0) {
75 | _.play();
76 |
77 | if (o.pause) {
78 | el.on('mouseover mouseout', function(e) {
79 | _.stop();
80 | e.type == 'mouseout' && _.play();
81 | });
82 | };
83 | };
84 | }, o.init | 0);
85 |
86 | // Keypresses
87 | if (o.keys) {
88 | $(document).keydown(function(e) {
89 | var key = e.which;
90 |
91 | if (key == 37)
92 | _.prev(); // Left
93 | else if (key == 39)
94 | _.next(); // Right
95 | else if (key == 27)
96 | _.stop(); // Esc
97 | });
98 | };
99 |
100 | // Dot pagination
101 | o.dots && nav('dot');
102 |
103 | // Arrows support
104 | o.arrows && nav('arrow');
105 |
106 | // Patch for fluid-width sliders. Screw those guys.
107 | if (o.fluid) {
108 | $(window).resize(function() {
109 | _.r && clearTimeout(_.r);
110 |
111 | _.r = setTimeout(function() {
112 | var styl = {height: li.eq(_.i).outerHeight()},
113 | width = el.outerWidth();
114 |
115 | ul.css(styl);
116 | styl['width'] = Math.min(Math.round((width / el.parent().width()) * 100), 100) + '%';
117 | el.css(styl);
118 | li.css({ width: width + 'px' });
119 | }, 50);
120 | }).resize();
121 | };
122 |
123 | // Move support
124 | if ($.event.special['move'] || $.Event('move')) {
125 | el.on('movestart', function(e) {
126 | if ((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) {
127 | e.preventDefault();
128 | }else{
129 | el.data("left", _.ul.offset().left / el.width() * 100);
130 | }
131 | }).on('move', function(e) {
132 | var left = 100 * e.distX / el.width();
133 | var leftDelta = 100 * e.deltaX / el.width();
134 | _.ul[0].style.left = parseInt(_.ul[0].style.left.replace("%", ""))+leftDelta+"%";
135 |
136 | _.ul.data("left", left);
137 | }).on('moveend', function(e) {
138 | var left = _.ul.data("left");
139 | if (Math.abs(left) > 30){
140 | var i = left > 0 ? _.i-1 : _.i+1;
141 | if (i < 0 || i >= len) i = _.i;
142 | _.to(i);
143 | }else{
144 | _.to(_.i);
145 | }
146 | });
147 | };
148 |
149 | return _;
150 | };
151 |
152 | // Move Unslider to a slide index
153 | _.to = function(index, callback) {
154 | if (_.t) {
155 | _.stop();
156 | _.play();
157 | }
158 | var o = _.o,
159 | el = _.el,
160 | ul = _.ul,
161 | li = _.li,
162 | current = _.i,
163 | target = li.eq(index);
164 |
165 | $.isFunction(o.starting) && !callback && o.starting(el, li.eq(current));
166 |
167 | // To slide or not to slide
168 | if ((!target.length || index < 0) && o.loop == f) return;
169 |
170 | // Check if it's out of bounds
171 | if (!target.length) index = 0;
172 | if (index < 0) index = li.length - 1;
173 | target = li.eq(index);
174 |
175 | var speed = callback ? 5 : o.speed | 0,
176 | easing = o.easing,
177 | obj = {height: target.outerHeight()};
178 |
179 | if (!ul.queue('fx').length) {
180 | // Handle those pesky dots
181 | el.find('.dot').eq(index).addClass('active').siblings().removeClass('active');
182 |
183 | el.animate(obj, speed, easing) && ul.animate($.extend({left: '-' + index + '00%'}, obj), speed, easing, function(data) {
184 | _.i = index;
185 |
186 | $.isFunction(o.complete) && !callback && o.complete(el, target);
187 | });
188 | };
189 | };
190 |
191 | // Autoplay functionality
192 | _.play = function() {
193 | _.t = setInterval(function() {
194 | _.to(_.i + 1);
195 | }, _.o.delay | 0);
196 | };
197 |
198 | // Stop autoplay
199 | _.stop = function() {
200 | _.t = clearInterval(_.t);
201 | return _;
202 | };
203 |
204 | // Move to previous/next slide
205 | _.next = function() {
206 | return _.stop().to(_.i + 1);
207 | };
208 |
209 | _.prev = function() {
210 | return _.stop().to(_.i - 1);
211 | };
212 |
213 | // Create dots and arrows
214 | function nav(name, html) {
215 | if (name == 'dot') {
216 | html = '';
217 | $.each(_.li, function(index) {
218 | html += '- ' + ++index + '
';
219 | });
220 | html += '
';
221 | } else {
222 | html = '' + html + name + ' prev">' + _.o.prev + '
' + html + name + ' next">' + _.o.next + '';
224 | };
225 |
226 | _.el.addClass('has-' + name + 's').append(html).find('.' + name).click(function() {
227 | var me = $(this);
228 | me.hasClass('dot') ? _.stop().to(me.index()) : me.hasClass('prev') ? _.prev() : _.next();
229 | });
230 | };
231 | };
232 |
233 | // Create a jQuery plugin
234 | $.fn.unslider = function(o) {
235 | var len = this.length;
236 |
237 | // Enable multiple-slider support
238 | return this.each(function(index) {
239 | // Cache a copy of $(this), so it
240 | var me = $(this),
241 | key = 'unslider' + (len > 1 ? '-' + ++index : ''),
242 | instance = (new Unslider).init(me, o);
243 |
244 | // Invoke an Unslider instance
245 | me.data(key, instance).data('key', key);
246 | });
247 | };
248 |
249 | Unslider.version = "1.0.0";
250 | })(jQuery, false);
251 |
--------------------------------------------------------------------------------
/DJangoHotel/static/pic/6240454_091935658000_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/static/pic/6240454_091935658000_2.jpg
--------------------------------------------------------------------------------
/DJangoHotel/static/pic/hotel-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/static/pic/hotel-logo.png
--------------------------------------------------------------------------------
/DJangoHotel/static/pic/key_home_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/static/pic/key_home_1.jpg
--------------------------------------------------------------------------------
/DJangoHotel/static/pic/key_home_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/static/pic/key_home_2.jpg
--------------------------------------------------------------------------------
/DJangoHotel/static/pic/key_home_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/static/pic/key_home_3.jpg
--------------------------------------------------------------------------------
/DJangoHotel/static/pic/key_overview_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/DJangoHotel/static/pic/key_overview_1.jpg
--------------------------------------------------------------------------------
/DJangoHotel/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/DJangoHotel/viewspackage/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
--------------------------------------------------------------------------------
/DJangoHotel/viewspackage/aboutView.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | from django.shortcuts import render, render_to_response
4 |
5 | # Create your views here.
6 |
7 | from DJangoHotel.models import Hotel
8 | def about(request):
9 | title='DJango Hotel'
10 | hotel=Hotel.objects.get(name='DJango Hotel')
11 | name=hotel.name
12 | description=hotel.description
13 | address=hotel.address
14 |
15 |
16 | return render_to_response('about.html',{'title':title,'name':name,'description':description,'address':address})
--------------------------------------------------------------------------------
/DJangoHotel/viewspackage/indexView.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from django.shortcuts import render, render_to_response
3 |
4 | # Create your views here.
5 |
6 | from DJangoHotel.models import Hotel
7 | def index(request):
8 | hotel=Hotel.objects.get(name='DJango Hotel')
9 | description=hotel.description
10 |
11 |
12 |
13 | return render_to_response('index.html',{'description':description})
--------------------------------------------------------------------------------
/DJangoHotel/viewspackage/orderResultView.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from django.shortcuts import render, render_to_response
3 | from django.http import HttpResponse
4 |
5 | from DJangoHotel.models import Order,RoomInfo,Customer
6 | import time
7 | import datetime
8 | def orderResult(request):
9 |
10 | tempCustomer=Customer()
11 | tempCustomer.tel= request.GET['tel']
12 | tempCustomer.name= request.GET['name']
13 | tempCustomer.cardid= request.GET['cardid']
14 | tempCustomer.save()
15 |
16 | tempOrder=Order()
17 | tempOrder.name = request.GET['name']
18 | tempOrder.tel = request.GET['tel']
19 | tempOrder.cardid = request.GET['cardid']
20 | tempOrder.roomtype = request.GET['roomtype']
21 |
22 | begin = request.GET['begin']
23 | end = request.GET['end']
24 | tempOrder.begin = (datetime.datetime.strptime(begin , '%Y-%m-%d')).date()
25 | tempOrder.end = (datetime.datetime.strptime(end , '%Y-%m-%d')).date()
26 | period = (tempOrder.end - tempOrder.begin).days
27 |
28 | price = 0
29 |
30 | if tempOrder.roomtype == 'standard':
31 | price = (RoomInfo.objects.get(name='标准间')).price
32 |
33 | elif tempOrder.roomtype =='better':
34 | price = (RoomInfo.objects.get(name='豪华间')).price
35 |
36 | elif tempOrder.roomtype =='president':
37 | price = (RoomInfo.objects.get(name='总统间')).price
38 |
39 |
40 | tempOrder.totalprice = period * price
41 | tempOrder.save()
42 |
43 | tel = request.GET['tel']
44 | begin = request.GET['begin']
45 |
46 | return render_to_response('orderresult.html',{'orderid':tempOrder.id})
--------------------------------------------------------------------------------
/DJangoHotel/viewspackage/orderView.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from django.shortcuts import render, render_to_response
3 |
4 | # Create your views here.
5 |
6 | from DJangoHotel.models import Order
7 | def order(request):
8 |
9 |
10 |
11 |
12 | return render_to_response('order.html')
--------------------------------------------------------------------------------
/DJangoHotel/viewspackage/roomInfoView.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | from django.shortcuts import render, render_to_response
4 |
5 | # Create your views here.
6 |
7 | from DJangoHotel.models import RoomInfo
8 | def roomInfo(request):
9 | roomInfoList=RoomInfo.objects.all()
10 | return render_to_response('roominfo.html',{'roomInfoList':roomInfoList})
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | DJangoHotel_Python
2 | ==================
3 |
4 | 基于Django的python信息管理系统,用于酒店预订管理
5 |
6 | #环境
7 |
8 | IDE:JetBrains PyCharm 3.4.1
9 |
10 | Python: 2.7.8
11 |
12 | Django:1.7
13 |
14 | MySQL:5.6.20
15 |
16 | ------
17 |
18 | **Demo:**
19 |
20 | #注意事项
21 | 1. 确保已安装python-mysql
22 | 1. 在mysql创建djangohotle表
23 | 2. 执行python manage.py syncdb创建数据库
24 | 3. 并在djangohotel.djangohotel_hotel中创建name为DJango Hotel的数据
25 |
26 |
--------------------------------------------------------------------------------
/kcsj/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ladder1984/DJangoHotel_Python/a39a37041e87af805ec571461d2ec214f304f193/kcsj/__init__.py
--------------------------------------------------------------------------------
/kcsj/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for kcsj project.
3 |
4 | For more information on this file, see
5 | https://docs.djangoproject.com/en/dev/topics/settings/
6 |
7 | For the full list of settings and their values, see
8 | https://docs.djangoproject.com/en/dev/ref/settings/
9 | """
10 |
11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
12 | import os
13 | from django.conf.global_settings import MEDIA_URL, MEDIA_ROOT
14 |
15 | BASE_DIR = os.path.dirname(os.path.dirname(__file__))
16 |
17 |
18 | # Quick-start development settings - unsuitable for production
19 | # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
20 |
21 | # SECURITY WARNING: keep the secret key used in production secret!
22 | SECRET_KEY = 'if4s&rsp65^oe*o!%%e*(%x9*pxazr0&bae%+&50a*cer$a(xa'
23 |
24 | # SECURITY WARNING: don't run with debug turned on in production!
25 | DEBUG = True
26 |
27 | TEMPLATE_DEBUG = True
28 |
29 | ALLOWED_HOSTS = []
30 |
31 |
32 | # Application definition
33 |
34 | INSTALLED_APPS = (
35 | 'django.contrib.admin',
36 | 'django.contrib.auth',
37 | 'django.contrib.contenttypes',
38 | 'django.contrib.sessions',
39 | 'django.contrib.messages',
40 | 'django.contrib.staticfiles',
41 | 'DJangoHotel',
42 | )
43 |
44 | MIDDLEWARE_CLASSES = (
45 | 'django.contrib.sessions.middleware.SessionMiddleware',
46 | 'django.middleware.common.CommonMiddleware',
47 | 'django.middleware.csrf.CsrfViewMiddleware',
48 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
49 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
50 | 'django.contrib.messages.middleware.MessageMiddleware',
51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
52 | )
53 |
54 | ROOT_URLCONF = 'kcsj.urls'
55 |
56 | WSGI_APPLICATION = 'kcsj.wsgi.application'
57 |
58 |
59 | # Database
60 | # https://docs.djangoproject.com/en/dev/ref/settings/#databases
61 |
62 | DATABASES = {
63 | 'default': {
64 | 'ENGINE': 'django.db.backends.mysql',
65 | 'NAME': 'djangohotel',
66 | 'USER': 'root',
67 | 'PASSWORD': '1234',
68 | 'HOST': '127.0.0.1',
69 | 'PORT': '3306',
70 | }
71 | }
72 |
73 | # Internationalization
74 | # https://docs.djangoproject.com/en/dev/topics/i18n/
75 |
76 | LANGUAGE_CODE = 'zh-hans'
77 |
78 | TIME_ZONE = 'Asia/Shanghai'
79 |
80 | USE_I18N = True
81 |
82 | USE_L10N = True
83 |
84 | USE_TZ = True
85 |
86 |
87 | # Static files (CSS, JavaScript, Images)
88 | # https://docs.djangoproject.com/en/dev/howto/static-files/
89 |
90 | STATIC_URL = '/static/'
91 |
92 |
93 |
94 | TEMPLATE_DIRS = (
95 | os.path.join(BASE_DIR, 'templates'),
96 | )
97 |
98 | STATICFILES_DIRS = (
99 | os.path.join(BASE_DIR, "static"),
100 |
101 | )
102 |
--------------------------------------------------------------------------------
/kcsj/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls import include, url, patterns
2 |
3 | from django.contrib import admin
4 |
5 | from DJangoHotel.viewspackage.aboutView import about
6 | from DJangoHotel.viewspackage.indexView import index
7 | from DJangoHotel.viewspackage.orderResultView import orderResult
8 | from DJangoHotel.viewspackage.orderView import order
9 | from DJangoHotel.viewspackage.roomInfoView import roomInfo
10 | from django.conf import settings
11 | from django.conf.urls.static import static
12 |
13 | urlpatterns = [
14 | # Examples:
15 | # url(r'^$', 'kcsj.views.home', name='home'),
16 | # url(r'^blog/', include('blog.urls')),
17 |
18 |
19 |
20 | url(r'^admin/', include(admin.site.urls)),
21 | url(r'^about/', about),
22 | url(r'^roominfo/', roomInfo),
23 | url(r'^$', index),
24 | url(r'^order/',order),
25 | url(r'^orderresult/',orderResult)
26 | ]
27 |
28 |
29 |
--------------------------------------------------------------------------------
/kcsj/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for kcsj project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kcsj.settings")
12 |
13 | from django.core.wsgi import get_wsgi_application
14 | application = get_wsgi_application()
15 |
--------------------------------------------------------------------------------
/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", "kcsj.settings")
7 |
8 | from django.core.management import execute_from_command_line
9 |
10 | execute_from_command_line(sys.argv)
11 |
--------------------------------------------------------------------------------
/templates/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 404
9 |
10 |
--------------------------------------------------------------------------------
/templates/about.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}酒店介绍{% endblock %}
3 | {% block wraptype %}
4 |
5 | {% endblock %}
6 | {% block content %}
7 |
8 |
9 | -
10 | {% load staticfiles %}
11 |
12 |
13 |
14 |
15 |
16 |
酒店介绍:DJango Hotel
17 |
18 | {{ description }}
19 |
20 |
21 |
22 | {% endblock %}
23 |
--------------------------------------------------------------------------------
/templates/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
{% block title %}{% endblock %}
8 | {% block insert %}
9 | {% load staticfiles %}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | {% endblock %}
20 |
21 |
22 | {% block header %}
23 |
24 |
25 | {% block wraptype %}
26 |
27 | {% endblock %}
28 |
43 | {% endblock %}
44 |
45 | {% block content %}{% endblock %}
46 |
47 | {% block footer %}
48 |
49 |
60 |
61 |
62 |
88 | {% endblock %}
89 |
90 |
91 |
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}首页 {% endblock %}
3 | {% block wraptype %}
4 |
5 | {% endblock %}
6 | {% block content %}
7 | {% load staticfiles %}
8 |
9 |
10 | -
11 |
12 |
13 | -
14 |
15 |
16 | -
17 |
18 |
19 |
20 |
21 |
22 |
23 |
42 |
43 |
44 |
45 |
酒店介绍
46 |
47 |
48 | {{ description }}
49 |
50 |
51 | {% endblock %}
--------------------------------------------------------------------------------
/templates/order.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}预定客房{% endblock %}
3 | {% block wraptype %}
4 |
5 | {% endblock %}
6 | {% block content %}
7 |
8 |
9 |
10 |
11 | -
12 | {% load staticfiles %}
13 |
14 |
15 |
16 |
17 |
18 |
预订
19 |
20 |
33 |
34 |
35 |
36 |
37 | {% endblock %}
--------------------------------------------------------------------------------
/templates/orderresult.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}预定结果{% endblock %}
3 | {% block wraptype %}
4 |
5 | {% endblock %}
6 | {% block content %}
7 |
8 |
您的订单提交成功,订单号是:{{ orderid }}
9 |
10 |
11 | {% endblock %}
--------------------------------------------------------------------------------
/templates/roominfo.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}房型介绍{% endblock %}
3 | {% block wraptype %}
4 |
5 | {% endblock %}
6 | {% block content %}
7 |
8 |
9 | -
10 | {% load staticfiles %}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {% for roomInfo in roomInfoList %}
21 |
22 |
23 |
24 | {{roomInfo.name}}
25 |
26 | {{roomInfo.description}}
27 |
28 |
29 |
30 | 价格:{{ roomInfo.price }}每日
31 |
32 |
33 | {% endfor %}
34 |
35 |
36 | {% endblock %}
--------------------------------------------------------------------------------