7 | {% endif %}
8 |
9 | {% endfor %}
10 | {% endblock %}
11 |
--------------------------------------------------------------------------------
/init/README.md:
--------------------------------------------------------------------------------
1 | # bird-lg init
2 |
3 | Systemd unit files for the bird-lg webservice, and for the proxy service running on routers.
4 |
5 | You need to adapt the exact command used to start the service (`ExecStart`) and the `User`
6 | under which it should run. Don't run the services as root!
7 |
8 | ## Installation
9 |
10 | Copy the init file under `/etc/systemd/system/` and run:
11 |
12 | systemctl daemon-reload
13 | systemctl start bird-lg-proxy
14 | systemctl enable bird-lg-proxy
15 |
16 | ## Credits
17 |
18 | Adapted from
19 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | bird-lg
2 | =======
3 |
4 | Copyright (c) 2006 Mehdi Abaakouk
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 |
--------------------------------------------------------------------------------
/templates/bgpmap.html:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 | {% block body %}
3 |
>"
429 | nodes[_as] = pydot.Node(_as, style="filled", fontsize="10", **kwargs)
430 | graph.add_node(nodes[_as])
431 | return nodes[_as]
432 |
433 | def add_edge(_previous_as, _as, **kwargs):
434 | kwargs["splines"] = "true"
435 | force = kwargs.get("force", False)
436 |
437 | edge_tuple = (_previous_as, _as)
438 | if force or edge_tuple not in edges:
439 | edge = pydot.Edge(*edge_tuple, **kwargs)
440 | graph.add_edge(edge)
441 | edges[edge_tuple] = edge
442 | elif "label" in kwargs and kwargs["label"]:
443 | e = edges[edge_tuple]
444 |
445 | label_without_star = kwargs["label"].replace("*", "")
446 | if e.get_label() is not None:
447 | labels = e.get_label().split("\r")
448 | else:
449 | return edges[edge_tuple]
450 | if "%s*" % label_without_star not in labels:
451 | labels = [ kwargs["label"] ] + [ l for l in labels if not l.startswith(label_without_star) ]
452 | labels = sorted(labels, cmp=lambda x,y: x.endswith("*") and -1 or 1)
453 | label = escape("\r".join(labels))
454 | e.set_label(label)
455 | return edges[edge_tuple]
456 |
457 | for host, asmaps in data.iteritems():
458 | if "DOMAIN" in app.config:
459 | add_node(host, label= "%s\r%s" % (host.upper(), app.config["DOMAIN"].upper()), shape="box", fillcolor="#F5A9A9")
460 | else:
461 | add_node(host, label= "%s" % (host.upper()), shape="box", fillcolor="#F5A9A9")
462 |
463 | as_number = app.config["AS_NUMBER"].get(host, None)
464 | if as_number:
465 | node = add_node(as_number, fillcolor="#F5A9A9")
466 | edge = add_edge(as_number, nodes[host])
467 | edge.set_color("red")
468 | edge.set_style("bold")
469 |
470 | #colors = [ "#009e23", "#1a6ec1" , "#d05701", "#6f879f", "#939a0e", "#0e9a93", "#9a0e85", "#56d8e1" ]
471 | previous_as = None
472 | hosts = data.keys()
473 | for host, asmaps in data.iteritems():
474 | first = True
475 | for asmap in asmaps:
476 | previous_as = host
477 | color = "#%x" % random.randint(0, 16777215)
478 |
479 | hop = False
480 | hop_label = ""
481 | for _as in asmap:
482 | if _as == previous_as:
483 | if not prepend_as.get(_as, None):
484 | prepend_as[_as] = {}
485 | if not prepend_as[_as].get(host, None):
486 | prepend_as[_as][host] = {}
487 | if not prepend_as[_as][host].get(asmap[0], None):
488 | prepend_as[_as][host][asmap[0]] = 1
489 | prepend_as[_as][host][asmap[0]] += 1
490 | continue
491 |
492 | if not hop:
493 | hop = True
494 | if _as not in hosts:
495 | hop_label = _as
496 | if first:
497 | hop_label = hop_label + "*"
498 | continue
499 | else:
500 | hop_label = ""
501 |
502 | if _as == asmap[-1]:
503 | add_node(_as, fillcolor="#F5A9A9", shape="box", )
504 | else:
505 | add_node(_as, fillcolor=(first and "#F5A9A9" or "white"), )
506 | if hop_label:
507 | edge = add_edge(nodes[previous_as], nodes[_as], label=hop_label, fontsize="7")
508 | else:
509 | edge = add_edge(nodes[previous_as], nodes[_as], fontsize="7")
510 |
511 | hop_label = ""
512 |
513 | if first or _as == asmap[-1]:
514 | edge.set_style("bold")
515 | edge.set_color("red")
516 | elif edge.get_style() != "bold":
517 | edge.set_style("dashed")
518 | edge.set_color(color)
519 |
520 | previous_as = _as
521 | first = False
522 |
523 | for _as in prepend_as:
524 | for n in set([ n for h, d in prepend_as[_as].iteritems() for p, n in d.iteritems() ]):
525 | graph.add_edge(pydot.Edge(*(_as, _as), label=" %dx" % n, color="grey", fontcolor="grey"))
526 |
527 | fmt = request.args.get('fmt', 'png')
528 | #response = Response("
" + graph.create_dot() + "
")
529 | if fmt == "png":
530 | response = Response(graph.create_png(), mimetype='image/png')
531 | elif fmt == "svg":
532 | response = Response(graph.create_svg(), mimetype='image/svg+xml')
533 | else:
534 | abort(400, "Incorrect format")
535 | response.headers['Last-Modified'] = datetime.now()
536 | response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
537 | response.headers['Pragma'] = 'no-cache'
538 | response.headers['Expires'] = '-1'
539 | return response
540 |
541 |
542 |
543 | def build_as_tree_from_raw_bird_ouput(host, proto, text):
544 | """Extract the as path from the raw bird "show route all" command"""
545 |
546 | path = None
547 | paths = []
548 | net_dest = None
549 | peer_protocol_name = ""
550 | for line in text:
551 | line = line.strip()
552 |
553 | expr = re.search(r'(.*)unicast\s+\[(\w+)\s+', line)
554 | if expr:
555 | if expr.group(1).strip():
556 | net_dest = expr.group(1).strip()
557 | peer_protocol_name = expr.group(2).strip()
558 |
559 | expr2 = re.search(r'(.*)via\s+([0-9a-fA-F:\.]+)\s+on\s+\S+(\s+\[(\w+)\s+)?', line)
560 | if expr2:
561 | if path:
562 | path.append(net_dest)
563 | paths.append(path)
564 | path = None
565 |
566 | if expr2.group(1).strip():
567 | net_dest = expr2.group(1).strip()
568 |
569 | peer_ip = expr2.group(2).strip()
570 | if expr2.group(4):
571 | peer_protocol_name = expr2.group(4).strip()
572 | # Check if via line is a internal route
573 | for rt_host, rt_ips in app.config["ROUTER_IP"].iteritems():
574 | # Special case for internal routing
575 | if peer_ip in rt_ips:
576 | path = [rt_host]
577 | break
578 | else:
579 | # ugly hack for good printing
580 | path = [ peer_protocol_name ]
581 | # path = ["%s\r%s" % (peer_protocol_name, get_as_name(get_as_number_from_protocol_name(host, proto, peer_protocol_name)))]
582 |
583 | expr3 = re.search(r'(.*)unreachable\s+\[(\w+)\s+', line)
584 | if expr3:
585 | if path:
586 | path.append(net_dest)
587 | paths.append(path)
588 | path = None
589 |
590 | if path is None:
591 | path = [ expr3.group(2).strip() ]
592 |
593 | if expr3.group(1).strip():
594 | net_dest = expr3.group(1).strip()
595 |
596 | if line.startswith("BGP.as_path:"):
597 | ASes = line.replace("BGP.as_path:", "").strip().split(" ")
598 | if path:
599 | path.extend(ASes)
600 | else:
601 | path = ASes
602 |
603 | if path:
604 | path.append(net_dest)
605 | paths.append(path)
606 |
607 | return paths
608 |
609 |
610 | def show_route(request_type, hosts, proto):
611 | expression = get_query()
612 | if not expression:
613 | abort(400)
614 |
615 | set_session(request_type, hosts, proto, expression)
616 |
617 | bgpmap = request_type.endswith("bgpmap")
618 |
619 | all = (request_type.endswith("detail") and " all" or "")
620 | if bgpmap:
621 | all = " all"
622 |
623 | if request_type.startswith("adv"):
624 | command = "show route " + expression.strip()
625 | if bgpmap and not command.endswith("all"):
626 | command = command + " all"
627 | elif request_type.startswith("where"):
628 | command = "show route where net ~ [ " + expression + " ]" + all
629 | else:
630 | mask = ""
631 | if len(expression.split("/")) == 2:
632 | expression, mask = (expression.split("/"))
633 |
634 | if not mask and proto == "ipv4":
635 | mask = "32"
636 | if not mask and proto == "ipv6":
637 | mask = "128"
638 | if not mask_is_valid(mask):
639 | return error_page("mask %s is invalid" % mask)
640 |
641 | if proto == "ipv6" and not ipv6_is_valid(expression):
642 | try:
643 | expression = resolve(expression, "AAAA")
644 | except:
645 | return error_page("%s is unresolvable or invalid for %s" % (expression, proto))
646 | if proto == "ipv4" and not ipv4_is_valid(expression):
647 | try:
648 | expression = resolve(expression, "A")
649 | except:
650 | return error_page("%s is unresolvable or invalid for %s" % (expression, proto))
651 |
652 | if mask:
653 | expression += "/" + mask
654 |
655 | command = "show route for " + expression + all
656 |
657 | detail = {}
658 | errors = []
659 | for host in hosts.split("+"):
660 | ret, res = bird_command(host, proto, command)
661 | res = res.split("\n")
662 |
663 | if ret is False:
664 | errors.append("%s" % res)
665 | continue
666 |
667 | if len(res) <= 1:
668 | errors.append("%s: bird command failed with error, %s" % (host, "\n".join(res)))
669 | continue
670 |
671 | if bgpmap:
672 | detail[host] = build_as_tree_from_raw_bird_ouput(host, proto, res)
673 | else:
674 | detail[host] = add_links(res)
675 |
676 | if bgpmap:
677 | detail = base64.b64encode(json.dumps(detail))
678 |
679 | return render_template((bgpmap and 'bgpmap.html' or 'route.html'), detail=detail, command=command, expression=expression, errors=errors)
680 |
681 |
682 | if __name__ == "__main__":
683 | app.run(app.config.get("BIND_IP", "0.0.0.0"), app.config.get("BIND_PORT", 5000))
684 |
--------------------------------------------------------------------------------
/gpl-3.0.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/static/js/bootstrap.js:
--------------------------------------------------------------------------------
1 | /* ===================================================
2 | * bootstrap-transition.js v2.0.0
3 | * http://twitter.github.com/bootstrap/javascript.html#transitions
4 | * ===================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ========================================================== */
19 |
20 | !function( $ ) {
21 |
22 | $(function () {
23 |
24 | "use strict"
25 |
26 | /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27 | * ======================================================= */
28 |
29 | $.support.transition = (function () {
30 | var thisBody = document.body || document.documentElement
31 | , thisStyle = thisBody.style
32 | , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
33 |
34 | return support && {
35 | end: (function () {
36 | var transitionEnd = "TransitionEnd"
37 | if ( $.browser.webkit ) {
38 | transitionEnd = "webkitTransitionEnd"
39 | } else if ( $.browser.mozilla ) {
40 | transitionEnd = "transitionend"
41 | } else if ( $.browser.opera ) {
42 | transitionEnd = "oTransitionEnd"
43 | }
44 | return transitionEnd
45 | }())
46 | }
47 | })()
48 |
49 | })
50 |
51 | }( window.jQuery )
52 | /* ==========================================================
53 | * bootstrap-alert.js v2.0.0
54 | * http://twitter.github.com/bootstrap/javascript.html#alerts
55 | * ==========================================================
56 | * Copyright 2012 Twitter, Inc.
57 | *
58 | * Licensed under the Apache License, Version 2.0 (the "License");
59 | * you may not use this file except in compliance with the License.
60 | * You may obtain a copy of the License at
61 | *
62 | * http://www.apache.org/licenses/LICENSE-2.0
63 | *
64 | * Unless required by applicable law or agreed to in writing, software
65 | * distributed under the License is distributed on an "AS IS" BASIS,
66 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67 | * See the License for the specific language governing permissions and
68 | * limitations under the License.
69 | * ========================================================== */
70 |
71 |
72 | !function( $ ){
73 |
74 | "use strict"
75 |
76 | /* ALERT CLASS DEFINITION
77 | * ====================== */
78 |
79 | var dismiss = '[data-dismiss="alert"]'
80 | , Alert = function ( el ) {
81 | $(el).on('click', dismiss, this.close)
82 | }
83 |
84 | Alert.prototype = {
85 |
86 | constructor: Alert
87 |
88 | , close: function ( e ) {
89 | var $this = $(this)
90 | , selector = $this.attr('data-target')
91 | , $parent
92 |
93 | if (!selector) {
94 | selector = $this.attr('href')
95 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
96 | }
97 |
98 | $parent = $(selector)
99 | $parent.trigger('close')
100 |
101 | e && e.preventDefault()
102 |
103 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
104 |
105 | $parent.removeClass('in')
106 |
107 | function removeElement() {
108 | $parent.remove()
109 | $parent.trigger('closed')
110 | }
111 |
112 | $.support.transition && $parent.hasClass('fade') ?
113 | $parent.on($.support.transition.end, removeElement) :
114 | removeElement()
115 | }
116 |
117 | }
118 |
119 |
120 | /* ALERT PLUGIN DEFINITION
121 | * ======================= */
122 |
123 | $.fn.alert = function ( option ) {
124 | return this.each(function () {
125 | var $this = $(this)
126 | , data = $this.data('alert')
127 | if (!data) $this.data('alert', (data = new Alert(this)))
128 | if (typeof option == 'string') data[option].call($this)
129 | })
130 | }
131 |
132 | $.fn.alert.Constructor = Alert
133 |
134 |
135 | /* ALERT DATA-API
136 | * ============== */
137 |
138 | $(function () {
139 | $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
140 | })
141 |
142 | }( window.jQuery )
143 | /* ============================================================
144 | * bootstrap-button.js v2.0.0
145 | * http://twitter.github.com/bootstrap/javascript.html#buttons
146 | * ============================================================
147 | * Copyright 2012 Twitter, Inc.
148 | *
149 | * Licensed under the Apache License, Version 2.0 (the "License");
150 | * you may not use this file except in compliance with the License.
151 | * You may obtain a copy of the License at
152 | *
153 | * http://www.apache.org/licenses/LICENSE-2.0
154 | *
155 | * Unless required by applicable law or agreed to in writing, software
156 | * distributed under the License is distributed on an "AS IS" BASIS,
157 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
158 | * See the License for the specific language governing permissions and
159 | * limitations under the License.
160 | * ============================================================ */
161 |
162 | !function( $ ){
163 |
164 | "use strict"
165 |
166 | /* BUTTON PUBLIC CLASS DEFINITION
167 | * ============================== */
168 |
169 | var Button = function ( element, options ) {
170 | this.$element = $(element)
171 | this.options = $.extend({}, $.fn.button.defaults, options)
172 | }
173 |
174 | Button.prototype = {
175 |
176 | constructor: Button
177 |
178 | , setState: function ( state ) {
179 | var d = 'disabled'
180 | , $el = this.$element
181 | , data = $el.data()
182 | , val = $el.is('input') ? 'val' : 'html'
183 |
184 | state = state + 'Text'
185 | data.resetText || $el.data('resetText', $el[val]())
186 |
187 | $el[val](data[state] || this.options[state])
188 |
189 | // push to event loop to allow forms to submit
190 | setTimeout(function () {
191 | state == 'loadingText' ?
192 | $el.addClass(d).attr(d, d) :
193 | $el.removeClass(d).removeAttr(d)
194 | }, 0)
195 | }
196 |
197 | , toggle: function () {
198 | var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
199 |
200 | $parent && $parent
201 | .find('.active')
202 | .removeClass('active')
203 |
204 | this.$element.toggleClass('active')
205 | }
206 |
207 | }
208 |
209 |
210 | /* BUTTON PLUGIN DEFINITION
211 | * ======================== */
212 |
213 | $.fn.button = function ( option ) {
214 | return this.each(function () {
215 | var $this = $(this)
216 | , data = $this.data('button')
217 | , options = typeof option == 'object' && option
218 | if (!data) $this.data('button', (data = new Button(this, options)))
219 | if (option == 'toggle') data.toggle()
220 | else if (option) data.setState(option)
221 | })
222 | }
223 |
224 | $.fn.button.defaults = {
225 | loadingText: 'loading...'
226 | }
227 |
228 | $.fn.button.Constructor = Button
229 |
230 |
231 | /* BUTTON DATA-API
232 | * =============== */
233 |
234 | $(function () {
235 | $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
236 | $(e.target).button('toggle')
237 | })
238 | })
239 |
240 | }( window.jQuery )
241 | /* ==========================================================
242 | * bootstrap-carousel.js v2.0.0
243 | * http://twitter.github.com/bootstrap/javascript.html#carousel
244 | * ==========================================================
245 | * Copyright 2012 Twitter, Inc.
246 | *
247 | * Licensed under the Apache License, Version 2.0 (the "License");
248 | * you may not use this file except in compliance with the License.
249 | * You may obtain a copy of the License at
250 | *
251 | * http://www.apache.org/licenses/LICENSE-2.0
252 | *
253 | * Unless required by applicable law or agreed to in writing, software
254 | * distributed under the License is distributed on an "AS IS" BASIS,
255 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
256 | * See the License for the specific language governing permissions and
257 | * limitations under the License.
258 | * ========================================================== */
259 |
260 |
261 | !function( $ ){
262 |
263 | "use strict"
264 |
265 | /* CAROUSEL CLASS DEFINITION
266 | * ========================= */
267 |
268 | var Carousel = function (element, options) {
269 | this.$element = $(element)
270 | this.options = $.extend({}, $.fn.carousel.defaults, options)
271 | this.options.slide && this.slide(this.options.slide)
272 | }
273 |
274 | Carousel.prototype = {
275 |
276 | cycle: function () {
277 | this.interval = setInterval($.proxy(this.next, this), this.options.interval)
278 | return this
279 | }
280 |
281 | , to: function (pos) {
282 | var $active = this.$element.find('.active')
283 | , children = $active.parent().children()
284 | , activePos = children.index($active)
285 | , that = this
286 |
287 | if (pos > (children.length - 1) || pos < 0) return
288 |
289 | if (this.sliding) {
290 | return this.$element.one('slid', function () {
291 | that.to(pos)
292 | })
293 | }
294 |
295 | if (activePos == pos) {
296 | return this.pause().cycle()
297 | }
298 |
299 | return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
300 | }
301 |
302 | , pause: function () {
303 | clearInterval(this.interval)
304 | return this
305 | }
306 |
307 | , next: function () {
308 | if (this.sliding) return
309 | return this.slide('next')
310 | }
311 |
312 | , prev: function () {
313 | if (this.sliding) return
314 | return this.slide('prev')
315 | }
316 |
317 | , slide: function (type, next) {
318 | var $active = this.$element.find('.active')
319 | , $next = next || $active[type]()
320 | , isCycling = this.interval
321 | , direction = type == 'next' ? 'left' : 'right'
322 | , fallback = type == 'next' ? 'first' : 'last'
323 | , that = this
324 |
325 | this.sliding = true
326 |
327 | isCycling && this.pause()
328 |
329 | $next = $next.length ? $next : this.$element.find('.item')[fallback]()
330 |
331 | if (!$.support.transition && this.$element.hasClass('slide')) {
332 | this.$element.trigger('slide')
333 | $active.removeClass('active')
334 | $next.addClass('active')
335 | this.sliding = false
336 | this.$element.trigger('slid')
337 | } else {
338 | $next.addClass(type)
339 | $next[0].offsetWidth // force reflow
340 | $active.addClass(direction)
341 | $next.addClass(direction)
342 | this.$element.trigger('slide')
343 | this.$element.one($.support.transition.end, function () {
344 | $next.removeClass([type, direction].join(' ')).addClass('active')
345 | $active.removeClass(['active', direction].join(' '))
346 | that.sliding = false
347 | setTimeout(function () { that.$element.trigger('slid') }, 0)
348 | })
349 | }
350 |
351 | isCycling && this.cycle()
352 |
353 | return this
354 | }
355 |
356 | }
357 |
358 |
359 | /* CAROUSEL PLUGIN DEFINITION
360 | * ========================== */
361 |
362 | $.fn.carousel = function ( option ) {
363 | return this.each(function () {
364 | var $this = $(this)
365 | , data = $this.data('carousel')
366 | , options = typeof option == 'object' && option
367 | if (!data) $this.data('carousel', (data = new Carousel(this, options)))
368 | if (typeof option == 'number') data.to(option)
369 | else if (typeof option == 'string' || (option = options.slide)) data[option]()
370 | else data.cycle()
371 | })
372 | }
373 |
374 | $.fn.carousel.defaults = {
375 | interval: 5000
376 | }
377 |
378 | $.fn.carousel.Constructor = Carousel
379 |
380 |
381 | /* CAROUSEL DATA-API
382 | * ================= */
383 |
384 | $(function () {
385 | $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
386 | var $this = $(this), href
387 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
388 | , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
389 | $target.carousel(options)
390 | e.preventDefault()
391 | })
392 | })
393 |
394 | }( window.jQuery )
395 | /* =============================================================
396 | * bootstrap-collapse.js v2.0.0
397 | * http://twitter.github.com/bootstrap/javascript.html#collapse
398 | * =============================================================
399 | * Copyright 2012 Twitter, Inc.
400 | *
401 | * Licensed under the Apache License, Version 2.0 (the "License");
402 | * you may not use this file except in compliance with the License.
403 | * You may obtain a copy of the License at
404 | *
405 | * http://www.apache.org/licenses/LICENSE-2.0
406 | *
407 | * Unless required by applicable law or agreed to in writing, software
408 | * distributed under the License is distributed on an "AS IS" BASIS,
409 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
410 | * See the License for the specific language governing permissions and
411 | * limitations under the License.
412 | * ============================================================ */
413 |
414 | !function( $ ){
415 |
416 | "use strict"
417 |
418 | var Collapse = function ( element, options ) {
419 | this.$element = $(element)
420 | this.options = $.extend({}, $.fn.collapse.defaults, options)
421 |
422 | if (this.options["parent"]) {
423 | this.$parent = $(this.options["parent"])
424 | }
425 |
426 | this.options.toggle && this.toggle()
427 | }
428 |
429 | Collapse.prototype = {
430 |
431 | constructor: Collapse
432 |
433 | , dimension: function () {
434 | var hasWidth = this.$element.hasClass('width')
435 | return hasWidth ? 'width' : 'height'
436 | }
437 |
438 | , show: function () {
439 | var dimension = this.dimension()
440 | , scroll = $.camelCase(['scroll', dimension].join('-'))
441 | , actives = this.$parent && this.$parent.find('.in')
442 | , hasData
443 |
444 | if (actives && actives.length) {
445 | hasData = actives.data('collapse')
446 | actives.collapse('hide')
447 | hasData || actives.data('collapse', null)
448 | }
449 |
450 | this.$element[dimension](0)
451 | this.transition('addClass', 'show', 'shown')
452 | this.$element[dimension](this.$element[0][scroll])
453 |
454 | }
455 |
456 | , hide: function () {
457 | var dimension = this.dimension()
458 | this.reset(this.$element[dimension]())
459 | this.transition('removeClass', 'hide', 'hidden')
460 | this.$element[dimension](0)
461 | }
462 |
463 | , reset: function ( size ) {
464 | var dimension = this.dimension()
465 |
466 | this.$element
467 | .removeClass('collapse')
468 | [dimension](size || 'auto')
469 | [0].offsetWidth
470 |
471 | this.$element.addClass('collapse')
472 | }
473 |
474 | , transition: function ( method, startEvent, completeEvent ) {
475 | var that = this
476 | , complete = function () {
477 | if (startEvent == 'show') that.reset()
478 | that.$element.trigger(completeEvent)
479 | }
480 |
481 | this.$element
482 | .trigger(startEvent)
483 | [method]('in')
484 |
485 | $.support.transition && this.$element.hasClass('collapse') ?
486 | this.$element.one($.support.transition.end, complete) :
487 | complete()
488 | }
489 |
490 | , toggle: function () {
491 | this[this.$element.hasClass('in') ? 'hide' : 'show']()
492 | }
493 |
494 | }
495 |
496 | /* COLLAPSIBLE PLUGIN DEFINITION
497 | * ============================== */
498 |
499 | $.fn.collapse = function ( option ) {
500 | return this.each(function () {
501 | var $this = $(this)
502 | , data = $this.data('collapse')
503 | , options = typeof option == 'object' && option
504 | if (!data) $this.data('collapse', (data = new Collapse(this, options)))
505 | if (typeof option == 'string') data[option]()
506 | })
507 | }
508 |
509 | $.fn.collapse.defaults = {
510 | toggle: true
511 | }
512 |
513 | $.fn.collapse.Constructor = Collapse
514 |
515 |
516 | /* COLLAPSIBLE DATA-API
517 | * ==================== */
518 |
519 | $(function () {
520 | $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
521 | var $this = $(this), href
522 | , target = $this.attr('data-target')
523 | || e.preventDefault()
524 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
525 | , option = $(target).data('collapse') ? 'toggle' : $this.data()
526 | $(target).collapse(option)
527 | })
528 | })
529 |
530 | }( window.jQuery )
531 | /* ============================================================
532 | * bootstrap-dropdown.js v2.0.0
533 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns
534 | * ============================================================
535 | * Copyright 2012 Twitter, Inc.
536 | *
537 | * Licensed under the Apache License, Version 2.0 (the "License");
538 | * you may not use this file except in compliance with the License.
539 | * You may obtain a copy of the License at
540 | *
541 | * http://www.apache.org/licenses/LICENSE-2.0
542 | *
543 | * Unless required by applicable law or agreed to in writing, software
544 | * distributed under the License is distributed on an "AS IS" BASIS,
545 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
546 | * See the License for the specific language governing permissions and
547 | * limitations under the License.
548 | * ============================================================ */
549 |
550 |
551 | !function( $ ){
552 |
553 | "use strict"
554 |
555 | /* DROPDOWN CLASS DEFINITION
556 | * ========================= */
557 |
558 | var toggle = '[data-toggle="dropdown"]'
559 | , Dropdown = function ( element ) {
560 | var $el = $(element).on('click.dropdown.data-api', this.toggle)
561 | $('html').on('click.dropdown.data-api', function () {
562 | $el.parent().removeClass('open')
563 | })
564 | }
565 |
566 | Dropdown.prototype = {
567 |
568 | constructor: Dropdown
569 |
570 | , toggle: function ( e ) {
571 | var $this = $(this)
572 | , selector = $this.attr('data-target')
573 | , $parent
574 | , isActive
575 |
576 | if (!selector) {
577 | selector = $this.attr('href')
578 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
579 | }
580 |
581 | $parent = $(selector)
582 | $parent.length || ($parent = $this.parent())
583 |
584 | isActive = $parent.hasClass('open')
585 |
586 | clearMenus()
587 | !isActive && $parent.toggleClass('open')
588 |
589 | return false
590 | }
591 |
592 | }
593 |
594 | function clearMenus() {
595 | $(toggle).parent().removeClass('open')
596 | }
597 |
598 |
599 | /* DROPDOWN PLUGIN DEFINITION
600 | * ========================== */
601 |
602 | $.fn.dropdown = function ( option ) {
603 | return this.each(function () {
604 | var $this = $(this)
605 | , data = $this.data('dropdown')
606 | if (!data) $this.data('dropdown', (data = new Dropdown(this)))
607 | if (typeof option == 'string') data[option].call($this)
608 | })
609 | }
610 |
611 | $.fn.dropdown.Constructor = Dropdown
612 |
613 |
614 | /* APPLY TO STANDARD DROPDOWN ELEMENTS
615 | * =================================== */
616 |
617 | $(function () {
618 | $('html').on('click.dropdown.data-api', clearMenus)
619 | $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
620 | })
621 |
622 | }( window.jQuery )
623 | /* =========================================================
624 | * bootstrap-modal.js v2.0.0
625 | * http://twitter.github.com/bootstrap/javascript.html#modals
626 | * =========================================================
627 | * Copyright 2012 Twitter, Inc.
628 | *
629 | * Licensed under the Apache License, Version 2.0 (the "License");
630 | * you may not use this file except in compliance with the License.
631 | * You may obtain a copy of the License at
632 | *
633 | * http://www.apache.org/licenses/LICENSE-2.0
634 | *
635 | * Unless required by applicable law or agreed to in writing, software
636 | * distributed under the License is distributed on an "AS IS" BASIS,
637 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
638 | * See the License for the specific language governing permissions and
639 | * limitations under the License.
640 | * ========================================================= */
641 |
642 |
643 | !function( $ ){
644 |
645 | "use strict"
646 |
647 | /* MODAL CLASS DEFINITION
648 | * ====================== */
649 |
650 | var Modal = function ( content, options ) {
651 | this.options = $.extend({}, $.fn.modal.defaults, options)
652 | this.$element = $(content)
653 | .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
654 | }
655 |
656 | Modal.prototype = {
657 |
658 | constructor: Modal
659 |
660 | , toggle: function () {
661 | return this[!this.isShown ? 'show' : 'hide']()
662 | }
663 |
664 | , show: function () {
665 | var that = this
666 |
667 | if (this.isShown) return
668 |
669 | $('body').addClass('modal-open')
670 |
671 | this.isShown = true
672 | this.$element.trigger('show')
673 |
674 | escape.call(this)
675 | backdrop.call(this, function () {
676 | var transition = $.support.transition && that.$element.hasClass('fade')
677 |
678 | !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
679 |
680 | that.$element
681 | .show()
682 |
683 | if (transition) {
684 | that.$element[0].offsetWidth // force reflow
685 | }
686 |
687 | that.$element.addClass('in')
688 |
689 | transition ?
690 | that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
691 | that.$element.trigger('shown')
692 |
693 | })
694 | }
695 |
696 | , hide: function ( e ) {
697 | e && e.preventDefault()
698 |
699 | if (!this.isShown) return
700 |
701 | var that = this
702 | this.isShown = false
703 |
704 | $('body').removeClass('modal-open')
705 |
706 | escape.call(this)
707 |
708 | this.$element
709 | .trigger('hide')
710 | .removeClass('in')
711 |
712 | $.support.transition && this.$element.hasClass('fade') ?
713 | hideWithTransition.call(this) :
714 | hideModal.call(this)
715 | }
716 |
717 | }
718 |
719 |
720 | /* MODAL PRIVATE METHODS
721 | * ===================== */
722 |
723 | function hideWithTransition() {
724 | var that = this
725 | , timeout = setTimeout(function () {
726 | that.$element.off($.support.transition.end)
727 | hideModal.call(that)
728 | }, 500)
729 |
730 | this.$element.one($.support.transition.end, function () {
731 | clearTimeout(timeout)
732 | hideModal.call(that)
733 | })
734 | }
735 |
736 | function hideModal( that ) {
737 | this.$element
738 | .hide()
739 | .trigger('hidden')
740 |
741 | backdrop.call(this)
742 | }
743 |
744 | function backdrop( callback ) {
745 | var that = this
746 | , animate = this.$element.hasClass('fade') ? 'fade' : ''
747 |
748 | if (this.isShown && this.options.backdrop) {
749 | var doAnimate = $.support.transition && animate
750 |
751 | this.$backdrop = $('')
752 | .appendTo(document.body)
753 |
754 | if (this.options.backdrop != 'static') {
755 | this.$backdrop.click($.proxy(this.hide, this))
756 | }
757 |
758 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
759 |
760 | this.$backdrop.addClass('in')
761 |
762 | doAnimate ?
763 | this.$backdrop.one($.support.transition.end, callback) :
764 | callback()
765 |
766 | } else if (!this.isShown && this.$backdrop) {
767 | this.$backdrop.removeClass('in')
768 |
769 | $.support.transition && this.$element.hasClass('fade')?
770 | this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
771 | removeBackdrop.call(this)
772 |
773 | } else if (callback) {
774 | callback()
775 | }
776 | }
777 |
778 | function removeBackdrop() {
779 | this.$backdrop.remove()
780 | this.$backdrop = null
781 | }
782 |
783 | function escape() {
784 | var that = this
785 | if (this.isShown && this.options.keyboard) {
786 | $(document).on('keyup.dismiss.modal', function ( e ) {
787 | e.which == 27 && that.hide()
788 | })
789 | } else if (!this.isShown) {
790 | $(document).off('keyup.dismiss.modal')
791 | }
792 | }
793 |
794 |
795 | /* MODAL PLUGIN DEFINITION
796 | * ======================= */
797 |
798 | $.fn.modal = function ( option ) {
799 | return this.each(function () {
800 | var $this = $(this)
801 | , data = $this.data('modal')
802 | , options = typeof option == 'object' && option
803 | if (!data) $this.data('modal', (data = new Modal(this, options)))
804 | if (typeof option == 'string') data[option]()
805 | else data.show()
806 | })
807 | }
808 |
809 | $.fn.modal.defaults = {
810 | backdrop: true
811 | , keyboard: true
812 | }
813 |
814 | $.fn.modal.Constructor = Modal
815 |
816 |
817 | /* MODAL DATA-API
818 | * ============== */
819 |
820 | $(function () {
821 | $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
822 | var $this = $(this), href
823 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
824 | , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
825 |
826 | e.preventDefault()
827 | $target.modal(option)
828 | })
829 | })
830 |
831 | }( window.jQuery )
832 | /* ===========================================================
833 | * bootstrap-tooltip.js v2.0.0
834 | * http://twitter.github.com/bootstrap/javascript.html#tooltips
835 | * Inspired by the original jQuery.tipsy by Jason Frame
836 | * ===========================================================
837 | * Copyright 2012 Twitter, Inc.
838 | *
839 | * Licensed under the Apache License, Version 2.0 (the "License");
840 | * you may not use this file except in compliance with the License.
841 | * You may obtain a copy of the License at
842 | *
843 | * http://www.apache.org/licenses/LICENSE-2.0
844 | *
845 | * Unless required by applicable law or agreed to in writing, software
846 | * distributed under the License is distributed on an "AS IS" BASIS,
847 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
848 | * See the License for the specific language governing permissions and
849 | * limitations under the License.
850 | * ========================================================== */
851 |
852 | !function( $ ) {
853 |
854 | "use strict"
855 |
856 | /* TOOLTIP PUBLIC CLASS DEFINITION
857 | * =============================== */
858 |
859 | var Tooltip = function ( element, options ) {
860 | this.init('tooltip', element, options)
861 | }
862 |
863 | Tooltip.prototype = {
864 |
865 | constructor: Tooltip
866 |
867 | , init: function ( type, element, options ) {
868 | var eventIn
869 | , eventOut
870 |
871 | this.type = type
872 | this.$element = $(element)
873 | this.options = this.getOptions(options)
874 | this.enabled = true
875 |
876 | if (this.options.trigger != 'manual') {
877 | eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
878 | eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
879 | this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
880 | this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
881 | }
882 |
883 | this.options.selector ?
884 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
885 | this.fixTitle()
886 | }
887 |
888 | , getOptions: function ( options ) {
889 | options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
890 |
891 | if (options.delay && typeof options.delay == 'number') {
892 | options.delay = {
893 | show: options.delay
894 | , hide: options.delay
895 | }
896 | }
897 |
898 | return options
899 | }
900 |
901 | , enter: function ( e ) {
902 | var self = $(e.currentTarget)[this.type](this._options).data(this.type)
903 |
904 | if (!self.options.delay || !self.options.delay.show) {
905 | self.show()
906 | } else {
907 | self.hoverState = 'in'
908 | setTimeout(function() {
909 | if (self.hoverState == 'in') {
910 | self.show()
911 | }
912 | }, self.options.delay.show)
913 | }
914 | }
915 |
916 | , leave: function ( e ) {
917 | var self = $(e.currentTarget)[this.type](this._options).data(this.type)
918 |
919 | if (!self.options.delay || !self.options.delay.hide) {
920 | self.hide()
921 | } else {
922 | self.hoverState = 'out'
923 | setTimeout(function() {
924 | if (self.hoverState == 'out') {
925 | self.hide()
926 | }
927 | }, self.options.delay.hide)
928 | }
929 | }
930 |
931 | , show: function () {
932 | var $tip
933 | , inside
934 | , pos
935 | , actualWidth
936 | , actualHeight
937 | , placement
938 | , tp
939 |
940 | if (this.hasContent() && this.enabled) {
941 | $tip = this.tip()
942 | this.setContent()
943 |
944 | if (this.options.animation) {
945 | $tip.addClass('fade')
946 | }
947 |
948 | placement = typeof this.options.placement == 'function' ?
949 | this.options.placement.call(this, $tip[0], this.$element[0]) :
950 | this.options.placement
951 |
952 | inside = /in/.test(placement)
953 |
954 | $tip
955 | .remove()
956 | .css({ top: 0, left: 0, display: 'block' })
957 | .appendTo(inside ? this.$element : document.body)
958 |
959 | pos = this.getPosition(inside)
960 |
961 | actualWidth = $tip[0].offsetWidth
962 | actualHeight = $tip[0].offsetHeight
963 |
964 | switch (inside ? placement.split(' ')[1] : placement) {
965 | case 'bottom':
966 | tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
967 | break
968 | case 'top':
969 | tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
970 | break
971 | case 'left':
972 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
973 | break
974 | case 'right':
975 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
976 | break
977 | }
978 |
979 | $tip
980 | .css(tp)
981 | .addClass(placement)
982 | .addClass('in')
983 | }
984 | }
985 |
986 | , setContent: function () {
987 | var $tip = this.tip()
988 | $tip.find('.tooltip-inner').html(this.getTitle())
989 | $tip.removeClass('fade in top bottom left right')
990 | }
991 |
992 | , hide: function () {
993 | var that = this
994 | , $tip = this.tip()
995 |
996 | $tip.removeClass('in')
997 |
998 | function removeWithAnimation() {
999 | var timeout = setTimeout(function () {
1000 | $tip.off($.support.transition.end).remove()
1001 | }, 500)
1002 |
1003 | $tip.one($.support.transition.end, function () {
1004 | clearTimeout(timeout)
1005 | $tip.remove()
1006 | })
1007 | }
1008 |
1009 | $.support.transition && this.$tip.hasClass('fade') ?
1010 | removeWithAnimation() :
1011 | $tip.remove()
1012 | }
1013 |
1014 | , fixTitle: function () {
1015 | var $e = this.$element
1016 | if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1017 | $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1018 | }
1019 | }
1020 |
1021 | , hasContent: function () {
1022 | return this.getTitle()
1023 | }
1024 |
1025 | , getPosition: function (inside) {
1026 | return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1027 | width: this.$element[0].offsetWidth
1028 | , height: this.$element[0].offsetHeight
1029 | })
1030 | }
1031 |
1032 | , getTitle: function () {
1033 | var title
1034 | , $e = this.$element
1035 | , o = this.options
1036 |
1037 | title = $e.attr('data-original-title')
1038 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1039 |
1040 | title = title.toString().replace(/(^\s*|\s*$)/, "")
1041 |
1042 | return title
1043 | }
1044 |
1045 | , tip: function () {
1046 | return this.$tip = this.$tip || $(this.options.template)
1047 | }
1048 |
1049 | , validate: function () {
1050 | if (!this.$element[0].parentNode) {
1051 | this.hide()
1052 | this.$element = null
1053 | this.options = null
1054 | }
1055 | }
1056 |
1057 | , enable: function () {
1058 | this.enabled = true
1059 | }
1060 |
1061 | , disable: function () {
1062 | this.enabled = false
1063 | }
1064 |
1065 | , toggleEnabled: function () {
1066 | this.enabled = !this.enabled
1067 | }
1068 |
1069 | , toggle: function () {
1070 | this[this.tip().hasClass('in') ? 'hide' : 'show']()
1071 | }
1072 |
1073 | }
1074 |
1075 |
1076 | /* TOOLTIP PLUGIN DEFINITION
1077 | * ========================= */
1078 |
1079 | $.fn.tooltip = function ( option ) {
1080 | return this.each(function () {
1081 | var $this = $(this)
1082 | , data = $this.data('tooltip')
1083 | , options = typeof option == 'object' && option
1084 | if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
1085 | if (typeof option == 'string') data[option]()
1086 | })
1087 | }
1088 |
1089 | $.fn.tooltip.Constructor = Tooltip
1090 |
1091 | $.fn.tooltip.defaults = {
1092 | animation: true
1093 | , delay: 0
1094 | , selector: false
1095 | , placement: 'top'
1096 | , trigger: 'hover'
1097 | , title: ''
1098 | , template: '
'
1099 | }
1100 |
1101 | }( window.jQuery )
1102 | /* ===========================================================
1103 | * bootstrap-popover.js v2.0.0
1104 | * http://twitter.github.com/bootstrap/javascript.html#popovers
1105 | * ===========================================================
1106 | * Copyright 2012 Twitter, Inc.
1107 | *
1108 | * Licensed under the Apache License, Version 2.0 (the "License");
1109 | * you may not use this file except in compliance with the License.
1110 | * You may obtain a copy of the License at
1111 | *
1112 | * http://www.apache.org/licenses/LICENSE-2.0
1113 | *
1114 | * Unless required by applicable law or agreed to in writing, software
1115 | * distributed under the License is distributed on an "AS IS" BASIS,
1116 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1117 | * See the License for the specific language governing permissions and
1118 | * limitations under the License.
1119 | * =========================================================== */
1120 |
1121 |
1122 | !function( $ ) {
1123 |
1124 | "use strict"
1125 |
1126 | var Popover = function ( element, options ) {
1127 | this.init('popover', element, options)
1128 | }
1129 |
1130 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1131 | ========================================== */
1132 |
1133 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
1134 |
1135 | constructor: Popover
1136 |
1137 | , setContent: function () {
1138 | var $tip = this.tip()
1139 | , title = this.getTitle()
1140 | , content = this.getContent()
1141 |
1142 | $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
1143 | $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
1144 |
1145 | $tip.removeClass('fade top bottom left right in')
1146 | }
1147 |
1148 | , hasContent: function () {
1149 | return this.getTitle() || this.getContent()
1150 | }
1151 |
1152 | , getContent: function () {
1153 | var content
1154 | , $e = this.$element
1155 | , o = this.options
1156 |
1157 | content = $e.attr('data-content')
1158 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1159 |
1160 | content = content.toString().replace(/(^\s*|\s*$)/, "")
1161 |
1162 | return content
1163 | }
1164 |
1165 | , tip: function() {
1166 | if (!this.$tip) {
1167 | this.$tip = $(this.options.template)
1168 | }
1169 | return this.$tip
1170 | }
1171 |
1172 | })
1173 |
1174 |
1175 | /* POPOVER PLUGIN DEFINITION
1176 | * ======================= */
1177 |
1178 | $.fn.popover = function ( option ) {
1179 | return this.each(function () {
1180 | var $this = $(this)
1181 | , data = $this.data('popover')
1182 | , options = typeof option == 'object' && option
1183 | if (!data) $this.data('popover', (data = new Popover(this, options)))
1184 | if (typeof option == 'string') data[option]()
1185 | })
1186 | }
1187 |
1188 | $.fn.popover.Constructor = Popover
1189 |
1190 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
1191 | placement: 'right'
1192 | , content: ''
1193 | , template: '
'
1194 | })
1195 |
1196 | }( window.jQuery )
1197 | /* =============================================================
1198 | * bootstrap-scrollspy.js v2.0.0
1199 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1200 | * =============================================================
1201 | * Copyright 2012 Twitter, Inc.
1202 | *
1203 | * Licensed under the Apache License, Version 2.0 (the "License");
1204 | * you may not use this file except in compliance with the License.
1205 | * You may obtain a copy of the License at
1206 | *
1207 | * http://www.apache.org/licenses/LICENSE-2.0
1208 | *
1209 | * Unless required by applicable law or agreed to in writing, software
1210 | * distributed under the License is distributed on an "AS IS" BASIS,
1211 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 | * See the License for the specific language governing permissions and
1213 | * limitations under the License.
1214 | * ============================================================== */
1215 |
1216 | !function ( $ ) {
1217 |
1218 | "use strict"
1219 |
1220 | /* SCROLLSPY CLASS DEFINITION
1221 | * ========================== */
1222 |
1223 | function ScrollSpy( element, options) {
1224 | var process = $.proxy(this.process, this)
1225 | , $element = $(element).is('body') ? $(window) : $(element)
1226 | , href
1227 | this.options = $.extend({}, $.fn.scrollspy.defaults, options)
1228 | this.$scrollElement = $element.on('scroll.scroll.data-api', process)
1229 | this.selector = (this.options.target
1230 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1231 | || '') + ' .nav li > a'
1232 | this.$body = $('body').on('click.scroll.data-api', this.selector, process)
1233 | this.refresh()
1234 | this.process()
1235 | }
1236 |
1237 | ScrollSpy.prototype = {
1238 |
1239 | constructor: ScrollSpy
1240 |
1241 | , refresh: function () {
1242 | this.targets = this.$body
1243 | .find(this.selector)
1244 | .map(function () {
1245 | var href = $(this).attr('href')
1246 | return /^#\w/.test(href) && $(href).length ? href : null
1247 | })
1248 |
1249 | this.offsets = $.map(this.targets, function (id) {
1250 | return $(id).position().top
1251 | })
1252 | }
1253 |
1254 | , process: function () {
1255 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1256 | , offsets = this.offsets
1257 | , targets = this.targets
1258 | , activeTarget = this.activeTarget
1259 | , i
1260 |
1261 | for (i = offsets.length; i--;) {
1262 | activeTarget != targets[i]
1263 | && scrollTop >= offsets[i]
1264 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1265 | && this.activate( targets[i] )
1266 | }
1267 | }
1268 |
1269 | , activate: function (target) {
1270 | var active
1271 |
1272 | this.activeTarget = target
1273 |
1274 | this.$body
1275 | .find(this.selector).parent('.active')
1276 | .removeClass('active')
1277 |
1278 | active = this.$body
1279 | .find(this.selector + '[href="' + target + '"]')
1280 | .parent('li')
1281 | .addClass('active')
1282 |
1283 | if ( active.parent('.dropdown-menu') ) {
1284 | active.closest('li.dropdown').addClass('active')
1285 | }
1286 | }
1287 |
1288 | }
1289 |
1290 |
1291 | /* SCROLLSPY PLUGIN DEFINITION
1292 | * =========================== */
1293 |
1294 | $.fn.scrollspy = function ( option ) {
1295 | return this.each(function () {
1296 | var $this = $(this)
1297 | , data = $this.data('scrollspy')
1298 | , options = typeof option == 'object' && option
1299 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
1300 | if (typeof option == 'string') data[option]()
1301 | })
1302 | }
1303 |
1304 | $.fn.scrollspy.Constructor = ScrollSpy
1305 |
1306 | $.fn.scrollspy.defaults = {
1307 | offset: 10
1308 | }
1309 |
1310 |
1311 | /* SCROLLSPY DATA-API
1312 | * ================== */
1313 |
1314 | $(function () {
1315 | $('[data-spy="scroll"]').each(function () {
1316 | var $spy = $(this)
1317 | $spy.scrollspy($spy.data())
1318 | })
1319 | })
1320 |
1321 | }( window.jQuery )
1322 | /* ========================================================
1323 | * bootstrap-tab.js v2.0.0
1324 | * http://twitter.github.com/bootstrap/javascript.html#tabs
1325 | * ========================================================
1326 | * Copyright 2012 Twitter, Inc.
1327 | *
1328 | * Licensed under the Apache License, Version 2.0 (the "License");
1329 | * you may not use this file except in compliance with the License.
1330 | * You may obtain a copy of the License at
1331 | *
1332 | * http://www.apache.org/licenses/LICENSE-2.0
1333 | *
1334 | * Unless required by applicable law or agreed to in writing, software
1335 | * distributed under the License is distributed on an "AS IS" BASIS,
1336 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1337 | * See the License for the specific language governing permissions and
1338 | * limitations under the License.
1339 | * ======================================================== */
1340 |
1341 |
1342 | !function( $ ){
1343 |
1344 | "use strict"
1345 |
1346 | /* TAB CLASS DEFINITION
1347 | * ==================== */
1348 |
1349 | var Tab = function ( element ) {
1350 | this.element = $(element)
1351 | }
1352 |
1353 | Tab.prototype = {
1354 |
1355 | constructor: Tab
1356 |
1357 | , show: function () {
1358 | var $this = this.element
1359 | , $ul = $this.closest('ul:not(.dropdown-menu)')
1360 | , selector = $this.attr('data-target')
1361 | , previous
1362 | , $target
1363 |
1364 | if (!selector) {
1365 | selector = $this.attr('href')
1366 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1367 | }
1368 |
1369 | if ( $this.parent('li').hasClass('active') ) return
1370 |
1371 | previous = $ul.find('.active a').last()[0]
1372 |
1373 | $this.trigger({
1374 | type: 'show'
1375 | , relatedTarget: previous
1376 | })
1377 |
1378 | $target = $(selector)
1379 |
1380 | this.activate($this.parent('li'), $ul)
1381 | this.activate($target, $target.parent(), function () {
1382 | $this.trigger({
1383 | type: 'shown'
1384 | , relatedTarget: previous
1385 | })
1386 | })
1387 | }
1388 |
1389 | , activate: function ( element, container, callback) {
1390 | var $active = container.find('> .active')
1391 | , transition = callback
1392 | && $.support.transition
1393 | && $active.hasClass('fade')
1394 |
1395 | function next() {
1396 | $active
1397 | .removeClass('active')
1398 | .find('> .dropdown-menu > .active')
1399 | .removeClass('active')
1400 |
1401 | element.addClass('active')
1402 |
1403 | if (transition) {
1404 | element[0].offsetWidth // reflow for transition
1405 | element.addClass('in')
1406 | } else {
1407 | element.removeClass('fade')
1408 | }
1409 |
1410 | if ( element.parent('.dropdown-menu') ) {
1411 | element.closest('li.dropdown').addClass('active')
1412 | }
1413 |
1414 | callback && callback()
1415 | }
1416 |
1417 | transition ?
1418 | $active.one($.support.transition.end, next) :
1419 | next()
1420 |
1421 | $active.removeClass('in')
1422 | }
1423 | }
1424 |
1425 |
1426 | /* TAB PLUGIN DEFINITION
1427 | * ===================== */
1428 |
1429 | $.fn.tab = function ( option ) {
1430 | return this.each(function () {
1431 | var $this = $(this)
1432 | , data = $this.data('tab')
1433 | if (!data) $this.data('tab', (data = new Tab(this)))
1434 | if (typeof option == 'string') data[option]()
1435 | })
1436 | }
1437 |
1438 | $.fn.tab.Constructor = Tab
1439 |
1440 |
1441 | /* TAB DATA-API
1442 | * ============ */
1443 |
1444 | $(function () {
1445 | $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1446 | e.preventDefault()
1447 | $(this).tab('show')
1448 | })
1449 | })
1450 |
1451 | }( window.jQuery )
1452 | /* =============================================================
1453 | * bootstrap-typeahead.js v2.0.0
1454 | * http://twitter.github.com/bootstrap/javascript.html#typeahead
1455 | * =============================================================
1456 | * Copyright 2012 Twitter, Inc.
1457 | *
1458 | * Licensed under the Apache License, Version 2.0 (the "License");
1459 | * you may not use this file except in compliance with the License.
1460 | * You may obtain a copy of the License at
1461 | *
1462 | * http://www.apache.org/licenses/LICENSE-2.0
1463 | *
1464 | * Unless required by applicable law or agreed to in writing, software
1465 | * distributed under the License is distributed on an "AS IS" BASIS,
1466 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1467 | * See the License for the specific language governing permissions and
1468 | * limitations under the License.
1469 | * ============================================================ */
1470 |
1471 | !function( $ ){
1472 |
1473 | "use strict"
1474 |
1475 | var Typeahead = function ( element, options ) {
1476 | this.$element = $(element)
1477 | this.options = $.extend({}, $.fn.typeahead.defaults, options)
1478 | this.matcher = this.options.matcher || this.matcher
1479 | this.sorter = this.options.sorter || this.sorter
1480 | this.highlighter = this.options.highlighter || this.highlighter
1481 | this.$menu = $(this.options.menu).appendTo('body')
1482 | this.source = this.options.source
1483 | this.shown = false
1484 | this.listen()
1485 | }
1486 |
1487 | Typeahead.prototype = {
1488 |
1489 | constructor: Typeahead
1490 |
1491 | , select: function () {
1492 | var val = this.$menu.find('.active').attr('data-value')
1493 | this.$element.val(val)
1494 | return this.hide()
1495 | }
1496 |
1497 | , show: function () {
1498 | var pos = $.extend({}, this.$element.offset(), {
1499 | height: this.$element[0].offsetHeight
1500 | })
1501 |
1502 | this.$menu.css({
1503 | top: pos.top + pos.height
1504 | , left: pos.left
1505 | })
1506 |
1507 | this.$menu.show()
1508 | this.shown = true
1509 | return this
1510 | }
1511 |
1512 | , hide: function () {
1513 | this.$menu.hide()
1514 | this.shown = false
1515 | return this
1516 | }
1517 |
1518 | , lookup: function (event) {
1519 | var that = this
1520 | , items
1521 | , q
1522 |
1523 | this.query = this.$element.val()
1524 |
1525 | if (!this.query) {
1526 | return this.shown ? this.hide() : this
1527 | }
1528 |
1529 | items = $.grep(this.source, function (item) {
1530 | if (that.matcher(item)) return item
1531 | })
1532 |
1533 | items = this.sorter(items)
1534 |
1535 | if (!items.length) {
1536 | return this.shown ? this.hide() : this
1537 | }
1538 |
1539 | return this.render(items.slice(0, this.options.items)).show()
1540 | }
1541 |
1542 | , matcher: function (item) {
1543 | return ~item.toLowerCase().indexOf(this.query.toLowerCase())
1544 | }
1545 |
1546 | , sorter: function (items) {
1547 | var beginswith = []
1548 | , caseSensitive = []
1549 | , caseInsensitive = []
1550 | , item
1551 |
1552 | while (item = items.shift()) {
1553 | if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
1554 | else if (~item.indexOf(this.query)) caseSensitive.push(item)
1555 | else caseInsensitive.push(item)
1556 | }
1557 |
1558 | return beginswith.concat(caseSensitive, caseInsensitive)
1559 | }
1560 |
1561 | , highlighter: function (item) {
1562 | return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) {
1563 | return '' + match + ''
1564 | })
1565 | }
1566 |
1567 | , render: function (items) {
1568 | var that = this
1569 |
1570 | items = $(items).map(function (i, item) {
1571 | i = $(that.options.item).attr('data-value', item)
1572 | i.find('a').html(that.highlighter(item))
1573 | return i[0]
1574 | })
1575 |
1576 | items.first().addClass('active')
1577 | this.$menu.html(items)
1578 | return this
1579 | }
1580 |
1581 | , next: function (event) {
1582 | var active = this.$menu.find('.active').removeClass('active')
1583 | , next = active.next()
1584 |
1585 | if (!next.length) {
1586 | next = $(this.$menu.find('li')[0])
1587 | }
1588 |
1589 | next.addClass('active')
1590 | }
1591 |
1592 | , prev: function (event) {
1593 | var active = this.$menu.find('.active').removeClass('active')
1594 | , prev = active.prev()
1595 |
1596 | if (!prev.length) {
1597 | prev = this.$menu.find('li').last()
1598 | }
1599 |
1600 | prev.addClass('active')
1601 | }
1602 |
1603 | , listen: function () {
1604 | this.$element
1605 | .on('blur', $.proxy(this.blur, this))
1606 | .on('keypress', $.proxy(this.keypress, this))
1607 | .on('keyup', $.proxy(this.keyup, this))
1608 |
1609 | if ($.browser.webkit || $.browser.msie) {
1610 | this.$element.on('keydown', $.proxy(this.keypress, this))
1611 | }
1612 |
1613 | this.$menu
1614 | .on('click', $.proxy(this.click, this))
1615 | .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
1616 | }
1617 |
1618 | , keyup: function (e) {
1619 | e.stopPropagation()
1620 | e.preventDefault()
1621 |
1622 | switch(e.keyCode) {
1623 | case 40: // down arrow
1624 | case 38: // up arrow
1625 | break
1626 |
1627 | case 9: // tab
1628 | case 13: // enter
1629 | if (!this.shown) return
1630 | this.select()
1631 | break
1632 |
1633 | case 27: // escape
1634 | this.hide()
1635 | break
1636 |
1637 | default:
1638 | this.lookup()
1639 | }
1640 |
1641 | }
1642 |
1643 | , keypress: function (e) {
1644 | e.stopPropagation()
1645 | if (!this.shown) return
1646 |
1647 | switch(e.keyCode) {
1648 | case 9: // tab
1649 | case 13: // enter
1650 | case 27: // escape
1651 | e.preventDefault()
1652 | break
1653 |
1654 | case 38: // up arrow
1655 | e.preventDefault()
1656 | this.prev()
1657 | break
1658 |
1659 | case 40: // down arrow
1660 | e.preventDefault()
1661 | this.next()
1662 | break
1663 | }
1664 | }
1665 |
1666 | , blur: function (e) {
1667 | var that = this
1668 | e.stopPropagation()
1669 | e.preventDefault()
1670 | setTimeout(function () { that.hide() }, 150)
1671 | }
1672 |
1673 | , click: function (e) {
1674 | e.stopPropagation()
1675 | e.preventDefault()
1676 | this.select()
1677 | }
1678 |
1679 | , mouseenter: function (e) {
1680 | this.$menu.find('.active').removeClass('active')
1681 | $(e.currentTarget).addClass('active')
1682 | }
1683 |
1684 | }
1685 |
1686 |
1687 | /* TYPEAHEAD PLUGIN DEFINITION
1688 | * =========================== */
1689 |
1690 | $.fn.typeahead = function ( option ) {
1691 | return this.each(function () {
1692 | var $this = $(this)
1693 | , data = $this.data('typeahead')
1694 | , options = typeof option == 'object' && option
1695 | if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
1696 | if (typeof option == 'string') data[option]()
1697 | })
1698 | }
1699 |
1700 | $.fn.typeahead.defaults = {
1701 | source: []
1702 | , items: 8
1703 | , menu: '