diff --git a/services/web/app/views/general/sidebar.jade b/services/web/app/views/general/sidebar.jade deleted file mode 100644 index edcbe17f89..0000000000 --- a/services/web/app/views/general/sidebar.jade +++ /dev/null @@ -1,24 +0,0 @@ -.sidebar-navigation(style="width: 180px; top: 40px") - ul - li(class = typeof projectTabActive != "undefined" ? "active" : "") - a(href="/project").tab-link.project-list-tab - .content Projects - li(class = typeof accountSettingsTabActive != "undefined" ? "active" : "") - a(href="/user/settings").tab-link.account-settings-tab - .content Account Settings - - if (settings.enableSubscriptions) - li(class = typeof subscriptionTabActive != "undefined" ? "active" : "") - a(href="/user/subscription").tab-link.subscription-tab - .content Subscription - - - if (settings.enableSubscriptions) - .bonus-advert.ab-bonus-sidebar - .speech-bubble - h3 - a(href="/user/bonus").plain-link Get free stuff! - p - a(href="/user/bonus").plain-link Recommend ShareLaTeX to your friends and we'll upgrade your account for free. - p - a(href="/user/bonus").btn.btn-success Get free stuff - img(src="/brand/logo/logo-64.png").lion - diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index b21c6f098e..e52781d195 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -9,7 +9,7 @@ html(itemscope, itemtype='http://schema.org/Product') - else title= 'Online LaTeX Editor ShareLaTeX - ' +title link(rel='stylesheet', href='/stylesheets/style.css?fingerprint='+fingerprint('/stylesheets/style.css')) - link(href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css",rel="stylesheet") + link(href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css",rel="stylesheet") meta(itemprop="name" ,content="ShareLaTeX - Real Time Online LaTeX Collaborative Editor in Your Browser") meta(itemprop="description", content="Online LaTeX editor for collaborative editing, great for Maths or Sciences. You don't need to install LaTeX so it's great for beginners too.") @@ -30,13 +30,13 @@ html(itemscope, itemtype='http://schema.org/Product') script(type='text/javascript') window.ga = function() { console.log("Sending to GA", arguments) }; - script + script(type="text/javscript"). window.csrfToken = "#{csrfToken}"; script(src=jsPath+'libs/jquery.js') - if (typeof(bodyClasses) == "undefined") - bodyClasses = [] + - var bodyClasses = [] body(class=bodyClasses) include menubar block content diff --git a/services/web/app/views/menubar.jade b/services/web/app/views/menubar.jade index 123336d10c..4daa9aec0b 100644 --- a/services/web/app/views/menubar.jade +++ b/services/web/app/views/menubar.jade @@ -1,39 +1,31 @@ -nav.navbar.navbar-fixed-top.navbar-default +nav.navbar.navbar-default .container-fluid .navbar-header + button.navbar-toggle(data-toggle="collapse",data-target="#navbar-collapse") + i.fa.fa-bars a(href='/').navbar-brand ShareLaTeX - .navbar-collapse.collapse - ul.nav.navbar-nav + .navbar-collapse.collapse#navbar-collapse + ul.nav.navbar-nav.navbar-right -if(session && session.user) li a(href='/project') Projects - -if(typeof(tenderUrl) != "undefined") - li - a.js-tender-widget(href='#') Support & Feedback - li - a(href='/help') Help - li - a(href='/blog') Blog - li - a(href='/templates')#templatesLink LaTeX Templates - - if (settings.enableSubscriptions) - li.nav-collapse - a(href='/user/subscription/plans')#plansLink Plans & Pricing - li.dropdown.nav-collapse - a.dropdown-toggle(href='#',data-toggle="dropdown") Info + + li.dropdown + a.dropdown-toggle(href='#',data-toggle="dropdown") + | Help b.caret ul.dropdown-menu - li.nav-collapse - a(href="/learn")#learnLink LaTeX help guide - li.nav-collapse - a(href='/resources')#resourcesLink LaTeX Resources - li.nav-collapse - a(href='/about')#aboutUsLink About Us - ul.nav.navbar-nav.navbar-right + li + a(href='/learn') Documentation + -if(typeof(tenderUrl) != "undefined") + li + a.js-tender-widget(href='#') Contact + -if(session && session.user) li.dropdown - a.dropdown-toggle(href="#",data-toggle="dropdown") Account + a.dropdown-toggle(href="#",data-toggle="dropdown") + | Account b.caret ul.dropdown-menu li diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index 2d1a307e45..a34932d92d 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -11,121 +11,182 @@ block content -else span Unknown? + mixin formatOwnerText(level, publicLevel) + -if (level == "owner") + span Me + -else + span #{formatProjectPublicAccessLevel()}   + mixin formatAccessLevel(project.accessLevel) + mixin tag(project_id, tagName, showDeleteIcon) span.label.label-info.tag-label(data-project-id=project_id, data-tag=tagName) - span.text #{tagName} + span.text #{tagName}   - if (showDeleteIcon) - i.icon-remove.icon-white.delete-tag(data-project-id=project_id, data-tag=tagName) + i.fa.fa-times.delete-tag(data-project-id=project_id, data-tag=tagName) mixin projectList(projects) -each project in projects - project_id = project._id.toString() - .project_entry(id=project_id) - .btn-group.project-actions - a.btn.dropdown-toggle(data-toggle="dropdown", href="#") Actions + li.project_entry(id=project_id) + label.checkbox.select-item + input(type="checkbox") + span.title + a.projectName(href="/project/#{project._id}") #{project.name} + span.project-tags(data-project-id=project_id) + - each tag in project.tags + mixin tag(project_id, tag.name, true) + span.owner + mixin formatOwnerText(project.accessLevel, project.publicAccesLevel) + span.last-modified.isoDate #{project.lastUpdated.toISOString()} + + .container + .row + .col-md-2 + br + #newProject.dropdown + a.btn.btn-primary.dropdown-toggle(data-toggle="dropdown", href="#") New Project span.caret - ul.dropdown-menu.pull-right(role="menu") + ul.dropdown-menu(role="menu") li - a(href='/project/'+project_id+'/clone', data-csrf=csrfToken).cloneProject Clone + a#blankNewProject(href="#", data-csrf=csrfToken) Blank Project li - a(href='/project/'+project._id+'/download/zip').downloadZip Download Zip - -if (project.accessLevel == "owner") - li - a(href='/project/'+project_id+'/rename', data-name=project.name, data-id=project_id, data-csrf=csrfToken).renameProject Rename - li - a(href='/project/'+project_id, data-name=project.name, data-id=project_id, data-csrf=csrfToken).archiveProject Delete - -else - li - a(href='/project/'+project_id+'/leave', data-name=project.name, data-id=project_id, data-csrf=csrfToken).leaveProject Leave - a.projectName(href="/project/#{project._id}") #{project.name} - .projectDetails - span Last modified on - span.isoDate #{project.lastUpdated.toISOString()} - span   -   - span #{formatProjectPublicAccessLevel(project.publicAccesLevel)} - span   -   - mixin formatAccessLevel(project.accessLevel) - .project-tags(data-project-id=project_id) - - each tag in project.tags - mixin tag(project_id, tag.name, true) - span.new-tags - span.newTagLocation - span.label.addTagButton(data-project-id=project_id) Add Tag - i.icon-plus.icon-white - - div - input(placeholder='Tag Name', name='tags', style="display: none;", data-project-id=project_id).tags-input + a#newProjectExample(href="#", data-csrf=csrfToken) Example Project + li + a#uploadNewProject(href="#", data-csrf=csrfToken) Upload Project + li.divider + li.dropdown-submenu + a(tabindex="-1", href="#", data-toggle="dropdown") Templates + ul.dropdown-menu + li + a.menu-indent(href="/templates/cv") CV or Resume + li + a.menu-indent(href="/templates/cover-letters") Cover Letter + li + a.menu-indent(href="/templates/journals") Journal Article + li + a.menu-indent(href="/templates/presentations") Presentation + li + a.menu-indent(href="/templates/thesis") Thesis + li + a.menu-indent(href="/templates/bibliographies") Bibliographies + li + a.menu-indent(href="/templates") View All » - include ../general/sidebar + br + ul.unstyled.menu.js-folders-menu + li + a.normalText.menu-indent(href="#") All projects + li + a.normalText.menu-indent(href="#") Your projects + li + a.normalText.menu-indent(href="#") Shared with you + li Folders + li + a.normalText.menu-indent(href="#") + i.icon.fa.fa-folder-o + | PhD work + span.normalText (5) + li + a.normalText.menu-indent(href="#") + i.icon.fa.fa-folder-o + | Notes + span.normalText (2) + li + a.normalText.menu-indent(href="#") + i.icon.fa.fa-folder-o + | Papers + span.normalText (1) + ul.unstyled.menu + li + a.normalText.menu-indent(href="#") + i.icon.fa.fa-plus + | New Folder - .content-with-navigation-sidebar - .box#projectListArea - .row-fluid - .span12 - .page-header - .btn-group.pull-right#newProject - a.btn.btn-success.dropdown-toggle(data-toggle="dropdown", href="#") New Project - span.caret - ul.dropdown-menu.pull-right(role="menu") + -if (tags.length > 0) + hr.soften + ul#allProjectTagsArea.unstyled.menu + li Tags + - each tag in tags + -if (tag.project_ids.length > 0) li - a.normalText#blankNewProject(href="#", data-csrf=csrfToken) Blank Project - li - a.normalText#newProjectExample(href="#", data-csrf=csrfToken) Example Project - li - a.normalText#uploadNewProject(href="#", data-csrf=csrfToken) Upload Zipped Project - li.divider - li - .normalText.menu-header From Template - li - a.normalText.menu-indent(href="/templates/cv") CV or Resume - li - a.normalText.menu-indent(href="/templates/cover-letters") Cover Letter - li - a.normalText.menu-indent(href="/templates/journals") Journal Article - li - a.normalText.menu-indent(href="/templates/presentations") Presentation - li - a.normalText.menu-indent(href="/templates/thesis") Thesis - li - a.normalText.menu-indent(href="/templates/bibliographies") Bibliographies - a(href="/project/archived").pull-right.archived-projects Archived Projects - h1 Projects - - if (projects.length > 0) - .row-fluid - .span9 - form.search - input#projectFilter(placeholder='Search Projects', autofocus='autofocus').span6.projectSearch.search-query - i.icon-search - i.icon-remove - ul#projectList - mixin projectList(projects) + mixin tag("", tag.name, false) + span.number x #{tag.project_ids.length} - .span3 - .tag-list - h2 Tags - #allProjectTagsArea - ul - - each tag in tags - -if (tag.project_ids.length > 0) - li - mixin tag("", tag.name, false) - span.number x #{tag.project_ids.length} + -if (settings.enableSubscriptions) + p + a(href="/user/bonus").btn.btn-info Upgrade Account - - else + .col-md-10 .row-fluid .span12 - .sharelatex-intro - .create-project-arrow Create your first project - .welcome - h2 Welcome to ShareLaTeX! - p New to LaTeX? Then have a look at our - a(href="/templates") templates - | or - a(href="/learn") help guides - | . + form.form-inline.search.project-search + input#projectFilter(placeholder='Search projects…', autofocus='autofocus').span6.projectSearch.search-query + i.fa.fa-search + //- i.fa.fa-remove + .project-tools.js-toggle-tools.hidden + .btn-toolbar + .btn-group + a(href='/project/'+"5369c5737fc6b47f048da1f5"+'/download/zip', data-toggle="tooltip", data-placement="bottom", title="", data-original-title="Download .zip File").btn.downloadZip + i.fa.fa-cloud-download + -if ("owner" == "owner") + a(href='/project/'+"5369c5737fc6b47f048da1f5", data-name="the project", data-id="5369c5737fc6b47f048da1f5", data-csrf=csrfToken, data-toggle="tooltip", data-placement="bottom", title="", data-original-title="Remove").btn.deleteProject + i.fa.fa-trash-o + a.btn.dropdown-toggle + i.fa.fa-folder-open-o + .btn-group.project-actions + a.btn.dropdown-toggle(data-toggle="dropdown", href="#") More + span.caret + ul.dropdown-menu.pull-right(role="menu") + li + a(href='/project/'+"5369c5737fc6b47f048da1f5"+'/clone', data-csrf=csrfToken).cloneProject Make a Copy... + -if ("owner" == "owner") + li + a(href='/project/'+"5369c5737fc6b47f048da1f5"+'/rename', data-name="the project", data-id="5369c5737fc6b47f048da1f5", data-csrf=csrfToken).renameProject Rename... + -else + li + a(href='/project/'+"5369c5737fc6b47f048da1f5"+'/leave', data-name="the project", data-id="5369c5737fc6b47f048da1f5", data-csrf=csrfToken).leaveProject Leave Project + .card.card-thin.first + - if (projects.length > 0) + ul#projectList + li + label.checkbox.select-all + input(type="checkbox") + span.title TITLE + span.owner OWNER + span.last-modified LAST MODIFIED + mixin projectList(projects) + - else + .row + .span12 + .welcome + h1 + i.fa.fa-arrow-left + | Welcome! Follow the arrow to get started + p New to LaTeX? Start by having a look at our + a(href="/templates") templates + | or + a(href="/learn") help guides + | . + + if freeTrial && !freeTrial.expired + .row-fluid + .span12 + .alert.alert-info.alert-free-trial + h2 You are currently using a free trial which expires on #{freeTrial.expiresAt}. + p + a(href="/user/subscription").btn.btn-primary Upgrade now + if freeTrial && freeTrial.expired + .row-fluid + .span12 + .alert.alert-danger.alert-free-trial + h2 Your free trial has expired! + p Upgrade now to continue using ShareLaTeX uninterrupted. + p + a(href="/user/subscription").btn.btn-danger Upgrade now + + include ../general/small-footer - include ../general/small-footer script(type="text/template")#tagTemplate mixin tag('{{ project_id }}', '{{ tagName }}', true) @@ -137,8 +198,7 @@ block content } }; script( - data-main=jsPath+'list.js?fingerprint='+fingerprint(jsPath + 'list.js'), + data-main=jsPath+'list.js?fingerprint='+fingerprint(jsPath + 'list.js'), baseurl=jsPath, src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js') ) - diff --git a/services/web/public/coffee/forms.coffee b/services/web/public/coffee/forms.coffee index 83569ca811..c90fca3a66 100644 --- a/services/web/public/coffee/forms.coffee +++ b/services/web/public/coffee/forms.coffee @@ -1,7 +1,7 @@ require [ "libs/jquery.validate" "libs/fineuploader" - "libs/bootstrap/bootstrap2full" + "libs/bootstrap" ], ()-> $().ready -> diff --git a/services/web/public/coffee/gui.coffee b/services/web/public/coffee/gui.coffee index ffa6863f63..e110a8e5d1 100644 --- a/services/web/public/coffee/gui.coffee +++ b/services/web/public/coffee/gui.coffee @@ -1,6 +1,6 @@ require [ "libs/jquery.storage" - "libs/bootstrap/bootstrap2full" + "libs/bootstrap" ], ()-> $('tr.clickable').click (event)-> window.location = $(event.target).closest('tr').attr("href") diff --git a/services/web/public/coffee/home.coffee b/services/web/public/coffee/home.coffee index 85ea435420..2290ef2b03 100644 --- a/services/web/public/coffee/home.coffee +++ b/services/web/public/coffee/home.coffee @@ -1,5 +1,5 @@ define [ - "libs/bootstrap/bootstrap2full" + "libs/bootstrap" "forms" ], ()-> $(document).ready ()-> diff --git a/services/web/public/coffee/utils/Modal.coffee b/services/web/public/coffee/utils/Modal.coffee index d2adc70df8..e8dbde1b8b 100644 --- a/services/web/public/coffee/utils/Modal.coffee +++ b/services/web/public/coffee/utils/Modal.coffee @@ -1,7 +1,7 @@ define [ "libs/backbone" "libs/mustache" - "libs/bootstrap/bootstrap2full" + "libs/bootstrap" ], () -> Modal = Backbone.View.extend { templates: diff --git a/services/web/public/js/libs/bootstrap.js b/services/web/public/js/libs/bootstrap.js index 38548a9de8..8ae571b6da 100644 --- a/services/web/public/js/libs/bootstrap.js +++ b/services/web/public/js/libs/bootstrap.js @@ -1,130 +1,126 @@ -/* =================================================== - * bootstrap-transition.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#transitions - * =================================================== - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ +/*! + * Bootstrap v3.1.1 (http://getbootstrap.com) + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ -!function( $ ) { +if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } - $(function () { - - "use strict" - - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) - * ======================================================= */ - - $.support.transition = (function () { - var thisBody = document.body || document.documentElement - , thisStyle = thisBody.style - , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined - - return support && { - end: (function () { - var transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" - } - return transitionEnd - }()) - } - })() - - }) - -}( window.jQuery ) -/* ========================================================== - * bootstrap-alert.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#alerts - * ========================================================== - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ +/* ======================================================================== + * Bootstrap: transition.js v3.1.1 + * http://getbootstrap.com/javascript/#transitions + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ -!function( $ ){ ++function ($) { + 'use strict'; - "use strict" + // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) + // ============================================================ - /* ALERT CLASS DEFINITION - * ====================== */ + function transitionEnd() { + var el = document.createElement('bootstrap') - var dismiss = '[data-dismiss="alert"]' - , Alert = function ( el ) { - $(el).on('click', dismiss, this.close) - } - - Alert.prototype = { - - constructor: Alert - - , close: function ( e ) { - var $this = $(this) - , selector = $this.attr('data-target') - , $parent - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } - - $parent = $(selector) - $parent.trigger('close') - - e && e.preventDefault() - - $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) - - $parent.removeClass('in') - - function removeElement() { - $parent.remove() - $parent.trigger('closed') - } - - $.support.transition && $parent.hasClass('fade') ? - $parent.on($.support.transition.end, removeElement) : - removeElement() + var transEndEventNames = { + 'WebkitTransition' : 'webkitTransitionEnd', + 'MozTransition' : 'transitionend', + 'OTransition' : 'oTransitionEnd otransitionend', + 'transition' : 'transitionend' } + for (var name in transEndEventNames) { + if (el.style[name] !== undefined) { + return { end: transEndEventNames[name] } + } + } + + return false // explicit for ie8 ( ._.) + } + + // http://blog.alexmaccaw.com/css-transitions + $.fn.emulateTransitionEnd = function (duration) { + var called = false, $el = this + $(this).one($.support.transition.end, function () { called = true }) + var callback = function () { if (!called) $($el).trigger($.support.transition.end) } + setTimeout(callback, duration) + return this + } + + $(function () { + $.support.transition = transitionEnd() + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: alert.js v3.1.1 + * http://getbootstrap.com/javascript/#alerts + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // ALERT CLASS DEFINITION + // ====================== + + var dismiss = '[data-dismiss="alert"]' + var Alert = function (el) { + $(el).on('click', dismiss, this.close) + } + + Alert.prototype.close = function (e) { + var $this = $(this) + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = $(selector) + + if (e) e.preventDefault() + + if (!$parent.length) { + $parent = $this.hasClass('alert') ? $this : $this.parent() + } + + $parent.trigger(e = $.Event('close.bs.alert')) + + if (e.isDefaultPrevented()) return + + $parent.removeClass('in') + + function removeElement() { + $parent.trigger('closed.bs.alert').remove() + } + + $.support.transition && $parent.hasClass('fade') ? + $parent + .one($.support.transition.end, removeElement) + .emulateTransitionEnd(150) : + removeElement() } - /* ALERT PLUGIN DEFINITION - * ======================= */ + // ALERT PLUGIN DEFINITION + // ======================= - $.fn.alert = function ( option ) { + var old = $.fn.alert + + $.fn.alert = function (option) { return this.each(function () { var $this = $(this) - , data = $this.data('alert') - if (!data) $this.data('alert', (data = new Alert(this))) + var data = $this.data('bs.alert') + + if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } @@ -132,478 +128,628 @@ $.fn.alert.Constructor = Alert - /* ALERT DATA-API - * ============== */ - - $(function () { - $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) - }) - -}( window.jQuery ) -/* ============================================================ - * bootstrap-button.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#buttons - * ============================================================ - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ - -!function( $ ){ - - "use strict" - - /* BUTTON PUBLIC CLASS DEFINITION - * ============================== */ - - var Button = function ( element, options ) { - this.$element = $(element) - this.options = $.extend({}, $.fn.button.defaults, options) - } - - Button.prototype = { - - constructor: Button - - , setState: function ( state ) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' - - state = state + 'Text' - data.resetText || $el.data('resetText', $el[val]()) - - $el[val](data[state] || this.options[state]) - - // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d) - }, 0) - } - - , toggle: function () { - var $parent = this.$element.parent('[data-toggle="buttons-radio"]') - - $parent && $parent - .find('.active') - .removeClass('active') - - this.$element.toggleClass('active') - } + // ALERT NO CONFLICT + // ================= + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this } - /* BUTTON PLUGIN DEFINITION - * ======================== */ + // ALERT DATA-API + // ============== - $.fn.button = function ( option ) { + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: button.js v3.1.1 + * http://getbootstrap.com/javascript/#buttons + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // BUTTON PUBLIC CLASS DEFINITION + // ============================== + + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false + } + + Button.DEFAULTS = { + loadingText: 'loading...' + } + + Button.prototype.setState = function (state) { + var d = 'disabled' + var $el = this.$element + var val = $el.is('input') ? 'val' : 'html' + var data = $el.data() + + state = state + 'Text' + + if (!data.resetText) $el.data('resetText', $el[val]()) + + $el[val](data[state] || this.options[state]) + + // push to event loop to allow forms to submit + setTimeout($.proxy(function () { + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) + } + + Button.prototype.toggle = function () { + var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') + + if ($parent.length) { + var $input = this.$element.find('input') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked') && this.$element.hasClass('active')) changed = false + else $parent.find('.active').removeClass('active') + } + if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') + } + + if (changed) this.$element.toggleClass('active') + } + + + // BUTTON PLUGIN DEFINITION + // ======================== + + var old = $.fn.button + + $.fn.button = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('button') - , options = typeof option == 'object' && option - if (!data) $this.data('button', (data = new Button(this, options))) + var $this = $(this) + var data = $this.data('bs.button') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.button', (data = new Button(this, options))) + if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } - $.fn.button.defaults = { - loadingText: 'loading...' - } - $.fn.button.Constructor = Button - /* BUTTON DATA-API - * =============== */ + // BUTTON NO CONFLICT + // ================== - $(function () { - $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { - $(e.currentTarget).button('toggle') - }) - }) - -}( window.jQuery ) -/* ========================================================== - * bootstrap-carousel.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#carousel - * ========================================================== - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ - - -!function( $ ){ - - "use strict" - - /* CAROUSEL CLASS DEFINITION - * ========================= */ - - var Carousel = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.carousel.defaults, options) - this.options.slide && this.slide(this.options.slide) + $.fn.button.noConflict = function () { + $.fn.button = old + return this } - Carousel.prototype = { - cycle: function () { - this.interval = setInterval($.proxy(this.next, this), this.options.interval) - return this + // BUTTON DATA-API + // =============== + + $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + $btn.button('toggle') + e.preventDefault() + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: carousel.js v3.1.1 + * http://getbootstrap.com/javascript/#carousel + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CAROUSEL CLASS DEFINITION + // ========================= + + var Carousel = function (element, options) { + this.$element = $(element) + this.$indicators = this.$element.find('.carousel-indicators') + this.options = options + this.paused = + this.sliding = + this.interval = + this.$active = + this.$items = null + + this.options.pause == 'hover' && this.$element + .on('mouseenter', $.proxy(this.pause, this)) + .on('mouseleave', $.proxy(this.cycle, this)) + } + + Carousel.DEFAULTS = { + interval: 5000, + pause: 'hover', + wrap: true + } + + Carousel.prototype.cycle = function (e) { + e || (this.paused = false) + + this.interval && clearInterval(this.interval) + + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) + + return this + } + + Carousel.prototype.getActiveIndex = function () { + this.$active = this.$element.find('.item.active') + this.$items = this.$active.parent().children() + + return this.$items.index(this.$active) + } + + Carousel.prototype.to = function (pos) { + var that = this + var activeIndex = this.getActiveIndex() + + if (pos > (this.$items.length - 1) || pos < 0) return + + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) + if (activeIndex == pos) return this.pause().cycle() + + return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) + } + + Carousel.prototype.pause = function (e) { + e || (this.paused = true) + + if (this.$element.find('.next, .prev').length && $.support.transition) { + this.$element.trigger($.support.transition.end) + this.cycle(true) } - , to: function (pos) { - var $active = this.$element.find('.active') - , children = $active.parent().children() - , activePos = children.index($active) - , that = this + this.interval = clearInterval(this.interval) - if (pos > (children.length - 1) || pos < 0) return + return this + } - if (this.sliding) { - return this.$element.one('slid', function () { - that.to(pos) - }) - } + Carousel.prototype.next = function () { + if (this.sliding) return + return this.slide('next') + } - if (activePos == pos) { - return this.pause().cycle() - } + Carousel.prototype.prev = function () { + if (this.sliding) return + return this.slide('prev') + } - return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) + Carousel.prototype.slide = function (type, next) { + var $active = this.$element.find('.item.active') + var $next = next || $active[type]() + var isCycling = this.interval + var direction = type == 'next' ? 'left' : 'right' + var fallback = type == 'next' ? 'first' : 'last' + var that = this + + if (!$next.length) { + if (!this.options.wrap) return + $next = this.$element.find('.item')[fallback]() } - , pause: function () { - clearInterval(this.interval) - return this + if ($next.hasClass('active')) return this.sliding = false + + var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) + this.$element.trigger(e) + if (e.isDefaultPrevented()) return + + this.sliding = true + + isCycling && this.pause() + + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + this.$element.one('slid.bs.carousel', function () { + var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) + $nextIndicator && $nextIndicator.addClass('active') + }) } - , next: function () { - if (this.sliding) return - return this.slide('next') - } - - , prev: function () { - if (this.sliding) return - return this.slide('prev') - } - - , slide: function (type, next) { - var $active = this.$element.find('.active') - , $next = next || $active[type]() - , isCycling = this.interval - , direction = type == 'next' ? 'left' : 'right' - , fallback = type == 'next' ? 'first' : 'last' - , that = this - - this.sliding = true - - isCycling && this.pause() - - $next = $next.length ? $next : this.$element.find('.item')[fallback]() - - if (!$.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger('slide') - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger('slid') - } else { - $next.addClass(type) - $next[0].offsetWidth // force reflow - $active.addClass(direction) - $next.addClass(direction) - this.$element.trigger('slide') - this.$element.one($.support.transition.end, function () { + if ($.support.transition && this.$element.hasClass('slide')) { + $next.addClass(type) + $next[0].offsetWidth // force reflow + $active.addClass(direction) + $next.addClass(direction) + $active + .one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false - setTimeout(function () { that.$element.trigger('slid') }, 0) + setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) }) - } - - isCycling && this.cycle() - - return this + .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) + } else { + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger('slid.bs.carousel') } + isCycling && this.cycle() + + return this } - /* CAROUSEL PLUGIN DEFINITION - * ========================== */ + // CAROUSEL PLUGIN DEFINITION + // ========================== - $.fn.carousel = function ( option ) { + var old = $.fn.carousel + + $.fn.carousel = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('carousel') - , options = typeof option == 'object' && option - if (!data) $this.data('carousel', (data = new Carousel(this, options))) - if (typeof option == 'number') data.to(option) - else if (typeof option == 'string' || (option = options.slide)) data[option]() - else data.cycle() - }) - } + var $this = $(this) + var data = $this.data('bs.carousel') + var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) + var action = typeof option == 'string' ? option : options.slide - $.fn.carousel.defaults = { - interval: 5000 + if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) + if (typeof option == 'number') data.to(option) + else if (action) data[action]() + else if (options.interval) data.pause().cycle() + }) } $.fn.carousel.Constructor = Carousel - /* CAROUSEL DATA-API - * ================= */ + // CAROUSEL NO CONFLICT + // ==================== - $(function () { - $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) - $target.carousel(options) - e.preventDefault() + $.fn.carousel.noConflict = function () { + $.fn.carousel = old + return this + } + + + // CAROUSEL DATA-API + // ================= + + $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { + var $this = $(this), href + var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + var options = $.extend({}, $target.data(), $this.data()) + var slideIndex = $this.attr('data-slide-to') + if (slideIndex) options.interval = false + + $target.carousel(options) + + if (slideIndex = $this.attr('data-slide-to')) { + $target.data('bs.carousel').to(slideIndex) + } + + e.preventDefault() + }) + + $(window).on('load', function () { + $('[data-ride="carousel"]').each(function () { + var $carousel = $(this) + $carousel.carousel($carousel.data()) }) }) -}( window.jQuery ) -/* ============================================================= - * bootstrap-collapse.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#collapse - * ============================================================= - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ +}(jQuery); -!function( $ ){ +/* ======================================================================== + * Bootstrap: collapse.js v3.1.1 + * http://getbootstrap.com/javascript/#collapse + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ - "use strict" - var Collapse = function ( element, options ) { - this.$element = $(element) - this.options = $.extend({}, $.fn.collapse.defaults, options) ++function ($) { + 'use strict'; - if (this.options["parent"]) { - this.$parent = $(this.options["parent"]) - } + // COLLAPSE PUBLIC CLASS DEFINITION + // ================================ - this.options.toggle && this.toggle() + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Collapse.DEFAULTS, options) + this.transitioning = null + + if (this.options.parent) this.$parent = $(this.options.parent) + if (this.options.toggle) this.toggle() } - Collapse.prototype = { - - constructor: Collapse - - , dimension: function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } - - , show: function () { - var dimension = this.dimension() - , scroll = $.camelCase(['scroll', dimension].join('-')) - , actives = this.$parent && this.$parent.find('.in') - , hasData - - if (actives && actives.length) { - hasData = actives.data('collapse') - actives.collapse('hide') - hasData || actives.data('collapse', null) - } - - this.$element[dimension](0) - this.transition('addClass', 'show', 'shown') - this.$element[dimension](this.$element[0][scroll]) - - } - - , hide: function () { - var dimension = this.dimension() - this.reset(this.$element[dimension]()) - this.transition('removeClass', 'hide', 'hidden') - this.$element[dimension](0) - } - - , reset: function ( size ) { - var dimension = this.dimension() - - this.$element - .removeClass('collapse') - [dimension](size || 'auto') - [0].offsetWidth - - this.$element.addClass('collapse') - } - - , transition: function ( method, startEvent, completeEvent ) { - var that = this - , complete = function () { - if (startEvent == 'show') that.reset() - that.$element.trigger(completeEvent) - } - - this.$element - .trigger(startEvent) - [method]('in') - - $.support.transition && this.$element.hasClass('collapse') ? - this.$element.one($.support.transition.end, complete) : - complete() - } - - , toggle: function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - + Collapse.DEFAULTS = { + toggle: true } - /* COLLAPSIBLE PLUGIN DEFINITION - * ============================== */ + Collapse.prototype.dimension = function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } - $.fn.collapse = function ( option ) { + Collapse.prototype.show = function () { + if (this.transitioning || this.$element.hasClass('in')) return + + var startEvent = $.Event('show.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var actives = this.$parent && this.$parent.find('> .panel > .in') + + if (actives && actives.length) { + var hasData = actives.data('bs.collapse') + if (hasData && hasData.transitioning) return + actives.collapse('hide') + hasData || actives.data('bs.collapse', null) + } + + var dimension = this.dimension() + + this.$element + .removeClass('collapse') + .addClass('collapsing') + [dimension](0) + + this.transitioning = 1 + + var complete = function () { + this.$element + .removeClass('collapsing') + .addClass('collapse in') + [dimension]('auto') + this.transitioning = 0 + this.$element.trigger('shown.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + var scrollSize = $.camelCase(['scroll', dimension].join('-')) + + this.$element + .one($.support.transition.end, $.proxy(complete, this)) + .emulateTransitionEnd(350) + [dimension](this.$element[0][scrollSize]) + } + + Collapse.prototype.hide = function () { + if (this.transitioning || !this.$element.hasClass('in')) return + + var startEvent = $.Event('hide.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var dimension = this.dimension() + + this.$element + [dimension](this.$element[dimension]()) + [0].offsetHeight + + this.$element + .addClass('collapsing') + .removeClass('collapse') + .removeClass('in') + + this.transitioning = 1 + + var complete = function () { + this.transitioning = 0 + this.$element + .trigger('hidden.bs.collapse') + .removeClass('collapsing') + .addClass('collapse') + } + + if (!$.support.transition) return complete.call(this) + + this.$element + [dimension](0) + .one($.support.transition.end, $.proxy(complete, this)) + .emulateTransitionEnd(350) + } + + Collapse.prototype.toggle = function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + + // COLLAPSE PLUGIN DEFINITION + // ========================== + + var old = $.fn.collapse + + $.fn.collapse = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('collapse') - , options = typeof option == 'object' && option - if (!data) $this.data('collapse', (data = new Collapse(this, options))) + var $this = $(this) + var data = $this.data('bs.collapse') + var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data && options.toggle && option == 'show') option = !option + if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } - $.fn.collapse.defaults = { - toggle: true - } - $.fn.collapse.Constructor = Collapse - /* COLLAPSIBLE DATA-API - * ==================== */ + // COLLAPSE NO CONFLICT + // ==================== - $(function () { - $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { - var $this = $(this), href - , target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 - , option = $(target).data('collapse') ? 'toggle' : $this.data() - $(target).collapse(option) - }) - }) - -}( window.jQuery ) -/* ============================================================ - * bootstrap-dropdown.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#dropdowns - * ============================================================ - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } -!function( $ ){ + // COLLAPSE DATA-API + // ================= - "use strict" + $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { + var $this = $(this), href + var target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + var $target = $(target) + var data = $target.data('bs.collapse') + var option = data ? 'toggle' : $this.data() + var parent = $this.attr('data-parent') + var $parent = parent && $(parent) - /* DROPDOWN CLASS DEFINITION - * ========================= */ - - var toggle = '[data-toggle="dropdown"]' - , Dropdown = function ( element ) { - var $el = $(element).on('click.dropdown.data-api', this.toggle) - $('html').on('click.dropdown.data-api', function () { - $el.parent().removeClass('open') - }) - } - - Dropdown.prototype = { - - constructor: Dropdown - - , toggle: function ( e ) { - var $this = $(this) - , selector = $this.attr('data-target') - , $parent - , isActive - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } - - $parent = $(selector) - $parent.length || ($parent = $this.parent()) - - isActive = $parent.hasClass('open') - - clearMenus() - !isActive && $parent.toggleClass('open') - - return false + if (!data || !data.transitioning) { + if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') + $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') } + $target.collapse(option) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: dropdown.js v3.1.1 + * http://getbootstrap.com/javascript/#dropdowns + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // DROPDOWN CLASS DEFINITION + // ========================= + + var backdrop = '.dropdown-backdrop' + var toggle = '[data-toggle=dropdown]' + var Dropdown = function (element) { + $(element).on('click.bs.dropdown', this.toggle) } - function clearMenus() { - $(toggle).parent().removeClass('open') + Dropdown.prototype.toggle = function (e) { + var $this = $(this) + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + clearMenus() + + if (!isActive) { + if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { + // if mobile we use a backdrop because click events don't delegate + $('