66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/app/js/options.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | function addStatus(ev, status) {
4 | status = status || '';
5 | var $el = $(
6 | '');
8 |
9 | $('#statuses').append($el);
10 | $el.focus();
11 | }
12 |
13 | function save() {
14 | var statuses = [];
15 | $('#statuses input').each(function(i, el) {
16 | var status = $(el).val().trim().replace(/,/g, ',');
17 | if (status) {
18 | statuses.push(status);
19 | }
20 | });
21 | localStorage.setItem('statuses', statuses);
22 | localStorage.setItem('placeid', $('#placeid').val().trim());
23 | localStorage.setItem('geolocation', $('#geolocation').is(':checked'));
24 | localStorage.setItem('countdown', $('#countdown').val());
25 | localStorage.setItem('consumer-key', $('#consumer-key').val().trim());
26 | localStorage.setItem('shared-secret', $('#shared-secret').val().trim());
27 | localStorage.setItem('access-token', $('#access-token').val().trim());
28 | localStorage.setItem('access-secret', $('#access-secret').val().trim());
29 |
30 | chrome.tabs.getCurrent(function(tab) {
31 | chrome.tabs.remove(tab.id);
32 | });
33 | }
34 |
35 | // initialize
36 | (localStorage.getItem('statuses') || '').split(',').forEach(function(status) {
37 | addStatus(null, status.replace(/,/g, ','));
38 | });
39 | $('#placeid').val(localStorage.getItem('placeid'));
40 | $('#geolocation').prop('checked',
41 | localStorage.getItem('geolocation') === 'true');
42 | $('#countdown').val(localStorage.getItem('countdown'));
43 | $('#consumer-key').val(localStorage.getItem('consumer-key'));
44 | $('#shared-secret').val(localStorage.getItem('shared-secret'));
45 | $('#access-token').val(localStorage.getItem('access-token'));
46 | $('#access-secret').val(localStorage.getItem('access-secret'));
47 |
48 | // event handlers
49 | $('#add-status').on('click', addStatus);
50 | $('#save').on('click', save);
51 |
52 | // i18n messages, relies on a data-message attribute
53 | // TODO: there's probably a cleaner way to do this
54 | var objects = document.getElementsByTagName('*'), i;
55 | for(i = 0; i < objects.length; i++) {
56 | if (objects[i].dataset && objects[i].dataset.message) {
57 | objects[i].innerHTML = chrome.i18n.getMessage(objects[i].dataset.message);
58 | }
59 | }
60 |
61 | // disable geolocation input if using browser support
62 | $("input[id='geolocation']").click(function(){
63 | if ($(this).is(':checked')) {
64 | $('#placeid').attr("disabled", true);
65 | } else {
66 | $('#placeid').attr("disabled", false);
67 | }
68 | });
69 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Twisitor
2 |
3 | Looking to contribute something? Here's how you can help.
4 |
5 | ## Bugs reports
6 |
7 | A bug is a _demonstrable problem_ that is caused by the code in the
8 | repository. Good bug reports are extremely helpful - thank you!
9 |
10 | Guidelines for bug reports:
11 |
12 | 1. **Use the GitHub issue search** — check if the issue has already been
13 | reported.
14 |
15 | 2. **Check if the issue has been fixed** — try to reproduce it using the
16 | latest `master` or development branch in the repository.
17 |
18 | 3. **Isolate the problem** — ideally create a reduced test
19 | case and a live example.
20 |
21 | 4. Please try to be as detailed as possible in your report. Include specific
22 | information about the environment - operating system and version, browser
23 | and version, product version - and steps required to reproduce the issue.
24 |
25 |
26 | ## Feature requests & contribution enquiries
27 |
28 | Feature requests are welcome. But take a moment to find out whether your idea
29 | fits with the scope and aims of the project. It's up to *you* to make a strong
30 | case for the inclusion of your feature. Please provide as much detail and
31 | context as possible.
32 |
33 | Contribution enquiries should take place before any significant pull request,
34 | otherwise you risk spending a lot of time working on something that we might
35 | have good reasons for rejecting.
36 |
37 | ## Pull requests
38 |
39 | Good pull requests - patches, improvements, new features - are a fantastic
40 | help. They should remain focused in scope and avoid containing unrelated
41 | commits.
42 |
43 | Make sure to adhere to the coding conventions used throughout the codebase
44 | (indentation, accurate comments, etc.) and any other requirements (such as test
45 | coverage).
46 |
47 | Please follow this process; it's the best way to get your work included in the
48 | project:
49 |
50 | 1. Create a new topic branch to contain your feature, change, or fix:
51 |
52 | 2. Commit your changes in logical chunks. Provide clear and explanatory commit
53 | messages. Use git's [interactive rebase](https://help.github.com/articles/interactive-rebase)
54 | feature to tidy up your commits before making them public.
55 |
56 | 3. Locally merge (or rebase) the upstream development branch into your topic branch:
57 |
58 | 4. Push your topic branch up to your fork:
59 |
60 | 5. [Open a Pull Request](http://help.github.com/send-pull-requests/) with a
61 | clear title and description.
62 |
63 | ## License
64 |
65 | By contributing your code,
66 |
67 | You agree to license your contribution under the terms of the Apache Public License 2.0
68 | https://github.com/twitter/twisitor/blob/master/LICENSE
69 |
--------------------------------------------------------------------------------
/app/css/app.css:
--------------------------------------------------------------------------------
1 | .modal {
2 | margin-left: -335px;
3 | width: 670px;
4 | z-index: 10000;
5 | }
6 |
7 | .modal-body {
8 | max-height: 500px;
9 | }
10 |
11 | #scenePhotobooth {
12 | position: relative;
13 | height: 480px;
14 | }
15 |
16 | #monitor ,
17 | #counter ,
18 | #flash {
19 | margin: 0px;
20 | padding: 0px;
21 | position: absolute;
22 | width: 640px;
23 | height: 480px;
24 | top: 0px;
25 | left: 0px;
26 | }
27 |
28 | #monitor {
29 | -webkit-transform: matrix(-1, 0, 0, 1, 0, 0);
30 | }
31 |
32 | #counter {
33 | color: white;
34 | text-align: center;
35 | font: bold 100px sans-serif;
36 | margin-top: 175px;
37 | opacity: 0.7;
38 | }
39 |
40 | #flash {
41 | background: white;
42 | opacity: 0;
43 | }
44 |
45 | #flash.off {
46 | -webkit-animation: flashy 0.5s linear;
47 | }
48 |
49 | @-webkit-keyframes flashy {
50 | 0% { opacity: 0 }
51 | 50% { opacity: 1 }
52 | 100% { opacity: 0 }
53 | }
54 |
55 | #handlesContainer {
56 | font: bold 14px sans-serif;
57 | display: inline-block;
58 | margin-left: 280px;
59 | }
60 |
61 | .statusButton {
62 | width: 100%;
63 | height: 60px;
64 | text-align: center;
65 | white-space: normal;
66 | }
67 |
68 | #statusesContainer {
69 | width: 460px;
70 | }
71 |
72 | .thumbnail {
73 | width: 160px;
74 | height: 120px;
75 | position: absolute;
76 | top: 13px;
77 | }
78 |
79 | #sceneStatusSelection .thumbnail {
80 | right: 20px;
81 | }
82 |
83 | #sceneTwitterHandle .thumbnail {
84 | width: 250px;
85 | height: auto;
86 | }
87 |
88 | .input-prepend {
89 | margin: 5px 25px 10px 0;
90 | }
91 |
92 | #container {
93 | position: relative;
94 | margin: 0px;
95 | padding: 0px;
96 | top: 0px;
97 | left: 0px;
98 | width: 100%;
99 | height: 100%;
100 | }
101 |
102 | #btnStart {
103 | position: absolute;
104 | top: 50%;
105 | left: 50%;
106 | width: 280px;
107 | height: 280px;
108 | margin-left: -165px;
109 | margin-top: 140px;
110 | padding: 50px;
111 | -webkit-border-radius: 12px;
112 | -moz-border-radius: 12px;
113 | border-radius: 12px;
114 | border-width: 2px;
115 | cursor: pointer;
116 | }
117 |
118 | .modal.fade.in {
119 | top: 5%;
120 | }
121 |
122 | #btnTimer {
123 | background: #49AFCD url(../img/timer.png) no-repeat 4px;
124 | width: 42px;
125 | height: 42px;
126 | }
127 |
128 | #tweet {
129 | display: relative;
130 | width: 640px;
131 | height: 480px;
132 | }
133 |
134 | #tweet .footer {
135 | position: absolute;
136 | bottom: 0;
137 | color: #fff;
138 | background-color: rgba(0, 0, 0, 0.3);
139 | padding: 10px;
140 | width: 620px;
141 | }
142 |
143 | #tweet .text {
144 | display: inline-block;
145 | margin-left: 10px;
146 | vertical-align: top;
147 | max-width: 540px;
148 | }
149 |
150 | #tweet .details {
151 | color: #aaa;
152 | font-size: 83%;
153 | margin-bottom: 0;
154 | }
155 |
156 | #tweet .avatar {
157 | border-radius: 5px;
158 | }
159 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Twisitor [](https://travis-ci.org/twitter/twisitor)
2 |
3 | Twisitor is a simple and spectacular photo-tweeting birdhouse.
4 |
5 | It's developed as a Chrome application (extension).
6 |
7 | 
8 |
9 | ## Getting Started
10 |
11 | To get started, simply install Twisitor locally:
12 |
13 | * Visit `chrome:extensions` in Google Chrome
14 | * Check the "Developer mode" checkbox
15 | * Click the "Load unpacked extension..." button
16 | * Select the *app* directory, at ``/app
17 | * Select the Window->Extensions page and setup Twisitor options
18 | * Open a new tab and within there you can launch Twisitor
19 |
20 | 
21 |
22 | ## Setup
23 |
24 | ### Tweets
25 |
26 | The first thing to do is to select your pre-populated tweets.
27 |
28 | 
29 |
30 | These are the messages displayed after taking a picture.
31 |
32 | Note: {handles} is used as a the template for user specified Twitter handles
33 |
34 | ### Tweet Location
35 |
36 | Enter the *optional* location (using a placeid) your tweets should come from:
37 |
38 | 
39 |
40 | Note: You can optionally use browser geolocation support to get your location.
41 |
42 | ### Shutter Time
43 |
44 | Enter your shutter time in seconds:
45 |
46 | 
47 |
48 | ### OAuth Settings
49 |
50 | Fill in your OAuth settings for your Twitter account and application:
51 |
52 | 
53 |
54 | If you haven't done this before, create a new twitter application here: https://dev.twitter.com/apps/new
55 |
56 | ###
57 |
58 | ## Lego Birdhouse
59 |
60 | We have open sourced the design of our traveling Lego birdhouse:
61 |
62 | 
63 |
64 | See the [LEGO Birdhouse README](README-BIRDHOUSE.md) for more information.
65 |
66 | You can also open the [LXF](birdhouse.lxf) file in [Lego Digital Designer](http://ldd.lego.com/).
67 |
68 | ## Kiosk Mode
69 |
70 | Are you running in Kiosk Mode?
71 |
72 | Make sure Chrome was started with `--disable-dev-tools`
73 |
74 | Another option is to:
75 | * Edit `/Users//Library/Application Support/Google/Chrome/Default/Preferences`
76 | * Add `disabled: true` to `devtools`
77 |
78 | ## Authors and Contributors
79 |
80 | * Marcel Duran
81 | * Mo Kudeki
82 | * Chris Aniszczyk
83 | * Wenyu Zhang
84 |
85 | A special thanks to:
86 | * Nick Fisher
87 | * Adam Nace
88 | * Laura Chan
89 | * Olga Safronova
90 | * Louise Chow
91 | * Adelin Cai
92 | * Henna Kermani
93 | * Bryan Innes
94 | * Doug Grismore (for the lego birdhouse)
95 |
96 | ## License
97 | Copyright 2013 Twitter, Inc and other contributors.
98 |
99 | Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
100 |
--------------------------------------------------------------------------------
/README-BIRDHOUSE.md:
--------------------------------------------------------------------------------
1 | == Lego Birdhouse ==
2 |
3 | The birdhouse was created with version 4.3.6 of Lego Digital Designer for the Mac.
4 |
5 | http://ldd.lego.com/
6 |
7 | Note: The software is relatively touchy about opening this model.
8 |
9 | The size of this model comes from two sources: it's basically the same size as the original wooden version from the Twitter offices, which completely coincidentally is within 1/2" in both dimensions of nine 16x16 LEGO plates, in a 3 by 3 grid (this is the base of the model). The computer we place into the house, running the Twisitor software, is a 13" MacBook Pro. At this width, a right-angle USB cable is required to connect the camera to the USB port on the left side of the MacBook Pro (this wouldn't be necessary on a smaller laptop, like an 11" MacBook Air).
10 |
11 | === Building Notes ==
12 |
13 | The 1.0 version of the LEGO Twisitor house was very much a learning endeavor.
14 |
15 | Here are a few things I noted while assembling it:
16 |
17 | * height: the built model is roughly six bricks 'shorter' than this version. this was an aesthetic choice as I was constructing the house, with the 13" MacBook Pro on hand to do modeling duties. The software model is the same height as the wooden birdhouse in the Twitter offices, except the wooden version has a 1.5" base deck for the MacBook Pro to rest on...hence the aesthetic removal of some of the height of this model.
18 | * PVC cement and warping: The model was built from the bottom up. Every single one of the floor tiles is PVC Cement-ed to the base plates...and note the tiles are offset by one (so they all cross the boundaries of the 16x16 base plates on which everything rests, for rigidity). After letting the base rest for 24 hours, it began to warp - this is a theme that recurs throughout construction.
19 | * the original intent was for this model to come apart into six or seven relatively flat pieces for easy movement to recruiting and other public events where Twitter might want to place the tweeting birdhouse. however, due to consistent warping caused by the PVC cement (which slightly "melts" the LEGO bricks together - that's how solvents work, people), the 1.0 build is a single mostly-solid and mostly-glued piece.
20 | * learning from the base, the two side and one large back wall are mostly not glued - they are glued to the base, and around the outsides, and at the top, but the 'flex' that the unglued walls provide actually allow the completely glued roof tile system to flex enough that the entire model is actually buildable in real life (there's no way the back pieces, which is a 'ladder' join, would actually be able to be fit together by humans if they were anything but permanently attached.
21 | * yes, the roof is completely glued, one roof tile at a time, and yes, the model has no roof joists for rigidity. it actually works this way...but I found it easier as I was going along to glue in cross-members to hold the roof pieces a consistent distance apart (the warping on the roof is really challenging but gives the roof a nice uneven 'shingled' experience when built). you'll also need something to mount the camera to - I see this piece as wholly custom to the camera you choose to mount, so I didn't put my roof joist and camera mount into the plan.
22 | * again due to the consistent warping, since I built the back wall, and the front 'entrance' to the birdhouse at separate times, the 1.0 model I built does not 'join' the top of the birdhouse at all - the as-built model has it 'floating' about a half-brick below the roof. With multiple hands building the model, moving faster, before the solvent sets, this could have been avoided (there may also be a master builder 'trick' to maintain a consistent 0.1mm gap in three dimensions across the roof - I am in no way a LEGO master builder).
23 |
24 | Other than the above notes, the traveling birdhouse we now use is build just like the accompanying LXF file.
25 |
26 | Enjoy!
--------------------------------------------------------------------------------
/app/options.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
'
183 | );
184 |
185 | this.$handles.push($handle.find('input'));
186 | this.$container.append($handle);
187 | }
188 | },
189 |
190 | reset: function() {
191 | for (var i = 0; i < this.$handles.length; ++i) {
192 | this.$handles[i].val('');
193 | }
194 |
195 | this.handles = '';
196 | },
197 |
198 | show: function() {
199 | App.$dlgTitle.text('Enter Your Twitter Handle');
200 | this.$body.show();
201 | },
202 |
203 | hide: function() {
204 | this.$body.hide();
205 | },
206 |
207 | back: function() {
208 | this.hide();
209 | App.currentScene = App.scenePhotobooth;
210 | App.currentScene.show();
211 | },
212 |
213 | next: function() {
214 | var handleChecker = /^[_0-9A-Za-z]{1,15}$/;
215 | this.handles = '';
216 |
217 | for (var i = 0; i < this.$handles.length; ++i) {
218 | var val = this.$handles[i].val().trim();
219 |
220 | if (handleChecker.test(val)) {
221 | this.handles += ' @' + val;
222 | }
223 | }
224 |
225 | this.handles = this.handles.trim().split(' ').join(', ');
226 | var idx = this.handles.lastIndexOf(', ');
227 | if (idx > -1) {
228 | this.handles = this.handles.slice(0, idx) + ' and ' +
229 | this.handles.slice(idx + 2);
230 | }
231 |
232 | if (!this.handles.length) {
233 | this.handles = 'me';
234 | }
235 |
236 | this.hide();
237 | App.currentScene = App.sceneStatusSelection;
238 | App.currentScene.show();
239 | }
240 | },
241 |
242 | sceneStatusSelection: {
243 | load: function() {
244 | this.$body = $('#sceneStatusSelection');
245 | this.$body.hide();
246 | this.$container = $('#statusesContainer');
247 | },
248 |
249 | reset: function() {
250 | this.$statusButtons = [];
251 | this.$container.empty();
252 |
253 | for (var i = 0; i < this.statuses.length; ++i) {
254 | var $btn = $('');
255 | this.$statusButtons.push($btn);
256 | this.$container.append($btn);
257 | }
258 |
259 | this.$statusButtons[0].addClass('active');
260 | },
261 |
262 | show: function() {
263 | App.$dlgTitle.text('Select your Tweet');
264 | this.$body.show();
265 | App.$btnNext.text('Tweet!');
266 |
267 | var handles = App.sceneTwitterHandle.handles;
268 |
269 | for (var i = 0; i < this.statuses.length; ++i) {
270 | var text = this.statuses[i].replace('{handles}', handles);
271 | this.$statusButtons[i].text(text).data('val', text);
272 | }
273 | },
274 |
275 | hide: function() {
276 | App.$btnNext.text('Next');
277 | this.$body.hide();
278 | },
279 |
280 | back: function() {
281 | this.hide();
282 | App.currentScene = App.sceneTwitterHandle;
283 | App.currentScene.show();
284 | },
285 |
286 | next: function() {
287 | this.hide();
288 | App.currentScene = App.sceneTweetConfirm;
289 | App.currentScene.show();
290 | },
291 |
292 | statuses: localStorage.getItem('statuses').split(',').map(function(s) {
293 | return s.replace(/,/g, ',');
294 | })
295 | },
296 |
297 | sceneTweetConfirm: {
298 | load: function() {
299 | this.$body = $('#sceneTweetConfirm');
300 | this.$body.hide();
301 | this.$message = this.$body.find('.message');
302 | this.$tweet = $('#tweet');
303 | this.$status = this.$tweet.find('.status');
304 | this.$details = this.$tweet.find('.details');
305 | },
306 |
307 | reset: function() {
308 | },
309 |
310 | show: function() {
311 | App.$btnBack.hide();
312 | App.$btnNext.hide();
313 | App.$dlgTitle.text('Posting your Tweet');
314 | this.$message.text('Please wait...');
315 | this.$body.show();
316 |
317 | var that = this;
318 | var status = $('.statusButton.active').data('val');
319 |
320 | this.$tweet.css('background', 'url(' + App.snapshot.canvas.toDataURL() +
321 | ')');
322 | this.$status.text(status);
323 |
324 | var now = new Date();
325 | var details = {
326 | h: (now.getHours() % 12) ? now.getHours() % 12 : 12,
327 | m: ('00' + now.getMinutes()).slice(now.getMinutes().toString().length),
328 | ap: now.getHours() > 12 ? 'PM' : 'AM',
329 | d: now.getDate(),
330 | M: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
331 | 'Oct', 'Nov', 'Dec'][now.getMonth()],
332 | y: now.getFullYear().toString().slice(2),
333 | loc: 'Twitter HQ, San Francisco'
334 | };
335 | var mask = '{h}:{m} {ap} - {d} {M} {y} from {loc}';
336 | Object.keys(details).forEach(function(key) {
337 | mask = mask.replace('{' + key + '}', details[key]);
338 | });
339 | this.$details.text(mask);
340 |
341 | var binary = atob(App.snapshot.canvas.toDataURL('image/jpeg').split(',')[1]);
342 | var array = [];
343 | for(var i = 0; i < binary.length; i++) {
344 | array.push(binary.charCodeAt(i));
345 | }
346 | var blobImage = new Blob([new Uint8Array(array)], {type: 'image/jpeg'});
347 |
348 | Twitter.tweet(
349 | status,
350 | blobImage,
351 | function() {
352 | that.$message.text('Thank you!');
353 | setTimeout(function() {
354 | that.next();
355 | }, 5000);
356 | }
357 | );
358 | },
359 |
360 | hide: function() {
361 | this.$body.hide();
362 | },
363 |
364 | back: function() {
365 | },
366 |
367 | next: function() {
368 | this.hide();
369 | App.$wizard.modal('hide');
370 | }
371 | }
372 | };
373 |
374 | $('body').ready(App.init.bind(App));
375 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/app/js/lib/oauthsimple.js:
--------------------------------------------------------------------------------
1 | /* OAuthSimple
2 | * A simpler version of OAuth
3 | *
4 | * author: jr conlin
5 | * mail: src@anticipatr.com
6 | * copyright: unitedHeroes.net
7 | * version: 1.2
8 | * url: http://unitedHeroes.net/OAuthSimple
9 | *
10 | * Copyright (c) 2011, unitedHeroes.net
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * modification, are permitted provided that the following conditions are met:
14 | * * Redistributions of source code must retain the above copyright
15 | * notice, this list of conditions and the following disclaimer.
16 | * * Redistributions in binary form must reproduce the above copyright
17 | * notice, this list of conditions and the following disclaimer in the
18 | * documentation and/or other materials provided with the distribution.
19 | * * Neither the name of the unitedHeroes.net nor the
20 | * names of its contributors may be used to endorse or promote products
21 | * derived from this software without specific prior written permission.
22 | *
23 | * THIS SOFTWARE IS PROVIDED BY UNITEDHEROES.NET ''AS IS'' AND ANY
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 | * DISCLAIMED. IN NO EVENT SHALL UNITEDHEROES.NET BE LIABLE FOR ANY
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | */
34 | var OAuthSimple;
35 |
36 | if (OAuthSimple === undefined)
37 | {
38 | /* Simple OAuth
39 | *
40 | * This class only builds the OAuth elements, it does not do the actual
41 | * transmission or reception of the tokens. It does not validate elements
42 | * of the token. It is for client use only.
43 | *
44 | * api_key is the API key, also known as the OAuth consumer key
45 | * shared_secret is the shared secret (duh).
46 | *
47 | * Both the api_key and shared_secret are generally provided by the site
48 | * offering OAuth services. You need to specify them at object creation
49 | * because nobody ing uses OAuth without that minimal set of
50 | * signatures.
51 | *
52 | * If you want to use the higher order security that comes from the
53 | * OAuth token (sorry, I don't provide the functions to fetch that because
54 | * sites aren't horribly consistent about how they offer that), you need to
55 | * pass those in either with .signatures() or as an argument to the
56 | * .sign() or .getHeaderString() functions.
57 | *
58 | * Example:
59 |
60 | var oauthObject = OAuthSimple().sign({path:'http://example.com/rest/',
61 | parameters: 'foo=bar&gorp=banana',
62 | signatures:{
63 | api_key:'12345abcd',
64 | shared_secret:'xyz-5309'
65 | }});
66 | document.getElementById('someLink').href=oauthObject.signed_url;
67 |
68 | *
69 | * that will sign as a "GET" using "SHA1-MAC" the url. If you need more than
70 | * that, read on, McDuff.
71 | */
72 |
73 | /** OAuthSimple creator
74 | *
75 | * Create an instance of OAuthSimple
76 | *
77 | * @param api_key {string} The API Key (sometimes referred to as the consumer key) This value is usually supplied by the site you wish to use.
78 | * @param shared_secret (string) The shared secret. This value is also usually provided by the site you wish to use.
79 | */
80 | OAuthSimple = function (consumer_key,shared_secret)
81 | {
82 | /* if (api_key == undefined)
83 | throw("Missing argument: api_key (oauth_consumer_key) for OAuthSimple. This is usually provided by the hosting site.");
84 | if (shared_secret == undefined)
85 | throw("Missing argument: shared_secret (shared secret) for OAuthSimple. This is usually provided by the hosting site.");
86 | */ var self = {};
87 | self._secrets={};
88 |
89 |
90 | // General configuration options.
91 | if (consumer_key !== undefined) {
92 | self._secrets['consumer_key'] = consumer_key;
93 | }
94 | if (shared_secret !== undefined) {
95 | self._secrets['shared_secret'] = shared_secret;
96 | }
97 | self._default_signature_method= "HMAC-SHA1";
98 | self._action = "GET";
99 | self._nonce_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
100 | self._parameters={};
101 |
102 |
103 | self.reset = function() {
104 | this._parameters={};
105 | this._path=undefined;
106 | this.sbs=undefined;
107 | return this;
108 | };
109 |
110 | /** set the parameters either from a hash or a string
111 | *
112 | * @param {string,object} List of parameters for the call, this can either be a URI string (e.g. "foo=bar&gorp=banana" or an object/hash)
113 | */
114 | self.setParameters = function (parameters) {
115 | if (parameters === undefined) {
116 | parameters = {};
117 | }
118 | if (typeof(parameters) == 'string') {
119 | parameters=this._parseParameterString(parameters);
120 | }
121 | this._parameters = this._merge(parameters,this._parameters);
122 | if (this._parameters['oauth_nonce'] === undefined) {
123 | this._getNonce();
124 | }
125 | if (this._parameters['oauth_timestamp'] === undefined) {
126 | this._getTimestamp();
127 | }
128 | if (this._parameters['oauth_method'] === undefined) {
129 | this.setSignatureMethod();
130 | }
131 | if (this._parameters['oauth_consumer_key'] === undefined) {
132 | this._getApiKey();
133 | }
134 | if(this._parameters['oauth_token'] === undefined) {
135 | this._getAccessToken();
136 | }
137 | if(this._parameters['oauth_version'] === undefined) {
138 | this._parameters['oauth_version']=='1.0';
139 | }
140 |
141 | return this;
142 | };
143 |
144 | /** convienence method for setParameters
145 | *
146 | * @param parameters {string,object} See .setParameters
147 | */
148 | self.setQueryString = function (parameters) {
149 | return this.setParameters(parameters);
150 | };
151 |
152 | /** Set the target URL (does not include the parameters)
153 | *
154 | * @param path {string} the fully qualified URI (excluding query arguments) (e.g "http://example.org/foo")
155 | */
156 | self.setURL = function (path) {
157 | if (path == '') {
158 | throw ('No path specified for OAuthSimple.setURL');
159 | }
160 | this._path = path;
161 | return this;
162 | };
163 |
164 | /** convienence method for setURL
165 | *
166 | * @param path {string} see .setURL
167 | */
168 | self.setPath = function(path){
169 | return this.setURL(path);
170 | };
171 |
172 | /** set the "action" for the url, (e.g. GET,POST, DELETE, etc.)
173 | *
174 | * @param action {string} HTTP Action word.
175 | */
176 | self.setAction = function(action) {
177 | if (action === undefined) {
178 | action="GET";
179 | }
180 | action = action.toUpperCase();
181 | if (action.match('[^A-Z]')) {
182 | throw ('Invalid action specified for OAuthSimple.setAction');
183 | }
184 | this._action = action;
185 | return this;
186 | };
187 |
188 | /** set the signatures (as well as validate the ones you have)
189 | *
190 | * @param signatures {object} object/hash of the token/signature pairs {api_key:, shared_secret:, oauth_token: oauth_secret:}
191 | */
192 | self.signatures = function(signatures) {
193 | if (signatures)
194 | {
195 | this._secrets = this._merge(signatures,this._secrets);
196 | }
197 | // Aliases
198 | if (this._secrets['api_key']) {
199 | this._secrets.consumer_key = this._secrets.api_key;
200 | }
201 | if (this._secrets['access_token']) {
202 | this._secrets.oauth_token = this._secrets.access_token;
203 | }
204 | if (this._secrets['access_secret']) {
205 | this._secrets.oauth_secret = this._secrets.access_secret;
206 | }
207 | if (this._secrets['oauth_token_secret']) {
208 | this._secrets.oauth_secret = this._secrets.oauth_token_secret;
209 | }
210 | // Gauntlet
211 | if (this._secrets.consumer_key === undefined) {
212 | throw('Missing required consumer_key in OAuthSimple.signatures');
213 | }
214 | if (this._secrets.shared_secret === undefined) {
215 | throw('Missing required shared_secret in OAuthSimple.signatures');
216 | }
217 | if ((this._secrets.oauth_token !== undefined) && (this._secrets.oauth_secret === undefined)) {
218 | throw('Missing oauth_secret for supplied oauth_token in OAuthSimple.signatures');
219 | }
220 | return this;
221 | };
222 |
223 | self.setTokensAndSecrets = function(signatures) {
224 | return this.signatures(signatures);
225 | };
226 |
227 | /** set the signature method (currently only Plaintext or SHA-MAC1)
228 | *
229 | * @param method {string} Method of signing the transaction (only PLAINTEXT and SHA-MAC1 allowed for now)
230 | */
231 | self.setSignatureMethod = function(method) {
232 | if (method === undefined) {
233 | method = this._default_signature_method;
234 | }
235 | //TODO: accept things other than PlainText or SHA-MAC1
236 | if (method.toUpperCase().match(/(PLAINTEXT|HMAC-SHA1)/) === undefined) {
237 | throw ('Unknown signing method specified for OAuthSimple.setSignatureMethod');
238 | }
239 | this._parameters['oauth_signature_method']= method.toUpperCase();
240 | return this;
241 | };
242 |
243 | /** sign the request
244 | *
245 | * note: all arguments are optional, provided you've set them using the
246 | * other helper functions.
247 | *
248 | * @param args {object} hash of arguments for the call
249 | * {action:, path:, parameters:, method:, signatures:}
250 | * all arguments are optional.
251 | */
252 | self.sign = function (args) {
253 | if (args === undefined) {
254 | args = {};
255 | }
256 | // Set any given parameters
257 | if(args['action'] !== undefined) {
258 | this.setAction(args['action']);
259 | }
260 | if (args['path'] !== undefined) {
261 | this.setPath(args['path']);
262 | }
263 | if (args['method'] !== undefined) {
264 | this.setSignatureMethod(args['method']);
265 | }
266 | this.signatures(args['signatures']);
267 | this.setParameters(args['parameters']);
268 | // check the parameters
269 | var normParams = this._normalizedParameters();
270 | this._parameters['oauth_signature']=this._generateSignature(normParams);
271 | return {
272 | parameters: this._parameters,
273 | signature: this._oauthEscape(this._parameters['oauth_signature']),
274 | signed_url: this._path + '?' + this._normalizedParameters(),
275 | header: this.getHeaderString()
276 | };
277 | };
278 |
279 | /** Return a formatted "header" string
280 | *
281 | * NOTE: This doesn't set the "Authorization: " prefix, which is required.
282 | * I don't set it because various set header functions prefer different
283 | * ways to do that.
284 | *
285 | * @param args {object} see .sign
286 | */
287 | self.getHeaderString = function(args) {
288 | if (this._parameters['oauth_signature'] === undefined) {
289 | this.sign(args);
290 | }
291 |
292 | var j,pName,pLength,result = 'OAuth ';
293 | for (pName in this._parameters)
294 | {
295 | if (pName.match(/^oauth/) === undefined) {
296 | continue;
297 | }
298 | if ((this._parameters[pName]) instanceof Array)
299 | {
300 | pLength = this._parameters[pName].length;
301 | for (j=0;j>16)+(y>>16)+(l>>16);return(m<<16)|(l&0xFFFF);}function _r(n,c){return(n<>>(32-c));}function _c(x,l){x[l>>5]|=0x80<<(24-l%32);x[((l+64>>9)<<4)+15]=l;var w=[80],a=1732584193,b=-271733879,c=-1732584194,d=271733878,e=-1009589776;for(var i=0;i>5]|=(s.charCodeAt(i/8)&m)<<(32-_z-i%32);}return b;}function _h(k,d){var b=_b(k);if(b.length>16){b=_c(b,k.length*_z);}var p=[16],o=[16];for(var i=0;i<16;i++){p[i]=b[i]^0x36363636;o[i]=b[i]^0x5C5C5C5C;}var h=_c(p.concat(_b(d)),512+d.length*_z);return _c(o.concat(h),512+160);}function _n(b){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s='';for(var i=0;i>2]>>8*(3-i%4))&0xFF)<<16)|(((b[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((b[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>b.length*32){s+=_p;}else{s+=t.charAt((r>>6*(3-j))&0x3F);}}}return s;}function _x(k,d){return _n(_h(k,d));}return _x(k,d);
404 | }
405 |
406 |
407 | self._normalizedParameters = function() {
408 | var elements = new Array(),
409 | paramNames = [],
410 | i=0,
411 | ra =0;
412 | for (var paramName in this._parameters)
413 | {
414 | if (ra++ > 1000) {
415 | throw('runaway 1');
416 | }
417 | paramNames.unshift(paramName);
418 | }
419 | paramNames = paramNames.sort();
420 | pLen = paramNames.length;
421 | for (;i 1000) {
435 | throw('runaway 1');
436 | }
437 | elements.push(this._oauthEscape(paramName) + '=' +
438 | this._oauthEscape(sorted[j]));
439 | }
440 | continue;
441 | }
442 | elements.push(this._oauthEscape(paramName) + '=' +
443 | this._oauthEscape(this._parameters[paramName]));
444 | }
445 | return elements.join('&');
446 | };
447 |
448 | self._generateSignature = function() {
449 |
450 | var secretKey = this._oauthEscape(this._secrets.shared_secret)+'&'+
451 | this._oauthEscape(this._secrets.oauth_secret);
452 | if (this._parameters['oauth_signature_method'] == 'PLAINTEXT')
453 | {
454 | return secretKey;
455 | }
456 | if (this._parameters['oauth_signature_method'] == 'HMAC-SHA1')
457 | {
458 | var sigString = this._oauthEscape(this._action)+'&'+this._oauthEscape(this._path)+'&'+this._oauthEscape(this._normalizedParameters());
459 | return this.b64_hmac_sha1(secretKey,sigString);
460 | }
461 | return null;
462 | };
463 |
464 | self._merge = function(source,target) {
465 | if (source == undefined)
466 | source = {};
467 | if (target == undefined)
468 | target = {};
469 | for (var key in source) {
470 | target[key] = source[key];
471 | }
472 | return target;
473 | }
474 |
475 | return self;
476 | };
477 | }
478 |
--------------------------------------------------------------------------------
/app/js/lib/bootstrap.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap.js by @fat & @mdo
3 | * Copyright 2012 Twitter, Inc.
4 | * http://www.apache.org/licenses/LICENSE-2.0.txt
5 | */
6 | !function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||s.toggleClass("open"),n.focus(),!1},keydown:function(n){var r,s,o,u,a,f;if(!/(38|40|27)/.test(n.keyCode))return;r=e(this),n.preventDefault(),n.stopPropagation();if(r.is(".disabled, :disabled"))return;u=i(r),a=u.hasClass("open");if(!a||a&&n.keyCode==27)return n.which==27&&u.find(t).focus(),r.click();s=e("[role=menu] li:not(.divider):visible a",u);if(!s.length)return;f=s.index(s.filter(":focus")),n.keyCode==38&&f>0&&f--,n.keyCode==40&&f').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!t)return;i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(s).one("hide",function(){n.focus()})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s,o,u,a;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,o=this.options.trigger.split(" ");for(a=o.length;a--;)u=o[a],u=="click"?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):u!="manual"&&(i=u=="hover"?"mouseenter":"focus",s=u=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e.fn[this.type].defaults,r={},i;this._options&&e.each(this._options,function(e,t){n[e]!=t&&(r[e]=t)},this),i=e(t.currentTarget)[this.type](r).data(this.type);if(!i.options.delay||!i.options.delay.show)return i.show();clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){i.hoverState=="in"&&i.show()},i.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,r,i,s,o,u=e.Event("show");if(this.hasContent()&&this.enabled){this.$element.trigger(u);if(u.isDefaultPrevented())return;t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight;switch(s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(o,s),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n=this.tip(),r=n[0].offsetWidth,i=n[0].offsetHeight,s,o,u,a;n.offset(e).addClass(t).addClass("in"),s=n[0].offsetWidth,o=n[0].offsetHeight,t=="top"&&o!=i&&(e.top=e.top+i-o,a=!0),t=="bottom"||t=="top"?(u=0,e.left<0&&(u=e.left*-2,e.left=0,n.offset(e),s=n[0].offsetWidth,o=n[0].offsetHeight),this.replaceArrow(u-r+s,s,"left")):this.replaceArrow(o-i,o,"top"),a&&n.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function i(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var t=this,n=this.tip(),r=e.Event("hide");this.$element.trigger(r);if(r.isDefaultPrevented())return;return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=(typeof n.content=="function"?n.content.call(t[0]):n.content)||t.attr("data-content"),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'