diff --git a/.credentials/HCAPTCHA_SECRET b/.credentials/HCAPTCHA_SECRET deleted file mode 100644 index 7daa69d3..00000000 --- a/.credentials/HCAPTCHA_SECRET +++ /dev/null @@ -1 +0,0 @@ -0x0000000000000000000000000000000000000000 diff --git a/.credentials/HCAPTCHA_SITEKEY b/.credentials/HCAPTCHA_SITEKEY deleted file mode 100644 index f5093057..00000000 --- a/.credentials/HCAPTCHA_SITEKEY +++ /dev/null @@ -1 +0,0 @@ -10000000-ffff-ffff-ffff-000000000001 diff --git a/.credentials/KFETOPEN_TOKEN b/.credentials/KFETOPEN_TOKEN deleted file mode 100644 index 4cbb2bf5..00000000 --- a/.credentials/KFETOPEN_TOKEN +++ /dev/null @@ -1 +0,0 @@ -k-feste_token diff --git a/.credentials/SECRET_KEY b/.credentials/SECRET_KEY deleted file mode 100644 index de873cc2..00000000 --- a/.credentials/SECRET_KEY +++ /dev/null @@ -1 +0,0 @@ -insecure-key diff --git a/.envrc b/.envrc deleted file mode 100644 index 1d953f4b..00000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use nix diff --git a/.gitignore b/.gitignore index 70b12409..2f3d166c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,19 +5,13 @@ cof/settings.py settings.py *~ venv/ -.venv/ .vagrant /src media/ *.log -.sass-cache/ *.sqlite3 .coverage # PyCharm .idea .cache - -# VSCode -.vscode/ -.direnv diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ce3bd041..95d9305d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,12 @@ -image: "python:3.7" +image: "python:3.5" + +services: + - postgres:latest + - redis:latest variables: # GestioCOF settings + DJANGO_SETTINGS_MODULE: "cof.settings.prod" DBHOST: "postgres" REDIS_HOST: "redis" REDIS_PASSWD: "dummy" @@ -17,24 +22,21 @@ variables: # psql password authentication PGPASSWORD: $POSTGRES_PASSWORD - # apps to check migrations for - MIGRATION_APPS: "bda bds cofcms clubs events gestioncof kfet kfetauth kfetcms open petitscours shared" - -.test_template: +test: + stage: test before_script: - mkdir -p vendor/{pip,apt} - - apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev - - sed -E 's/^REDIS_HOST.*/REDIS_HOST = "redis"/' gestioasso/settings/secret_example.py > gestioasso/settings/secret.py - - sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' gestioasso/settings/secret.py + - apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client + - sed -E 's/^REDIS_HOST.*/REDIS_HOST = "redis"/' cof/settings/secret_example.py > cof/settings/secret.py + - sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' cof/settings/secret.py # Remove the old test database if it has not been done yet - psql --username=$POSTGRES_USER --host=$DBHOST -c "DROP DATABASE IF EXISTS test_$POSTGRES_DB" - - pip install --upgrade -r requirements-prod.txt coverage tblib + - pip install --upgrade -r requirements.txt coverage - python --version + script: + - coverage run manage.py test after_script: - coverage report - services: - - postgres:11.7 - - redis:latest cache: key: test paths: @@ -43,61 +45,18 @@ variables: # Keep this disabled for now, as it may kill GitLab... # coverage: '/TOTAL.*\s(\d+\.\d+)\%$/' -kfettest: - stage: test - extends: .test_template - variables: - DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod" - script: - - coverage run manage.py test kfet - -coftest: - stage: test - extends: .test_template - variables: - DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod" - script: - - coverage run manage.py test gestioncof bda petitscours shared --parallel - -bdstest: - stage: test - extends: .test_template - variables: - DJANGO_SETTINGS_MODULE: "gestioasso.settings.bds_prod" - script: - - coverage run manage.py test bds clubs events --parallel - linters: + image: python:3.6 stage: test before_script: - mkdir -p vendor/pip - pip install --upgrade black isort flake8 script: - black --check . - - isort --check --diff . + - isort --recursive --check-only --diff bda cof gestioncof kfet provisioning shared utils # Print errors only - - flake8 --exit-zero bda bds clubs gestioasso events gestioncof kfet petitscours provisioning shared + - flake8 --exit-zero bda cof gestioncof kfet provisioning shared utils cache: key: linters paths: - vendor/ - -# Check whether there are some missing migrations. -migration_checks: - stage: test - variables: - DJANGO_SETTINGS_MODULE: "gestioasso.settings.local" - before_script: - - mkdir -p vendor/{pip,apt} - - apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev - - cp gestioasso/settings/secret_example.py gestioasso/settings/secret.py - - pip install --upgrade -r requirements-devel.txt - - python --version - script: python manage.py makemigrations --dry-run --check $MIGRATION_APPS - services: - # this should not be necessary… - - postgres:11.7 - cache: - key: migration_checks - paths: - - vendor/ diff --git a/.pre-commit.sh b/.pre-commit.sh index abf1fe7d..b9985979 100755 --- a/.pre-commit.sh +++ b/.pre-commit.sh @@ -12,7 +12,6 @@ checker_dirty=0 # Working? -> Stash unstaged changes, run it, pop stash STAGED_PYTHON_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".py$") - # Formatter: black printf "> black ... " @@ -24,8 +23,8 @@ if type black &>/dev/null; then BLACK_OUTPUT="/tmp/gc-black-output.log" touch $BLACK_OUTPUT - if ! echo "$STAGED_PYTHON_FILES" | xargs -d'\n' black --check &>$BLACK_OUTPUT; then - echo "$STAGED_PYTHON_FILES" | xargs -d'\n' black &>$BLACK_OUTPUT + if ! black --check "$STAGED_PYTHON_FILES" &>$BLACK_OUTPUT; then + black $STAGED_PYTHON_FILES &>$BLACK_OUTPUT tail -1 $BLACK_OUTPUT formatter_updated=1 else @@ -48,8 +47,8 @@ if type isort &>/dev/null; then ISORT_OUTPUT="/tmp/gc-isort-output.log" touch $ISORT_OUTPUT - if ! echo "$STAGED_PYTHON_FILES" | xargs -d'\n' isort --check &>$ISORT_OUTPUT; then - echo "$STAGED_PYTHON_FILES" | xargs -d'\n' isort &>$ISORT_OUTPUT + if ! isort --check-only "$STAGED_PYTHON_FILES" &>$ISORT_OUTPUT; then + isort $STAGED_PYTHON_FILES &>$ISORT_OUTPUT printf "Reformatted.\n" formatter_updated=1 else @@ -72,7 +71,7 @@ if type flake8 &>/dev/null; then FLAKE8_OUTPUT="/tmp/gc-flake8-output.log" touch $FLAKE8_OUTPUT - if ! echo "$STAGED_PYTHON_FILES" | xargs -d'\n' flake8 &>$FLAKE8_OUTPUT; then + if ! flake8 $STAGED_PYTHON_FILES &>$FLAKE8_OUTPUT; then printf "FAIL\n" cat $FLAKE8_OUTPUT checker_dirty=1 diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index b68fb40c..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,303 +0,0 @@ -# Changelog - -Liste des changements notables dans GestioCOF depuis la version 0.1 (septembre -2018). - -## Le FUTUR ! (pas prêt pour la prod) - -### Nouveau module de gestion des événements - -- Désormais complet niveau modèles -- Export des participants implémenté - -#### TODO - -- Vue de création d'événements ergonomique -- Vue d'inscription à un événement **ou** intégration propre dans la vue - "inscription d'un nouveau membre" - -### Nouveau module de gestion des clubs - -Uniquement un modèle simple de clubs avec des respos. Aucune gestion des -adhérents ni des cotisations. - -## TODO Prod - -- Lancer `python manage.py update_translation_fields` après la migration -- Mettre à jour les units systemd `daphne.service` et `worker.service` - -- Créer un compte hCaptcha (https://www.hcaptcha.com/), au COF, et remplacer les secrets associés - -## Version ??? - ??/??/???? - -## Version 0.15.1 - 15/06/2023 - -### K-Fêt - -- Rattrape les erreurs d'envoi de mail de négatif -- Utilise l'adresse chefs pour les envois de négatifs - -## Version 0.15 - 22/05/2023 - -### K-Fêt - -- Rajoute un formulaire de contact -- Rajoute un formulaire de demande de soirée -- Désactive les mails d'envoi de négatifs sur les comptes gelés - -## Version 0.14 - 19/05/2023 - -- Répare les dépendances en spécifiant toutes les versions - -### K-Fêt - -- Répare la gestion des changement d'heure via moment.js - -## Version 0.13 - 19/02/2023 - -### K-Fêt - -- Rajoute la valeur des inventaires -- Résout les problèmes de négatif ne disparaissant pas -- Affiche son surnom s'il y en a un -- Bugfixes - -## Version 0.12.1 - 03/10/2022 - -### K-Fêt - -- Fixe un problème de rendu causé par l'agrandissement du menu - -- Mise à jour vers Channels 3.x et Django 3.2 - -## Version 0.12 - 17/06/2022 - -### K-Fêt - -- Ajoute une exception à la limite d'historique pour les comptes `LIQ` et `#13` -- Répare le problème des étiquettes LIQ/Comptes K-Fêt inversées dans les stats des articles K-Fêt - -## Version 0.11 - 26/10/2021 - -### COF - -- Répare un problème de rendu sur le wagtail du COF - -### K-Fêt - -- Ajoute de mails de rappels pour les comptes en négatif -- La recherche de comptes sur K-Psul remarche normalement -- Le pointeur de la souris change de forme quand on survole un item d'autocomplétion -- Modification du gel de compte: - - on ne peut plus geler/dégeler son compte soi-même (il faut la permission "Gérer les permissions K-Fêt") - - on ne peut rien compter sur un compte gelé (aucune override possible), et les K-Fêteux·ses dont le compte est gelé perdent tout accès à K-Psul - - les comptes actuellement gelés (sur l'ancien système) sont dégelés automatiquement -- Modification du fonctionnement des négatifs - - impossible d'avoir des négatifs inférieurs à `kfet_config.overdraft_amount` - - il n'y a plus de limite de temps sur les négatifs - - supression des autorisations de négatif - - il n'est plus possible de réinitialiser la durée d'un négatif en faisant puis en annulant une charge -- La gestion des erreurs passe du client au serveur, ce qui permet d'avoir des messages plus explicites -- La supression d'opérations anciennes est réparée - -## Version 0.10 - 18/04/2021 - -### K-Fêt - -- On fait sauter la limite qui empêchait de vendre plus de 24 unités d'un item à - la fois. -- L'interface indique plus clairement quand on fait une erreur en modifiant un - compte. -- On supprime la fonction "décalage de balance". -- L'accès à l'historique est maintenant limité à 7 jours pour raison de - confidentialité. Les chefs/trez peuvent disposer d'une permission - supplémentaire pour accéder à jusqu'à 30 jours en cas de problème de compta. - L'accès à son historique personnel n'est pas limité. Les durées sont - configurables dans `settings/cof_prod.py`. - -### COF - -- Le Captcha sur la page de demande de petits cours utilise maintenant hCaptcha - au lieu de ReCaptcha, pour mieux respecter la vie privée des utilisateur·ices - -## Version 0.9 - 06/02/2020 - -### COF / BdA - -- Le COF peut remettre à zéro la liste de ses adhérents en août (sans passer par - KDE). -- La page d'accueil affiche la date de fermeture des tirages BdA. -- On peut revendre une place dès qu'on l'a payée, plus besoin de payer toutes - ses places pour pouvoir revendre. -- On s'assure que l'email fourni lors d'une demande de petit cours est valide. - -### BDS - -- Le burô peut maintenant accorder ou révoquer le statut de membre du Burô - en modifiant le profil d'un membre du BDS. -- Le burô peut exporter la liste de ses membres avec email au format CSV depuis - la page d'accueil. - -### K-Fêt - -- On affiche les articles actuellement en vente en premier lors des inventaires - et des commandes. -- On peut supprimer un inventaire. Seuls les articles dont c'est le dernier - inventaire sont affectés. - -## Version 0.8 - 03/12/2020 - -### COF - -- La page "Mes places" dans la section BdA indique quelles places sont sur - listing. -- ergonomie de l'interface admin du BdA : moins d'options inutiles lors de - la sélection de participants. -- les tirages sont maintenant archivables pour éviter d'avoir encore d'autres - options inutiles. -- l'autocomplétion dans l'admin BdA est réparée. -- Les icones de la page de gestion des petits cours sont (à nouveau) réparées. -- On a supprimé la possibilité de modifier les mails automatiques depuis - l'interface admin car trop problématique. Faute de mieux, envoyer un mail à - KDE pour modifier ces mails. -- corrige un crash sporadique sur la page d'inscription au système de petits - cours - -### K-Fêt - -- (fix partiel) Empêche la K-Fêt de modifier des données COF (e.g. nom, prénom, - username) lors de la création d'un nouveau compte. -- Les statistiques de conso globales montrent deux courbes COF / non-COF au - lieu de LIQ / sur compte. -- Un bug empêchait de fermer manuellement la K-Fêt depuis un compte non - privilégié en tapant un mot de passe. C'est corrigé. - -## Version 0.7.2 - 08/09/2020 - -- Nouvelle page 404 -- Correction de bug en K-Fêt : le lien pour créer un nouveau compte exté apparaît - à nouveau dans l'autocomplétion - -## Version 0.7.1 - 05/09/2020 - -Petits ajustements sur le site du COF : - -- Possibilité d'ajouter des champs d'infos supplémentaires en plus de l'email et - de la page web dans les annuaires (clubs et partenaires). -- Corrige un bug d'affichage des adresses emails de clubs - -## Version 0.7 - 29/08/2020 - -### GestioBDS - -- Ajout d'un bouton pour supprimer un compte -- Le nombre d'adhérent⋅es est affiché sur la page d'accueil -- le groupe BDS a les bonnes permissions - -### Site du COF - -- Captcha fonctionnel pour les mailing-listes - -### K-Fêt - -- L'autocomplétion pour la création de compte K-Fêt se lance à 3 caractères seulement, -donc est plus rapide. - -## Version 0.6 - 27/07/2020 - -Arrivée du BDS ! -GestioCOF et GestioBDS ont du code en commun mais tournent de façon séparée, les -deux bases de données sont distinctes. - -## Version 0.5 - 11/07/2020 - -### Problèmes corrigés - -- La recherche d'utilisateurices (COF + K-Fêt) fonctionne de nouveau -- Bug d'affichage quand on a beaucoup de clubs dans le cadre "Accès rapide" sur - la page des clubs (nouveau site du COF) -- Version mobile plus ergonimique sur le nouveau site du COF -- Cliquer sur "visualiser" sur les pages de clubs dans wagtail ne provoque plus - d'erreurs 500 (nouveau site du COF) -- L'historique des ventes des articles K-Fêt fonctionne à nouveau -- Les montants en K-Fêt sont à nouveau affichés en UKF (et non en €). -- Les boutons "afficher/cacher" des mails et noms des participant⋅e⋅s à un - spectacle BdA fonctionnent à nouveau. -- on ne peut plus compter de consos sur ☠☠☠, ni éditer les comptes spéciaux -(LIQ, GNR, ☠☠☠, #13). - -### Nouvelles fonctionnalités - -- On n'affiche que 4 articles sur la pages "nouveautés" (nouveau site du COF) -- Plus de traductions sur le nouveau site du COF -- Les transferts apparaissent maintenant dans l'historique K-Fêt et l'historique - personnel. -- les statistiques K-Fêt remontent à plus d'un an (et le code est simplifié) - -## Version 0.4.1 - 17/01/2020 - -- Corrige un bug sur K-Psul lorsqu'un trigramme contient des caractères réservés - aux urls (\#, /...) - -## Version 0.4 - 15/01/2020 - -- Corrige un bug d'affichage d'images sur l'interface des petits cours -- La page des transferts permet de créer un nombre illimité de transferts en - une fois. -- Nouveau site du COF : les liens sont optionnels dans les descriptions de clubs -- Mise à jour du lien vers le calendire de la K-Fêt sur la page d'accueil -- Certaines opérations sont à nouveau accessibles depuis la session partagée - K-Fêt. -- Le bouton "déconnexion" déconnecte vraiment du CAS pour les comptes clipper -- Corrige un crash sur la page des reventes pour les nouveaux participants. -- Corrige un bug d'affichage pour les trigrammes avec caractères spéciaux - -## Version 0.3.3 - 30/11/2019 - -- Corrige un problème de redirection lors de la déconnexion (CAS seulement) -- Les catégories d'articles K-Fêt peuvent être exemptées de subvention COF -- Corrige un bug d'affichage dans K-Psul quand on annule une transaction sur LIQ -- Corrige une privilege escalation liée aux sessions partagées en K-Fêt - https://git.eleves.ens.fr/klub-dev-ens/gestioCOF/issues/240 - -## Version 0.3.2 - 04/11/2019 - -- Bugfix: modifier un compte K-Fêt ne supprime plus nom/prénom - -## Version 0.3.1 - 19/10/2019 - -- Bugfix: l'historique des utilisateurices s'affiche à nouveau - -## Version 0.3 - 16/10/2019 - -- Comptes extés: lien pour changer son mot de passe sur la page d'accueil -- Les utilisateurices non-COF peuvent éditer leur profil -- Un peu de pub pour KDEns sur la page d'accueil -- Fix erreur 500 sur /bda/revente//manage -- Si on essaie d'accéder au compte que qqn d'autre on a une 404 (et plus une 403) -- On ne peut plus modifier des comptes COF depuis l'interface K-Fêt -- Le champ de paiement BdA se fait au niveau des attributions -- Affiche un message d'erreur plutôt que de crasher si échec de l'envoi du mail - de bienvenue aux nouveaux membres -- On peut supprimer des comptes et des articles K-Fêt -- Passage à Django2 -- Dev : on peut désactiver la barre de debug avec une variable shell -- Remplace les CSS de Google par des polices de proximité -- Passage du site du COF et de la K-Fêt en Wagtail 2.3 et Wagtail-modeltranslation 0.9 -- Ajoute un lien vers l'administration générale depuis les petits cours -- Abandon de l'ancien catalogue BdA (déjà plus utilisé depuis longtemps) -- Force l'unicité des logins clipper -- Nouveau site du COF en wagtail -- Meilleurs affichage des longues listes de spectacles à cocher dans BdA-Revente -- Bugfix : les pages de la revente ne sont plus accessibles qu'aux membres du - COF - -## Version 0.2 - 07/11/2018 - -- Corrections de bugs d'interface dans l'inscription aux tirages BdA -- On peut annuler une revente à tout moment -- Pleiiiiin de tests - -## Version 0.1 - 09/09/2018 - -Début de la numérotation des versions, début du changelog diff --git a/README.md b/README.md index 28c6686d..2f08f3aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GestioCOF / GestioBDS +# GestioCOF [![pipeline status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/pipeline.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master) [![coverage report](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/coverage.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master) @@ -38,11 +38,11 @@ Vous pouvez maintenant installer les dépendances Python depuis le fichier pip install -U pip # parfois nécessaire la première fois pip install -r requirements-devel.txt -Pour terminer, copier le fichier `gestioasso/settings/secret_example.py` vers -`gestioasso/settings/secret.py`. Sous Linux ou Mac, préférez plutôt un lien symbolique +Pour terminer, copier le fichier `cof/settings/secret_example.py` vers +`cof/settings/secret.py`. Sous Linux ou Mac, préférez plutôt un lien symbolique pour profiter de façon transparente des mises à jour du fichier: - ln -s secret_example.py gestioasso/settings/secret.py + ln -s secret_example.py cof/settings/secret.py Nous avons un git hook de pre-commit pour formatter et vérifier que votre code vérifie nos conventions. Pour bénéficier des mises à jour du hook, préférez @@ -186,18 +186,6 @@ Pour lancer les tests : python manage.py test ``` -### Astuces - -- En développement on utilise la django debug toolbar parce que c'est utile pour - débuguer les templates ou les requêtes SQL mais des fois c'est pénible parce - ça fait ramer GestioCOF (surtout dans wagtail). - Vous pouvez la désactiver temporairement en définissant la variable - d'environnement `DJANGO_NO_DDT` dans votre shell : par exemple dans - bash/zsh/…: - ``` - $ export DJANGO_NO_DDT=1 - ``` - ## Documentation utilisateur diff --git a/TODO_PROD.md b/TODO_PROD.md new file mode 100644 index 00000000..1a7d0736 --- /dev/null +++ b/TODO_PROD.md @@ -0,0 +1 @@ +- Changer les urls dans les mails "bda-revente" et "bda-shotgun" diff --git a/Vagrantfile b/Vagrantfile index f34653a5..e12a45ed 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,19 +1,47 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# Configuration de base pour GestioCOF. -# Voir https://docs.vagrantup.com pour plus d'informations. +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. Vagrant.configure(2) do |config| - # On se base sur Debian 10 (Buster) pour avoir le même environnement qu'en - # production. - config.vm.box = "debian/contrib-buster64" + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + config.vm.box = "ubuntu/xenial64" # On associe le port 80 dans la machine virtuelle avec le port 8080 de notre # ordinateur, et le port 8000 avec le port 8000. config.vm.network :forwarded_port, guest: 80, host: 8080 config.vm.network :forwarded_port, guest: 8000, host: 8000 - # Le restes de la configuration (installation de paquets, etc) est géré un - # script shell. + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the + # documentation for more information about their specific syntax and use. + # config.vm.provision "shell", inline: <<-SHELL + # sudo apt-get update + # sudo apt-get install -y apache2 + # SHELL config.vm.provision :shell, path: "provisioning/bootstrap.sh" end diff --git a/bda/admin.py b/bda/admin.py index f52f721d..b32144f1 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -1,11 +1,10 @@ from datetime import timedelta +from custommail.shortcuts import send_mass_custom_mail from dal.autocomplete import ModelSelect2 from django import forms from django.contrib import admin -from django.core.mail import send_mass_mail -from django.db.models import Count, Q, Sum -from django.template import loader +from django.db.models import Count, Sum from django.template.defaultfilters import pluralize from django.utils import timezone @@ -33,6 +32,20 @@ class ReadOnlyMixin(object): return readonly_fields + self.readonly_fields_update +class ChoixSpectacleAdminForm(forms.ModelForm): + class Meta: + widgets = { + "participant": ModelSelect2(url="bda-participant-autocomplete"), + "spectacle": ModelSelect2(url="bda-spectacle-autocomplete"), + } + + +class ChoixSpectacleInline(admin.TabularInline): + model = ChoixSpectacle + form = ChoixSpectacleAdminForm + sortable_field_name = "priority" + + class AttributionTabularAdminForm(forms.ModelForm): listing = None @@ -68,51 +81,27 @@ class WithListingAttributionInline(AttributionInline): exclude = ("given",) form = WithListingAttributionTabularAdminForm listing = True - verbose_name_plural = "Attributions sur listing" class WithoutListingAttributionInline(AttributionInline): form = WithoutListingAttributionTabularAdminForm listing = False - verbose_name_plural = "Attributions hors listing" class ParticipantAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - queryset = Spectacle.objects.select_related("location") - - if self.instance.pk is not None: - queryset = queryset.filter(tirage=self.instance.tirage) - - self.fields["choicesrevente"].queryset = queryset - - -class ParticipantPaidFilter(admin.SimpleListFilter): - """ - Permet de filtrer les participants sur s'ils ont payé leurs places ou pas - """ - - title = "A payé" - parameter_name = "paid" - - def lookups(self, request, model_admin): - return ((True, "Oui"), (False, "Non")) - - def queryset(self, request, queryset): - return queryset.filter(paid=self.value()) + self.fields["choicesrevente"].queryset = Spectacle.objects.select_related( + "location" + ) class ParticipantAdmin(ReadOnlyMixin, admin.ModelAdmin): inlines = [WithListingAttributionInline, WithoutListingAttributionInline] def get_queryset(self, request): - return self.model.objects.annotate_paid().annotate( - nb_places=Count("attributions"), - remain=Sum( - "attribution__spectacle__price", filter=Q(attribution__paid=False) - ), - total=Sum("attributions__price"), + return Participant.objects.annotate( + nb_places=Count("attributions"), total=Sum("attributions__price") ) def nb_places(self, obj): @@ -121,13 +110,6 @@ class ParticipantAdmin(ReadOnlyMixin, admin.ModelAdmin): nb_places.admin_order_field = "nb_places" nb_places.short_description = "Nombre de places" - def paid(self, obj): - return obj.paid - - paid.short_description = "A payé" - paid.boolean = True - paid.admin_order_field = "paid" - def total(self, obj): tot = obj.total if tot: @@ -136,46 +118,31 @@ class ParticipantAdmin(ReadOnlyMixin, admin.ModelAdmin): return "0 €" total.admin_order_field = "total" - total.short_description = "Total des places" - - def remain(self, obj): - rem = obj.remain - if rem: - return "%.02f €" % rem - else: - return "0 €" - - remain.admin_order_field = "remain" - remain.short_description = "Reste à payer" - - list_display = ("user", "nb_places", "total", "paid", "remain", "tirage") - list_filter = (ParticipantPaidFilter, "tirage") + total.short_description = "Total à payer" + list_display = ("user", "nb_places", "total", "paid", "paymenttype", "tirage") + list_filter = ("paid", "tirage") search_fields = ("user__username", "user__first_name", "user__last_name") actions = ["send_attribs"] actions_on_bottom = True list_per_page = 400 - readonly_fields = ("total", "paid") + readonly_fields = ("total",) readonly_fields_update = ("user", "tirage") form = ParticipantAdminForm def send_attribs(self, request, queryset): - emails = [] + datatuple = [] for member in queryset.all(): - subject = "Résultats du tirage au sort" attribs = member.attributions.all() context = {"member": member.user} - - template_name = "" + shortname = "" if len(attribs) == 0: - template_name = "bda/mails/attributions-decus.txt" + shortname = "bda-attributions-decus" else: - template_name = "bda/mails/attributions.txt" + shortname = "bda-attributions" context["places"] = attribs - - message = loader.render_to_string(template_name, context) - emails.append((subject, message, "bda@ens.fr", [member.user.email])) - - send_mass_mail(emails) + print(context) + datatuple.append((shortname, context, "bda@ens.fr", [member.user.email])) + send_mass_custom_mail(datatuple) count = len(queryset.all()) if count == 1: message_bit = "1 membre a" @@ -191,6 +158,17 @@ class ParticipantAdmin(ReadOnlyMixin, admin.ModelAdmin): class AttributionAdminForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if "spectacle" in self.fields: + self.fields["spectacle"].queryset = Spectacle.objects.select_related( + "location" + ) + if "participant" in self.fields: + self.fields["participant"].queryset = Participant.objects.select_related( + "user", "tirage" + ) + def clean(self): cleaned_data = super().clean() participant = cleaned_data.get("participant") @@ -203,14 +181,13 @@ class AttributionAdminForm(forms.ModelForm): ) return cleaned_data - class Meta: - widgets = { - "participant": ModelSelect2(url="bda-participant-autocomplete"), - "spectacle": ModelSelect2(url="bda-spectacle-autocomplete"), - } - class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin): + def paid(self, obj): + return obj.participant.paid + + paid.short_description = "A payé" + paid.boolean = True list_display = ("id", "spectacle", "participant", "given", "paid") search_fields = ( "spectacle__title", @@ -223,7 +200,7 @@ class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin): class ChoixSpectacleAdmin(admin.ModelAdmin): - autocomplete_fields = ["participant", "spectacle"] + form = ChoixSpectacleAdminForm def tirage(self, obj): return obj.participant.tirage @@ -267,14 +244,15 @@ class SalleAdmin(admin.ModelAdmin): class SpectacleReventeAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - qset = Participant.objects.select_related("user", "tirage") - - if self.instance.pk is not None: - qset = qset.filter(tirage=self.instance.seller.tirage) - - self.fields["confirmed_entry"].queryset = qset - self.fields["seller"].queryset = qset - self.fields["soldTo"].queryset = qset + self.fields["confirmed_entry"].queryset = Participant.objects.select_related( + "user", "tirage" + ) + self.fields["seller"].queryset = Participant.objects.select_related( + "user", "tirage" + ) + self.fields["soldTo"].queryset = Participant.objects.select_related( + "user", "tirage" + ) class SpectacleReventeAdmin(admin.ModelAdmin): diff --git a/bda/algorithm.py b/bda/algorithm.py index 078f2be8..add09335 100644 --- a/bda/algorithm.py +++ b/bda/algorithm.py @@ -2,6 +2,7 @@ import random class Algorithm(object): + shows = None ranks = None origranks = None @@ -9,10 +10,10 @@ class Algorithm(object): def __init__(self, shows, members, choices): """Initialisation : - - on aggrège toutes les demandes pour chaque spectacle dans - show.requests - - on crée des tables de demandes pour chaque personne, afin de - pouvoir modifier les rankings""" + - on aggrège toutes les demandes pour chaque spectacle dans + show.requests + - on crée des tables de demandes pour chaque personne, afin de + pouvoir modifier les rankings""" self.max_group = 2 * max(choice.priority for choice in choices) self.shows = [] showdict = {} diff --git a/bda/forms.py b/bda/forms.py index d1d0f74f..4560d3e5 100644 --- a/bda/forms.py +++ b/bda/forms.py @@ -1,9 +1,8 @@ from django import forms from django.forms.models import BaseInlineFormSet -from django.template import loader from django.utils import timezone -from bda.models import SpectacleRevente +from bda.models import Attribution, Spectacle, SpectacleRevente class InscriptionInlineFormSet(BaseInlineFormSet): @@ -39,146 +38,134 @@ class TokenForm(forms.Form): token = forms.CharField(widget=forms.widgets.Textarea()) -class TemplateLabelField(forms.ModelMultipleChoiceField): - """ - Extends ModelMultipleChoiceField to offer two more customization options : - - `label_from_instance` can be used with a template file - - the widget rendering template can be specified with `option_template_name` - """ +class AttributionModelMultipleChoiceField(forms.ModelMultipleChoiceField): + def label_from_instance(self, obj): + return str(obj.spectacle) - def __init__( - self, - label_template_name=None, - context_object_name="obj", - option_template_name=None, - *args, - **kwargs - ): + +class ReventeModelMultipleChoiceField(forms.ModelMultipleChoiceField): + def __init__(self, *args, own=True, **kwargs): super().__init__(*args, **kwargs) - self.label_template_name = label_template_name - self.context_object_name = context_object_name - if option_template_name is not None: - self.widget.option_template_name = option_template_name + self.own = own def label_from_instance(self, obj): - if self.label_template_name is None: - return super().label_from_instance(obj) + label = "{show}{suffix}" + suffix = "" + if self.own: + # C'est notre propre revente : pas besoin de spécifier le vendeur + if obj.soldTo is not None: + suffix = " -- Vendue à {firstname} {lastname}".format( + firstname=obj.soldTo.user.first_name, + lastname=obj.soldTo.user.last_name, + ) else: - return loader.render_to_string( - self.label_template_name, context={self.context_object_name: obj} + # Ce n'est pas à nous : on ne voit jamais l'acheteur + suffix = " -- Vendue par {firstname} {lastname}".format( + firstname=obj.seller.user.first_name, lastname=obj.seller.user.last_name ) - -# Formulaires pour revente_manage + return label.format(show=str(obj.attribution.spectacle), suffix=suffix) class ResellForm(forms.Form): + attributions = AttributionModelMultipleChoiceField( + label="", + queryset=Attribution.objects.none(), + widget=forms.CheckboxSelectMultiple, + required=False, + ) + def __init__(self, participant, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields["attributions"] = TemplateLabelField( - queryset=participant.attribution_set.filter( - spectacle__date__gte=timezone.now(), paid=True - ) + self.fields["attributions"].queryset = ( + participant.attribution_set.filter(spectacle__date__gte=timezone.now()) .exclude(revente__seller=participant) - .select_related("spectacle", "spectacle__location", "participant__user"), - widget=forms.CheckboxSelectMultiple, - required=False, - label_template_name="bda/forms/attribution_label_table.html", - option_template_name="bda/forms/checkbox_table.html", - context_object_name="attribution", + .select_related("spectacle", "spectacle__location", "participant__user") ) class AnnulForm(forms.Form): + reventes = ReventeModelMultipleChoiceField( + own=True, + label="", + queryset=Attribution.objects.none(), + widget=forms.CheckboxSelectMultiple, + required=False, + ) + def __init__(self, participant, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields["reventes"] = TemplateLabelField( - label="", - queryset=participant.original_shows.filter( - attribution__spectacle__date__gte=timezone.now(), soldTo__isnull=True + self.fields["reventes"].queryset = participant.original_shows.filter( + attribution__spectacle__date__gte=timezone.now(), + notif_sent=False, + soldTo__isnull=True, + ).select_related("attribution__spectacle", "attribution__spectacle__location") + + +class InscriptionReventeForm(forms.Form): + spectacles = forms.ModelMultipleChoiceField( + queryset=Spectacle.objects.none(), + widget=forms.CheckboxSelectMultiple, + required=False, + ) + + def __init__(self, tirage, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields["spectacles"].queryset = tirage.spectacle_set.select_related( + "location" + ).filter(date__gte=timezone.now()) + + +class ReventeTirageAnnulForm(forms.Form): + reventes = ReventeModelMultipleChoiceField( + own=False, + label="", + queryset=SpectacleRevente.objects.none(), + widget=forms.CheckboxSelectMultiple, + required=False, + ) + + def __init__(self, participant, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields["reventes"].queryset = participant.entered.filter( + soldTo__isnull=True + ).select_related("attribution__spectacle", "seller__user") + + +class ReventeTirageForm(forms.Form): + reventes = ReventeModelMultipleChoiceField( + own=False, + label="", + queryset=SpectacleRevente.objects.none(), + widget=forms.CheckboxSelectMultiple, + required=False, + ) + + def __init__(self, participant, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields["reventes"].queryset = ( + SpectacleRevente.objects.filter( + notif_sent=True, shotgun=False, tirage_done=False ) - .select_related( - "attribution__spectacle", "attribution__spectacle__location" - ) - .order_by("-date"), - widget=forms.CheckboxSelectMultiple, - required=False, - label_template_name="bda/forms/revente_self_label_table.html", - option_template_name="bda/forms/checkbox_table.html", - context_object_name="revente", + .exclude(confirmed_entry=participant) + .select_related("attribution__spectacle") ) class SoldForm(forms.Form): + reventes = ReventeModelMultipleChoiceField( + own=True, + label="", + queryset=Attribution.objects.none(), + widget=forms.CheckboxSelectMultiple, + ) + def __init__(self, participant, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields["reventes"] = TemplateLabelField( - queryset=participant.original_shows.filter(soldTo__isnull=False) + self.fields["reventes"].queryset = ( + participant.original_shows.filter(soldTo__isnull=False) .exclude(soldTo=participant) .select_related( "attribution__spectacle", "attribution__spectacle__location" - ), - widget=forms.CheckboxSelectMultiple, - label_template_name="bda/forms/revente_sold_label_table.html", - option_template_name="bda/forms/checkbox_table.html", - context_object_name="revente", - ) - - -# Formulaire pour revente_subscribe - - -class InscriptionReventeForm(forms.Form): - def __init__(self, tirage, *args, **kwargs): - super().__init__(*args, **kwargs) - self.fields["spectacles"] = TemplateLabelField( - queryset=tirage.spectacle_set.select_related("location").filter( - date__gte=timezone.now() - ), - widget=forms.CheckboxSelectMultiple, - required=False, - label_template_name="bda/forms/spectacle_label_table.html", - option_template_name="bda/forms/checkbox_table.html", - context_object_name="spectacle", - ) - - -# Formulaires pour revente_tirages - - -class ReventeTirageAnnulForm(forms.Form): - def __init__(self, participant, *args, **kwargs): - super().__init__(*args, **kwargs) - self.fields["reventes"] = TemplateLabelField( - queryset=participant.entered.filter(soldTo__isnull=True).select_related( - "attribution__spectacle", "seller__user" - ), - widget=forms.CheckboxSelectMultiple, - required=False, - label_template_name="bda/forms/revente_other_label_table.html", - option_template_name="bda/forms/checkbox_table.html", - context_object_name="revente", - ) - - -class ReventeTirageForm(forms.Form): - def __init__(self, participant, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.fields["reventes"] = TemplateLabelField( - queryset=( - SpectacleRevente.objects.filter( - notif_sent=True, - shotgun=False, - tirage_done=False, - attribution__spectacle__tirage=participant.tirage, - ) - .exclude(confirmed_entry=participant) - .select_related("attribution__spectacle") - ), - widget=forms.CheckboxSelectMultiple, - required=False, - label_template_name="bda/forms/revente_other_label_table.html", - option_template_name="bda/forms/checkbox_table.html", - context_object_name="revente", + ) ) diff --git a/bda/management/commands/loadbdadevdata.py b/bda/management/commands/loadbdadevdata.py index 186e1da7..a608db6a 100644 --- a/bda/management/commands/loadbdadevdata.py +++ b/bda/management/commands/loadbdadevdata.py @@ -81,7 +81,7 @@ class Command(MyBaseCommand): shows = random.sample( list(tirage.spectacle_set.all()), tirage.spectacle_set.count() // 2 ) - for rank, show in enumerate(shows): + for (rank, show) in enumerate(shows): choices.append( ChoixSpectacle( participant=part, diff --git a/bda/migrations/0001_initial.py b/bda/migrations/0001_initial.py index 5bc848c8..077ddd4e 100644 --- a/bda/migrations/0001_initial.py +++ b/bda/migrations/0001_initial.py @@ -6,6 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)] operations = [ diff --git a/bda/migrations/0002_add_tirage.py b/bda/migrations/0002_add_tirage.py index c2c6bd3c..f4b01ed2 100644 --- a/bda/migrations/0002_add_tirage.py +++ b/bda/migrations/0002_add_tirage.py @@ -35,6 +35,7 @@ def fill_tirage_fields(apps, schema_editor): class Migration(migrations.Migration): + dependencies = [("bda", "0001_initial")] operations = [ diff --git a/bda/migrations/0003_update_tirage_and_spectacle.py b/bda/migrations/0003_update_tirage_and_spectacle.py index 07f3742e..3548eb88 100644 --- a/bda/migrations/0003_update_tirage_and_spectacle.py +++ b/bda/migrations/0003_update_tirage_and_spectacle.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0002_add_tirage")] operations = [ diff --git a/bda/migrations/0004_mails-rappel.py b/bda/migrations/0004_mails-rappel.py index 407353a4..d331568a 100644 --- a/bda/migrations/0004_mails-rappel.py +++ b/bda/migrations/0004_mails-rappel.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0003_update_tirage_and_spectacle")] operations = [ diff --git a/bda/migrations/0005_encoding.py b/bda/migrations/0005_encoding.py index 29ee0027..eedfcee4 100644 --- a/bda/migrations/0005_encoding.py +++ b/bda/migrations/0005_encoding.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0004_mails-rappel")] operations = [ diff --git a/bda/migrations/0006_add_tirage_switch.py b/bda/migrations/0006_add_tirage_switch.py index 1535a5fe..ccfe7505 100644 --- a/bda/migrations/0006_add_tirage_switch.py +++ b/bda/migrations/0006_add_tirage_switch.py @@ -18,6 +18,7 @@ def forwards_func(apps, schema_editor): class Migration(migrations.Migration): + dependencies = [("bda", "0005_encoding")] operations = [ diff --git a/bda/migrations/0007_extends_spectacle.py b/bda/migrations/0007_extends_spectacle.py index 48865acb..87182ff7 100644 --- a/bda/migrations/0007_extends_spectacle.py +++ b/bda/migrations/0007_extends_spectacle.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0006_add_tirage_switch")] operations = [ diff --git a/bda/migrations/0008_py3.py b/bda/migrations/0008_py3.py index 3a7dfeb1..6aa69abd 100644 --- a/bda/migrations/0008_py3.py +++ b/bda/migrations/0008_py3.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0007_extends_spectacle")] operations = [ diff --git a/bda/migrations/0009_revente.py b/bda/migrations/0009_revente.py index 7a547f85..d888140f 100644 --- a/bda/migrations/0009_revente.py +++ b/bda/migrations/0009_revente.py @@ -6,6 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0008_py3")] operations = [ diff --git a/bda/migrations/0010_spectaclerevente_shotgun.py b/bda/migrations/0010_spectaclerevente_shotgun.py index ae0fdff1..da5c014c 100644 --- a/bda/migrations/0010_spectaclerevente_shotgun.py +++ b/bda/migrations/0010_spectaclerevente_shotgun.py @@ -12,15 +12,15 @@ def forwards_func(apps, schema_editor): for revente in SpectacleRevente.objects.all(): is_expired = timezone.now() > revente.date_tirage() - is_direct = ( - revente.attribution.spectacle.date >= revente.date - and timezone.now() > revente.date + timedelta(minutes=15) + is_direct = revente.attribution.spectacle.date >= revente.date and timezone.now() > revente.date + timedelta( + minutes=15 ) revente.shotgun = is_expired or is_direct revente.save() class Migration(migrations.Migration): + dependencies = [("bda", "0009_revente")] operations = [ diff --git a/bda/migrations/0011_tirage_appear_catalogue.py b/bda/migrations/0011_tirage_appear_catalogue.py index a8c49e2d..446be392 100644 --- a/bda/migrations/0011_tirage_appear_catalogue.py +++ b/bda/migrations/0011_tirage_appear_catalogue.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0010_spectaclerevente_shotgun")] operations = [ diff --git a/bda/migrations/0012_notif_time.py b/bda/migrations/0012_notif_time.py index 78ef8dce..96853a24 100644 --- a/bda/migrations/0012_notif_time.py +++ b/bda/migrations/0012_notif_time.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [("bda", "0011_tirage_appear_catalogue")] operations = [ diff --git a/bda/migrations/0012_swap_double_choice.py b/bda/migrations/0012_swap_double_choice.py index dcb8056d..e712f2ff 100644 --- a/bda/migrations/0012_swap_double_choice.py +++ b/bda/migrations/0012_swap_double_choice.py @@ -13,6 +13,7 @@ def swap_double_choice(apps, schema_editor): class Migration(migrations.Migration): + dependencies = [("bda", "0011_tirage_appear_catalogue")] operations = [ diff --git a/bda/migrations/0013_merge_20180524_2123.py b/bda/migrations/0013_merge_20180524_2123.py index b974abf2..8f78b6a9 100644 --- a/bda/migrations/0013_merge_20180524_2123.py +++ b/bda/migrations/0013_merge_20180524_2123.py @@ -6,6 +6,7 @@ from django.db import migrations class Migration(migrations.Migration): + dependencies = [("bda", "0012_notif_time"), ("bda", "0012_swap_double_choice")] operations = [] diff --git a/bda/migrations/0014_attribution_paid_field.py b/bda/migrations/0014_attribution_paid_field.py deleted file mode 100644 index e5ef2b2d..00000000 --- a/bda/migrations/0014_attribution_paid_field.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 2.2 on 2019-06-03 19:13 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [("bda", "0013_merge_20180524_2123")] - - operations = [ - migrations.AddField( - model_name="attribution", - name="paid", - field=models.BooleanField(default=False, verbose_name="Payée"), - ), - migrations.AddField( - model_name="attribution", - name="paymenttype", - field=models.CharField( - blank=True, - choices=[ - ("cash", "Cash"), - ("cb", "CB"), - ("cheque", "Chèque"), - ("autre", "Autre"), - ], - max_length=6, - verbose_name="Moyen de paiement", - ), - ), - ] diff --git a/bda/migrations/0015_move_bda_payment.py b/bda/migrations/0015_move_bda_payment.py deleted file mode 100644 index a39a159c..00000000 --- a/bda/migrations/0015_move_bda_payment.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 2.2 on 2019-06-03 19:30 - -from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist -from django.db import migrations - - -def set_attr_payment(apps, schema_editor): - Attribution = apps.get_model("bda", "Attribution") - for attr in Attribution.objects.all(): - attr.paid = attr.participant.paid - attr.paymenttype = attr.participant.paymenttype - attr.save() - - -def set_participant_payment(apps, schema_editor): - Participant = apps.get_model("bda", "Participant") - for part in Participant.objects.all(): - attr_set = part.attribution_set - part.paid = attr_set.exists() and not attr_set.filter(paid=False).exists() - try: - # S'il n'y a qu'un seul type de paiement, on le set - part.paymenttype = ( - attr_set.values_list("paymenttype", flat=True).distinct().get() - ) - # Sinon, whatever - except (ObjectDoesNotExist, MultipleObjectsReturned): - pass - part.save() - - -class Migration(migrations.Migration): - dependencies = [("bda", "0014_attribution_paid_field")] - - operations = [ - migrations.RunPython(set_attr_payment, set_participant_payment, atomic=True) - ] diff --git a/bda/migrations/0016_delete_participant_paid.py b/bda/migrations/0016_delete_participant_paid.py deleted file mode 100644 index 86a17b24..00000000 --- a/bda/migrations/0016_delete_participant_paid.py +++ /dev/null @@ -1,12 +0,0 @@ -# Generated by Django 2.2 on 2019-06-03 19:30 - -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [("bda", "0015_move_bda_payment")] - - operations = [ - migrations.RemoveField(model_name="participant", name="paid"), - migrations.RemoveField(model_name="participant", name="paymenttype"), - ] diff --git a/bda/migrations/0017_participant_accepte_charte.py b/bda/migrations/0017_participant_accepte_charte.py deleted file mode 100644 index 3157654b..00000000 --- a/bda/migrations/0017_participant_accepte_charte.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.2 on 2019-09-18 16:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [("bda", "0016_delete_participant_paid")] - - operations = [ - migrations.AddField( - model_name="participant", - name="accepte_charte", - field=models.BooleanField( - default=False, verbose_name="A accepté la charte BdA" - ), - ) - ] diff --git a/bda/migrations/0018_auto_20201021_1818.py b/bda/migrations/0018_auto_20201021_1818.py deleted file mode 100644 index 444f32d8..00000000 --- a/bda/migrations/0018_auto_20201021_1818.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 2.2.12 on 2020-10-21 16:18 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("bda", "0017_participant_accepte_charte"), - ] - - operations = [ - migrations.AlterModelOptions( - name="participant", - options={"ordering": ("-tirage", "user__last_name", "user__first_name")}, - ), - migrations.AddField( - model_name="tirage", - name="archived", - field=models.BooleanField(default=False, verbose_name="Archivé"), - ), - migrations.AlterField( - model_name="participant", - name="tirage", - field=models.ForeignKey( - limit_choices_to={"archived": False}, - on_delete=django.db.models.deletion.CASCADE, - to="bda.Tirage", - ), - ), - migrations.AddConstraint( - model_name="participant", - constraint=models.UniqueConstraint( - fields=("tirage", "user"), name="unique_tirage" - ), - ), - ] diff --git a/bda/migrations/0019_auto_20220630_1245.py b/bda/migrations/0019_auto_20220630_1245.py deleted file mode 100644 index 12b7149d..00000000 --- a/bda/migrations/0019_auto_20220630_1245.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.2.13 on 2022-06-30 10:45 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("bda", "0018_auto_20201021_1818"), - ] - - operations = [ - migrations.AlterUniqueTogether( - name="choixspectacle", - unique_together=set(), - ), - migrations.AddConstraint( - model_name="choixspectacle", - constraint=models.UniqueConstraint( - fields=("participant", "spectacle"), name="unique_participation" - ), - ), - ] diff --git a/bda/models.py b/bda/models.py index 9bc2ce3c..9ac38a41 100644 --- a/bda/models.py +++ b/bda/models.py @@ -2,14 +2,14 @@ import calendar import random from datetime import timedelta +from custommail.models import CustomMail +from custommail.shortcuts import send_mass_custom_mail from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core import mail -from django.core.mail import EmailMessage, send_mass_mail from django.db import models -from django.db.models import Count, Exists -from django.template import loader +from django.db.models import Count from django.utils import formats, timezone @@ -31,7 +31,6 @@ class Tirage(models.Model): "Tirage à afficher dans le catalogue", default=False ) enable_do_tirage = models.BooleanField("Le tirage peut être lancé", default=False) - archived = models.BooleanField("Archivé", default=False) def __str__(self): return "%s - %s" % ( @@ -117,19 +116,16 @@ class Spectacle(models.Model): bda_generic.nb_attr = 1 members.append(bda_generic) # On écrit un mail personnalisé à chaque participant - mails = [ + datatuple = [ ( - str(self), - loader.render_to_string( - "bda/mails/rappel.txt", - context={"member": member, "nb_attr": member.nb_attr, "show": self}, - ), + "bda-rappel", + {"member": member, "nb_attr": member.nb_attr, "show": self}, settings.MAIL_DATA["rappels"]["FROM"], [member.email], ) for member in members ] - send_mass_mail(mails) + send_mass_custom_mail(datatuple) # On enregistre le fait que l'envoi a bien eu lieu self.rappel_sent = timezone.now() self.save() @@ -155,41 +151,6 @@ PAYMENT_TYPES = ( ) -class Attribution(models.Model): - participant = models.ForeignKey("Participant", on_delete=models.CASCADE) - spectacle = models.ForeignKey( - Spectacle, on_delete=models.CASCADE, related_name="attribues" - ) - given = models.BooleanField("Donnée", default=False) - paid = models.BooleanField("Payée", default=False) - paymenttype = models.CharField( - "Moyen de paiement", max_length=6, choices=PAYMENT_TYPES, blank=True - ) - - def __str__(self): - return "%s -- %s, %s" % ( - self.participant.user, - self.spectacle.title, - self.spectacle.date, - ) - - -class ParticipantPaidQueryset(models.QuerySet): - """ - Un manager qui annote le queryset avec un champ `paid`, - indiquant si un participant a payé toutes ses attributions. - """ - - def annotate_paid(self): - # OuterRef permet de se référer à un champ d'un modèle non encore fixé - # Voir: - # https://docs.djangoproject.com/en/2.2/ref/models/expressions/#django.db.models.OuterRef - unpaid = Attribution.objects.filter( - participant=models.OuterRef("pk"), paid=False - ) - return self.annotate(paid=~Exists(unpaid)) - - class Participant(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) choices = models.ManyToManyField( @@ -198,25 +159,18 @@ class Participant(models.Model): attributions = models.ManyToManyField( Spectacle, through="Attribution", related_name="attributed_to" ) - tirage = models.ForeignKey( - Tirage, on_delete=models.CASCADE, limit_choices_to={"archived": False} + paid = models.BooleanField("A payé", default=False) + paymenttype = models.CharField( + "Moyen de paiement", max_length=6, choices=PAYMENT_TYPES, blank=True ) - accepte_charte = models.BooleanField("A accepté la charte BdA", default=False) + tirage = models.ForeignKey(Tirage, on_delete=models.CASCADE) choicesrevente = models.ManyToManyField( Spectacle, related_name="subscribed", blank=True ) - objects = ParticipantPaidQueryset.as_manager() - def __str__(self): return "%s - %s" % (self.user, self.tirage.title) - class Meta: - ordering = ("-tirage", "user__last_name", "user__first_name") - constraints = [ - models.UniqueConstraint(fields=("tirage", "user"), name="unique_tirage"), - ] - DOUBLE_CHOICES = ( ("1", "1 place"), @@ -253,15 +207,26 @@ class ChoixSpectacle(models.Model): class Meta: ordering = ("priority",) - constraints = [ - models.UniqueConstraint( - fields=["participant", "spectacle"], name="unique_participation" - ) - ] + unique_together = (("participant", "spectacle"),) verbose_name = "voeu" verbose_name_plural = "voeux" +class Attribution(models.Model): + participant = models.ForeignKey(Participant, on_delete=models.CASCADE) + spectacle = models.ForeignKey( + Spectacle, on_delete=models.CASCADE, related_name="attribues" + ) + given = models.BooleanField("Donnée", default=False) + + def __str__(self): + return "%s -- %s, %s" % ( + self.participant.user, + self.spectacle.title, + self.spectacle.date, + ) + + class SpectacleRevente(models.Model): attribution = models.OneToOneField( Attribution, on_delete=models.CASCADE, related_name="revente" @@ -364,24 +329,21 @@ class SpectacleRevente(models.Model): BdA-Revente à tous les intéressés. """ inscrits = self.attribution.spectacle.subscribed.select_related("user") - mails = [ + datatuple = [ ( - "BdA-Revente : {}".format(self.attribution.spectacle.title), - loader.render_to_string( - "bda/mails/revente-new.txt", - context={ - "member": participant.user, - "show": self.attribution.spectacle, - "revente": self, - "site": Site.objects.get_current(), - }, - ), + "bda-revente", + { + "member": participant.user, + "show": self.attribution.spectacle, + "revente": self, + "site": Site.objects.get_current(), + }, settings.MAIL_DATA["revente"]["FROM"], [participant.user.email], ) for participant in inscrits ] - send_mass_mail(mails) + send_mass_custom_mail(datatuple) self.notif_sent = True self.notif_time = timezone.now() self.save() @@ -392,23 +354,20 @@ class SpectacleRevente(models.Model): leur indiquer qu'il est désormais disponible au shotgun. """ inscrits = self.attribution.spectacle.subscribed.select_related("user") - mails = [ + datatuple = [ ( - "BdA-Revente : {}".format(self.attribution.spectacle.title), - loader.render_to_string( - "bda/mails/revente-shotgun.txt", - context={ - "member": participant.user, - "show": self.attribution.spectacle, - "site": Site.objects.get_current(), - }, - ), + "bda-shotgun", + { + "member": participant.user, + "show": self.attribution.spectacle, + "site": Site.objects.get_current(), + }, settings.MAIL_DATA["revente"]["FROM"], [participant.user.email], ) for participant in inscrits ] - send_mass_mail(mails) + send_mass_custom_mail(datatuple) self.notif_sent = True self.notif_time = timezone.now() # Flag inutile, sauf si l'horloge interne merde @@ -440,30 +399,31 @@ class SpectacleRevente(models.Model): "show": spectacle, } - subject = "BdA-Revente : {}".format(spectacle.title) + c_mails_qs = CustomMail.objects.filter( + shortname__in=[ + "bda-revente-winner", + "bda-revente-loser", + "bda-revente-seller", + ] + ) + + c_mails = {cm.shortname: cm for cm in c_mails_qs} mails.append( - EmailMessage( - subject=subject, - body=loader.render_to_string( - "bda/mails/revente-tirage-winner.txt", - context=context, - ), + c_mails["bda-revente-winner"].get_message( + context, from_email=settings.MAIL_DATA["revente"]["FROM"], to=[winner.user.email], ) ) + mails.append( - EmailMessage( - subject=subject, - body=loader.render_to_string( - "bda/mails/revente-tirage-seller.txt", - context=context, - ), + c_mails["bda-revente-seller"].get_message( + context, from_email=settings.MAIL_DATA["revente"]["FROM"], to=[seller.user.email], reply_to=[winner.user.email], - ), + ) ) # Envoie un mail aux perdants @@ -473,15 +433,11 @@ class SpectacleRevente(models.Model): new_context["acheteur"] = inscrit.user mails.append( - EmailMessage( - subject=subject, - body=loader.render_to_string( - "bda/mails/revente-tirage-loser.txt", - context=new_context, - ), + c_mails["bda-revente-loser"].get_message( + new_context, from_email=settings.MAIL_DATA["revente"]["FROM"], to=[inscrit.user.email], - ), + ) ) mail_conn = mail.get_connection() diff --git a/bda/static/bda/css/bda.css b/bda/static/bda/css/bda.css deleted file mode 100644 index 7f2c1d9a..00000000 --- a/bda/static/bda/css/bda.css +++ /dev/null @@ -1,125 +0,0 @@ -form#tokenform { - text-align: center; - font-size: 2em; -} - -label { - margin-right: 10px; - vertical-align: top; -} - -form#tokenform textarea { - font-size: 2em; - width: 350px; - height: 200px; - font-family: 'Droif Serif', serif; -} - -/* wft ? -input { - width: 400px; - font-size: 2em; -}*/ - -ul.losers { - display: inline; - margin: 0; - padding: 0; -} - -ul.losers li { - display: inline; -} - -span.details { - font-size: 0.7em; -} - -td { - border: 0px solid black; - padding: 2px; -} -.attribresult { - margin: 10px 0px; -} - -.spectacle-passe { - opacity:0.5; -} - -/** JQuery-Confirm box **/ - -.jconfirm .jconfirm-bg { - background-color: rgb(0,0,0,0.6) !important; -} - -.jconfirm .jconfirm-box { - padding:0; - border-radius:0 !important; - font-family:Roboto; -} - -.jconfirm .jconfirm-box .content-pane { - border-bottom:1px solid #ddd; - margin: 0px !important; -} - -.jconfirm .jconfirm-box .content { - padding: 5px; -} - -.jconfirm .jconfirm-box .content-pane { - border-bottom:1px solid #ddd; - margin: 0px !important; -} - -.jconfirm .jconfirm-box .content { - padding: 10px; -} - -.jconfirm .jconfirm-box .content a, -.jconfirm .jconfirm-box .content a:hover { - color: #D81138; - font-weight: bold; -} - -.jconfirm .jconfirm-box .buttons { - margin-top:-6px; /* j'arrive pas à voir pk y'a un espace au dessus sinon... */ - padding:0; - height:40px; -} - -.jconfirm .jconfirm-box .buttons button { - min-width:40px; - height:100%; - margin:0; - margin:0 !important; - border-radius: 0 !important; -} - -.jconfirm .jconfirm-box .buttons button:first-child:focus, -.jconfirm .jconfirm-box .buttons button:first-child:hover { - color:#FFF !important; - background:forestgreen !important; -} - -.jconfirm .jconfirm-box .buttons button:nth-child(2):focus, -.jconfirm .jconfirm-box .buttons button:nth-child(2):hover { - color:#FFF !important; - background:#D93A32 !important; -} - -.jconfirm .jconfirm-box div.title-c .title { - display: block; - - padding:0 15px; - height:40px; - line-height:40px; - - font-family:Dosis; - font-size:20px; - font-weight:bold; - - color:#FFF; - background-color:rgb(222, 130, 107); -} \ No newline at end of file diff --git a/bda/static/css/bda.css b/bda/static/css/bda.css new file mode 100644 index 00000000..4d6ecfbd --- /dev/null +++ b/bda/static/css/bda.css @@ -0,0 +1,48 @@ +form#tokenform { + text-align: center; + font-size: 2em; +} + +label { + margin-right: 10px; + vertical-align: top; +} + +form#tokenform textarea { + font-size: 2em; + width: 350px; + height: 200px; + font-family: 'Droif Serif', serif; +} + +/* wft ? +input { + width: 400px; + font-size: 2em; +}*/ + +ul.losers { + display: inline; + margin: 0; + padding: 0; +} + +ul.losers li { + display: inline; +} + +span.details { + font-size: 0.7em; +} + +td { + border: 0px solid black; + padding: 2px; +} +.attribresult { + margin: 10px 0px; +} + +.spectacle-passe { + opacity:0.5; +} diff --git a/bda/static/fonts/josefinsans.ttf b/bda/static/fonts/josefinsans.ttf new file mode 100644 index 00000000..d234c43c Binary files /dev/null and b/bda/static/fonts/josefinsans.ttf differ diff --git a/bda/templates/bda-attrib.html b/bda/templates/bda-attrib.html index 057cacb4..5c22d2b3 100644 --- a/bda/templates/bda-attrib.html +++ b/bda/templates/bda-attrib.html @@ -1,8 +1,8 @@ {% extends "base_title.html" %} -{% load static %} +{% load staticfiles %} {% block extra_head %} - + {% endblock %} {% block realcontent %} diff --git a/bda/templates/bda/etat-places.html b/bda/templates/bda/etat-places.html index d1af0667..d2875cab 100644 --- a/bda/templates/bda/etat-places.html +++ b/bda/templates/bda/etat-places.html @@ -1,5 +1,5 @@ {% extends "base_title.html" %} -{% load static %} +{% load staticfiles %} {% block realcontent %}

État des inscriptions BdA

@@ -42,6 +42,9 @@ Total : {{ total }} place{{ total|pluralize }} demandée{{ total|pluralize }} sur {{ proposed }} place{{ proposed|pluralize }} proposée{{ proposed|pluralize }} + - - - - - + + + + {% endblock %} {% block realcontent %} @@ -54,11 +52,6 @@ var django = { } else { deleteInput.attr("checked", true); } - } else { - // Reset the default values - var selects = $(form).find("select"); - $(selects[0]).val(""); - $(selects[1]).val("1"); } // callback }); @@ -120,50 +113,11 @@ var django = { }); - +

1: cette liste de vœux est ordonnée (du plus important au moins important), pour ajuster la priorité vous pouvez déplacer chaque vœu.

- -{% if not charte %} - -{% endif %} {% endblock %} diff --git a/bda/templates/bda/mails-rappel.html b/bda/templates/bda/mails-rappel.html index c0770e47..c10503b0 100644 --- a/bda/templates/bda/mails-rappel.html +++ b/bda/templates/bda/mails-rappel.html @@ -26,6 +26,13 @@
+

+ Note : le template de ce mail peut être modifié à + cette adresse +

+ +
+

Forme des mails

Une seule place

diff --git a/bda/templates/bda/mails/attributions-decus.txt b/bda/templates/bda/mails/attributions-decus.txt deleted file mode 100644 index 69fadff6..00000000 --- a/bda/templates/bda/mails/attributions-decus.txt +++ /dev/null @@ -1,10 +0,0 @@ -Cher-e {{ member.first_name }}, - -Tu t'es inscrit-e pour le tirage au sort du BdA. Malheureusement, tu n'as -obtenu aucune place. - -Nous proposons cependant de nombreuses offres hors-tirage tout au long de -l'année, et nous t'invitons à nous contacter si l'une d'entre elles -t'intéresse ! --- -Le Bureau des Arts \ No newline at end of file diff --git a/bda/templates/bda/mails/attributions.txt b/bda/templates/bda/mails/attributions.txt deleted file mode 100644 index 3fd10032..00000000 --- a/bda/templates/bda/mails/attributions.txt +++ /dev/null @@ -1,31 +0,0 @@ -Cher-e {{ member.first_name }}, - -Tu t'es inscrit-e pour le tirage au sort du BdA. Tu as été sélectionné-e -pour les spectacles suivants : -{% for place in places %} -- 1 place pour {{ place }}{% endfor %} - -*Paiement* -L'intégralité de ces places de spectacles est à régler dès maintenant et AVANT -vendredi prochain, au bureau du COF pendant les heures de permanences (du lundi au vendredi -entre 12h et 14h, et entre 18h et 20h). Des facilités de paiement sont bien -évidemment possibles : nous pouvons ne pas encaisser le chèque immédiatement, -ou bien découper votre paiement en deux fois. Pour ceux qui ne pourraient pas -venir payer au bureau, merci de nous contacter par mail. - -*Mode de retrait des places* -Au moment du paiement, certaines places vous seront remises directement, -d'autres seront à récupérer au cours de l'année, d'autres encore seront -nominatives et à retirer le soir même dans les théâtres correspondants. -Pour chaque spectacle, vous recevrez un mail quelques jours avant la -représentation vous indiquant le mode de retrait. - -Nous vous rappelons que l'obtention de places du BdA vous engage à -respecter les règles de fonctionnement : -https://bda.ens.fr/lequipe/charte-bda/ -Un système de revente des places via les mails BdA-revente est disponible -directement sur votre compte GestioCOF. - -En vous souhaitant de très beaux spectacles tout au long de l'année, --- -Le Bureau des Arts \ No newline at end of file diff --git a/bda/templates/bda/mails/rappel.txt b/bda/templates/bda/mails/rappel.txt deleted file mode 100644 index 74614cbb..00000000 --- a/bda/templates/bda/mails/rappel.txt +++ /dev/null @@ -1,23 +0,0 @@ -Bonjour {{ member.first_name }}, - -Nous te rappellons que tu as eu la chance d'obtenir {{ nb_attr|pluralize:"une place,deux places" }} -pour {{ show.title }}, le {{ show.date }} au {{ show.location }}. N'oublie pas de t'y rendre ! -{% if nb_attr == 2 %} -Tu as obtenu deux places pour ce spectacle. Nous te rappelons que -ces places sont strictement réservées aux personnes de moins de 28 ans. -{% endif %} -{% if show.listing %}Pour ce spectacle, tu as reçu {{ nb_attr|pluralize:"une place,des places" }} sur -listing. Il te faudra donc te rendre 15 minutes en avance sur les lieux de la représentation -pour {{ nb_attr|pluralize:"la,les" }} retirer. -{% else %}Pour assister à ce spectacle, tu dois présenter les billets qui ont -été distribués au burô. -{% endif %} - -Si tu ne peux plus assister à cette représentation, tu peux -revendre ta place via BdA-revente, accessible directement sur -GestioCOF (lien "revendre une place du premier tirage" sur la page -d'accueil https://www.cof.ens.fr/gestion/). - -En te souhaitant un excellent spectacle, --- -Le Bureau des Arts \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-new.txt b/bda/templates/bda/mails/revente-new.txt deleted file mode 100644 index 7344011a..00000000 --- a/bda/templates/bda/mails/revente-new.txt +++ /dev/null @@ -1,12 +0,0 @@ -Bonjour {{ member.first_name }} - -Une place pour le spectacle {{ show.title }} ({{ show.date }}) -a été postée sur BdA-Revente. - -Si ce spectacle t'intéresse toujours, merci de nous le signaler en cliquant -sur ce lien : https://{{ site }}{% url "bda-revente-confirm" revente.id %}. -Dans le cas où plusieurs personnes seraient intéressées, nous procèderons à -un tirage au sort le {{ revente.date_tirage|date:"DATE_FORMAT" }}. - -Chaleureusement, -Le BdA \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-seller.txt b/bda/templates/bda/mails/revente-seller.txt deleted file mode 100644 index 851ac09c..00000000 --- a/bda/templates/bda/mails/revente-seller.txt +++ /dev/null @@ -1,13 +0,0 @@ -Bonjour {{ vendeur.first_name }}, - -Tu t’es bien inscrit·e pour revendre une place pour {{ show.title }}. - -{% with revente.date_tirage as time %} -Le tirage au sort entre tout·e·s les racheteuse·eur·s potentiel·le·s aura lieu -le {{ time|date:"DATE_FORMAT" }} à {{ time|time:"TIME_FORMAT" }} (dans {{time|timeuntil }}). -Si personne ne s’est inscrit pour racheter la place, celle-ci apparaîtra parmi -les « Places disponibles immédiatement à la revente » sur GestioCOF. -{% endwith %} - -Bonne revente ! -Le Bureau des Arts \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-shotgun-seller.txt b/bda/templates/bda/mails/revente-shotgun-seller.txt deleted file mode 100644 index e67083fc..00000000 --- a/bda/templates/bda/mails/revente-shotgun-seller.txt +++ /dev/null @@ -1,6 +0,0 @@ -Bonjour {{ vendeur.first_name }} ! - -Je souhaiterais racheter ta place pour {{ show.title }} le {{ show.date }} ({{ show.location }}) à {{ show.price|floatformat:2 }}€. -Contacte-moi si tu es toujours intéressé·e ! - -{{ acheteur.get_full_name }} ({{ acheteur.email }}) \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-shotgun.txt b/bda/templates/bda/mails/revente-shotgun.txt deleted file mode 100644 index e7b1ce29..00000000 --- a/bda/templates/bda/mails/revente-shotgun.txt +++ /dev/null @@ -1,11 +0,0 @@ -Bonjour {{ member.first_name }} - -Une place pour le spectacle {{ show.title }} ({{ show.date }}) -a été postée sur BdA-Revente. - -Puisque ce spectacle a lieu dans moins de 24h, il n'y a pas de tirage au sort pour -cette place : elle est disponible immédiatement à l'adresse -https://{{ site }}{% url "bda-revente-buy" show.id %}, à la disposition de tous. - -Chaleureusement, -Le BdA \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-tirage-loser.txt b/bda/templates/bda/mails/revente-tirage-loser.txt deleted file mode 100644 index c1d49a01..00000000 --- a/bda/templates/bda/mails/revente-tirage-loser.txt +++ /dev/null @@ -1,9 +0,0 @@ -Bonjour {{ acheteur.first_name }}, - -Tu t'étais inscrit·e pour la revente de la place de {{ vendeur.get_full_name }} -pour {{ show.title }}. -Malheureusement, une autre personne a été tirée au sort pour racheter la place. -Tu pourras certainement retenter ta chance pour une autre revente ! - -À très bientôt, -Le Bureau des Arts \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-tirage-seller.txt b/bda/templates/bda/mails/revente-tirage-seller.txt deleted file mode 100644 index 7abff7ca..00000000 --- a/bda/templates/bda/mails/revente-tirage-seller.txt +++ /dev/null @@ -1,7 +0,0 @@ -Bonjour {{ vendeur.first_name }}, - -La personne tirée au sort pour racheter ta place pour {{ show.title }} est {{ acheteur.get_full_name }}. -Tu peux le/la contacter à l'adresse {{ acheteur.email }}, ou en répondant à ce mail. - -Chaleureusement, -Le BdA \ No newline at end of file diff --git a/bda/templates/bda/mails/revente-tirage-winner.txt b/bda/templates/bda/mails/revente-tirage-winner.txt deleted file mode 100644 index 11428ef7..00000000 --- a/bda/templates/bda/mails/revente-tirage-winner.txt +++ /dev/null @@ -1,7 +0,0 @@ -Bonjour {{ acheteur.first_name }}, - -Tu as été tiré·e au sort pour racheter une place pour {{ show.title }} le {{ show.date }} ({{ show.location }}) à {{ show.price|floatformat:2 }}€. -Tu peux contacter le/la vendeur·se à l'adresse {{ vendeur.email }}. - -Chaleureusement, -Le BdA \ No newline at end of file diff --git a/bda/templates/bda/participants.html b/bda/templates/bda/participants.html index c99e5182..c3ff31d6 100644 --- a/bda/templates/bda/participants.html +++ b/bda/templates/bda/participants.html @@ -1,5 +1,5 @@ {% extends "base_title.html" %} -{% load static %} +{% load staticfiles %} {% block realcontent %}

{{ spectacle }}

@@ -16,7 +16,7 @@ {% for participant in participants %} - {{participant.name}} + {{participant.name}} {{participant.nb_places}} place{{participant.nb_places|pluralize}} {{participant.email}} @@ -38,7 +38,7 @@

Ajouter une attribution

- + @@ -56,7 +56,9 @@ Page d'envoi manuel des mails de rappel
- + - +{% endwith %} {% endblock %} diff --git a/bda/templates/bda/revente/notpaid.html b/bda/templates/bda/revente/notpaid.html new file mode 100644 index 00000000..0dd4e4df --- /dev/null +++ b/bda/templates/bda/revente/notpaid.html @@ -0,0 +1,6 @@ +{% extends "base_title.html" %} + +{% block realcontent %} +

Nope

+

Avant de revendre des places, il faut aller les payer !

+{% endblock %} diff --git a/bda/templates/bda/revente/shotgun.html b/bda/templates/bda/revente/shotgun.html index a724032e..fae36c04 100644 --- a/bda/templates/bda/revente/shotgun.html +++ b/bda/templates/bda/revente/shotgun.html @@ -2,26 +2,11 @@ {% block realcontent %}

Places disponibles immédiatement

- {% if spectacles %} - - - - - - - - - - - - {% for spectacle in spectacles %} - - {% include "bda/forms/spectacle_label_table.html" with spectacle=spectacle %} - - {% endfor %} - -
TitreDateLieuPrix
Racheter -
+ {% if shotgun %} +
{% endif %} -
+
@@ -94,22 +89,29 @@ $(document).ready(function() { khistory = new KHistory({ display_trigramme: false, - fetch_options: { - account: {{ account.pk }}, - } }); - $(document).on('keydown', function (e) { - if (e.keyCode == 46) { - // DEL (Suppr) - khistory.cancel_selected() + function getHistory() { + var data = { + 'accounts': [{{ account.pk }}], } - }); - khistory.fetch().done(function () { + $.ajax({ + dataType: "json", + url : "{% url 'kfet.history.json' %}", + method : "POST", + data : data, + }) + .done(function(data) { + for (var i=0; i diff --git a/kfet/templates/kfet/account_search_autocomplete.html b/kfet/templates/kfet/account_search_autocomplete.html new file mode 100644 index 00000000..e18eb1eb --- /dev/null +++ b/kfet/templates/kfet/account_search_autocomplete.html @@ -0,0 +1,14 @@ +{% load kfet_tags %} + + + diff --git a/kfet/templates/kfet/account_update.html b/kfet/templates/kfet/account_update.html index 65965d83..2fa1cec2 100644 --- a/kfet/templates/kfet/account_update.html +++ b/kfet/templates/kfet/account_update.html @@ -6,38 +6,52 @@ {% block title %} {% if account.user == request.user %} -Modification de mes informations + Modification de mes informations {% else %} -{{ account.trigramme }} - Édition + {{ account.trigramme }} - Édition {% endif %} {% endblock %} {% block header-title %} {% if account.user == request.user %} -Modification de mes informations + Modification de mes informations {% else %} -Édition du compte {{ account.trigramme }} + Édition du compte {{ account.trigramme }} {% endif %} {% endblock %} {% block footer %} {% if not account.is_team %} -{% include "kfet/base_footer.html" %} + {% include "kfet/base_footer.html" %} {% endif %} {% endblock %} {% block main %} -
+ {% csrf_token %} - {% include 'kfet/form_snippet.html' with form=user_info_form %} + {% include 'kfet/form_snippet.html' with form=user_form %} + {% include 'kfet/form_snippet.html' with form=cof_form %} {% include 'kfet/form_snippet.html' with form=account_form %} - {% include 'kfet/form_snippet.html' with form=frozen_form %} {% include 'kfet/form_snippet.html' with form=group_form %} {% include 'kfet/form_snippet.html' with form=pwd_form %} - - {% include 'kfet/form_authentication_snippet.html' %} + {% include 'kfet/form_snippet.html' with form=negative_form %} + {% if perms.kfet.is_team %} + {% include 'kfet/form_authentication_snippet.html' %} + {% endif %} {% include 'kfet/form_submit_snippet.html' with value="Mettre à jour" %}
-{% endblock %} \ No newline at end of file + + +{% endblock %} diff --git a/kfet/templates/kfet/article_read.html b/kfet/templates/kfet/article_read.html index 67673c7c..fee541f3 100644 --- a/kfet/templates/kfet/article_read.html +++ b/kfet/templates/kfet/article_read.html @@ -1,8 +1,8 @@ {% extends 'kfet/base_col_2.html' %} -{% load static kfet_tags %} +{% load staticfiles kfet_tags %} {% block extra_head %} - + {% endblock %} @@ -20,21 +20,12 @@ Éditer - {% if perms.kfet.delete_account %} - -
- {% csrf_token %} -
- {% endif %}
  • Prix: {{ article.price }}€ - +
  • Stock: {{ article.stock }}
  • En vente: {{ article.is_sold|yesno|title }}
  • @@ -72,35 +63,35 @@
    -
    -
    -
    -
    +
    +
    +
    +
    -

    Inventaires récents

    -
    - {% include "kfet/article_inventories_snippet.html" with inventoryarts=inventoryarts|slice:5 %} -
    +

    Inventaires récents

    +
    + {% include "kfet/article_inventories_snippet.html" with inventoryarts=inventoryarts|slice:5 %} +
    -
    -
    +
    +
    -

    Derniers prix fournisseurs

    -
    - {% include "kfet/article_suppliers_snippet.html" with supplierarts=supplierarts|slice:5 %} -
    +

    Derniers prix fournisseurs

    +
    + {% include "kfet/article_suppliers_snippet.html" with supplierarts=supplierarts|slice:5 %} +
    -
    -
    -
    -
    +
    +
    +
    +
    -
    -
    -

    Ventes

    -
    -
    -
    +
    +
    +

    Ventes

    +
    +
    +
    @@ -119,45 +110,26 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/kfet/templates/kfet/base.html b/kfet/templates/kfet/base.html index 9b75af03..a3a671ab 100644 --- a/kfet/templates/kfet/base.html +++ b/kfet/templates/kfet/base.html @@ -9,25 +9,26 @@ - + {# CSS #} - - - - + + + + {# JS #} - - - - - - - - - + + + + + + + + + + {% include "kfetopen/init.html" %} diff --git a/kfet/templates/kfet/base_footer.html b/kfet/templates/kfet/base_footer.html index 7a016705..c5333476 100644 --- a/kfet/templates/kfet/base_footer.html +++ b/kfet/templates/kfet/base_footer.html @@ -1,13 +1,17 @@ {% load wagtailcore_tags %} +{% with "k-fet@ens.fr" as kfet_mail %} + + + +{% endwith %} diff --git a/kfet/templates/kfet/base_nav.html b/kfet/templates/kfet/base_nav.html index b636de27..1cded20b 100644 --- a/kfet/templates/kfet/base_nav.html +++ b/kfet/templates/kfet/base_nav.html @@ -32,20 +32,20 @@ {% for item in menu_items %} {% if item.text == "Accueil" %} - {% else %} - {% endif %} {% endfor %} - {% endif %} - {% if perms.kfet.delete_inventory %} -
-
- -
- {% csrf_token %} -
- {% endif %} -
@@ -37,12 +26,6 @@ {% block main %} -
-
- Les valeurs de stock sont calculées sur la base du prix actuel des articles. -
-
-
Erreur - {% regroup inventoryarts by article.category.name as category_list %} + {% regroup inventoryarts by article.category as category_list %} {% for category in category_list %} - + {% for inventoryart in category.list %} - + {% endfor %} {% endfor %} - - - - - - - -
{{ category.grouper }}{{ category.grouper.name }}
- + {{ inventoryart.article.name }} {{ inventoryart.stock_old }} {{ inventoryart.stock_new }}{{ inventoryart.stock_error }} / {{ inventoryart.amount_error|floatformat:"-2" }} €{{ inventoryart.stock_error }}
Valeurs totales{{ total_amount_old|floatformat:"-2" }} €{{ total_amount_new|floatformat:"-2" }} €{{ total_amount_error|floatformat:"-2" }} €
- - {% endblock %} diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index ad8ee240..08b060bf 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -1,16 +1,10 @@ {% extends 'kfet/base.html' %} -{% load static %} +{% load staticfiles %} {% block extra_head %} - - + - - - - - {% endblock %} {% block title %}K-Psul{% endblock %} @@ -190,7 +184,7 @@ $(document).ready(function() { // ----- // Lock to avoid multiple requests - window.lock = 0; + lock = 0; // Retrieve settings @@ -214,8 +208,174 @@ $(document).ready(function() { // Account data management // ----- - var account_manager = new AccountManager(); + // Initializing + var account_container = $('#account'); var triInput = $('#id_trigramme'); + var account_data = {}; + var account_data_default = { + 'id' : 0, + 'name' : '', + 'email': '', + 'is_cof' : '', + 'promo' : '', + 'balance': '', + 'trigramme' : '', + 'is_frozen' : false, + 'departement': '', + 'nickname' : '', + }; + + // Display data + function displayAccountData() { + var balance = account_data['trigramme'] != 'LIQ' ? account_data['balance'] : ''; + if (balance != '') + balance = amountToUKF(account_data['balance'], account_data['is_cof'], true); + var is_cof = account_data['trigramme'] ? account_data['is_cof'] : ''; + if (is_cof !== '') + is_cof = is_cof ? 'COF' : 'Non-COF'; + for (var elem in account_data) { + if (elem == 'balance') { + $('#account-balance').text(balance); + } else if (elem == 'is_cof') { + $('#account-is_cof').html(is_cof); + } else { + $('#account-'+elem).text(account_data[elem]); + } + } + if (account_data['is_frozen']) { + $('#account').attr('data-balance', 'frozen'); + } else if (account_data['balance'] >= 5 || account_data['trigramme'] == 'LIQ') { + $('#account').attr('data-balance', 'ok'); + } else if (account_data['balance'] == '') { + $('#account').attr('data-balance', ''); + } else if (account_data['balance'] >= 0) { + $('#account').attr('data-balance', 'low'); + } else { + $('#account').attr('data-balance', 'neg'); + } + + var buttons = ''; + if (account_data['id'] != 0) { + var url_base = '{% url 'kfet.account.read' 'LIQ' %}'; + url_base = url_base.substr(0, url_base.length - 3); + trigramme = encodeURIComponent(account_data['trigramme']) ; + buttons += ''; + } + if (account_data['id'] == 0) { + var trigramme = triInput.val().toUpperCase(); + if (isValidTrigramme(trigramme)) { + var url_base = '{% url 'kfet.account.create' %}' + trigramme = encodeURIComponent(trigramme); + buttons += ''; + } else { + var url_base = '{% url 'kfet.account' %}' + buttons += ''; + } + } + account_container.find('.buttons').html(buttons); + } + + // Search for an account + function searchAccount() { + var content = '
' ; + $.dialog({ + title: 'Recherche de compte', + content: content, + backgroundDismiss: true, + animation: 'top', + closeAnimation: 'bottom', + keyboardEnabled: true, + + onOpen: function() { + var that=this ; + $('input#search_autocomplete').yourlabsAutocomplete({ + url: '{% url "kfet.account.search.autocomplete" %}', + minimumCharacters: 2, + id: 'search_autocomplete', + choiceSelector: '.choice', + placeholder: "Chercher un utilisateur K-Fêt", + box: $("#account_results"), + fixPosition: function() {}, + }); + $('input#search_autocomplete').bind( + 'selectChoice', + function(e, choice, autocomplete) { + autocomplete.hide() ; + triInput.val(choice.find('.trigramme').text()) ; + triInput.trigger('input') ; + that.close() ; + }); + } + }); + } + + account_container.on('click', '.search', function () { + searchAccount() ; + }) ; + + account_container.on('keydown', function(e) { + if (e.which == 70 && e.ctrlKey) { + // Ctrl + F : universal search shortcut + searchAccount() ; + e.preventDefault() ; + } + }); + + // Clear data + function resetAccountData() { + account_data = account_data_default; + $('#id_on_acc').val(0); + displayAccountData(); + } + + function resetAccount() { + triInput.val(''); + resetAccountData(); + } + + // Store data + function storeAccountData(data) { + account_data = $.extend({}, account_data_default, data); + account_data['balance'] = parseFloat(account_data['balance']); + $('#id_on_acc').val(account_data['id']); + displayAccountData(); + } + + // Retrieve via ajax + function retrieveAccountData(tri) { + $.ajax({ + dataType: "json", + url : "{% url 'kfet.account.read.json' %}", + method : "POST", + data : { trigramme: tri }, + }) + .done(function(data) { + storeAccountData(data); + articleSelect.focus(); + updateBasketAmount(); + updateBasketRel(); + }) + .fail(function() { resetAccountData() }); + } + + // Event listener + triInput.on('input', function() { + var tri = triInput.val().toUpperCase(); + // Checking if tri is valid to avoid sending requests + if (isValidTrigramme(tri)) { + retrieveAccountData(tri); + } else { + resetAccountData(); + } + }); + + triInput.on('keydown', function(e) { + if (e.keyCode == 40) { + // Arrow Down - Shorcut to LIQ + triInput.val('LIQ'); + triInput.trigger('input'); + } + }); // ----- @@ -301,7 +461,7 @@ $(document).ready(function() { // Event listener checkoutInput.on('change', function() { retrieveCheckoutData(checkoutInput.val()); - if (account_manager.data['trigramme']) { + if (account_data['trigramme']) { articleSelect.focus().select(); } else { triInput.focus().select(); @@ -340,6 +500,21 @@ $(document).ready(function() { $('#id_comment').val(''); } + // ----- + // Errors ajax + // ----- + + function displayErrors(html) { + $.alert({ + title: 'Erreurs', + content: html, + backgroundDismiss: true, + animation: 'top', + closeAnimation: 'bottom', + keyboardEnabled: true, + }); + } + // ----- // Perform operations // ----- @@ -349,9 +524,9 @@ $(document).ready(function() { var operations = $('#operation_formset'); function performOperations(password = '') { - if (window.lock == 1) + if (lock == 1) return false; - window.lock = 1; + lock = 1; var data = operationGroup.serialize() + '&' + operations.serialize(); $.ajax({ dataType: "json", @@ -367,7 +542,7 @@ $(document).ready(function() { .done(function(data) { updatePreviousOp(); coolReset(); - window.lock = 0; + lock = 0; }) .fail(function($xhr) { var data = $xhr.responseJSON; @@ -376,14 +551,14 @@ $(document).ready(function() { requestAuth(data, performOperations, articleSelect); break; case 400: - if ('need_comment' in data) { + if ('need_comment' in data['errors']) { askComment(performOperations); } else { - displayErrors(data); + displayErrors(getErrorsHtml(data)); } break; } - window.lock = 0; + lock = 0; }); } @@ -392,6 +567,55 @@ $(document).ready(function() { performOperations(); }); + // ----- + // Cancel operations + // ----- + + var cancelButton = $('#cancel_operations'); + var cancelForm = $('#cancel_form'); + + function cancelOperations(opes_array, password = '') { + if (lock == 1) + return false + lock = 1; + var data = { 'operations' : opes_array } + $.ajax({ + dataType: "json", + url : "{% url 'kfet.kpsul.cancel_operations' %}", + method : "POST", + data : data, + beforeSend: function ($xhr) { + $xhr.setRequestHeader("X-CSRFToken", csrftoken); + if (password != '') + $xhr.setRequestHeader("KFetPassword", password); + }, + + }) + .done(function(data) { + coolReset(); + lock = 0; + }) + .fail(function($xhr) { + var data = $xhr.responseJSON; + switch ($xhr.status) { + case 403: + requestAuth(data, function(password) { + cancelOperations(opes_array, password); + }, triInput); + break; + case 400: + displayErrors(getErrorsHtml(data)); + break; + } + lock = 0; + }); + } + + // Event listeners + cancelButton.on('click', function() { + cancelOperations(); + }); + // ----- // Articles data // ----- @@ -430,13 +654,13 @@ $(document).ready(function() { var $after = articles_container.find('#data-category-'+article['category_id']); articles_container .find('.article.data-category-'+article['category_id']).each(function() { - if (article['name'].toLowerCase() < $('.name', this).text().toLowerCase()) + if (article['name'].toLowerCase < $('.name', this).text().toLowerCase()) return false; $after = $(this); }); $after.after(article_html); // Pour l'autocomplétion - articlesList.push([article['name'],article['id'],article['category_id'],article['price'], article['stock'],article['category__has_addcost'],article['category__has_reduction']]); + articlesList.push([article['name'],article['id'],article['category_id'],article['price'], article['stock'],article['category__has_addcost']]); } function getArticles() { @@ -583,7 +807,7 @@ $(document).ready(function() { }); function is_nb_ok(nb) { - return /^[0-9]+$/.test(nb) && nb > 0; + return /^[0-9]+$/.test(nb) && nb > 0 && nb <= 24; } articleNb.on('keydown', function(e) { @@ -622,11 +846,11 @@ $(document).ready(function() { var amount_euro = - article_data[3] * nb ; if (settings['addcost_for'] && settings['addcost_amount'] - && account_manager.data['trigramme'] != settings['addcost_for'] + && account_data['trigramme'] != settings['addcost_for'] && article_data[5]) amount_euro -= settings['addcost_amount'] * nb; var reduc_divisor = 1; - if (account_manager.data['is_cof'] && article_data[6]) + if (account_data['is_cof']) reduc_divisor = 1 + settings['subvention_cof'] / 100; return (amount_euro / reduc_divisor).toFixed(2); } @@ -649,7 +873,7 @@ $(document).ready(function() { .attr('data-opeindex', index) .find('.number').text('('+nb+'/'+article_data[4]+')').end() .find('.name').text(article_data[0]).end() - .find('.amount').text(amountToUKF(amount_euro, account_manager.data['is_cof'], false)); + .find('.amount').text(amountToUKF(amount_euro, account_data['is_cof']), false); basket_container.prepend(article_basket_html); if (is_low_stock(id, nb)) article_basket_html.find('.lowstock') @@ -675,7 +899,7 @@ $(document).ready(function() { .attr('data-opeindex', index) .find('.number').text(amount+"€").end() .find('.name').text('Charge').end() - .find('.amount').text(amountToUKF(amount, account_manager.data['is_cof'], false)); + .find('.amount').text(amountToUKF(amount, account_data['is_cof'], false)); basket_container.prepend(deposit_basket_html); updateBasketRel(); } @@ -688,7 +912,7 @@ $(document).ready(function() { .attr('data-opeindex', index) .find('.number').text(amount+"€").end() .find('.name').text('Édition').end() - .find('.amount').text(amountToUKF(amount, account_manager.data['is_cof'], false)); + .find('.amount').text(amountToUKF(amount, account_data['is_cof'], false)); basket_container.prepend(deposit_basket_html); updateBasketRel(); } @@ -701,7 +925,7 @@ $(document).ready(function() { .attr('data-opeindex', index) .find('.number').text(amount+"€").end() .find('.name').text('Retrait').end() - .find('.amount').text(amountToUKF(amount, account_manager.data['is_cof'], false)); + .find('.amount').text(amountToUKF(amount, account_data['is_cof'], false)); basket_container.prepend(withdraw_basket_html); updateBasketRel(); } @@ -757,7 +981,7 @@ $(document).ready(function() { var amount = $(this).find('#id_form-'+opeindex+'-amount'); if (!deleted && type == "purchase") amount.val(amountEuroPurchase(article_id, article_nb)); - basket_container.find('[data-opeindex='+opeindex+'] .amount').text(amountToUKF(amount.val(), account_manager.data['is_cof'], false)); + basket_container.find('[data-opeindex='+opeindex+'] .amount').text(amountToUKF(amount.val(), account_data['is_cof'], false)); }); } @@ -765,7 +989,7 @@ $(document).ready(function() { function updateBasketRel() { var basketrel_html = ''; - if (account_manager.data['trigramme'] == 'LIQ' && !isBasketEmpty()) { + if (account_data['trigramme'] == 'LIQ' && !isBasketEmpty()) { var amount = - getAmountBasket(); basketrel_html += '
Total: '+amount.toFixed(2)+' €
'; if (amount < 5) @@ -774,11 +998,11 @@ $(document).ready(function() { basketrel_html += '
Sur 10€: '+ (10-amount).toFixed(2) +' €
'; if (amount < 20) basketrel_html += '
Sur 20€: '+ (20-amount).toFixed(2) +' €
'; - } else if (account_manager.data['trigramme'] != '' && !isBasketEmpty()) { + } else if (account_data['trigramme'] != '' && !isBasketEmpty()) { var amount = getAmountBasket(); - var amountUKF = amountToUKF(amount, account_manager.data['is_cof'], false); - var newBalance = account_manager.data['balance'] + amount; - var newBalanceUKF = amountToUKF(newBalance, account_manager.data['is_cof'], true); + var amountUKF = amountToUKF(amount, account_data['is_cof'], false); + var newBalance = account_data['balance'] + amount; + var newBalanceUKF = amountToUKF(newBalance, account_data['is_cof'], true); basketrel_html += '
Total: '+amountUKF+'
'; basketrel_html += '
Nouveau solde: '+newBalanceUKF+'
'; if (newBalance < 0) @@ -799,7 +1023,7 @@ $(document).ready(function() { var nb_before = formset_container.find("#id_form-"+opeindex+"-article_nb").val(); var nb_after = parseInt(nb_before) + parseInt(nb); var amountEuro_after = amountEuroPurchase(id, nb_after); - var amountUKF_after = amountToUKF(amountEuro_after, account_manager.data['is_cof']); + var amountUKF_after = amountToUKF(amountEuro_after, account_data['is_cof']); if (type == 'purchase') { if (nb_after == 0) { @@ -1010,18 +1234,30 @@ $(document).ready(function() { // History // ----- - khistory = new KHistory({ - fetch_options: { - start: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), - opes_only: true, - }, - }); + khistory = new KHistory(); + + function getHistory() { + var data = { + from: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), + }; + $.ajax({ + dataType: "json", + url : "{% url 'kfet.history.json' %}", + method : "POST", + data : data, + }) + .done(function(data) { + for (var i=0; i'; previousop_html += basketrel_container.html(); previousop_container.html(previousop_html); @@ -1074,7 +1310,7 @@ $(document).ready(function() { }, triInput); break; case 400: - askAddcost(getErrorsHtml(data["errors"], is_error=true)); + askAddcost(getErrorsHtml(data)); break; } }); @@ -1111,10 +1347,29 @@ $(document).ready(function() { // Cancel from history // ----- + khistory.$container.selectable({ + filter: 'div.opegroup, div.ope', + selected: function(e, ui) { + $(ui.selected).each(function() { + if ($(this).hasClass('opegroup')) { + var opegroup = $(this).data('opegroup'); + $(this).siblings('.ope').filter(function() { + return $(this).data('opegroup') == opegroup + }).addClass('ui-selected'); + } + }); + }, + }); + $(document).on('keydown', function (e) { if (e.keyCode == 46) { // DEL (Suppr) - khistory.cancel_selected() + var opes_to_cancel = []; + khistory.$container.find('.ope.ui-selected').each(function () { + opes_to_cancel.push($(this).data('ope')); + }); + if (opes_to_cancel.length > 0) + cancelOperations(opes_to_cancel); } }); @@ -1123,9 +1378,16 @@ $(document).ready(function() { // ----- OperationWebSocket.add_handler(function(data) { - for (var i=0; i - {% if perms.kfet.is_team %}
Éditer - {% if perms.kfet.delete_account %} -
- -
- {% csrf_token %} -
- {% endif %} + + Créditer +
- {% endif %}

{{ account.name|title }}

    + {% if perms.kfet.is_team %}
  • {{ account.nickname }}
  • + {% endif %}
  • {{ account.email|default:"Pas d'email!" }}
  • -
  • - {% if account.promo %} - {{ account.departement }} {{ account.promo }} - {% else %} - Sans promo - {% endif %} -
  • +
  • {{ account.departement }} {{ account.promo }}
  • {% if account.is_cof %} - Adhérent COF + Adhérent COF {% else %} Non-COF {% endif %} @@ -51,13 +38,22 @@
- {% if account.negative and account.balance_ukf < 0 %} + {% if account.negative %}

Négatif

    {% if account.negative.start %}
  • Depuis le {{ account.negative.start|date:"d/m/Y à H:i" }}
  • {% endif %} + {% if account.real_balance != account.balance %} +
  • Solde réel: {{ account.real_balance }} €
  • + {% endif %} +
  • + Plafond : + {{ account.negative.authz_overdraft_amount|default:kfet_config.overdraft_amount }} € + jusqu'au + {{ account.negative.authz_overdraft_until|default:account.negative.until_default|date:"d/m/Y à H:i" }} +
{% endif %} @@ -84,36 +80,17 @@ {% endif %} diff --git a/kfet/templates/kfet/mails/creation_trigramme.txt b/kfet/templates/kfet/mails/creation_trigramme.txt deleted file mode 100644 index 25638186..00000000 --- a/kfet/templates/kfet/mails/creation_trigramme.txt +++ /dev/null @@ -1,12 +0,0 @@ -Salut {{ account.name }}, - -Ton compte K-Fêt a bien été créé le {{ account.created_at }} avec le trigramme {{ account.trigramme }}. - -Tu peux désormais : -- Accéder à ton historique personnel des consommations : https://{{ site }}{{ url_read }} -- Modifier tes informations : https://{{ site }}{{ url_update }} -- Supprimer ton compte : https://{{ site }}{{ url_delete }} - -En espérant te revoir bientôt, --- -L'équipe K-Fêt diff --git a/kfet/templates/kfet/mails/demande_soiree.txt b/kfet/templates/kfet/mails/demande_soiree.txt deleted file mode 100644 index 9fd6d635..00000000 --- a/kfet/templates/kfet/mails/demande_soiree.txt +++ /dev/null @@ -1,16 +0,0 @@ -Bonjour, - -J'aimerais organiser une soirée le {{ date }}, au thème « {{ theme|safe }} », en K-Fêt. -Elle se terminerait à {{ horaire_fin }}, et le service serait en mode {{ service }}. - -Les 4 responsables de la soirée seraient : -- {{ respo1 }} -- {{ respo2 }} -- {{ respo3 }} -- {{ respo4 }} - -Quelques remarques supplémentaires : -{{ remarques|safe }} - -Bien cordialement, -{{ nom|safe }} diff --git a/kfet/templates/kfet/mails/rappel.txt b/kfet/templates/kfet/mails/rappel.txt deleted file mode 100644 index b37b2b0e..00000000 --- a/kfet/templates/kfet/mails/rappel.txt +++ /dev/null @@ -1,8 +0,0 @@ -Bonjour {{ account.first_name }}, - -Nous te rappelons que tu es en négatif de {{ neg_amount }}€ depuis le {{ start_date }}. -N'oublie pas de régulariser ta situation au plus vite. - -En espérant te revoir très bientôt, --- -L'équipe K-Fêt diff --git a/kfet/templates/kfet/nav_item.html b/kfet/templates/kfet/nav_item.html index 76a24ca4..b5981266 100644 --- a/kfet/templates/kfet/nav_item.html +++ b/kfet/templates/kfet/nav_item.html @@ -11,7 +11,7 @@ -->{{ text }}{{ text }} {% if href %} diff --git a/kfet/templates/kfet/order_create.html b/kfet/templates/kfet/order_create.html index 20ae7b69..7cb4d1cb 100644 --- a/kfet/templates/kfet/order_create.html +++ b/kfet/templates/kfet/order_create.html @@ -58,39 +58,31 @@ {% endfor %} - {% regroup formset by is_sold as is_sold_list %} - {% for condition in is_sold_list %} - - - {% if condition.grouper %} Vendu {% else %} Non vendu {% endif %} + {% regroup formset by category_name as category_list %} + {% for category in category_list %} + + + {{ category.grouper }} - {% regroup condition.list by category_name as category_list %} - {% for category in category_list %} - - - {{ category.grouper }} - - - - {% for form in category.list %} - - {{ form.article }} - {{ form.name }} - {% for v_chunk in form.v_all %} - {{ v_chunk }} - {% endfor %} - {{ form.v_moy }} - {{ form.v_et }} - {{ form.v_prev }} - {{ form.stock }} - {{ form.box_capacity|default:"" }} - {{ form.c_rec }} - {{ form.quantity_ordered|add_class:"form-control" }} - - {% endfor %} - - {% endfor %} + + {% for form in category.list %} + + {{ form.article }} + {{ form.name }} + {% for v_chunk in form.v_all %} + {{ v_chunk }} + {% endfor %} + {{ form.v_moy }} + {{ form.v_et }} + {{ form.v_prev }} + {{ form.stock }} + {{ form.box_capacity|default:"" }} + {{ form.c_rec }} + {{ form.quantity_ordered|add_class:"form-control" }} + + {% endfor %} + {% endfor %} diff --git a/kfet/templates/kfet/search_results.html b/kfet/templates/kfet/search_results.html deleted file mode 100644 index d1ee70ac..00000000 --- a/kfet/templates/kfet/search_results.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "shared/search_results.html" %} -{% load i18n %} - -{% block extra_section %} -
  • - {% if not results %} - - {% trans "Aucune correspondance trouvée" %} - - {% else %} - - {% trans "Pas dans la liste ?" %} - - {% endif %} -
  • -
  • - - {% trans "Créer un compte" %} - -
  • -{% endblock %} diff --git a/kfet/templates/kfet/transfers.html b/kfet/templates/kfet/transfers.html index f285b4dc..f6778b3f 100644 --- a/kfet/templates/kfet/transfers.html +++ b/kfet/templates/kfet/transfers.html @@ -1,15 +1,9 @@ {% extends 'kfet/base_col_2.html' %} -{% load l10n static widget_tweaks %} +{% load staticfiles %} {% block title %}Transferts{% endblock %} {% block header-title %}Transferts{% endblock %} -{% block extra_head %} - - - -{% endblock %} - {% block fixed %}
    @@ -22,31 +16,109 @@ {% block main %} - -
    +
    + {% for transfergroup in transfergroups %} +
    + {{ transfergroup.at }} + {{ transfergroup.valid_by.trigramme }} + {{ transfergroup.comment }} +
    + {% for transfer in transfergroup.transfers.all %} +
    + {{ transfer.amount }} € + {{ transfer.from_acc.trigramme }} + + {{ transfer.to_acc.trigramme }} +
    + {% endfor %} + {% endfor %} +
    diff --git a/kfet/templates/kfet/transfers_create.html b/kfet/templates/kfet/transfers_create.html index 3a85264d..b44bfd2d 100644 --- a/kfet/templates/kfet/transfers_create.html +++ b/kfet/templates/kfet/transfers_create.html @@ -1,9 +1,8 @@ {% extends "kfet/base_col_1.html" %} -{% load static %} +{% load staticfiles %} {% block extra_head %} - {% endblock %} {% block title %}Nouveaux transferts{% endblock %} @@ -20,7 +19,7 @@ --> {{ transfer_formset.management_form }}
    - +
    @@ -52,12 +51,12 @@ diff --git a/kfet/templatetags/kfet_tags.py b/kfet/templatetags/kfet_tags.py index db4cfbf1..4c26dd17 100644 --- a/kfet/templatetags/kfet_tags.py +++ b/kfet/templatetags/kfet_tags.py @@ -1,4 +1,8 @@ +import re + from django import template +from django.utils.html import escape +from django.utils.safestring import mark_safe from ..utils import to_ukf @@ -7,14 +11,40 @@ register = template.Library() register.filter("ukf", to_ukf) +@register.filter() +def highlight_text(text, q): + q2 = "|".join(re.escape(word) for word in q.split()) + pattern = re.compile(r"(?P%s)" % q2, re.IGNORECASE) + regex = r"\g" + return mark_safe(re.sub(pattern, regex, escape(text))) + + +@register.filter(is_safe=True) +def highlight_user(user, q): + if user.first_name and user.last_name: + text = "%s %s (%s)" % (user.first_name, user.last_name, user.username) + else: + text = user.username + return highlight_text(text, q) + + +@register.filter(is_safe=True) +def highlight_clipper(clipper, q): + if clipper.fullname: + text = "%s (%s)" % (clipper.fullname, clipper.clipper) + else: + text = clipper.clipper + return highlight_text(text, q) + + @register.filter() def widget_type(field): return field.field.widget.__class__.__name__ @register.filter() -def slice(t, start, end=None): +def slice(l, start, end=None): if end is None: end = start start = 0 - return t[start:end] + return l[start:end] diff --git a/kfet/tests/test_models.py b/kfet/tests/test_models.py index a534493d..7ce6605c 100644 --- a/kfet/tests/test_models.py +++ b/kfet/tests/test_models.py @@ -1,12 +1,10 @@ -from datetime import datetime, timedelta, timezone as tz -from decimal import Decimal -from unittest import mock +import datetime from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone -from kfet.models import Account, AccountNegative, Checkout +from kfet.models import Account, Checkout from .utils import create_user @@ -30,56 +28,6 @@ class AccountTests(TestCase): with self.assertRaises(Account.DoesNotExist): Account.objects.get_by_password("bernard") - @mock.patch("django.utils.timezone.now") - def test_negative_creation(self, mock_now): - now = datetime(2005, 7, 15, tzinfo=tz.utc) - mock_now.return_value = now - self.account.balance = Decimal(-10) - self.account.update_negative() - - self.assertTrue(hasattr(self.account, "negative")) - self.assertEqual(self.account.negative.start, now) - - @mock.patch("django.utils.timezone.now") - def test_negative_no_reset(self, mock_now): - now = datetime(2005, 7, 15, tzinfo=tz.utc) - mock_now.return_value = now - - self.account.balance = Decimal(-10) - AccountNegative.objects.create( - account=self.account, start=now - timedelta(minutes=3) - ) - self.account.refresh_from_db() - - self.account.balance = Decimal(5) - self.account.update_negative() - self.assertTrue(hasattr(self.account, "negative")) - - self.account.balance = Decimal(-10) - self.account.update_negative() - self.assertEqual(self.account.negative.start, now - timedelta(minutes=3)) - - @mock.patch("django.utils.timezone.now") - def test_negative_eventually_resets(self, mock_now): - now = datetime(2005, 7, 15, tzinfo=tz.utc) - mock_now.return_value = now - - self.account.balance = Decimal(-10) - AccountNegative.objects.create( - account=self.account, start=now - timedelta(minutes=20) - ) - self.account.refresh_from_db() - self.account.balance = Decimal(5) - - mock_now.return_value = now - timedelta(minutes=10) - self.account.update_negative() - - mock_now.return_value = now - self.account.update_negative() - self.account.refresh_from_db() - - self.assertFalse(hasattr(self.account, "negative")) - class CheckoutTests(TestCase): def setUp(self): @@ -91,7 +39,7 @@ class CheckoutTests(TestCase): self.c = Checkout( created_by=self.u_acc, valid_from=self.now, - valid_to=self.now + timedelta(days=1), + valid_to=self.now + datetime.timedelta(days=1), ) def test_initial_statement(self): diff --git a/kfet/tests/test_statistic.py b/kfet/tests/test_statistic.py index 6d8ecb47..f0ed7f74 100644 --- a/kfet/tests/test_statistic.py +++ b/kfet/tests/test_statistic.py @@ -18,9 +18,7 @@ class TestStats(TestCase): user.set_password("foobar") user.save() Account.objects.create(trigramme="FOO", cofprofile=user.profile) - perm = Permission.objects.get( - codename="is_team", content_type__app_label="kfet" - ) + perm = Permission.objects.get(codename="is_team") user.user_permissions.add(perm) user2 = User.objects.create(username="Barfoo") @@ -38,15 +36,16 @@ class TestStats(TestCase): client2 = Client() client2.login(username="Barfoo", password="barfoo") - # 1. FOO should be able to get these pages but BAR receives a 404 + # 1. FOO should be able to get these pages but BAR receives a Forbidden + # response user_urls = [ "/k-fet/accounts/FOO/stat/operations/list", "/k-fet/accounts/FOO/stat/operations?{}".format( "&".join( [ - "scale-name=day", - "scale-n_steps=7", - "scale-last=True", + "scale=day", + "types=['purchase']", + "scale_args={'n_steps':+7,+'last':+True}", "format=json", ] ) @@ -58,26 +57,16 @@ class TestStats(TestCase): resp = client.get(url) self.assertEqual(200, resp.status_code) resp2 = client2.get(url) - self.assertEqual(404, resp2.status_code) + self.assertEqual(403, resp2.status_code) # 2. FOO is a member of the team and can get these pages but BAR # receives a Redirect response articles_urls = [ "/k-fet/articles/{}/stat/sales/list".format(article.pk), - "/k-fet/articles/{}/stat/sales?{}".format( - article.pk, - "&".join( - [ - "scale-name=day", - "scale-n_steps=7", - "scale-last=True", - "format=json", - ] - ), - ), + "/k-fet/articles/{}/stat/sales".format(article.pk), ] for url in articles_urls: resp = client.get(url) self.assertEqual(200, resp.status_code) resp2 = client2.get(url, follow=True) - self.assertRedirects(resp2, "/gestion/") + self.assertRedirects(resp2, "/") diff --git a/kfet/tests/test_tests_utils.py b/kfet/tests/test_tests_utils.py index 2c42ff79..45ca2348 100644 --- a/kfet/tests/test_tests_utils.py +++ b/kfet/tests/test_tests_utils.py @@ -1,6 +1,3 @@ -from decimal import Decimal -from unittest import mock - from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType @@ -8,16 +5,9 @@ from django.test import TestCase from gestioncof.models import CofProfile -from ..models import Account, Article, ArticleCategory, Checkout, Operation +from ..models import Account from .testcases import TestCaseMixin -from .utils import ( - create_operation_group, - create_root, - create_team, - create_user, - get_perms, - user_add_perms, -) +from .utils import create_root, create_team, create_user, get_perms, user_add_perms User = get_user_model() @@ -94,81 +84,5 @@ class PermHelpersTest(TestCaseMixin, TestCase): self.assertQuerysetEqual( user.user_permissions.all(), map(repr, [self.perm1, self.perm2, self.perm_team]), - transform=repr, ordered=False, ) - - -class OperationHelpersTest(TestCase): - def test_create_operation_group(self): - operation_group = create_operation_group() - - on_acc = Account.objects.get(cofprofile__user__username="user") - checkout = Checkout.objects.get(name="Checkout") - self.assertDictEqual( - operation_group.__dict__, - { - "_state": mock.ANY, - "amount": 0, - "at": mock.ANY, - "checkout_id": checkout.pk, - "comment": "", - "id": mock.ANY, - "is_cof": False, - "on_acc_id": on_acc.pk, - "valid_by_id": None, - }, - ) - self.assertFalse(operation_group.opes.all()) - - def test_create_operation_group_with_content(self): - article_category = ArticleCategory.objects.create(name="Category") - article1 = Article.objects.create( - category=article_category, name="Article 1", price=Decimal("2.50") - ) - article2 = Article.objects.create( - category=article_category, name="Article 2", price=Decimal("4.00") - ) - operation_group = create_operation_group( - content=[ - { - "type": Operation.PURCHASE, - "amount": Decimal("-3.50"), - "article": article1, - "article_nb": 2, - }, - {"type": Operation.PURCHASE, "article": article2, "article_nb": 2}, - {"type": Operation.PURCHASE, "article": article2}, - {"type": Operation.DEPOSIT, "amount": Decimal("10.00")}, - {"type": Operation.WITHDRAW, "amount": Decimal("-1.00")}, - {"type": Operation.EDIT, "amount": Decimal("7.00")}, - ] - ) - - self.assertEqual(operation_group.amount, Decimal("0.50")) - - operation_list = list(operation_group.opes.all()) - # Passed args: with purchase, article, article_nb, amount - self.assertEqual(operation_list[0].type, Operation.PURCHASE) - self.assertEqual(operation_list[0].article, article1) - self.assertEqual(operation_list[0].article_nb, 2) - self.assertEqual(operation_list[0].amount, Decimal("-3.50")) - # Passed args: with purchase, article, article_nb; without amount - self.assertEqual(operation_list[1].type, Operation.PURCHASE) - self.assertEqual(operation_list[1].article, article2) - self.assertEqual(operation_list[1].article_nb, 2) - self.assertEqual(operation_list[1].amount, Decimal("-8.00")) - # Passed args: with purchase, article; without article_nb, amount - self.assertEqual(operation_list[2].type, Operation.PURCHASE) - self.assertEqual(operation_list[2].article, article2) - self.assertEqual(operation_list[2].article_nb, 1) - self.assertEqual(operation_list[2].amount, Decimal("-4.00")) - # Passed args: with deposit, amount - self.assertEqual(operation_list[3].type, Operation.DEPOSIT) - self.assertEqual(operation_list[3].amount, Decimal("10.00")) - # Passed args: with withdraw, amount - self.assertEqual(operation_list[4].type, Operation.WITHDRAW) - self.assertEqual(operation_list[4].amount, Decimal("-1.00")) - # Passed args: with edit, amount - self.assertEqual(operation_list[5].type, Operation.EDIT) - self.assertEqual(operation_list[5].amount, Decimal("7.00")) diff --git a/kfet/tests/test_views.py b/kfet/tests/test_views.py index d09ff3e8..bd57b6f8 100644 --- a/kfet/tests/test_views.py +++ b/kfet/tests/test_views.py @@ -3,20 +3,15 @@ from datetime import datetime, timedelta from decimal import Decimal from unittest import mock -from asgiref.sync import async_to_sync -from channels.layers import get_channel_layer -from django.contrib.auth.models import User +from django.contrib.auth.models import Group +from django.core.urlresolvers import reverse from django.test import Client, TestCase -from django.urls import reverse from django.utils import timezone -from .. import KFET_DELETED_TRIGRAMME -from ..auth import KFET_GENERIC_TRIGRAMME -from ..auth.models import KFetGroup -from ..auth.utils import hash_password from ..config import kfet_config from ..models import ( Account, + AccountNegative, Article, ArticleCategory, Checkout, @@ -33,16 +28,7 @@ from ..models import ( TransferGroup, ) from .testcases import ViewTestCaseMixin -from .utils import ( - create_checkout, - create_checkout_statement, - create_inventory_article, - create_operation_group, - create_team, - create_user, - get_perms, - user_add_perms, -) +from .utils import create_team, create_user, get_perms, user_add_perms class AccountListViewTests(ViewTestCaseMixin, TestCase): @@ -184,14 +170,10 @@ class AccountCreateAutocompleteViewTests(ViewTestCaseMixin, TestCase): def test_ok(self): r = self.client.get(self.url, {"q": "first"}) self.assertEqual(r.status_code, 200) - self.assertEqual(len(r.context["results"]), 1) - (res,) = r.context["results"] - self.assertEqual(res.name, "kfet") - - u = self.users["user"] + self.assertEqual(len(r.context["users_notcof"]), 0) + self.assertEqual(len(r.context["users_cof"]), 0) self.assertSetEqual( - {e.verbose_name for e in res.entries}, - {"{} ({})".format(u, u.profile.account_kfet.trigramme)}, + set(r.context["kfet"]), set([(self.accounts["user"], self.users["user"])]) ) @@ -205,12 +187,7 @@ class AccountSearchViewTests(ViewTestCaseMixin, TestCase): def test_ok(self): r = self.client.get(self.url, {"q": "first"}) self.assertEqual(r.status_code, 200) - - u = self.users["user"] - self.assertSetEqual( - {e.verbose_name for e in r.context["results"][0].entries}, - {"{} ({})".format(u, u.profile.account_kfet.trigramme)}, - ) + self.assertSetEqual(set(r.context["accounts"]), set([("000", "first last")])) class AccountReadViewTests(ViewTestCaseMixin, TestCase): @@ -221,27 +198,6 @@ class AccountReadViewTests(ViewTestCaseMixin, TestCase): auth_user = "team" auth_forbidden = [None, "user"] - # Users with forbidden access users should get a 404 here, to avoid leaking trigrams - # See issue #224 - def test_forbidden(self): - for user in self.auth_forbidden: - self.assertRedirectsToLoginOr404(user, self.url_expected) - self.assertRedirectsToLoginOr404(user, "/k-fet/accounts/NEX") - - def assertRedirectsToLoginOr404(self, user, url): - client = Client() - if user is None: - response = client.get(url) - self.assertRedirects( - response, - "/gestion/login?next={}".format(url), - fetch_redirect_response=False, - ) - else: - client.login(username=user, password=user) - response = client.get(url) - self.assertEqual(response.status_code, 404) - def get_users_extra(self): return {"user1": create_user("user1", "001")} @@ -298,8 +254,8 @@ class AccountReadViewTests(ViewTestCaseMixin, TestCase): class AccountUpdateViewTests(ViewTestCaseMixin, TestCase): url_name = "kfet.account.update" - url_kwargs = {"trigramme": "100"} - url_expected = "/k-fet/accounts/100/edit" + url_kwargs = {"trigramme": "001"} + url_expected = "/k-fet/accounts/001/edit" http_methods = ["GET", "POST"] @@ -319,139 +275,60 @@ class AccountUpdateViewTests(ViewTestCaseMixin, TestCase): "promo": "", # 'is_frozen': not checked # Account password - "pwd1": "changed_pwd", - "pwd2": "changed_pwd", + "pwd1": "", + "pwd2": "", } def get_users_extra(self): return { + "user1": create_user("user1", "001"), "team1": create_team("team1", "101", perms=["kfet.change_account"]), - "team2": create_team("team2", "102"), } - def assertRedirectsToLoginOr404(self, user, method, url): - client = Client() - meth = getattr(client, method) - if user is None: - response = meth(url) - self.assertRedirects( - response, - "/gestion/login?next={}".format(url), - fetch_redirect_response=False, - ) - else: - client.login(username=user, password=user) - response = meth(url) - self.assertEqual(response.status_code, 404) - def test_get_ok(self): r = self.client.get(self.url) self.assertEqual(r.status_code, 200) + def test_get_ok_self(self): + client = Client() + client.login(username="user1", password="user1") + r = client.get(self.url) + self.assertEqual(r.status_code, 200) + def test_post_ok(self): client = Client() client.login(username="team1", password="team1") - r = client.post(self.url, self.post_data, follow=True) + r = client.post(self.url, self.post_data) self.assertRedirects(r, reverse("kfet.account.read", args=["051"])) - # Comportement attendu : compte modifié, - # utilisateur/mdp inchangé, warning pour le mdp - - self.accounts["team"].refresh_from_db() - self.users["team"].refresh_from_db() + self.accounts["user1"].refresh_from_db() + self.users["user1"].refresh_from_db() self.assertInstanceExpected( - self.accounts["team"], - {"first_name": "team", "last_name": "member", "trigramme": "051"}, - ) - self.assertEqual(self.accounts["team"].password, hash_password("kfetpwd_team")) - - self.assertTrue( - any("mot de passe" in str(msg).casefold() for msg in r.context["messages"]) + self.accounts["user1"], + {"first_name": "The first", "last_name": "The last", "trigramme": "051"}, ) def test_post_ok_self(self): - r = self.client.post(self.url, self.post_data, follow=True) - self.assertRedirects(r, reverse("kfet.account.read", args=["051"])) + client = Client() + client.login(username="user1", password="user1") - self.accounts["team"].refresh_from_db() - self.users["team"].refresh_from_db() + post_data = {"first_name": "The first", "last_name": "The last"} - # Comportement attendu : compte/mdp modifié, utilisateur inchangé + r = client.post(self.url, post_data) + self.assertRedirects(r, reverse("kfet.account.read", args=["001"])) + + self.accounts["user1"].refresh_from_db() + self.users["user1"].refresh_from_db() self.assertInstanceExpected( - self.accounts["team"], - {"first_name": "team", "last_name": "member", "trigramme": "051"}, + self.accounts["user1"], {"first_name": "The first", "last_name": "The last"} ) - self.assertEqual(self.accounts["team"].password, hash_password("changed_pwd")) def test_post_forbidden(self): - client = Client() - client.login(username="team2", password="team2") - r = client.post(self.url, self.post_data) - - self.assertTrue( - any( - "permission refusée" in str(msg).casefold() - for msg in r.context["messages"] - ) - ) - - -class AccountDeleteViewTests(ViewTestCaseMixin, TestCase): - url_name = "kfet.account.delete" - url_kwargs = {"trigramme": "001"} - url_expected = "/k-fet/accounts/001/delete" - - auth_user = "team1" - auth_forbidden = [None, "user", "team"] - http_methods = ["GET", "POST"] - with_liq = True - - def get_users_extra(self): - return { - "user1": create_user("user1", "001"), - "team1": create_team("team1", "101", perms=["kfet.delete_account"]), - "trez": create_user("trez", "#13"), - } - - def test_get_405(self): - r = self.client.get(self.url) - self.assertEqual(r.status_code, 405) - - def test_post_ok(self): - r = self.client.post(self.url, {}) - self.assertRedirects(r, reverse("kfet.account")) - - with self.assertRaises(Account.DoesNotExist): - self.accounts["user1"].refresh_from_db() - - def test_protected_accounts(self): - for trigramme in ["LIQ", "#13", KFET_GENERIC_TRIGRAMME, KFET_DELETED_TRIGRAMME]: - if Account.objects.get(trigramme=trigramme).readable: - expected_code = 200 - else: - expected_code = 404 - r = self.client.post( - reverse(self.url_name, kwargs={"trigramme": trigramme}), {} - ) - self.assertRedirects( - r, - reverse("kfet.account.read", kwargs={"trigramme": trigramme}), - target_status_code=expected_code, - ) - # Devrait être redondant avec le précédent, mais on sait jamais - self.assertTrue(Account.objects.filter(trigramme=trigramme).exists()) - - def test_nonempty_accounts(self): - self.accounts["user1"].balance = 1 - self.accounts["user1"].save() - - r = self.client.post(self.url, {}) - self.assertRedirects(r, reverse("kfet.account.read", kwargs=self.url_kwargs)) - # Shouldn't throw an error - self.accounts["user1"].refresh_from_db() + r = self.client.post(self.url, self.post_data) + self.assertForbiddenKfet(r) class AccountGroupListViewTests(ViewTestCaseMixin, TestCase): @@ -466,18 +343,15 @@ class AccountGroupListViewTests(ViewTestCaseMixin, TestCase): def setUp(self): super().setUp() - self.group1 = KFetGroup.objects.create(name="Group1") - self.group2 = KFetGroup.objects.create(name="Group2") + self.group1 = Group.objects.create(name="K-Fêt - Group1") + self.group2 = Group.objects.create(name="K-Fêt - Group2") def test_ok(self): r = self.client.get(self.url) self.assertEqual(r.status_code, 200) self.assertQuerysetEqual( - r.context["groups"], - [self.group1.pk, self.group2.pk], - transform=lambda group: group.pk, - ordered=False, + r.context["groups"], map(repr, [self.group1, self.group2]), ordered=False ) @@ -515,12 +389,11 @@ class AccountGroupCreateViewTests(ViewTestCaseMixin, TestCase): r = self.client.post(self.url, self.post_data) self.assertRedirects(r, reverse("kfet.account.group")) - group = KFetGroup.objects.get(name="The Group") + group = Group.objects.get(name="K-Fêt The Group") self.assertQuerysetEqual( group.permissions.all(), map(repr, [self.perms["kfet.is_team"], self.perms["kfet.manage_perms"]]), - transform=repr, ordered=False, ) @@ -557,7 +430,7 @@ class AccountGroupUpdateViewTests(ViewTestCaseMixin, TestCase): def setUp(self): super().setUp() self.perms = get_perms("kfet.is_team", "kfet.manage_perms") - self.group = KFetGroup.objects.create(name="Group") + self.group = Group.objects.create(name="K-Fêt - Group") self.group.permissions.set(self.perms.values()) def test_get_ok(self): @@ -570,11 +443,10 @@ class AccountGroupUpdateViewTests(ViewTestCaseMixin, TestCase): self.group.refresh_from_db() - self.assertEqual(self.group.name, "The Group") + self.assertEqual(self.group.name, "K-Fêt The Group") self.assertQuerysetEqual( self.group.permissions.all(), map(repr, [self.perms["kfet.is_team"], self.perms["kfet.manage_perms"]]), - transform=repr, ordered=False, ) @@ -602,7 +474,6 @@ class AccountNegativeListViewTests(ViewTestCaseMixin, TestCase): self.assertQuerysetEqual( r.context["negatives"], map(repr, [self.accounts["user"].negative]), - transform=repr, ordered=False, ) @@ -618,29 +489,6 @@ class AccountStatOperationListViewTests(ViewTestCaseMixin, TestCase): def get_users_extra(self): return {"user1": create_user("user1", "001")} - # Users with forbidden access users should get a 404 here, to avoid leaking trigrams - # See issue #224 - def test_forbidden(self): - for user in self.auth_forbidden: - self.assertRedirectsToLoginOr404(user, self.url_expected) - self.assertRedirectsToLoginOr404( - user, "/k-fet/accounts/NEX/stat/operations/list" - ) - - def assertRedirectsToLoginOr404(self, user, url): - client = Client() - if user is None: - response = client.get(url) - self.assertRedirects( - response, - "/gestion/login?next={}".format(url), - fetch_redirect_response=False, - ) - else: - client.login(username=user, password=user) - response = client.get(url) - self.assertEqual(response.status_code, 404) - def test_ok(self): r = self.client.get(self.url) self.assertEqual(r.status_code, 200) @@ -651,50 +499,38 @@ class AccountStatOperationListViewTests(ViewTestCaseMixin, TestCase): expected_stats = [ { - "label": "Tout le temps", + "label": "Derniers mois", "url": { "path": base_url, "query": { - "scale-name": ["month"], - "scale-last": ["True"], - "scale-begin": [ - self.accounts["user1"] - .created_at.replace(tzinfo=None) - .isoformat(" ") - ], + "scale_n_steps": ["7"], + "scale_name": ["month"], + "types": ["['purchase']"], + "scale_last": ["True"], }, }, }, { - "label": "1 an", + "label": "Dernières semaines", "url": { "path": base_url, "query": { - "scale-n_steps": ["12"], - "scale-name": ["month"], - "scale-last": ["True"], + "scale_n_steps": ["7"], + "scale_name": ["week"], + "types": ["['purchase']"], + "scale_last": ["True"], }, }, }, { - "label": "3 mois", + "label": "Derniers jours", "url": { "path": base_url, "query": { - "scale-n_steps": ["13"], - "scale-name": ["week"], - "scale-last": ["True"], - }, - }, - }, - { - "label": "2 semaines", - "url": { - "path": base_url, - "query": { - "scale-n_steps": ["14"], - "scale-name": ["day"], - "scale-last": ["True"], + "scale_n_steps": ["7"], + "scale_name": ["day"], + "types": ["['purchase']"], + "scale_last": ["True"], }, }, }, @@ -703,7 +539,7 @@ class AccountStatOperationListViewTests(ViewTestCaseMixin, TestCase): for stat, expected in zip(content["stats"], expected_stats): expected_url = expected.pop("url") self.assertUrlsEqual(stat["url"], expected_url) - self.assertEqual(stat, {**stat, **expected}) + self.assertDictContainsSubset(expected, stat) class AccountStatOperationViewTests(ViewTestCaseMixin, TestCase): @@ -714,36 +550,11 @@ class AccountStatOperationViewTests(ViewTestCaseMixin, TestCase): auth_user = "user1" auth_forbidden = [None, "user", "team"] - # Users with forbidden access users should get a 404 here, to avoid leaking trigrams - # See issue #224 - def test_forbidden(self): - for user in self.auth_forbidden: - self.assertRedirectsToLoginOr404(user, self.url_expected) - self.assertRedirectsToLoginOr404( - user, "/k-fet/accounts/NEX/stat/operations" - ) - - def assertRedirectsToLoginOr404(self, user, url): - client = Client() - if user is None: - response = client.get(url) - self.assertRedirects( - response, - "/gestion/login?next={}".format(url), - fetch_redirect_response=False, - ) - else: - client.login(username=user, password=user) - response = client.get(url) - self.assertEqual(response.status_code, 404) - def get_users_extra(self): return {"user1": create_user("user1", "001")} def test_ok(self): - r = self.client.get( - self.url, {"scale-name": "day", "scale-n_steps": 7, "scale-last": True} - ) + r = self.client.get(self.url) self.assertEqual(r.status_code, 200) @@ -755,29 +566,6 @@ class AccountStatBalanceListViewTests(ViewTestCaseMixin, TestCase): auth_user = "user1" auth_forbidden = [None, "user", "team"] - # Users with forbidden access users should get a 404 here, to avoid leaking trigrams - # See issue #224 - def test_forbidden(self): - for user in self.auth_forbidden: - self.assertRedirectsToLoginOr404(user, self.url_expected) - self.assertRedirectsToLoginOr404( - user, "/k-fet/accounts/NEX/stat/balance/list" - ) - - def assertRedirectsToLoginOr404(self, user, url): - client = Client() - if user is None: - response = client.get(url) - self.assertRedirects( - response, - "/gestion/login?next={}".format(url), - fetch_redirect_response=False, - ) - else: - client.login(username=user, password=user) - response = client.get(url) - self.assertEqual(response.status_code, 404) - def get_users_extra(self): return {"user1": create_user("user1", "001")} @@ -812,7 +600,7 @@ class AccountStatBalanceListViewTests(ViewTestCaseMixin, TestCase): for stat, expected in zip(content["stats"], expected_stats): expected_url = expected.pop("url") self.assertUrlsEqual(stat["url"], expected_url) - self.assertEqual(stat, {**stat, **expected}) + self.assertDictContainsSubset(expected, stat) class AccountStatBalanceViewTests(ViewTestCaseMixin, TestCase): @@ -823,27 +611,6 @@ class AccountStatBalanceViewTests(ViewTestCaseMixin, TestCase): auth_user = "user1" auth_forbidden = [None, "user", "team"] - # Users with forbidden access users should get a 404 here, to avoid leaking trigrams - # See issue #224 - def test_forbidden(self): - for user in self.auth_forbidden: - self.assertRedirectsToLoginOr404(user, self.url_expected) - self.assertRedirectsToLoginOr404(user, "/k-fet/accounts/NEX/stat/balance") - - def assertRedirectsToLoginOr404(self, user, url): - client = Client() - if user is None: - response = client.get(url) - self.assertRedirects( - response, - "/gestion/login?next={}".format(url), - fetch_redirect_response=False, - ) - else: - client.login(username=user, password=user) - response = client.get(url) - self.assertEqual(response.status_code, 404) - def get_users_extra(self): return {"user1": create_user("user1", "001")} @@ -880,7 +647,6 @@ class CheckoutListViewTests(ViewTestCaseMixin, TestCase): self.assertQuerysetEqual( r.context["checkouts"], map(repr, [self.checkout1, self.checkout2]), - transform=repr, ordered=False, ) @@ -1071,7 +837,6 @@ class CheckoutStatementListViewTests(ViewTestCaseMixin, TestCase): self.assertQuerysetEqual( r.context["checkoutstatements"], map(repr, expected_statements), - transform=repr, ordered=False, ) @@ -1298,9 +1063,7 @@ class ArticleCategoryListViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(r.status_code, 200) self.assertQuerysetEqual( - r.context["categories"], - map(repr, [self.category1, self.category2]), - transform=repr, + r.context["categories"], map(repr, [self.category1, self.category2]) ) @@ -1375,9 +1138,7 @@ class ArticleListViewTests(ViewTestCaseMixin, TestCase): r = self.client.get(self.url) self.assertEqual(r.status_code, 200) self.assertQuerysetEqual( - r.context["articles"], - map(repr, [self.article1, self.article2]), - transform=repr, + r.context["articles"], map(repr, [self.article1, self.article2]) ) @@ -1518,42 +1279,6 @@ class ArticleUpdateViewTests(ViewTestCaseMixin, TestCase): self.assertForbiddenKfet(r) -class ArticleDeleteViewTests(ViewTestCaseMixin, TestCase): - url_name = "kfet.article.delete" - - auth_user = "team1" - auth_forbidden = [None, "user", "team"] - - @property - def url_kwargs(self): - return {"pk": self.article.pk} - - @property - def url_expected(self): - return "/k-fet/articles/{}/delete".format(self.article.pk) - - def get_users_extra(self): - return {"team1": create_team("team1", "101", perms=["kfet.delete_article"])} - - def setUp(self): - super().setUp() - self.category = ArticleCategory.objects.create(name="Category") - self.article = Article.objects.create( - name="Article", category=self.category, stock=5, price=Decimal("2.5") - ) - - def test_get_redirects(self): - r = self.client.get(self.url) - self.assertRedirects(r, reverse("kfet.article.read", kwargs=self.url_kwargs)) - - def test_post_ok(self): - r = self.client.post(self.url, {}) - self.assertRedirects(r, reverse("kfet.article")) - - with self.assertRaises(Article.DoesNotExist): - self.article.refresh_from_db() - - class ArticleStatSalesListViewTests(ViewTestCaseMixin, TestCase): url_name = "kfet.article.stat.sales.list" @@ -1573,21 +1298,6 @@ class ArticleStatSalesListViewTests(ViewTestCaseMixin, TestCase): self.article = Article.objects.create( name="Article", category=ArticleCategory.objects.create(name="Category") ) - checkout = Checkout.objects.create( - name="Checkout", - created_by=self.accounts["team"], - balance=5, - valid_from=self.now, - valid_to=self.now + timedelta(days=5), - ) - - self.opegroup = create_operation_group( - on_acc=self.accounts["user"], - checkout=checkout, - content=[ - {"type": Operation.PURCHASE, "article": self.article, "article_nb": 2}, - ], - ) def test_ok(self): r = self.client.get(self.url) @@ -1599,46 +1309,35 @@ class ArticleStatSalesListViewTests(ViewTestCaseMixin, TestCase): expected_stats = [ { - "label": "Tout le temps", + "label": "Derniers mois", "url": { "path": base_url, "query": { - "scale-name": ["month"], - "scale-last": ["True"], - "scale-begin": [self.opegroup.at.strftime("%Y-%m-%d %H:%M:%S")], + "scale_n_steps": ["7"], + "scale_name": ["month"], + "scale_last": ["True"], }, }, }, { - "label": "1 an", + "label": "Dernières semaines", "url": { "path": base_url, "query": { - "scale-n_steps": ["12"], - "scale-name": ["month"], - "scale-last": ["True"], + "scale_n_steps": ["7"], + "scale_name": ["week"], + "scale_last": ["True"], }, }, }, { - "label": "3 mois", + "label": "Derniers jours", "url": { "path": base_url, "query": { - "scale-n_steps": ["13"], - "scale-name": ["week"], - "scale-last": ["True"], - }, - }, - }, - { - "label": "2 semaines", - "url": { - "path": base_url, - "query": { - "scale-n_steps": ["14"], - "scale-name": ["day"], - "scale-last": ["True"], + "scale_n_steps": ["7"], + "scale_name": ["day"], + "scale_last": ["True"], }, }, }, @@ -1647,7 +1346,7 @@ class ArticleStatSalesListViewTests(ViewTestCaseMixin, TestCase): for stat, expected in zip(content["stats"], expected_stats): expected_url = expected.pop("url") self.assertUrlsEqual(stat["url"], expected_url) - self.assertEqual(stat, {**stat, **expected}) + self.assertDictContainsSubset(expected, stat) class ArticleStatSalesViewTests(ViewTestCaseMixin, TestCase): @@ -1671,9 +1370,7 @@ class ArticleStatSalesViewTests(ViewTestCaseMixin, TestCase): ) def test_ok(self): - r = self.client.get( - self.url, {"scale-name": "day", "scale-n_steps": 7, "scale-last": True} - ) + r = self.client.get(self.url) self.assertEqual(r.status_code, 200) @@ -1716,7 +1413,7 @@ class KPsulCheckoutDataViewTests(ViewTestCaseMixin, TestCase): expected = {"name": "Checkout", "balance": "10.00"} - self.assertEqual(content, {**content, **expected}) + self.assertDictContainsSubset(expected, content) self.assertSetEqual( set(content.keys()), @@ -1803,29 +1500,16 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): price=Decimal("2.5"), stock=20, ) - # Another Article, price=2.5, stock=20, no COF reduction - self.article_no_reduction = Article.objects.create( - category=ArticleCategory.objects.create( - name="Category_no_reduction", - has_reduction=False, - ), - name="Article_no_reduction", - price=Decimal("2.5"), - stock=20, - ) # An Account, trigramme=000, balance=50 # Do not assume user is cof, nor not cof. self.account = self.accounts["user"] self.account.balance = Decimal("50.00") self.account.save() - # Create a channel to listen to KPsul's messages - channel_layer = get_channel_layer() - self.channel = async_to_sync(channel_layer.new_channel)() - - async_to_sync(channel_layer.group_add)("kfet.kpsul", self.channel) - - self.receive_msg = lambda: async_to_sync(channel_layer.receive)(self.channel) + # Mock consumer of K-Psul websocket to catch what we're sending + kpsul_consumer_patcher = mock.patch("kfet.consumers.KPsul") + self.kpsul_consumer_mock = kpsul_consumer_patcher.start() + self.addCleanup(kpsul_consumer_patcher.stop) # Reset cache of kfet config kfet_config._conf_init = False @@ -1869,10 +1553,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_on_acc", "invalid_formset"], - ) + self.assertEqual(json_data["errors"]["operation_group"], ["on_acc"]) def test_group_on_acc_expects_comment(self): user_add_perms(self.users["team"], ["kfet.perform_commented_operations"]) @@ -1915,7 +1596,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertEqual(json_data["need_comment"], True) + self.assertEqual(json_data["errors"]["need_comment"], True) def test_invalid_group_on_acc_needs_comment_requires_perm(self): self.account.trigramme = "#13" @@ -1938,11 +1619,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 403) json_data = json.loads(resp.content.decode("utf-8")) self.assertEqual( - json_data["missing_perms"], + json_data["errors"]["missing_perms"], ["Enregistrer des commandes avec commentaires"], ) - def test_error_on_acc_frozen(self): + def test_group_on_acc_frozen(self): + user_add_perms(self.users["team"], ["kfet.override_frozen_protection"]) self.account.is_frozen = True self.account.save() @@ -1959,9 +1641,30 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): ) resp = self.client.post(self.url, data) - self.assertEqual(resp.status_code, 400) + self._assertResponseOk(resp) + + def test_invalid_group_on_acc_frozen_requires_perm(self): + self.account.is_frozen = True + self.account.save() + + data = dict( + self.base_post_data, + **{ + "comment": "A comment to explain it", + "form-TOTAL_FORMS": "1", + "form-0-type": "purchase", + "form-0-amount": "", + "form-0-article": str(self.article.pk), + "form-0-article_nb": "2", + } + ) + resp = self.client.post(self.url, data) + + self.assertEqual(resp.status_code, 403) json_data = json.loads(resp.content.decode("utf-8")) - self.assertEqual([e["code"] for e in json_data["errors"]], ["frozen_acc"]) + self.assertEqual( + json_data["errors"]["missing_perms"], ["Forcer le gel d'un compte"] + ) def test_invalid_group_checkout(self): self.checkout.valid_from -= timedelta(days=300) @@ -1973,10 +1676,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_checkout", "invalid_formset"], - ) + self.assertEqual(json_data["errors"]["operation_group"], ["checkout"]) def test_invalid_group_expects_one_operation(self): data = dict(self.base_post_data) @@ -1984,10 +1684,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], - ) + self.assertEqual(json_data["errors"]["operations"], []) def test_purchase_with_user_is_nof_cof(self): self.account.cofprofile.is_cof = False @@ -2045,7 +1742,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): # Check response content self.assertDictEqual( json_data, - {"errors": []}, + { + "operationgroup": operation_group.pk, + "operations": [operation.pk], + "warnings": {}, + "errors": {}, + }, ) # Check object updates @@ -2057,16 +1759,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(self.article.stock, 18) # Check websocket data - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, + self.kpsul_consumer_mock.group_send.assert_called_once_with( + "kfet.kpsul", { - "type": "kpsul", - "groups": [ + "opegroups": [ { "add": True, - "type": "operation", "at": mock.ANY, "amount": Decimal("-5.00"), "checkout__name": "Checkout", @@ -2075,7 +1773,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): "is_cof": False, "on_acc__trigramme": "000", "valid_by__trigramme": None, - "entries": [ + "opes": [ { "id": operation.pk, "addcost_amount": None, @@ -2155,35 +1853,6 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.article.refresh_from_db() self.assertEqual(self.article.stock, 18) - def test_purchase_no_reduction(self): - kfet_config.set(kfet_reduction_cof=Decimal("20")) - self.account.cofprofile.is_cof = True - self.account.cofprofile.save() - data = dict( - self.base_post_data, - **{ - "form-TOTAL_FORMS": "2", - "form-0-type": "purchase", - "form-0-amount": "", - "form-0-article": str(self.article_no_reduction.pk), - "form-0-article_nb": "1", - "form-1-type": "purchase", - "form-1-amount": "", - "form-1-article": str(self.article.pk), - "form-1-article_nb": "1", - } - ) - - resp = self.client.post(self.url, data) - self._assertResponseOk(resp) - - operation_group = OperationGroup.objects.get() - self.assertEqual(operation_group.amount, Decimal("-4.50")) - operation = Operation.objects.get(article=self.article) - self.assertEqual(operation.amount, Decimal("-2.00")) - operation = Operation.objects.get(article=self.article_no_reduction) - self.assertEqual(operation.amount, Decimal("-2.50")) - def test_invalid_purchase_expects_article(self): data = dict( self.base_post_data, @@ -2199,9 +1868,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], + [{"__all__": ["Un achat nécessite un article et une quantité"]}], ) def test_invalid_purchase_expects_article_nb(self): @@ -2219,9 +1888,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], + [{"__all__": ["Un achat nécessite un article et une quantité"]}], ) def test_invalid_purchase_expects_article_nb_greater_than_1(self): @@ -2239,9 +1908,16 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], + [ + { + "__all__": ["Un achat nécessite un article et une quantité"], + "article_nb": [ + "Assurez-vous que cette valeur est supérieure ou " "égale à 1." + ], + } + ], ) def test_invalid_operation_not_purchase_with_cash(self): @@ -2260,10 +1936,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_liq"], - ) + self.assertEqual(json_data["errors"]["account"], "LIQ") def test_deposit(self): user_add_perms(self.users["team"], ["kfet.perform_deposit"]) @@ -2316,7 +1989,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertDictEqual( json_data, - {"errors": []}, + { + "operationgroup": operation_group.pk, + "operations": [operation.pk], + "warnings": {}, + "errors": {}, + }, ) self.account.refresh_from_db() @@ -2324,16 +2002,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.checkout.refresh_from_db() self.assertEqual(self.checkout.balance, Decimal("110.75")) - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, + self.kpsul_consumer_mock.group_send.assert_called_once_with( + "kfet.kpsul", { - "type": "kpsul", - "groups": [ + "opegroups": [ { "add": True, - "type": "operation", "at": mock.ANY, "amount": Decimal("10.75"), "checkout__name": "Checkout", @@ -2342,7 +2016,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): "is_cof": False, "on_acc__trigramme": "000", "valid_by__trigramme": "100", - "entries": [ + "opes": [ { "id": operation.pk, "addcost_amount": None, @@ -2378,9 +2052,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], [{"__all__": ["Bad request"]}] ) def test_invalid_deposit_too_many_params(self): @@ -2398,9 +2071,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], [{"__all__": ["Bad request"]}] ) def test_invalid_deposit_expects_positive_amount(self): @@ -2418,9 +2090,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], [{"__all__": ["Charge non positive"]}] ) def test_invalid_deposit_requires_perm(self): @@ -2438,7 +2109,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 403) json_data = json.loads(resp.content.decode("utf-8")) - self.assertEqual(json_data["missing_perms"], ["Effectuer une charge"]) + self.assertEqual(json_data["errors"]["missing_perms"], ["Effectuer une charge"]) def test_withdraw(self): data = dict( @@ -2490,7 +2161,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertDictEqual( json_data, - {"errors": []}, + { + "operationgroup": operation_group.pk, + "operations": [operation.pk], + "warnings": {}, + "errors": {}, + }, ) self.account.refresh_from_db() @@ -2498,16 +2174,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.checkout.refresh_from_db() self.assertEqual(self.checkout.balance, Decimal("89.25")) - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, + self.kpsul_consumer_mock.group_send.assert_called_once_with( + "kfet.kpsul", { - "type": "kpsul", - "groups": [ + "opegroups": [ { "add": True, - "type": "operation", "at": mock.ANY, "amount": Decimal("-10.75"), "checkout__name": "Checkout", @@ -2516,7 +2188,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): "is_cof": False, "on_acc__trigramme": "000", "valid_by__trigramme": None, - "entries": [ + "opes": [ { "id": operation.pk, "addcost_amount": None, @@ -2552,9 +2224,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], [{"__all__": ["Bad request"]}] ) def test_invalid_withdraw_too_many_params(self): @@ -2572,9 +2243,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], [{"__all__": ["Bad request"]}] ) def test_invalid_withdraw_expects_negative_amount(self): @@ -2592,9 +2262,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_formset"], + self.assertEqual( + json_data["errors"]["operations"], [{"__all__": ["Retrait non négatif"]}] ) def test_edit(self): @@ -2650,7 +2319,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertDictEqual( json_data, - {"errors": []}, + { + "operationgroup": operation_group.pk, + "operations": [operation.pk], + "warnings": {}, + "errors": {}, + }, ) self.account.refresh_from_db() @@ -2658,16 +2332,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.checkout.refresh_from_db() self.assertEqual(self.checkout.balance, Decimal("100.00")) - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, + self.kpsul_consumer_mock.group_send.assert_called_once_with( + "kfet.kpsul", { - "type": "kpsul", - "groups": [ + "opegroups": [ { "add": True, - "type": "operation", "at": mock.ANY, "amount": Decimal("10.75"), "checkout__name": "Checkout", @@ -2676,7 +2346,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): "is_cof": False, "on_acc__trigramme": "000", "valid_by__trigramme": "100", - "entries": [ + "opes": [ { "id": operation.pk, "addcost_amount": None, @@ -2714,8 +2384,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 403) json_data = json.loads(resp.content.decode("utf-8")) self.assertEqual( - json_data["missing_perms"], - ["Modifier la balance d'un compte"], + json_data["errors"]["missing_perms"], ["Modifier la balance d'un compte"] ) def test_invalid_edit_expects_comment(self): @@ -2735,7 +2404,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 400) json_data = json.loads(resp.content.decode("utf-8")) - self.assertEqual(json_data["need_comment"], True) + self.assertEqual(json_data["errors"]["need_comment"], True) def _setup_addcost(self): self.register_user("addcost", create_user("addcost", "ADD")) @@ -2776,9 +2445,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.checkout.refresh_from_db() self.assertEqual(self.checkout.balance, Decimal("100.00")) - ws_data = self.receive_msg() - ws_data_ope = ws_data["groups"][0]["entries"][0] - + ws_data_ope = self.kpsul_consumer_mock.group_send.call_args[0][1]["opegroups"][ + 0 + ]["opes"][0] self.assertEqual(ws_data_ope["addcost_amount"], Decimal("1.00")) self.assertEqual(ws_data_ope["addcost_for__trigramme"], "ADD") @@ -2816,9 +2485,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.checkout.refresh_from_db() self.assertEqual(self.checkout.balance, Decimal("100.00")) - ws_data = self.receive_msg() - ws_data_ope = ws_data["groups"][0]["entries"][0] - + ws_data_ope = self.kpsul_consumer_mock.group_send.call_args[0][1]["opegroups"][ + 0 + ]["opes"][0] self.assertEqual(ws_data_ope["addcost_amount"], Decimal("0.80")) self.assertEqual(ws_data_ope["addcost_for__trigramme"], "ADD") @@ -2854,9 +2523,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.checkout.refresh_from_db() self.assertEqual(self.checkout.balance, Decimal("106.00")) - ws_data = self.receive_msg() - ws_data_ope = ws_data["groups"][0]["entries"][0] - + ws_data_ope = self.kpsul_consumer_mock.group_send.call_args[0][1]["opegroups"][ + 0 + ]["opes"][0] self.assertEqual(ws_data_ope["addcost_amount"], Decimal("1.00")) self.assertEqual(ws_data_ope["addcost_for__trigramme"], "ADD") @@ -2890,9 +2559,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.accounts["addcost"].refresh_from_db() self.assertEqual(self.accounts["addcost"].balance, Decimal("15.00")) - ws_data = self.receive_msg() - ws_data_ope = ws_data["groups"][0]["entries"][0] - + ws_data_ope = self.kpsul_consumer_mock.group_send.call_args[0][1]["opegroups"][ + 0 + ]["opes"][0] self.assertEqual(ws_data_ope["addcost_amount"], None) self.assertEqual(ws_data_ope["addcost_for__trigramme"], None) @@ -2925,9 +2594,9 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.accounts["addcost"].refresh_from_db() self.assertEqual(self.accounts["addcost"].balance, Decimal("0.00")) - ws_data = self.receive_msg() - ws_data_ope = ws_data["groups"][0]["entries"][0] - + ws_data_ope = self.kpsul_consumer_mock.group_send.call_args[0][1]["opegroups"][ + 0 + ]["opes"][0] self.assertEqual(ws_data_ope["addcost_amount"], None) self.assertEqual(ws_data_ope["addcost_for__trigramme"], None) @@ -3022,10 +2691,62 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(resp.status_code, 403) json_data = json.loads(resp.content.decode("utf-8")) self.assertEqual( - json_data["missing_perms"], - ["Enregistrer des commandes en négatif"], + json_data["errors"], + {"missing_perms": ["Enregistrer des commandes en négatif"]}, ) + def test_invalid_negative_exceeds_allowed_duration_from_config(self): + user_add_perms(self.users["team"], ["kfet.perform_negative_operations"]) + kfet_config.set(overdraft_duration=timedelta(days=5)) + self.account.balance = Decimal("1.00") + self.account.save() + self.account.negative = AccountNegative.objects.create( + account=self.account, start=timezone.now() - timedelta(days=5, minutes=1) + ) + + data = dict( + self.base_post_data, + **{ + "form-TOTAL_FORMS": "1", + "form-0-type": "purchase", + "form-0-amount": "", + "form-0-article": str(self.article.pk), + "form-0-article_nb": "2", + } + ) + resp = self.client.post(self.url, data) + + self.assertEqual(resp.status_code, 403) + json_data = json.loads(resp.content.decode("utf-8")) + self.assertEqual(json_data["errors"], {"negative": ["000"]}) + + def test_invalid_negative_exceeds_allowed_duration_from_account(self): + user_add_perms(self.users["team"], ["kfet.perform_negative_operations"]) + kfet_config.set(overdraft_duration=timedelta(days=5)) + self.account.balance = Decimal("1.00") + self.account.save() + self.account.negative = AccountNegative.objects.create( + account=self.account, + start=timezone.now() - timedelta(days=3), + authz_overdraft_until=timezone.now() - timedelta(seconds=1), + ) + + data = dict( + self.base_post_data, + **{ + "form-TOTAL_FORMS": "1", + "form-0-type": "purchase", + "form-0-amount": "", + "form-0-article": str(self.article.pk), + "form-0-article_nb": "2", + } + ) + resp = self.client.post(self.url, data) + + self.assertEqual(resp.status_code, 403) + json_data = json.loads(resp.content.decode("utf-8")) + self.assertEqual(json_data["errors"], {"negative": ["000"]}) + def test_invalid_negative_exceeds_amount_allowed_from_config(self): user_add_perms(self.users["team"], ["kfet.perform_negative_operations"]) kfet_config.set(overdraft_amount=Decimal("-1.00")) @@ -3045,13 +2766,38 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): ) resp = self.client.post(self.url, data) - self.assertEqual(resp.status_code, 400) + self.assertEqual(resp.status_code, 403) json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["negative"], + self.assertEqual(json_data["errors"], {"negative": ["000"]}) + + def test_invalid_negative_exceeds_amount_allowed_from_account(self): + user_add_perms(self.users["team"], ["kfet.perform_negative_operations"]) + kfet_config.set(overdraft_amount=Decimal("10.00")) + self.account.balance = Decimal("1.00") + self.account.save() + self.account.update_negative() + self.account.negative = AccountNegative.objects.create( + account=self.account, + start=timezone.now() - timedelta(days=3), + authz_overdraft_amount=Decimal("1.00"), ) + data = dict( + self.base_post_data, + **{ + "form-TOTAL_FORMS": "1", + "form-0-type": "purchase", + "form-0-amount": "", + "form-0-article": str(self.article.pk), + "form-0-article_nb": "2", + } + ) + resp = self.client.post(self.url, data) + + self.assertEqual(resp.status_code, 403) + json_data = json.loads(resp.content.decode("utf-8")) + self.assertEqual(json_data["errors"], {"negative": ["000"]}) + def test_multi_0(self): article2 = Article.objects.create( name="Article 2", @@ -3135,7 +2881,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): # Check response content self.assertDictEqual( json_data, - {"errors": []}, + { + "operationgroup": operation_group.pk, + "operations": [operation_list[0].pk, operation_list[1].pk], + "warnings": {}, + "errors": {}, + }, ) # Check object updates @@ -3149,16 +2900,12 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(article2.stock, -6) # Check websocket data - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, + self.kpsul_consumer_mock.group_send.assert_called_once_with( + "kfet.kpsul", { - "type": "kpsul", - "groups": [ + "opegroups": [ { "add": True, - "type": "operation", "at": mock.ANY, "amount": Decimal("-9.00"), "checkout__name": "Checkout", @@ -3167,7 +2914,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): "is_cof": False, "on_acc__trigramme": "000", "valid_by__trigramme": None, - "entries": [ + "opes": [ { "id": operation_list[0].pk, "addcost_amount": None, @@ -3205,22 +2952,7 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase): class KPsulCancelOperationsViewTests(ViewTestCaseMixin, TestCase): - """ - Test cases for kpsul_cancel_operations view. - - To test valid requests, one should use '_assertResponseOk(response)' to get - hints about failure reasons, if any. - - At least one test per operation type should test the complete response and - behavior (HTTP, WebSocket, object updates, and object creations) - Other tests of the same operation type can only assert the specific - behavior differences. - - For invalid requests, response errors should be tested. - - """ - - url_name = "kfet.operations.cancel" + url_name = "kfet.kpsul.cancel_operations" url_expected = "/k-fet/k-psul/cancel_operations" http_methods = ["POST"] @@ -3228,847 +2960,8 @@ class KPsulCancelOperationsViewTests(ViewTestCaseMixin, TestCase): auth_user = "team" auth_forbidden = [None, "user"] - with_liq = True - - def setUp(self): - super(KPsulCancelOperationsViewTests, self).setUp() - - self.checkout = create_checkout(balance=Decimal("100.00")) - # An Article, price=2.5, stock=20 - self.article = Article.objects.create( - category=ArticleCategory.objects.create(name="Category"), - name="Article", - price=Decimal("2.5"), - stock=20, - ) - # An Account, trigramme=000, balance=50 - # Do not assume user is cof, nor not cof. - self.account = self.accounts["user"] - self.account.balance = Decimal("50.00") - self.account.save() - - # Create a channel to listen to KPsul's messages - channel_layer = get_channel_layer() - - self.channel = async_to_sync(channel_layer.new_channel)() - - async_to_sync(channel_layer.group_add)("kfet.kpsul", self.channel) - - self.receive_msg = lambda: async_to_sync(channel_layer.receive)(self.channel) - - def _assertResponseOk(self, response): - """ - Asserts that status code of 'response' is 200, and returns the - deserialized content of the JSONResponse. - - In case status code is not 200, it prints the content of "errors" of - the response. - - """ - json_data = json.loads(getattr(response, "content", b"{}").decode("utf-8")) - try: - self.assertEqual(response.status_code, 200) - except AssertionError as exc: - msg = "Expected response is 200, got {}. Errors: {}".format( - response.status_code, json_data.get("errors") - ) - raise AssertionError(msg) from exc - return json_data - - def test_invalid_operation_not_int(self): - data = {"operations[]": ["a"]} - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 400) - json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["invalid_request"], - ) - - def test_invalid_operation_not_exist(self): - data = {"operations[]": ["1000"]} - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 400) - json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["cancel_missing"], - ) - - @mock.patch("django.utils.timezone.now") - def test_purchase(self, now_mock): - now_mock.return_value = self.now - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[ - { - "type": Operation.PURCHASE, - "article": self.article, - "article_nb": 2, - } - ], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(seconds=15) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - group = OperationGroup.objects.get() - self.assertDictEqual( - group.__dict__, - { - "_state": mock.ANY, - "amount": Decimal("0.00"), - "at": mock.ANY, - "checkout_id": self.checkout.pk, - "comment": "", - "id": mock.ANY, - "is_cof": False, - "on_acc_id": self.account.pk, - "valid_by_id": None, - }, - ) - operation = Operation.objects.get() - self.assertDictEqual( - operation.__dict__, - { - "_state": mock.ANY, - "addcost_amount": None, - "addcost_for_id": None, - "amount": Decimal("-5.00"), - "article_id": self.article.pk, - "article_nb": 2, - "canceled_at": self.now + timedelta(seconds=15), - "canceled_by_id": None, - "group_id": group.pk, - "id": mock.ANY, - "type": Operation.PURCHASE, - }, - ) - - self.assertDictEqual( - json_data, - { - "canceled": [ - { - "id": operation.id, - # l'encodage des dates en JSON est relou... - "canceled_at": mock.ANY, - "canceled_by__trigramme": None, - } - ], - "errors": [], - "warnings": {}, - "opegroups_to_update": [ - { - "id": group.pk, - "amount": str(group.amount), - "is_cof": group.is_cof, - } - ], - }, - ) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("55.00")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 22) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("100.00")) - - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, - { - "type": "kpsul", - "checkouts": [], - "articles": [{"id": self.article.pk, "stock": 22}], - }, - ) - - def test_purchase_with_addcost(self): - # TODO(AD): L'état de la balance du compte destinataire de la majoration ne - # devrait pas empêcher l'annulation d'une opération. - addcost_user = create_user( - "addcost", "ADD", account_attrs={"balance": Decimal("10.00")} - ) - addcost_account = addcost_user.profile.account_kfet - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[ - { - "type": Operation.PURCHASE, - "article": self.article, - "article_nb": 2, - "amount": Decimal("-6.00"), - "addcost_amount": Decimal("1.00"), - "addcost_for": addcost_account, - } - ], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - self._assertResponseOk(resp) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("56.00")) - addcost_account.refresh_from_db() - self.assertEqual(addcost_account.balance, Decimal("9.00")) - - def test_purchase_cash(self): - group = create_operation_group( - on_acc=self.accounts["liq"], - checkout=self.checkout, - content=[ - { - "type": Operation.PURCHASE, - "article": self.article, - "article_nb": 2, - "amount": Decimal("-5.00"), - } - ], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - self._assertResponseOk(resp) - - self.assertEqual(self.accounts["liq"].balance, Decimal("0.00")) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("95.00")) - - ws_data = self.receive_msg() - - self.assertListEqual( - ws_data["checkouts"], - [{"id": self.checkout.pk, "balance": Decimal("95.00")}], - ) - - def test_purchase_cash_with_addcost(self): - # TODO(AD): L'état de la balance du compte destinataire de la majoration ne - # devrait pas empêcher l'annulation d'une opération. - addcost_user = create_user( - "addcost", "ADD", account_attrs={"balance": Decimal("10.00")} - ) - addcost_account = addcost_user.profile.account_kfet - group = create_operation_group( - on_acc=self.accounts["liq"], - checkout=self.checkout, - content=[ - { - "type": Operation.PURCHASE, - "article": self.article, - "article_nb": 2, - "amount": Decimal("-6.00"), - "addcost_amount": Decimal("1.00"), - "addcost_for": addcost_account, - } - ], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - self._assertResponseOk(resp) - - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("94.00")) - addcost_account.refresh_from_db() - self.assertEqual(addcost_account.balance, Decimal("9.00")) - - ws_data = self.receive_msg() - - self.assertListEqual( - ws_data["checkouts"], - [{"id": self.checkout.pk, "balance": Decimal("94.00")}], - ) - - @mock.patch("django.utils.timezone.now") - def test_deposit(self, now_mock): - now_mock.return_value = self.now - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.DEPOSIT, "amount": Decimal("10.75")}], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(seconds=15) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - group = OperationGroup.objects.get() - self.assertDictEqual( - group.__dict__, - { - "_state": mock.ANY, - "amount": Decimal("0.00"), - "at": mock.ANY, - "checkout_id": self.checkout.pk, - "comment": "", - "id": mock.ANY, - "is_cof": False, - "on_acc_id": self.account.pk, - "valid_by_id": None, - }, - ) - operation = Operation.objects.get() - self.assertDictEqual( - operation.__dict__, - { - "_state": mock.ANY, - "addcost_amount": None, - "addcost_for_id": None, - "amount": Decimal("10.75"), - "article_id": None, - "article_nb": None, - "canceled_at": self.now + timedelta(seconds=15), - "canceled_by_id": None, - "group_id": group.pk, - "id": mock.ANY, - "type": Operation.DEPOSIT, - }, - ) - - self.assertDictEqual( - json_data, - { - "canceled": [ - { - "id": operation.id, - # l'encodage des dates en JSON est relou... - "canceled_at": mock.ANY, - "canceled_by__trigramme": None, - } - ], - "errors": [], - "warnings": {}, - "opegroups_to_update": [ - { - "id": group.pk, - "amount": str(group.amount), - "is_cof": group.is_cof, - } - ], - }, - ) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("39.25")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 20) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("89.25")) - - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, - { - "type": "kpsul", - "checkouts": [{"id": self.checkout.pk, "balance": Decimal("89.25")}], - "articles": [], - }, - ) - - @mock.patch("django.utils.timezone.now") - def test_withdraw(self, now_mock): - now_mock.return_value = self.now - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.WITHDRAW, "amount": Decimal("-10.75")}], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(seconds=15) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - group = OperationGroup.objects.get() - self.assertDictEqual( - group.__dict__, - { - "_state": mock.ANY, - "amount": Decimal("0.00"), - "at": mock.ANY, - "checkout_id": self.checkout.pk, - "comment": "", - "id": mock.ANY, - "is_cof": False, - "on_acc_id": self.account.pk, - "valid_by_id": None, - }, - ) - operation = Operation.objects.get() - self.assertDictEqual( - operation.__dict__, - { - "_state": mock.ANY, - "addcost_amount": None, - "addcost_for_id": None, - "amount": Decimal("-10.75"), - "article_id": None, - "article_nb": None, - "canceled_at": self.now + timedelta(seconds=15), - "canceled_by_id": None, - "group_id": group.pk, - "id": mock.ANY, - "type": Operation.WITHDRAW, - }, - ) - - self.assertDictEqual( - json_data, - { - "canceled": [ - { - "id": operation.id, - # l'encodage des dates en JSON est relou... - "canceled_at": mock.ANY, - "canceled_by__trigramme": None, - } - ], - "errors": [], - "warnings": {}, - "opegroups_to_update": [ - { - "id": group.pk, - "amount": str(group.amount), - "is_cof": group.is_cof, - } - ], - }, - ) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("60.75")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 20) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("110.75")) - - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, - { - "type": "kpsul", - "checkouts": [{"id": self.checkout.pk, "balance": Decimal("110.75")}], - "articles": [], - }, - ) - - @mock.patch("django.utils.timezone.now") - def test_edit(self, now_mock): - now_mock.return_value = self.now - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.EDIT, "amount": Decimal("-10.75")}], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(seconds=15) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - group = OperationGroup.objects.get() - self.assertDictEqual( - group.__dict__, - { - "_state": mock.ANY, - "amount": Decimal("0.00"), - "at": mock.ANY, - "checkout_id": self.checkout.pk, - "comment": "", - "id": mock.ANY, - "is_cof": False, - "on_acc_id": self.account.pk, - "valid_by_id": None, - }, - ) - operation = Operation.objects.get() - self.assertDictEqual( - operation.__dict__, - { - "_state": mock.ANY, - "addcost_amount": None, - "addcost_for_id": None, - "amount": Decimal("-10.75"), - "article_id": None, - "article_nb": None, - "canceled_at": self.now + timedelta(seconds=15), - "canceled_by_id": None, - "group_id": group.pk, - "id": mock.ANY, - "type": Operation.EDIT, - }, - ) - - self.assertDictEqual( - json_data, - { - "canceled": [ - { - "id": operation.id, - # l'encodage des dates en JSON est relou... - "canceled_at": mock.ANY, - "canceled_by__trigramme": None, - } - ], - "errors": [], - "warnings": {}, - "opegroups_to_update": [ - { - "id": group.pk, - "amount": str(group.amount), - "is_cof": group.is_cof, - } - ], - }, - ) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("60.75")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 20) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("100.00")) - - ws_data = self.receive_msg() - - self.assertDictEqual( - ws_data, - {"type": "kpsul", "checkouts": [], "articles": []}, - ) - - @mock.patch("django.utils.timezone.now") - def test_old_operations(self, now_mock): - kfet_config.set(cancel_duration=timedelta(minutes=10)) - user_add_perms(self.users["team"], ["kfet.cancel_old_operations"]) - now_mock.return_value = self.now - group = create_operation_group( - at=self.now, - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.WITHDRAW, "amount": Decimal("-10.75")}], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(minutes=10, seconds=1) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - self.assertEqual(len(json_data["canceled"]), 1) - - @mock.patch("django.utils.timezone.now") - def test_invalid_old_operations_requires_perm(self, now_mock): - kfet_config.set(cancel_duration=timedelta(minutes=10)) - now_mock.return_value = self.now - group = create_operation_group( - at=self.now, - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.WITHDRAW, "amount": Decimal("-10.75")}], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(minutes=10, seconds=1) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 403) - json_data = json.loads(resp.content.decode("utf-8")) - self.assertEqual( - json_data["missing_perms"], - ["Annuler des commandes non récentes"], - ) - - def test_already_canceled(self): - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[ - { - "type": Operation.WITHDRAW, - "amount": Decimal("-10.75"), - "canceled_at": timezone.now(), - } - ], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - self.assertDictEqual( - json_data["warnings"], {"already_canceled": [operation.pk]} - ) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("50.00")) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("100.00")) - - @mock.patch("django.utils.timezone.now") - def test_checkout_before_last_statement(self, now_mock): - now_mock.return_value = self.now - group = create_operation_group( - at=self.now, - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.WITHDRAW, "amount": Decimal("-10.75")}], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(seconds=30) - create_checkout_statement(checkout=self.checkout) - now_mock.return_value += timedelta(seconds=30) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - self.assertEqual(len(json_data["canceled"]), 1) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("60.75")) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("100.00")) - - @mock.patch("django.utils.timezone.now") - def test_article_before_last_inventory(self, now_mock): - now_mock.return_value = self.now - group = create_operation_group( - at=self.now, - on_acc=self.account, - checkout=self.checkout, - content=[ - {"type": Operation.PURCHASE, "article": self.article, "article_nb": 2} - ], - ) - operation = group.opes.get() - now_mock.return_value += timedelta(seconds=30) - create_inventory_article(article=self.article) - now_mock.return_value += timedelta(seconds=30) - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - self.assertEqual(len(json_data["canceled"]), 1) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("55.00")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 20) - - def test_negative(self): - kfet_config.set(overdraft_amount=Decimal("40.00")) - user_add_perms(self.users["team"], ["kfet.perform_negative_operations"]) - self.account.balance = Decimal("-20.00") - self.account.save() - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.DEPOSIT, "amount": Decimal("10.75")}], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - self.assertEqual(len(json_data["canceled"]), 1) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("-30.75")) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("89.25")) - - def test_invalid_negative_above_thresholds(self): - kfet_config.set(overdraft_amount=Decimal("5.00")) - user_add_perms(self.users["team"], ["kfet.perform_negative_operations"]) - self.account.balance = Decimal("-20.00") - self.account.save() - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.DEPOSIT, "amount": Decimal("10.75")}], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 400) - json_data = json.loads(resp.content.decode("utf-8")) - self.assertCountEqual( - [e["code"] for e in json_data["errors"]], - ["negative"], - ) - - def test_invalid_negative_requires_perms(self): - kfet_config.set(overdraft_amount=Decimal("40.00")) - self.account.balance = Decimal("-20.00") - self.account.save() - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[{"type": Operation.DEPOSIT, "amount": Decimal("10.75")}], - ) - operation = group.opes.get() - - data = {"operations[]": [str(operation.pk)]} - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 403) - json_data = json.loads(resp.content.decode("utf-8")) - self.assertEqual( - json_data["missing_perms"], - ["Enregistrer des commandes en négatif"], - ) - - def test_partial_0(self): - group = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[ - {"type": Operation.PURCHASE, "article": self.article, "article_nb": 2}, - {"type": Operation.DEPOSIT, "amount": Decimal("10.75")}, - {"type": Operation.EDIT, "amount": Decimal("-6.00")}, - { - "type": Operation.WITHDRAW, - "amount": Decimal("-10.75"), - "canceled_at": timezone.now(), - }, - ], - ) - operation1 = group.opes.get(type=Operation.PURCHASE) - operation2 = group.opes.get(type=Operation.EDIT) - operation3 = group.opes.get(type=Operation.WITHDRAW) - - data = { - "operations[]": [str(operation1.pk), str(operation2.pk), str(operation3.pk)] - } - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - group.refresh_from_db() - self.assertEqual(group.amount, Decimal("10.75")) - self.assertEqual(group.opes.exclude(canceled_at=None).count(), 3) - self.maxDiff = None - self.assertDictEqual( - json_data, - { - "canceled": [ - { - "id": operation1.id, - # l'encodage des dates en JSON est relou... - "canceled_at": mock.ANY, - "canceled_by__trigramme": None, - }, - { - "id": operation2.id, - # l'encodage des dates en JSON est relou... - "canceled_at": mock.ANY, - "canceled_by__trigramme": None, - }, - ], - "errors": [], - "warnings": {"already_canceled": [operation3.pk]}, - "opegroups_to_update": [ - { - "id": group.pk, - "amount": str(group.amount), - "is_cof": group.is_cof, - } - ], - }, - ) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("61.00")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 22) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("100.00")) - - def test_multi_0(self): - group1 = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[ - {"type": Operation.PURCHASE, "article": self.article, "article_nb": 2}, - {"type": Operation.DEPOSIT, "amount": Decimal("10.75")}, - {"type": Operation.EDIT, "amount": Decimal("-6.00")}, - ], - ) - operation11 = group1.opes.get(type=Operation.PURCHASE) - group2 = create_operation_group( - on_acc=self.account, - checkout=self.checkout, - content=[ - {"type": Operation.PURCHASE, "article": self.article, "article_nb": 5}, - {"type": Operation.DEPOSIT, "amount": Decimal("3.00")}, - ], - ) - operation21 = group2.opes.get(type=Operation.PURCHASE) - operation22 = group2.opes.get(type=Operation.DEPOSIT) - - data = { - "operations[]": [ - str(operation11.pk), - str(operation21.pk), - str(operation22.pk), - ] - } - resp = self.client.post(self.url, data) - - json_data = self._assertResponseOk(resp) - - group1.refresh_from_db() - self.assertEqual(group1.amount, Decimal("4.75")) - self.assertEqual(group1.opes.exclude(canceled_at=None).count(), 1) - group2.refresh_from_db() - self.assertEqual(group2.amount, Decimal(0)) - self.assertEqual(group2.opes.exclude(canceled_at=None).count(), 2) - - self.assertEqual(len(json_data["canceled"]), 3) - - self.account.refresh_from_db() - self.assertEqual(self.account.balance, Decimal("64.50")) - self.article.refresh_from_db() - self.assertEqual(self.article.stock, 27) - self.checkout.refresh_from_db() - self.assertEqual(self.checkout.balance, Decimal("97.00")) + def test_ok(self): + pass class KPsulArticlesData(ViewTestCaseMixin, TestCase): @@ -4100,7 +2993,7 @@ class KPsulArticlesData(ViewTestCaseMixin, TestCase): ] for expected, article in zip(expected_list, articles): - self.assertEqual(article, {**article, **expected}) + self.assertDictContainsSubset(expected, article) self.assertSetEqual( set(article.keys()), set( @@ -4112,7 +3005,6 @@ class KPsulArticlesData(ViewTestCaseMixin, TestCase): "category_id", "category__name", "category__has_addcost", - "category__has_reduction", ] ), ) @@ -4163,44 +3055,31 @@ class HistoryJSONViewTests(ViewTestCaseMixin, TestCase): url_name = "kfet.history.json" url_expected = "/k-fet/history.json" - auth_user = "team" - auth_forbidden = [None, "user", "noaccount"] + auth_user = "user" + auth_forbidden = [None] def test_ok(self): r = self.client.post(self.url) self.assertEqual(r.status_code, 200) - def get_users_extra(self): - noaccount = User.objects.create(username="noaccount") - noaccount.set_password("noaccount") - noaccount.save() - return {"noaccount": noaccount} - class AccountReadJSONViewTests(ViewTestCaseMixin, TestCase): url_name = "kfet.account.read.json" + url_expected = "/k-fet/accounts/read.json" - http_methods = ["GET"] + http_methods = ["POST"] auth_user = "team" auth_forbidden = [None, "user"] - @property - def url_kwargs(self): - return {"trigramme": self.accounts["user"].trigramme} - - @property - def url_expected(self): - return "/k-fet/accounts/{}/.json".format(self.accounts["user"].trigramme) - def test_ok(self): - r = self.client.get(self.url) + r = self.client.post(self.url, {"trigramme": "000"}) self.assertEqual(r.status_code, 200) content = json.loads(r.content.decode("utf-8")) expected = {"name": "first last", "trigramme": "000", "balance": "0.00"} - self.assertEqual(content, {**content, **expected}) + self.assertDictContainsSubset(expected, content) self.assertSetEqual( set(content.keys()), @@ -4444,9 +3323,7 @@ class InventoryListViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(r.status_code, 200) inventories = r.context["inventories"] - self.assertQuerysetEqual( - inventories, map(repr, [self.inventory]), transform=repr - ) + self.assertQuerysetEqual(inventories, map(repr, [self.inventory])) class InventoryCreateViewTests(ViewTestCaseMixin, TestCase): @@ -4527,87 +3404,6 @@ class InventoryReadViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(r.status_code, 200) -class InventoryDeleteViewTests(ViewTestCaseMixin, TestCase): - url_name = "kfet.inventory.delete" - - auth_user = "team1" - auth_forbidden = [None, "user", "team"] - - def get_users_extra(self): - return { - "user1": create_user("user1", "001"), - "team1": create_team("team1", "101", perms=["kfet.delete_inventory"]), - } - - @property - def url_kwargs(self): - return {"pk": self.inventory1.pk} - - @property - def url_expected(self): - return "/k-fet/inventaires/{}/delete".format(self.inventory1.pk) - - def setUp(self): - super().setUp() - # Deux inventaires : un avec article 1 + 2, l'autre avec 1 + 3 - self.inventory1 = Inventory.objects.create( - by=self.accounts["team"], at=self.now - ) - self.inventory2 = Inventory.objects.create( - by=self.accounts["team"], at=self.now + timedelta(days=1) - ) - category = ArticleCategory.objects.create(name="Category") - # Le stock des articles correspond à leur dernier inventaire - self.article1 = Article.objects.create( - name="Article1", category=category, stock=51 - ) - self.article2 = Article.objects.create( - name="Article2", category=category, stock=42 - ) - self.article3 = Article.objects.create( - name="Article3", category=category, stock=42 - ) - - InventoryArticle.objects.create( - inventory=self.inventory1, - article=self.article1, - stock_old=23, - stock_new=42, - ) - InventoryArticle.objects.create( - inventory=self.inventory1, - article=self.article2, - stock_old=23, - stock_new=42, - ) - InventoryArticle.objects.create( - inventory=self.inventory2, - article=self.article1, - stock_old=42, - stock_new=51, - ) - InventoryArticle.objects.create( - inventory=self.inventory2, - article=self.article3, - stock_old=23, - stock_new=42, - ) - - def test_ok(self): - r = self.client.post(self.url) - self.assertRedirects(r, reverse("kfet.inventory")) - - # On vérifie que l'inventaire n'existe plus - self.assertFalse(Inventory.objects.filter(pk=self.inventory1.pk).exists()) - # On check les stocks - self.article1.refresh_from_db() - self.article2.refresh_from_db() - self.article3.refresh_from_db() - self.assertEqual(self.article1.stock, 51) - self.assertEqual(self.article2.stock, 23) - self.assertEqual(self.article3.stock, 42) - - class OrderListViewTests(ViewTestCaseMixin, TestCase): url_name = "kfet.order" url_expected = "/k-fet/orders/" @@ -4633,7 +3429,7 @@ class OrderListViewTests(ViewTestCaseMixin, TestCase): self.assertEqual(r.status_code, 200) orders = r.context["orders"] - self.assertQuerysetEqual(orders, map(repr, [self.order]), transform=repr) + self.assertQuerysetEqual(orders, map(repr, [self.order])) class OrderReadViewTests(ViewTestCaseMixin, TestCase): @@ -4848,9 +3644,7 @@ class OrderToInventoryViewTests(ViewTestCaseMixin, TestCase): inventory, {"by": self.accounts["team1"], "at": self.now, "order": self.order}, ) - self.assertQuerysetEqual( - inventory.articles.all(), map(repr, [self.article]), transform=repr - ) + self.assertQuerysetEqual(inventory.articles.all(), map(repr, [self.article])) compte = InventoryArticle.objects.get(article=self.article) diff --git a/kfet/tests/testcases.py b/kfet/tests/testcases.py index a7962f33..36a4ab65 100644 --- a/kfet/tests/testcases.py +++ b/kfet/tests/testcases.py @@ -1,9 +1,9 @@ from unittest import mock from urllib.parse import parse_qs, urlparse +from django.core.urlresolvers import reverse from django.http import QueryDict from django.test import Client -from django.urls import reverse from django.utils import timezone from django.utils.functional import cached_property @@ -39,7 +39,7 @@ class TestCaseMixin: querystring = QueryDict(mutable=True) querystring["next"] = full_path - login_url = "/gestion/login?" + querystring.urlencode(safe="/") + login_url = "/login?" + querystring.urlencode(safe="/") # We don't focus on what the login view does. # So don't fetch the redirect. @@ -79,15 +79,10 @@ class TestCaseMixin: self.assertEqual(response.status_code, 200) try: form = response.context[form_ctx] - errors = [y for x in form.errors.as_data().values() for y in x] - self.assertTrue(any(e.code == "permission-denied" for e in errors)) + self.assertIn("Permission refusée", form.non_field_errors()) except (AssertionError, AttributeError, KeyError): - self.assertTrue( - any( - "permission-denied" in msg.tags - for msg in response.context["messages"] - ) - ) + messages = [str(msg) for msg in response.context["messages"]] + self.assertIn("Permission refusée", messages) except AssertionError: request = response.wsgi_request raise AssertionError( @@ -253,10 +248,7 @@ class ViewTestCaseMixin(TestCaseMixin): self.register_user(label, user) if self.auth_user: - self.client.force_login( - self.users[self.auth_user], - backend="django.contrib.auth.backends.ModelBackend", - ) + self.client.force_login(self.users[self.auth_user]) def tearDown(self): del self.users_base diff --git a/kfet/tests/utils.py b/kfet/tests/utils.py index 79ca1b5e..f1b6933a 100644 --- a/kfet/tests/utils.py +++ b/kfet/tests/utils.py @@ -1,21 +1,7 @@ -from datetime import timedelta -from decimal import Decimal - from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission -from django.utils import timezone -from ..models import ( - Account, - Article, - ArticleCategory, - Checkout, - CheckoutStatement, - Inventory, - InventoryArticle, - Operation, - OperationGroup, -) +from ..models import Account User = get_user_model() @@ -198,180 +184,3 @@ def user_add_perms(user, perms_labels): # it to avoid using of the previous permissions cache. # https://docs.djangoproject.com/en/dev/topics/auth/default/#permission-caching return User.objects.get(pk=user.pk) - - -def create_checkout(**kwargs): - """ - Factory to create a checkout. - See defaults for unpassed arguments in code below. - """ - if "created_by" not in kwargs or "created_by_id" not in kwargs: - try: - team_account = Account.objects.get(cofprofile__user__username="team") - except Account.DoesNotExist: - team_account = create_team().profile.account_kfet - kwargs["created_by"] = team_account - kwargs.setdefault("name", "Checkout") - kwargs.setdefault("valid_from", timezone.now() - timedelta(days=14)) - kwargs.setdefault("valid_to", timezone.now() - timedelta(days=14)) - - return Checkout.objects.create(**kwargs) - - -def create_operation_group(content=None, **kwargs): - """ - Factory to create an OperationGroup and a set of related Operation. - - It aims to get objects for testing purposes with minimal setup, and - preserving consistency. - For this, it uses, and creates if necessary, default objects for unpassed - arguments. - - Args: - content: list of dict - Describe set of Operation to create along the OperationGroup. - Each item is passed to the Operation factory. - kwargs: - Used to control OperationGroup creation. - - """ - if content is None: - content = [] - - # Prepare OperationGroup creation. - - # Set 'checkout' for OperationGroup if unpassed. - if "checkout" not in kwargs and "checkout_id" not in kwargs: - try: - checkout = Checkout.objects.get(name="Checkout") - except Checkout.DoesNotExist: - checkout = create_checkout() - kwargs["checkout"] = checkout - - # Set 'on_acc' for OperationGroup if unpassed. - if "on_acc" not in kwargs and "on_acc_id" not in kwargs: - try: - on_acc = Account.objects.get(cofprofile__user__username="user") - except Account.DoesNotExist: - on_acc = create_user().profile.account_kfet - kwargs["on_acc"] = on_acc - - # Set 'is_cof' for OperationGroup if unpassed. - if "is_cof" not in kwargs: - # Use current is_cof status of 'on_acc'. - kwargs["is_cof"] = kwargs["on_acc"].cofprofile.is_cof - - # Create OperationGroup. - group = OperationGroup.objects.create(**kwargs) - - # We can now create objects referencing this OperationGroup. - - # Process set of related Operation. - if content: - # Create them. - operation_list = [] - for operation_kwargs in content: - operation = create_operation(group=group, **operation_kwargs) - operation_list.append(operation) - - # Update OperationGroup accordingly, for consistency. - for operation in operation_list: - if not operation.canceled_at: - group.amount += operation.amount - group.save() - - return group - - -def create_operation(**kwargs): - """ - Factory to create an Operation for testing purposes. - - If you give a 'group' (OperationGroup), it won't update it, you have do - this "manually". Prefer using OperationGroup factory to get a consistent - group with operations. - - """ - if "group" not in kwargs and "group_id" not in kwargs: - # To get a consistent OperationGroup (amount...) for the operation - # in-creation, prefer using create_operation_group factory with - # 'content'. - kwargs["group"] = create_operation_group() - - if "type" not in kwargs: - raise RuntimeError("Can't create an Operation without 'type'.") - - # Apply defaults for purchase - if kwargs["type"] == Operation.PURCHASE: - if "article" not in kwargs: - raise NotImplementedError( - "One could write a create_article factory. Right now, you must" - "pass an 'article'." - ) - - # Unpassed 'article_nb' defaults to 1. - kwargs.setdefault("article_nb", 1) - - # Unpassed 'amount' will use current article price and quantity. - if "amount" not in kwargs: - if "addcost_for" in kwargs or "addcost_amount" in kwargs: - raise NotImplementedError( - "One could handle the case where 'amount' is missing and " - "addcost applies. Right now, please pass an 'amount'." - ) - kwargs["amount"] = -kwargs["article"].price * kwargs["article_nb"] - - return Operation.objects.create(**kwargs) - - -def create_checkout_statement(**kwargs): - if "checkout" not in kwargs: - kwargs["checkout"] = create_checkout() - if "by" not in kwargs: - try: - team_account = Account.objects.get(cofprofile__user__username="team") - except Account.DoesNotExist: - team_account = create_team().profile.account_kfet - kwargs["by"] = team_account - kwargs.setdefault("balance_new", kwargs["checkout"].balance) - kwargs.setdefault("balance_old", kwargs["checkout"].balance) - kwargs.setdefault("amount_taken", Decimal(0)) - - return CheckoutStatement.objects.create(**kwargs) - - -def create_article(**kwargs): - kwargs.setdefault("name", "Article") - kwargs.setdefault("price", Decimal("2.50")) - kwargs.setdefault("stock", 20) - if "category" not in kwargs: - kwargs["category"] = create_article_category() - - return Article.objects.create(**kwargs) - - -def create_article_category(**kwargs): - kwargs.setdefault("name", "Category") - return ArticleCategory.objects.create(**kwargs) - - -def create_inventory(**kwargs): - if "by" not in kwargs: - try: - team_account = Account.objects.get(cofprofile__user__username="team") - except Account.DoesNotExist: - team_account = create_team().profile.account_kfet - kwargs["by"] = team_account - - return Inventory.objects.create(**kwargs) - - -def create_inventory_article(**kwargs): - if "inventory" not in kwargs: - kwargs["inventory"] = create_inventory() - if "article" not in kwargs: - kwargs["article"] = create_article() - kwargs.setdefault("stock_old", kwargs["article"].stock) - kwargs.setdefault("stock_new", kwargs["article"].stock) - - return InventoryArticle.objects.create(**kwargs) diff --git a/kfet/urls.py b/kfet/urls.py index f33cea03..531e0cc9 100644 --- a/kfet/urls.py +++ b/kfet/urls.py @@ -1,107 +1,95 @@ +from django.conf.urls import include, url from django.contrib.auth.decorators import permission_required -from django.urls import include, path, register_converter -from kfet import converters, views +from kfet import autocomplete, views from kfet.decorators import teamkfet_required -register_converter(converters.TrigrammeConverter, "trigramme") - urlpatterns = [ - path("login/generic", views.login_generic, name="kfet.login.generic"), - path("history", views.history, name="kfet.history"), - path("contact", views.ContactView.as_view(), name="kfet.contact"), - path( - "demande-soiree", views.DemandeSoireeView.as_view(), name="kfet.demande-soiree" - ), + url(r"^login/generic$", views.login_generic, name="kfet.login.generic"), + url(r"^history$", views.history, name="kfet.history"), # ----- # Account urls # ----- # Account - General - path("accounts/", views.account, name="kfet.account"), - path( - "accounts/is_validandfree", + url(r"^accounts/$", views.account, name="kfet.account"), + url( + r"^accounts/is_validandfree$", views.account_is_validandfree_ajax, name="kfet.account.is_validandfree.ajax", ), # Account - Create - path("accounts/new", views.account_create, name="kfet.account.create"), - path( - "accounts/new/user/", + url(r"^accounts/new$", views.account_create, name="kfet.account.create"), + url( + r"^accounts/new/user/(?P.+)$", views.account_create_ajax, name="kfet.account.create.fromuser", ), - path( - "accounts/new/clipper//", + url( + r"^accounts/new/clipper/(?P[\w-]+)/(?P.*)$", views.account_create_ajax, name="kfet.account.create.fromclipper", ), - path( - "accounts/new/empty", + url( + r"^accounts/new/empty$", views.account_create_ajax, name="kfet.account.create.empty", ), - path( - "autocomplete/account_new", - views.AccountCreateAutocompleteView.as_view(), + url( + r"^autocomplete/account_new$", + autocomplete.account_create, name="kfet.account.create.autocomplete", ), # Account - Search - path( - "autocomplete/account_search", - views.AccountSearchAutocompleteView.as_view(), + url( + r"^autocomplete/account_search$", + autocomplete.account_search, name="kfet.account.search.autocomplete", ), # Account - Read - path( - "accounts/", views.account_read, name="kfet.account.read" + url( + r"^accounts/(?P.{3})$", views.account_read, name="kfet.account.read" ), # Account - Update - path( - "accounts//edit", + url( + r"^accounts/(?P.{3})/edit$", views.account_update, name="kfet.account.update", ), - # Account - Delete - path( - "accounts//delete", - views.AccountDelete.as_view(), - name="kfet.account.delete", - ), # Account - Groups - path("accounts/groups", views.account_group, name="kfet.account.group"), - path( - "accounts/groups/new", + url(r"^accounts/groups$", views.account_group, name="kfet.account.group"), + url( + r"^accounts/groups/new$", permission_required("kfet.manage_perms")(views.AccountGroupCreate.as_view()), name="kfet.account.group.create", ), - path( - "accounts/groups//edit", + url( + r"^accounts/groups/(?P\d+)/edit$", permission_required("kfet.manage_perms")(views.AccountGroupUpdate.as_view()), name="kfet.account.group.update", ), - path( - "accounts/negatives", + url( + r"^accounts/negatives$", permission_required("kfet.view_negs")(views.AccountNegativeList.as_view()), name="kfet.account.negative", ), # Account - Statistics - path( - "accounts//stat/operations/list", + url( + r"^accounts/(?P.{3})/stat/operations/list$", views.AccountStatOperationList.as_view(), name="kfet.account.stat.operation.list", ), - path( - "accounts//stat/operations", + url( + r"^accounts/(?P.{3})/stat/operations$", views.AccountStatOperation.as_view(), name="kfet.account.stat.operation", ), - path( - "accounts//stat/balance/list", + url( + r"^accounts/(?P.{3})/stat/balance/list$", views.AccountStatBalanceList.as_view(), name="kfet.account.stat.balance.list", ), - path( - "accounts//stat/balance", + url( + r"^accounts/(?P.{3})/stat/balance$", views.AccountStatBalance.as_view(), name="kfet.account.stat.balance", ), @@ -109,26 +97,26 @@ urlpatterns = [ # Checkout urls # ----- # Checkout - General - path( - "checkouts/", + url( + "^checkouts/$", teamkfet_required(views.CheckoutList.as_view()), name="kfet.checkout", ), # Checkout - Create - path( - "checkouts/new", + url( + "^checkouts/new$", teamkfet_required(views.CheckoutCreate.as_view()), name="kfet.checkout.create", ), # Checkout - Read - path( - "checkouts/", + url( + "^checkouts/(?P\d+)$", teamkfet_required(views.CheckoutRead.as_view()), name="kfet.checkout.read", ), # Checkout - Update - path( - "checkouts//edit", + url( + "^checkouts/(?P\d+)/edit$", teamkfet_required(views.CheckoutUpdate.as_view()), name="kfet.checkout.update", ), @@ -136,20 +124,20 @@ urlpatterns = [ # Checkout Statement urls # ----- # Checkout Statement - General - path( - "checkouts/statements/", + url( + "^checkouts/statements/$", teamkfet_required(views.CheckoutStatementList.as_view()), name="kfet.checkoutstatement", ), # Checkout Statement - Create - path( - "checkouts//statements/add", + url( + "^checkouts/(?P\d+)/statements/add", teamkfet_required(views.CheckoutStatementCreate.as_view()), name="kfet.checkoutstatement.create", ), # Checkout Statement - Update - path( - "checkouts//statements//edit", + url( + "^checkouts/(?P\d+)/statements/(?P\d+)/edit", teamkfet_required(views.CheckoutStatementUpdate.as_view()), name="kfet.checkoutstatement.update", ), @@ -157,147 +145,140 @@ urlpatterns = [ # Article urls # ----- # Category - General - path( - "categories/", + url( + "^categories/$", teamkfet_required(views.CategoryList.as_view()), name="kfet.category", ), # Category - Update - path( - "categories//edit", + url( + "^categories/(?P\d+)/edit$", teamkfet_required(views.CategoryUpdate.as_view()), name="kfet.category.update", ), # Article - General - path( - "articles/", teamkfet_required(views.ArticleList.as_view()), name="kfet.article" + url( + "^articles/$", + teamkfet_required(views.ArticleList.as_view()), + name="kfet.article", ), # Article - Create - path( - "articles/new", + url( + "^articles/new$", teamkfet_required(views.ArticleCreate.as_view()), name="kfet.article.create", ), # Article - Read - path( - "articles/", + url( + "^articles/(?P\d+)$", teamkfet_required(views.ArticleRead.as_view()), name="kfet.article.read", ), # Article - Update - path( - "articles//edit", + url( + "^articles/(?P\d+)/edit$", teamkfet_required(views.ArticleUpdate.as_view()), name="kfet.article.update", ), - # Article - Delete - path( - "articles//delete", - views.ArticleDelete.as_view(), - name="kfet.article.delete", - ), # Article - Statistics - path( - "articles//stat/sales/list", + url( + r"^articles/(?P\d+)/stat/sales/list$", views.ArticleStatSalesList.as_view(), name="kfet.article.stat.sales.list", ), - path( - "articles//stat/sales", + url( + r"^articles/(?P\d+)/stat/sales$", views.ArticleStatSales.as_view(), name="kfet.article.stat.sales", ), # ----- # K-Psul urls # ----- - path("k-psul/", views.kpsul, name="kfet.kpsul"), - path( - "k-psul/checkout_data", + url("^k-psul/$", views.kpsul, name="kfet.kpsul"), + url( + "^k-psul/checkout_data$", views.kpsul_checkout_data, name="kfet.kpsul.checkout_data", ), - path( - "k-psul/perform_operations", + url( + "^k-psul/perform_operations$", views.kpsul_perform_operations, name="kfet.kpsul.perform_operations", ), - path( - "k-psul/cancel_operations", - views.cancel_operations, - name="kfet.operations.cancel", + url( + "^k-psul/cancel_operations$", + views.kpsul_cancel_operations, + name="kfet.kpsul.cancel_operations", ), - path( - "k-psul/articles_data", + url( + "^k-psul/articles_data", views.kpsul_articles_data, name="kfet.kpsul.articles_data", ), - path( - "k-psul/update_addcost", + url( + "^k-psul/update_addcost$", views.kpsul_update_addcost, name="kfet.kpsul.update_addcost", ), - path( - "k-psul/get_settings", views.kpsul_get_settings, name="kfet.kpsul.get_settings" + url( + "^k-psul/get_settings$", + views.kpsul_get_settings, + name="kfet.kpsul.get_settings", ), # ----- # JSON urls # ----- - path("history.json", views.history_json, name="kfet.history.json"), - path( - "accounts//.json", - views.account_read_json, - name="kfet.account.read.json", + url(r"^history.json$", views.history_json, name="kfet.history.json"), + url( + r"^accounts/read.json$", views.account_read_json, name="kfet.account.read.json" ), # ----- # Settings urls # ----- - path("settings/", views.config_list, name="kfet.settings"), - path("settings/edit", views.config_update, name="kfet.settings.update"), + url(r"^settings/$", views.config_list, name="kfet.settings"), + url(r"^settings/edit$", views.config_update, name="kfet.settings.update"), # ----- # Transfers urls # ----- - path("transfers/", views.TransferView.as_view(), name="kfet.transfers"), - path("transfers/new", views.transfers_create, name="kfet.transfers.create"), - path("transfers/perform", views.perform_transfers, name="kfet.transfers.perform"), - path("transfers/cancel", views.cancel_transfers, name="kfet.transfers.cancel"), + url(r"^transfers/$", views.transfers, name="kfet.transfers"), + url(r"^transfers/new$", views.transfers_create, name="kfet.transfers.create"), + url(r"^transfers/perform$", views.perform_transfers, name="kfet.transfers.perform"), + url(r"^transfers/cancel$", views.cancel_transfers, name="kfet.transfers.cancel"), # ----- # Inventories urls # ----- - path( - "inventaires/", + url( + r"^inventaires/$", teamkfet_required(views.InventoryList.as_view()), name="kfet.inventory", ), - path("inventaires/new", views.inventory_create, name="kfet.inventory.create"), - path( - "inventaires/", + url(r"^inventaires/new$", views.inventory_create, name="kfet.inventory.create"), + url( + r"^inventaires/(?P\d+)$", teamkfet_required(views.InventoryRead.as_view()), name="kfet.inventory.read", ), - path( - "inventaires//delete", - views.InventoryDelete.as_view(), - name="kfet.inventory.delete", - ), # ----- # Order urls # ----- - path("orders/", teamkfet_required(views.OrderList.as_view()), name="kfet.order"), - path( - "orders/", + url(r"^orders/$", teamkfet_required(views.OrderList.as_view()), name="kfet.order"), + url( + r"^orders/(?P\d+)$", teamkfet_required(views.OrderRead.as_view()), name="kfet.order.read", ), - path( - "orders/suppliers//edit", + url( + r"^orders/suppliers/(?P\d+)/edit$", teamkfet_required(views.SupplierUpdate.as_view()), name="kfet.order.supplier.update", ), - path( - "orders/suppliers//new-order", views.order_create, name="kfet.order.new" + url( + r"^orders/suppliers/(?P\d+)/new-order$", + views.order_create, + name="kfet.order.new", ), - path( - "orders//to_inventory", + url( + r"^orders/(?P\d+)/to_inventory$", views.order_to_inventory, name="kfet.order.to_inventory", ), @@ -305,5 +286,5 @@ urlpatterns = [ urlpatterns += [ # K-Fêt Open urls - path("open/", include("kfet.open.urls")) + url("^open/", include("kfet.open.urls")) ] diff --git a/kfet/utils.py b/kfet/utils.py index 540f260c..0c4f170a 100644 --- a/kfet/utils.py +++ b/kfet/utils.py @@ -1,7 +1,8 @@ import json import math -from channels.generic.websocket import AsyncJsonWebsocketConsumer +from channels.channel import Group +from channels.generic.websockets import JsonWebsocketConsumer from django.core.cache import cache from django.core.serializers.json import DjangoJSONEncoder @@ -62,7 +63,7 @@ class CachedMixin: # Consumers -class DjangoJsonWebsocketConsumer(AsyncJsonWebsocketConsumer): +class DjangoJsonWebsocketConsumer(JsonWebsocketConsumer): """Custom Json Websocket Consumer. Encode to JSON with DjangoJSONEncoder. @@ -70,10 +71,7 @@ class DjangoJsonWebsocketConsumer(AsyncJsonWebsocketConsumer): """ @classmethod - async def encode_json(cls, content): - # Remove the type value, only used by Channels to choose the group to send to - content.pop("type") - + def encode_json(cls, content): return json.dumps(content, cls=DjangoJSONEncoder) @@ -91,11 +89,31 @@ class PermConsumerMixin: http_user = True # Enable message.user perms_connect = [] - async def connect(self): + def connect(self, message, **kwargs): """Check permissions on connection.""" - self.user = self.scope["user"] - - if self.user.has_perms(self.perms_connect): - await super().connect() + if message.user.has_perms(self.perms_connect): + super().connect(message, **kwargs) else: - await self.close() + self.close() + + def raw_connect(self, message, **kwargs): + # Same as original raw_connect method of JsonWebsocketConsumer + # We add user to connection_groups call. + groups = self.connection_groups(user=message.user, **kwargs) + for group in groups: + Group(group, channel_layer=message.channel_layer).add(message.reply_channel) + self.connect(message, **kwargs) + + def raw_disconnect(self, message, **kwargs): + # Same as original raw_connect method of JsonWebsocketConsumer + # We add user to connection_groups call. + groups = self.connection_groups(user=message.user, **kwargs) + for group in groups: + Group(group, channel_layer=message.channel_layer).discard( + message.reply_channel + ) + self.disconnect(message, **kwargs) + + def connection_groups(self, user, **kwargs): + """`message.user` is available as `user` arg. Original behavior.""" + return super().connection_groups(user=user, **kwargs) diff --git a/kfet/views.py b/kfet/views.py index 83d1a9e2..a2a69930 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1,61 +1,37 @@ +import ast import heapq import statistics from collections import defaultdict -from datetime import datetime, timedelta from decimal import Decimal -from typing import List, Tuple from urllib.parse import urlencode -from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required -from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.auth.models import Permission, User from django.contrib.messages.views import SuccessMessageMixin -from django.core.exceptions import SuspiciousOperation -from django.core.mail import EmailMessage +from django.core.exceptions import PermissionDenied +from django.core.urlresolvers import reverse, reverse_lazy from django.db import transaction -from django.db.models import ( - Count, - DecimalField, - ExpressionWrapper, - F, - Max, - OuterRef, - Prefetch, - Q, - Subquery, - Sum, -) -from django.forms import ValidationError, formset_factory -from django.http import ( - Http404, - HttpResponseBadRequest, - HttpResponseForbidden, - JsonResponse, -) +from django.db.models import Count, F, Prefetch, Sum +from django.forms import formset_factory +from django.http import Http404, JsonResponse from django.shortcuts import get_object_or_404, redirect, render -from django.template import loader -from django.urls import reverse, reverse_lazy from django.utils import timezone from django.utils.decorators import method_decorator from django.views.generic import DetailView, FormView, ListView, TemplateView from django.views.generic.detail import BaseDetailView -from django.views.generic.edit import CreateView, DeleteView, UpdateView +from django.views.generic.edit import CreateView, UpdateView from gestioncof.models import CofProfile -from kfet import KFET_DELETED_TRIGRAMME -from kfet.auth.decorators import kfet_password_auth -from kfet.autocomplete import kfet_account_only_autocomplete, kfet_autocomplete +from kfet import consumers from kfet.config import kfet_config -from kfet.consumers import KPsul from kfet.decorators import teamkfet_required from kfet.forms import ( AccountForm, - AccountFrozenForm, + AccountNegativeForm, AccountNoTriForm, AccountPwdForm, - AccountStatForm, + AccountRestrictForm, AccountTriForm, AddcostForm, ArticleForm, @@ -66,8 +42,7 @@ from kfet.forms import ( CheckoutStatementCreateForm, CheckoutStatementUpdateForm, CofForm, - ContactForm, - DemandeSoireeForm, + CofRestrictForm, FilterHistoryForm, InventoryArticleForm, KFetConfigForm, @@ -77,11 +52,11 @@ from kfet.forms import ( KPsulOperationGroupForm, OrderArticleForm, OrderArticleToInventoryForm, - StatScaleForm, TransferFormSet, UserForm, UserGroupForm, - UserInfoForm, + UserRestrictForm, + UserRestrictTeamForm, ) from kfet.models import ( Account, @@ -101,10 +76,8 @@ from kfet.models import ( Transfer, TransferGroup, ) -from kfet.statistic import SCALE_DICT, DayScale, MonthScale, WeekScale, scale_url_params -from shared.views import AutocompleteView +from kfet.statistic import ScaleMixin, WeekScale, last_stats_manifest -from .auth import KFET_GENERIC_TRIGRAMME from .auth.views import ( # noqa AccountGroupCreate, AccountGroupUpdate, @@ -118,61 +91,6 @@ def put_cleaned_data_in_dict(dict, form): dict[field] = form.cleaned_data[field] -class ContactView(FormView): - template_name = "kfet/contact.html" - form_class = ContactForm - success_url = reverse_lazy("kfet.contact") - - def form_valid(self, form): - # Envoie un mail lorsque le formulaire est valide - EmailMessage( - form.cleaned_data["subject"], - form.cleaned_data["message"], - from_email=form.cleaned_data["from_email"], - to=("chefs-k-fet@ens.psl.eu",), - ).send() - - messages.success( - self.request, - "Votre message a bien été envoyé aux Wo·men K-Fêt.", - ) - - return super().form_valid(form) - - -class DemandeSoireeView(FormView): - template_name = "kfet/demande_soiree.html" - form_class = DemandeSoireeForm - success_url = reverse_lazy("kfet.demande-soiree") - - def form_valid(self, form): - destinataires = ["chefs-k-fet@ens.psl.eu"] - - if form.cleaned_data["contact_boum"]: - destinataires.append("boum@ens.psl.eu") - - if form.cleaned_data["contact_pls"]: - destinataires.append("pls@ens.psl.eu") - - # Envoie un mail lorsque le formulaire est valide - EmailMessage( - f"Demande de soirée le {form.cleaned_data['date']}", - loader.render_to_string( - "kfet/mails/demande_soiree.txt", context=form.cleaned_data - ), - from_email=form.cleaned_data["from_email"], - to=destinataires, - cc=[form.cleaned_data["from_email"]], - ).send() - - messages.success( - self.request, - "Votre demande de soirée a bien été envoyée.", - ) - - return super().form_valid(form) - - # ----- # Account views # ----- @@ -202,8 +120,8 @@ def account_is_validandfree_ajax(request): @login_required @teamkfet_required -@kfet_password_auth def account_create(request): + # Enregistrement if request.method == "POST": trigramme_form = AccountTriForm(request.POST) @@ -230,9 +148,7 @@ def account_create(request): ): # Checking permission if not request.user.has_perm("kfet.add_account"): - messages.error( - request, "Permission refusée", extra_tags="permission-denied" - ) + messages.error(request, "Permission refusée") else: data = {} # Fill data for Account.save() @@ -244,7 +160,6 @@ def account_create(request): account_form = AccountNoTriForm(request.POST, instance=account) account_form.save() messages.success(request, "Compte créé : %s" % account.trigramme) - account.send_creation_email() return redirect("kfet.account.create") except Account.UserHasAccount as e: messages.error( @@ -272,11 +187,7 @@ def account_create(request): def account_form_set_readonly_fields(user_form, cof_form): user_form.fields["username"].widget.attrs["readonly"] = True - user_form.fields["first_name"].widget.attrs["readonly"] = True - user_form.fields["last_name"].widget.attrs["readonly"] = True - user_form.fields["email"].widget.attrs["readonly"] = True cof_form.fields["login_clipper"].widget.attrs["readonly"] = True - cof_form.fields["departement"].widget.attrs["readonly"] = True cof_form.fields["is_cof"].widget.attrs["disabled"] = True @@ -391,7 +302,7 @@ def account_read(request, trigramme): if not account.readable or ( not request.user.has_perm("kfet.is_team") and request.user != account.user ): - raise Http404 + raise PermissionDenied addcosts = ( OperationGroup.objects.filter(opes__addcost_for=account, opes__canceled_at=None) @@ -409,147 +320,165 @@ def account_read(request, trigramme): # Account - Update -@teamkfet_required -@kfet_password_auth +@login_required def account_update(request, trigramme): account = get_object_or_404(Account, trigramme=trigramme) # Checking permissions - if not account.editable: - # Plus de leak de trigramme ! - return HttpResponseForbidden + if not request.user.has_perm("kfet.is_team") and request.user != account.user: + raise PermissionDenied - user_info_form = UserInfoForm(instance=account.user) - account_form = AccountForm(instance=account) - group_form = UserGroupForm(instance=account.user) - frozen_form = AccountFrozenForm(instance=account) - pwd_form = AccountPwdForm() + if request.user.has_perm("kfet.is_team"): + user_form = UserRestrictTeamForm(instance=account.user) + group_form = UserGroupForm(instance=account.user) + account_form = AccountForm(instance=account) + cof_form = CofRestrictForm(instance=account.cofprofile) + pwd_form = AccountPwdForm() + if account.balance < 0 and not hasattr(account, "negative"): + AccountNegative.objects.create(account=account, start=timezone.now()) + account.refresh_from_db() + if hasattr(account, "negative"): + negative_form = AccountNegativeForm(instance=account.negative) + else: + negative_form = None + else: + user_form = UserRestrictForm(instance=account.user) + account_form = AccountRestrictForm(instance=account) + cof_form = None + group_form = None + negative_form = None + pwd_form = None if request.method == "POST": - self_update = request.user == account.user - account_form = AccountForm(request.POST, instance=account) - group_form = UserGroupForm(request.POST, instance=account.user) - frozen_form = AccountFrozenForm(request.POST, instance=account) - pwd_form = AccountPwdForm(request.POST, account=account) + # Update attempt + success = False + missing_perm = True - forms = [] - warnings = [] - - if self_update or request.user.has_perm("kfet.change_account"): - forms.append(account_form) - elif account_form.has_changed(): - warnings.append("compte") - - if request.user.has_perm("kfet.manage_perms"): - forms.append(group_form) - forms.append(frozen_form) - elif group_form.has_changed(): - warnings.append("statut d'équipe") - - # Il ne faut pas valider `pwd_form` si elle est inchangée - if pwd_form.has_changed(): - if self_update or request.user.has_perm("kfet.change_account_password"): - forms.append(pwd_form) - else: - warnings.append("mot de passe") - - # Updating account info - if forms == []: - messages.error( - request, - "Informations non mises à jour : permission refusée", - extra_tags="permission-denied", - ) - else: - if all(form.is_valid() for form in forms): - for form in forms: - form.save() - - if len(warnings): - messages.warning( - request, - "Permissions insuffisantes pour modifier" - " les informations suivantes : {}.".format(", ".join(warnings)), - ) - if self_update: - messages.success(request, "Vos informations ont été mises à jour !") - else: - messages.success( - request, - "Informations du compte %s mises à jour" % account.trigramme, - ) - - return redirect("kfet.account.read", account.trigramme) - else: - messages.error( - request, "Informations non mises à jour : corrigez les erreurs" + if request.user.has_perm("kfet.is_team"): + account_form = AccountForm(request.POST, instance=account) + cof_form = CofRestrictForm(request.POST, instance=account.cofprofile) + user_form = UserRestrictTeamForm(request.POST, instance=account.user) + group_form = UserGroupForm(request.POST, instance=account.user) + pwd_form = AccountPwdForm(request.POST) + if hasattr(account, "negative"): + negative_form = AccountNegativeForm( + request.POST, instance=account.negative ) + if ( + request.user.has_perm("kfet.change_account") + and account_form.is_valid() + and cof_form.is_valid() + and user_form.is_valid() + ): + missing_perm = False + data = {} + # Fill data for Account.save() + put_cleaned_data_in_dict(data, user_form) + put_cleaned_data_in_dict(data, cof_form) + + # Updating + account_form.save(data=data) + + # Checking perm to update password + if ( + request.user.has_perm("kfet.change_account_password") + and pwd_form.is_valid() + ): + pwd = pwd_form.cleaned_data["pwd1"] + account.change_pwd(pwd) + account.save() + messages.success(request, "Mot de passe mis à jour") + + # Checking perm to manage perms + if request.user.has_perm("kfet.manage_perms") and group_form.is_valid(): + group_form.save() + + # Checking perm to manage negative + if hasattr(account, "negative"): + balance_offset_old = 0 + if account.negative.balance_offset: + balance_offset_old = account.negative.balance_offset + if ( + hasattr(account, "negative") + and request.user.has_perm("kfet.change_accountnegative") + and negative_form.is_valid() + ): + balance_offset_new = negative_form.cleaned_data["balance_offset"] + if not balance_offset_new: + balance_offset_new = 0 + balance_offset_diff = balance_offset_new - balance_offset_old + Account.objects.filter(pk=account.pk).update( + balance=F("balance") + balance_offset_diff + ) + negative_form.save() + if ( + Account.objects.get(pk=account.pk).balance >= 0 + and not balance_offset_new + ): + AccountNegative.objects.get(account=account).delete() + + success = True + messages.success( + request, + "Informations du compte %s mises à jour" % account.trigramme, + ) + + # Modification de ses propres informations + if request.user == account.user: + missing_perm = False + account.refresh_from_db() + user_form = UserRestrictForm(request.POST, instance=account.user) + account_form = AccountRestrictForm(request.POST, instance=account) + pwd_form = AccountPwdForm(request.POST) + + if user_form.is_valid() and account_form.is_valid(): + user_form.save() + account_form.save() + success = True + messages.success(request, "Vos informations ont été mises à jour") + + if request.user.has_perm("kfet.is_team") and pwd_form.is_valid(): + pwd = pwd_form.cleaned_data["pwd1"] + account.change_pwd(pwd) + account.save() + messages.success(request, "Votre mot de passe a été mis à jour") + + if missing_perm: + messages.error(request, "Permission refusée") + if success: + return redirect("kfet.account.read", account.trigramme) + else: + messages.error( + request, "Informations non mises à jour. Corrigez les erreurs" + ) + return render( request, "kfet/account_update.html", { - "user_info_form": user_info_form, "account": account, "account_form": account_form, - "frozen_form": frozen_form, + "cof_form": cof_form, + "user_form": user_form, "group_form": group_form, + "negative_form": negative_form, "pwd_form": pwd_form, }, ) -# Account - Delete - - -class AccountDelete(PermissionRequiredMixin, DeleteView): - model = Account - slug_field = "trigramme" - slug_url_kwarg = "trigramme" - success_url = reverse_lazy("kfet.account") - success_message = "Compte supprimé avec succès !" - permission_required = "kfet.delete_account" - - http_method_names = ["post"] - - def delete(self, request, *args, **kwargs): - self.object = self.get_object() - if self.object.balance >= 0.01: - messages.error( - request, - "Impossible de supprimer un compte " - "avec une balance strictement positive !", - ) - return redirect("kfet.account.read", self.object.trigramme) - - if self.object.trigramme in [ - "LIQ", - KFET_GENERIC_TRIGRAMME, - KFET_DELETED_TRIGRAMME, - "#13", - ]: - messages.error(request, "Impossible de supprimer un trigramme protégé !") - return redirect("kfet.account.read", self.object.trigramme) - - # SuccessMessageMixin does not work with DeleteView, see : - # https://code.djangoproject.com/ticket/21926 - messages.success(request, self.success_message) - return super().delete(request, *args, **kwargs) - - class AccountNegativeList(ListView): - queryset = ( - AccountNegative.objects.select_related("account", "account__cofprofile__user") - .filter(account__balance__lt=0) - .exclude(account__trigramme="#13") - ) + queryset = AccountNegative.objects.select_related( + "account", "account__cofprofile__user" + ).exclude(account__trigramme="#13") template_name = "kfet/account_negative.html" context_object_name = "negatives" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - balances = (neg.account.balance for neg in self.object_list) - context["negatives_sum"] = sum(balances) + real_balances = (neg.account.real_balance for neg in self.object_list) + context["negatives_sum"] = sum(real_balances) return context @@ -569,7 +498,6 @@ class CheckoutList(ListView): # Checkout - Create -@method_decorator(kfet_password_auth, name="dispatch") class CheckoutCreate(SuccessMessageMixin, CreateView): model = Checkout template_name = "kfet/checkout_create.html" @@ -580,9 +508,7 @@ class CheckoutCreate(SuccessMessageMixin, CreateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.add_checkout"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Creating @@ -609,7 +535,6 @@ class CheckoutRead(DetailView): # Checkout - Update -@method_decorator(kfet_password_auth, name="dispatch") class CheckoutUpdate(SuccessMessageMixin, UpdateView): model = Checkout template_name = "kfet/checkout_update.html" @@ -620,9 +545,7 @@ class CheckoutUpdate(SuccessMessageMixin, UpdateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.change_checkout"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Updating return super().form_valid(form) @@ -686,7 +609,6 @@ def getAmountBalance(data): ) -@method_decorator(kfet_password_auth, name="dispatch") class CheckoutStatementCreate(SuccessMessageMixin, CreateView): model = CheckoutStatement template_name = "kfet/checkoutstatement_create.html" @@ -712,9 +634,7 @@ class CheckoutStatementCreate(SuccessMessageMixin, CreateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.add_checkoutstatement"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Creating form.instance.amount_taken = getAmountTaken(form.instance) @@ -725,7 +645,6 @@ class CheckoutStatementCreate(SuccessMessageMixin, CreateView): return super().form_valid(form) -@method_decorator(kfet_password_auth, name="dispatch") class CheckoutStatementUpdate(SuccessMessageMixin, UpdateView): model = CheckoutStatement template_name = "kfet/checkoutstatement_update.html" @@ -746,9 +665,7 @@ class CheckoutStatementUpdate(SuccessMessageMixin, UpdateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.change_checkoutstatement"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Updating form.instance.amount_taken = getAmountTaken(form.instance) @@ -768,7 +685,6 @@ class CategoryList(ListView): # Category - Update -@method_decorator(kfet_password_auth, name="dispatch") class CategoryUpdate(SuccessMessageMixin, UpdateView): model = ArticleCategory template_name = "kfet/category_update.html" @@ -780,9 +696,7 @@ class CategoryUpdate(SuccessMessageMixin, UpdateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.change_articlecategory"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Updating @@ -820,7 +734,6 @@ class ArticleList(ListView): # Article - Create -@method_decorator(kfet_password_auth, name="dispatch") class ArticleCreate(SuccessMessageMixin, CreateView): model = Article template_name = "kfet/article_create.html" @@ -831,9 +744,7 @@ class ArticleCreate(SuccessMessageMixin, CreateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.add_article"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Save ici pour save le manytomany suppliers @@ -888,7 +799,6 @@ class ArticleRead(DetailView): # Article - Update -@method_decorator(kfet_password_auth, name="dispatch") class ArticleUpdate(SuccessMessageMixin, UpdateView): model = Article template_name = "kfet/article_update.html" @@ -899,9 +809,7 @@ class ArticleUpdate(SuccessMessageMixin, UpdateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.change_article"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Save ici pour save le manytomany suppliers @@ -929,20 +837,6 @@ class ArticleUpdate(SuccessMessageMixin, UpdateView): return super().form_valid(form) -class ArticleDelete(PermissionRequiredMixin, DeleteView): - model = Article - success_url = reverse_lazy("kfet.article") - success_message = "Article supprimé avec succès !" - permission_required = "kfet.delete_article" - - def get(self, request, *args, **kwargs): - return redirect("kfet.article.read", self.kwargs.get(self.pk_url_kwarg)) - - def delete(self, request, *args, **kwargs): - messages.success(request, self.success_message) - return super().delete(request, *args, **kwargs) - - # ----- # K-Psul # ----- @@ -970,10 +864,9 @@ def kpsul_get_settings(request): @teamkfet_required -def account_read_json(request, trigramme): +def account_read_json(request): + trigramme = request.POST.get("trigramme", "") account = get_object_or_404(Account, trigramme=trigramme) - if not account.readable: - raise Http404 data = { "id": account.pk, "name": account.name, @@ -1032,21 +925,17 @@ def kpsul_checkout_data(request): @teamkfet_required -@kfet_password_auth def kpsul_update_addcost(request): addcost_form = AddcostForm(request.POST) - data = {"errors": []} if not addcost_form.is_valid(): - for field, errors in addcost_form.errors.items(): - for error in errors: - data["errors"].append({"code": f"invalid_{field}", "message": error}) - + data = {"errors": {"addcost": list(addcost_form.errors)}} return JsonResponse(data, status=400) - required_perms = ["kfet.manage_addcosts"] if not request.user.has_perms(required_perms): - data["missing_perms"] = get_missing_perms(required_perms, request.user) + data = { + "errors": {"missing_perms": get_missing_perms(required_perms, request.user)} + } return JsonResponse(data, status=403) trigramme = addcost_form.cleaned_data["trigramme"] @@ -1055,60 +944,37 @@ def kpsul_update_addcost(request): kfet_config.set(addcost_for=account, addcost_amount=amount) - data = { - "addcost": {"for": account and account.trigramme or None, "amount": amount}, - "type": "kpsul", - } - - KPsul.group_send("kfet.kpsul", data) - + data = {"addcost": {"for": account and account.trigramme or None, "amount": amount}} + consumers.KPsul.group_send("kfet.kpsul", data) return JsonResponse(data) -def get_missing_perms(required_perms: List[str], user: User) -> List[str]: - def get_perm_name(app_label: str, codename: str) -> str: - return Permission.objects.values_list("name", flat=True).get( - codename=codename, content_type__app_label=app_label - ) - - missing_perms = [ - get_perm_name(*perm.split(".")) - for perm in required_perms - if not user.has_perm(perm) +def get_missing_perms(required_perms, user): + missing_perms_codenames = [ + (perm.split("."))[1] for perm in required_perms if not user.has_perm(perm) ] - + missing_perms = list( + Permission.objects.filter(codename__in=missing_perms_codenames).values_list( + "name", flat=True + ) + ) return missing_perms @teamkfet_required -@kfet_password_auth def kpsul_perform_operations(request): # Initializing response data - data = {"errors": []} + data = {"operationgroup": 0, "operations": [], "warnings": {}, "errors": {}} # Checking operationgroup operationgroup_form = KPsulOperationGroupForm(request.POST) if not operationgroup_form.is_valid(): - for field in operationgroup_form.errors: - verbose_field, feminin = ( - ("compte", "") if field == "on_acc" else ("caisse", "e") - ) - data["errors"].append( - { - "code": f"invalid_{field}", - "message": f"Pas de {verbose_field} sélectionné{feminin}", - } - ) + data["errors"]["operation_group"] = list(operationgroup_form.errors) # Checking operation_formset operation_formset = KPsulOperationFormSet(request.POST) if not operation_formset.is_valid(): - data["errors"].append( - { - "code": "invalid_formset", - "message": "Formulaire d'opérations vide ou invalide", - } - ) + data["errors"]["operations"] = list(operation_formset.errors) # Returning BAD REQUEST if errors if data["errors"]: @@ -1117,7 +983,6 @@ def kpsul_perform_operations(request): # Pre-saving (no commit) operationgroup = operationgroup_form.save(commit=False) operations = operation_formset.save(commit=False) - on_acc = operationgroup.on_acc # Retrieving COF grant cof_grant = kfet_config.subvention_cof @@ -1131,13 +996,10 @@ def kpsul_perform_operations(request): to_addcost_for_balance = 0 # For balance of addcost_for to_checkout_balance = 0 # For balance of selected checkout to_articles_stocks = defaultdict(lambda: 0) # For stocks articles - is_addcost = all((addcost_for, addcost_amount, addcost_for != on_acc)) - need_comment = on_acc.need_comment - - if on_acc.is_frozen: - data["errors"].append( - {"code": "frozen_acc", "message": f"Le compte {on_acc.trigramme} est gelé"} - ) + is_addcost = all( + (addcost_for, addcost_amount, addcost_for != operationgroup.on_acc) + ) + need_comment = operationgroup.on_acc.need_comment # Filling data of each operations # + operationgroup + calculating other stuffs @@ -1149,23 +1011,16 @@ def kpsul_perform_operations(request): operation.addcost_amount = addcost_amount * operation.article_nb operation.amount -= operation.addcost_amount to_addcost_for_balance += operation.addcost_amount - if on_acc.is_cash: + if operationgroup.on_acc.is_cash: to_checkout_balance += -operation.amount - if on_acc.is_cof and operation.article.category.has_reduction: + if operationgroup.on_acc.is_cof: if is_addcost and operation.article.category.has_addcost: operation.addcost_amount /= cof_grant_divisor operation.amount = operation.amount / cof_grant_divisor to_articles_stocks[operation.article] -= operation.article_nb else: - if on_acc.is_cash: - data["errors"].append( - { - "code": "invalid_liq", - "message": ( - "Impossible de compter autre chose que des achats sur LIQ" - ), - } - ) + if operationgroup.on_acc.is_cash: + data["errors"]["account"] = "LIQ" if operation.type != Operation.EDIT: to_checkout_balance += operation.amount operationgroup.amount += operation.amount @@ -1174,42 +1029,41 @@ def kpsul_perform_operations(request): if operation.type == Operation.EDIT: required_perms.add("kfet.edit_balance_account") need_comment = True - if on_acc.is_cof: + if operationgroup.on_acc.is_cof: to_addcost_for_balance = to_addcost_for_balance / cof_grant_divisor - (perms, stop) = on_acc.perms_to_perform_operation(amount=operationgroup.amount) + (perms, stop) = operationgroup.on_acc.perms_to_perform_operation( + amount=operationgroup.amount + ) required_perms |= perms - if stop: - data["errors"].append( - { - "code": "negative", - "message": f"Le compte {on_acc.trigramme} a un solde insuffisant.", - } - ) - if need_comment: operationgroup.comment = operationgroup.comment.strip() if not operationgroup.comment: - data["need_comment"] = True + data["errors"]["need_comment"] = True - if data["errors"] or "need_comment" in data: + if data["errors"]: return JsonResponse(data, status=400) - if not request.user.has_perms(required_perms): - data["missing_perms"] = get_missing_perms(required_perms, request.user) + if stop or not request.user.has_perms(required_perms): + missing_perms = get_missing_perms(required_perms, request.user) + if missing_perms: + data["errors"]["missing_perms"] = missing_perms + if stop: + data["errors"]["negative"] = [operationgroup.on_acc.trigramme] return JsonResponse(data, status=403) # If 1 perm is required, filling who perform the operations if required_perms: operationgroup.valid_by = request.user.profile.account_kfet # Filling cof status for statistics - operationgroup.is_cof = on_acc.is_cof + operationgroup.is_cof = operationgroup.on_acc.is_cof # Starting transaction to ensure data consistency with transaction.atomic(): # If not cash account, # saving account's balance and adding to Negative if not in + on_acc = operationgroup.on_acc if not on_acc.is_cash: ( Account.objects.filter(pk=on_acc.pk).update( @@ -1233,10 +1087,13 @@ def kpsul_perform_operations(request): # Saving operation group operationgroup.save() + data["operationgroup"] = operationgroup.pk + # Filling operationgroup id for each operations and saving for operation in operations: operation.group = operationgroup operation.save() + data["operations"].append(operation.pk) # Updating articles stock for article in to_articles_stocks: @@ -1245,11 +1102,10 @@ def kpsul_perform_operations(request): ) # Websocket data - websocket_data = {"type": "kpsul"} - websocket_data["groups"] = [ + websocket_data = {} + websocket_data["opegroups"] = [ { "add": True, - "type": "operation", "id": operationgroup.pk, "amount": operationgroup.amount, "checkout__name": operationgroup.checkout.name, @@ -1259,8 +1115,8 @@ def kpsul_perform_operations(request): "valid_by__trigramme": ( operationgroup.valid_by and operationgroup.valid_by.trigramme or None ), - "on_acc__trigramme": on_acc.trigramme, - "entries": [], + "on_acc__trigramme": operationgroup.on_acc.trigramme, + "opes": [], } ] for operation in operations: @@ -1278,7 +1134,7 @@ def kpsul_perform_operations(request): "canceled_by__trigramme": None, "canceled_at": None, } - websocket_data["groups"][0]["entries"].append(ope_data) + websocket_data["opegroups"][0]["opes"].append(ope_data) # Need refresh from db cause we used update on queryset operationgroup.checkout.refresh_from_db() websocket_data["checkouts"] = [ @@ -1292,17 +1148,14 @@ def kpsul_perform_operations(request): websocket_data["articles"].append( {"id": article["id"], "stock": article["stock"]} ) - - KPsul.group_send("kfet.kpsul", websocket_data) - + consumers.KPsul.group_send("kfet.kpsul", websocket_data) return JsonResponse(data) @teamkfet_required -@kfet_password_auth -def cancel_operations(request): +def kpsul_cancel_operations(request): # Pour la réponse - data = {"canceled": [], "warnings": {}, "errors": []} + data = {"canceled": [], "warnings": {}, "errors": {}} # Checking if BAD REQUEST (opes_pk not int or not existing) try: @@ -1311,41 +1164,29 @@ def cancel_operations(request): map(int, filter(None, request.POST.getlist("operations[]", []))) ) except ValueError: - data["errors"].append( - {"code": "invalid_request", "message": "Requête invalide !"} - ) return JsonResponse(data, status=400) - opes_all = Operation.objects.select_related( "group", "group__on_acc", "group__on_acc__negative" ).filter(pk__in=opes_post) opes_pk = [ope.pk for ope in opes_all] opes_notexisting = [ope for ope in opes_post if ope not in opes_pk] if opes_notexisting: - data["errors"].append( - { - "code": "cancel_missing", - "message": "Opérations inexistantes : {}".format( - ", ".join(map(str, opes_notexisting)) - ), - } - ) + data["errors"]["opes_notexisting"] = opes_notexisting return JsonResponse(data, status=400) opes_already_canceled = [] # Déjà annulée opes = [] # Pas déjà annulée required_perms = set() + stop_all = False cancel_duration = kfet_config.cancel_duration - - # Modifs à faire sur les balances des comptes - to_accounts_balances = defaultdict(int) - # ------ sur les montants des groupes d'opé - to_groups_amounts = defaultdict(int) - # ------ sur les balances de caisses - to_checkouts_balances = defaultdict(int) - # ------ sur les stocks d'articles - to_articles_stocks = defaultdict(int) - + to_accounts_balances = defaultdict( + lambda: 0 + ) # Modifs à faire sur les balances des comptes + to_groups_amounts = defaultdict( + lambda: 0 + ) # ------ sur les montants des groupes d'opé + to_checkouts_balances = defaultdict(lambda: 0) # ------ sur les balances de caisses + to_articles_stocks = defaultdict(lambda: 0) # ------ sur les stocks d'articles for ope in opes_all: if ope.canceled_at: # Opération déjà annulée, va pour un warning en Response @@ -1416,22 +1257,16 @@ def cancel_operations(request): amount=to_accounts_balances[account] ) required_perms |= perms + stop_all = stop_all or stop if stop: negative_accounts.append(account.trigramme) - if negative_accounts: - data["errors"].append( - { - "code": "negative", - "message": "Solde insuffisant pour les comptes suivants : {}".format( - ", ".join(negative_accounts) - ), - } - ) - return JsonResponse(data, status=400) - - if not request.user.has_perms(required_perms): - data["missing_perms"] = get_missing_perms(required_perms, request.user) + if stop_all or not request.user.has_perms(required_perms): + missing_perms = get_missing_perms(required_perms, request.user) + if missing_perms: + data["errors"]["missing_perms"] = missing_perms + if stop_all: + data["errors"]["negative"] = negative_accounts return JsonResponse(data, status=403) canceled_by = required_perms and request.user.profile.account_kfet or None @@ -1466,174 +1301,102 @@ def cancel_operations(request): stock=F("stock") + to_articles_stocks[article] ) - # Need refresh from db cause we used update on querysets. - # Sort objects by pk to get deterministic responses. - opegroups_pk = [opegroup.pk for opegroup in to_groups_amounts] - opegroups = ( - OperationGroup.objects.values("id", "amount", "is_cof") - .filter(pk__in=opegroups_pk) - .order_by("pk") - ) - opes = ( - Operation.objects.values("id", "canceled_at", "canceled_by__trigramme") - .filter(pk__in=opes) - .order_by("pk") - ) - checkouts_pk = [checkout.pk for checkout in to_checkouts_balances] - checkouts = ( - Checkout.objects.values("id", "balance") - .filter(pk__in=checkouts_pk) - .order_by("pk") - ) - articles_pk = [article.pk for articles in to_articles_stocks] - articles = Article.objects.values("id", "stock").filter(pk__in=articles_pk) - # Websocket data - websocket_data = {"checkouts": [], "articles": [], "type": "kpsul"} + websocket_data = {"opegroups": [], "opes": [], "checkouts": [], "articles": []} + # Need refresh from db cause we used update on querysets + opegroups_pk = [opegroup.pk for opegroup in to_groups_amounts] + opegroups = OperationGroup.objects.values("id", "amount", "is_cof").filter( + pk__in=opegroups_pk + ) + for opegroup in opegroups: + websocket_data["opegroups"].append( + { + "cancellation": True, + "id": opegroup["id"], + "amount": opegroup["amount"], + "is_cof": opegroup["is_cof"], + } + ) + canceled_by__trigramme = canceled_by and canceled_by.trigramme or None + for ope in opes: + websocket_data["opes"].append( + { + "cancellation": True, + "id": ope, + "canceled_by__trigramme": canceled_by__trigramme, + "canceled_at": canceled_at, + } + ) + # Need refresh from db cause we used update on querysets + checkouts_pk = [checkout.pk for checkout in to_checkouts_balances] + checkouts = Checkout.objects.values("id", "balance").filter(pk__in=checkouts_pk) for checkout in checkouts: websocket_data["checkouts"].append( {"id": checkout["id"], "balance": checkout["balance"]} ) + # Need refresh from db cause we used update on querysets + articles_pk = [article.pk for articles in to_articles_stocks] + articles = Article.objects.values("id", "stock").filter(pk__in=articles_pk) for article in articles: websocket_data["articles"].append( {"id": article["id"], "stock": article["stock"]} ) + consumers.KPsul.group_send("kfet.kpsul", websocket_data) - KPsul.group_send("kfet.kpsul", websocket_data) - - data["canceled"] = list(opes) - data["opegroups_to_update"] = list(opegroups) + data["canceled"] = opes if opes_already_canceled: data["warnings"]["already_canceled"] = opes_already_canceled return JsonResponse(data) -def get_history_limit(user) -> Tuple[datetime, datetime]: - """returns a tuple of 2 dates - - the earliest date the given user can view history of any account - - the earliest date the given user can view history of special accounts - (LIQ and #13)""" - now = timezone.now() - if user.has_perm("kfet.access_old_history"): - return ( - now - settings.KFET_HISTORY_LONG_DATE_LIMIT, - settings.KFET_HISTORY_NO_DATE_LIMIT, - ) - if user.has_perm("kfet.is_team"): - limit = now - settings.KFET_HISTORY_DATE_LIMIT - return limit, limit - # should not happen - future earliest date - future = now + timedelta(days=1) - return future, future - - @login_required def history_json(request): # Récupération des paramètres - form = FilterHistoryForm(request.GET) - - if not form.is_valid(): - return HttpResponseBadRequest() - - start = form.cleaned_data["start"] - end = form.cleaned_data["end"] - account = form.cleaned_data["account"] - checkout = form.cleaned_data["checkout"] - transfers_only = form.cleaned_data["transfers_only"] - opes_only = form.cleaned_data["opes_only"] - - # Construction de la requête (sur les transferts) pour le prefetch - - transfer_queryset_prefetch = Transfer.objects.select_related( - "from_acc", "to_acc", "canceled_by" - ) - - # Le check sur les comptes est dans le prefetch pour les transferts - if account: - transfer_queryset_prefetch = transfer_queryset_prefetch.filter( - Q(from_acc=account) | Q(to_acc=account) - ) - - if not request.user.has_perm("kfet.is_team"): - try: - acc = request.user.profile.account_kfet - transfer_queryset_prefetch = transfer_queryset_prefetch.filter( - Q(from_acc=acc) | Q(to_acc=acc) - ) - except Account.DoesNotExist: - return JsonResponse({}, status=403) - - transfer_prefetch = Prefetch( - "transfers", queryset=transfer_queryset_prefetch, to_attr="filtered_transfers" - ) + from_date = request.POST.get("from", None) + to_date = request.POST.get("to", None) + limit = request.POST.get("limit", None) + checkouts = request.POST.getlist("checkouts[]", None) + accounts = request.POST.getlist("accounts[]", None) # Construction de la requête (sur les opérations) pour le prefetch - ope_queryset_prefetch = Operation.objects.select_related( + queryset_prefetch = Operation.objects.select_related( "article", "canceled_by", "addcost_for" ) - ope_prefetch = Prefetch("opes", queryset=ope_queryset_prefetch) # Construction de la requête principale opegroups = ( - OperationGroup.objects.prefetch_related(ope_prefetch) + OperationGroup.objects.prefetch_related( + Prefetch("opes", queryset=queryset_prefetch) + ) .select_related("on_acc", "valid_by") .order_by("at") ) - transfergroups = ( - TransferGroup.objects.prefetch_related(transfer_prefetch) - .select_related("valid_by") - .order_by("at") - ) - - # limite l'accès à l'historique plus vieux que settings.KFET_HISTORY_DATE_LIMIT - limit_date = True - # Application des filtres - if start: - opegroups = opegroups.filter(at__gte=start) - transfergroups = transfergroups.filter(at__gte=start) - if end: - opegroups = opegroups.filter(at__lt=end) - transfergroups = transfergroups.filter(at__lt=end) - if checkout: - opegroups = opegroups.filter(checkout=checkout) - transfergroups = TransferGroup.objects.none() - if transfers_only: - opegroups = OperationGroup.objects.none() - if opes_only: - transfergroups = TransferGroup.objects.none() - if account: - opegroups = opegroups.filter(on_acc=account) - if account.user == request.user: - limit_date = False # pas de limite de date sur son propre historique + if from_date: + opegroups = opegroups.filter(at__gte=from_date) + if to_date: + opegroups = opegroups.filter(at__lt=to_date) + if checkouts: + opegroups = opegroups.filter(checkout_id__in=checkouts) + if accounts: + opegroups = opegroups.filter(on_acc_id__in=accounts) # Un non-membre de l'équipe n'a que accès à son historique - elif not request.user.has_perm("kfet.is_team"): - # un non membre de la kfet doit avoir le champ account - # pré-rempli, cette requête est douteuse - return JsonResponse({}, status=403) - if limit_date: - # limiter l'accès à l'historique ancien pour confidentialité - earliest_date, earliest_date_no_limit = get_history_limit(request.user) - if ( - account - and account.trigramme in settings.KFET_HISTORY_NO_DATE_LIMIT_TRIGRAMMES - ): - earliest_date = earliest_date_no_limit - opegroups = opegroups.filter(at__gte=earliest_date) - transfergroups = transfergroups.filter(at__gte=earliest_date) + if not request.user.has_perm("kfet.is_team"): + opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet) + if limit: + opegroups = opegroups[:limit] # Construction de la réponse - history_groups = [] + opegroups_list = [] for opegroup in opegroups: opegroup_dict = { - "type": "operation", "id": opegroup.id, "amount": opegroup.amount, "at": opegroup.at, "checkout_id": opegroup.checkout_id, "is_cof": opegroup.is_cof, "comment": opegroup.comment, - "entries": [], + "opes": [], "on_acc__trigramme": opegroup.on_acc and opegroup.on_acc.trigramme or None, } if request.user.has_perm("kfet.is_team"): @@ -1657,40 +1420,9 @@ def history_json(request): ope_dict["canceled_by__trigramme"] = ( ope.canceled_by and ope.canceled_by.trigramme or None ) - opegroup_dict["entries"].append(ope_dict) - history_groups.append(opegroup_dict) - for transfergroup in transfergroups: - if transfergroup.filtered_transfers: - transfergroup_dict = { - "type": "transfer", - "id": transfergroup.id, - "at": transfergroup.at, - "comment": transfergroup.comment, - "entries": [], - } - if request.user.has_perm("kfet.is_team"): - transfergroup_dict["valid_by__trigramme"] = ( - transfergroup.valid_by and transfergroup.valid_by.trigramme or None - ) - - for transfer in transfergroup.filtered_transfers: - transfer_dict = { - "id": transfer.id, - "amount": transfer.amount, - "canceled_at": transfer.canceled_at, - "from_acc": transfer.from_acc.trigramme, - "to_acc": transfer.to_acc.trigramme, - } - if request.user.has_perm("kfet.is_team"): - transfer_dict["canceled_by__trigramme"] = ( - transfer.canceled_by and transfer.canceled_by.trigramme or None - ) - transfergroup_dict["entries"].append(transfer_dict) - history_groups.append(transfergroup_dict) - - history_groups.sort(key=lambda group: group["at"]) - - return JsonResponse({"groups": history_groups}) + opegroup_dict["opes"].append(ope_dict) + opegroups_list.append(opegroup_dict) + return JsonResponse({"opegroups": opegroups_list}) @teamkfet_required @@ -1703,27 +1435,13 @@ def kpsul_articles_data(request): "category_id", "category__name", "category__has_addcost", - "category__has_reduction", ).filter(is_sold=True) return JsonResponse({"articles": list(articles)}) @teamkfet_required def history(request): - # These limits are only useful for JS datepickers - # They don't enforce anything and can be bypassed - # Serious checks are done in history_json - history_limit, history_no_limit = get_history_limit(request.user) - history_no_limit_account_ids = Account.objects.filter( - trigramme__in=settings.KFET_HISTORY_NO_DATE_LIMIT_TRIGRAMMES - ).values_list("id", flat=True) - format_date = lambda date: date.strftime("%Y-%m-%d %H:%M") - data = { - "filter_form": FilterHistoryForm(), - "history_limit": format_date(history_limit), - "history_no_limit_account_ids": history_no_limit_account_ids, - "history_no_limit": format_date(history_no_limit), - } + data = {"filter_form": FilterHistoryForm()} return render(request, "kfet/history.html", data) @@ -1739,7 +1457,6 @@ class SettingsList(TemplateView): config_list = permission_required("kfet.see_config")(SettingsList.as_view()) -@method_decorator(kfet_password_auth, name="dispatch") class SettingsUpdate(SuccessMessageMixin, FormView): form_class = KFetConfigForm template_name = "kfet/settings_update.html" @@ -1749,9 +1466,7 @@ class SettingsUpdate(SuccessMessageMixin, FormView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.change_config"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) form.save() return super().form_valid(form) @@ -1765,9 +1480,18 @@ config_update = permission_required("kfet.change_config")(SettingsUpdate.as_view # ----- -@method_decorator(teamkfet_required, name="dispatch") -class TransferView(TemplateView): - template_name = "kfet/transfers.html" +@teamkfet_required +def transfers(request): + transfers_pre = Prefetch( + "transfers", queryset=(Transfer.objects.select_related("from_acc", "to_acc")) + ) + + transfergroups = ( + TransferGroup.objects.select_related("valid_by") + .prefetch_related(transfers_pre) + .order_by("-at") + ) + return render(request, "kfet/transfers.html", {"transfergroups": transfergroups}) @teamkfet_required @@ -1779,38 +1503,13 @@ def transfers_create(request): @teamkfet_required -@kfet_password_auth def perform_transfers(request): - data = {"errors": []} + data = {"errors": {}, "transfers": [], "transfergroup": 0} # Checking transfer_formset transfer_formset = TransferFormSet(request.POST) - try: - if not transfer_formset.is_valid(): - for form_errors in transfer_formset.errors: - for field, errors in form_errors.items(): - if field == "amount": - for error in errors: - data["errors"].append({"code": "amount", "message": error}) - else: - # C'est compliqué de trouver le compte qui pose problème... - acc_error = True - - if acc_error: - data["errors"].append( - { - "code": "invalid_acc", - "message": "L'un des comptes est invalide ou manquant", - } - ) - - return JsonResponse(data, status=400) - - except ValidationError: - data["errors"].append( - {"code": "invalid_request", "message": "Requête invalide"} - ) - return JsonResponse(data, status=400) + if not transfer_formset.is_valid(): + return JsonResponse({"errors": list(transfer_formset.errors)}, status=400) transfers = transfer_formset.save(commit=False) @@ -1818,51 +1517,31 @@ def perform_transfers(request): required_perms = set( ["kfet.add_transfer"] ) # Required perms to perform all transfers - to_accounts_balances = defaultdict(int) # For balances of accounts + to_accounts_balances = defaultdict(lambda: 0) # For balances of accounts for transfer in transfers: to_accounts_balances[transfer.from_acc] -= transfer.amount to_accounts_balances[transfer.to_acc] += transfer.amount + stop_all = False + negative_accounts = [] # Checking if ok on all accounts - frozen = set() for account in to_accounts_balances: - if account.is_frozen: - frozen.add(account.trigramme) - (perms, stop) = account.perms_to_perform_operation( amount=to_accounts_balances[account] ) required_perms |= perms + stop_all = stop_all or stop if stop: negative_accounts.append(account.trigramme) - if frozen: - data["errors"].append( - { - "code": "frozen", - "message": "Les comptes suivants sont gelés : {}".format( - ", ".join(frozen) - ), - } - ) - - if negative_accounts: - data["errors"].append( - { - "code": "negative", - "message": "Solde insuffisant pour les comptes suivants : {}".format( - ", ".join(negative_accounts) - ), - } - ) - - if data["errors"]: - return JsonResponse(data, status=400) - - if not request.user.has_perms(required_perms): - data["missing_perms"] = get_missing_perms(required_perms, request.user) + if stop_all or not request.user.has_perms(required_perms): + missing_perms = get_missing_perms(required_perms, request.user) + if missing_perms: + data["errors"]["missing_perms"] = missing_perms + if stop_all: + data["errors"]["negative"] = negative_accounts return JsonResponse(data, status=403) # Creating transfer group @@ -1880,24 +1559,34 @@ def perform_transfers(request): balance=F("balance") + to_accounts_balances[account] ) account.refresh_from_db() - account.update_negative() + if account.balance < 0: + if hasattr(account, "negative"): + if not account.negative.start: + account.negative.start = timezone.now() + account.negative.save() + else: + negative = AccountNegative(account=account, start=timezone.now()) + negative.save() + elif hasattr(account, "negative") and not account.negative.balance_offset: + account.negative.delete() # Saving transfer group transfergroup.save() + data["transfergroup"] = transfergroup.pk # Saving all transfers with group for transfer in transfers: transfer.group = transfergroup transfer.save() + data["transfers"].append(transfer.pk) - return JsonResponse({}) + return JsonResponse(data) @teamkfet_required -@kfet_password_auth def cancel_transfers(request): # Pour la réponse - data = {"canceled": [], "warnings": {}, "errors": []} + data = {"canceled": [], "warnings": {}, "errors": {}} # Checking if BAD REQUEST (transfers_pk not int or not existing) try: @@ -1906,11 +1595,7 @@ def cancel_transfers(request): map(int, filter(None, request.POST.getlist("transfers[]", []))) ) except ValueError: - data["errors"].append( - {"code": "invalid_request", "message": "Requête invalide !"} - ) return JsonResponse(data, status=400) - transfers_all = Transfer.objects.select_related( "group", "from_acc", "from_acc__negative", "to_acc", "to_acc__negative" ).filter(pk__in=transfers_post) @@ -1919,23 +1604,17 @@ def cancel_transfers(request): transfer for transfer in transfers_post if transfer not in transfers_pk ] if transfers_notexisting: - data["errors"].append( - { - "code": "cancel_missing", - "message": "Transferts inexistants : {}".format( - ", ".join(map(str, transfers_notexisting)) - ), - } - ) + data["errors"]["transfers_notexisting"] = transfers_notexisting return JsonResponse(data, status=400) - transfers_already_canceled = [] # Déjà annulés - transfers = [] # Pas déjà annulés + transfers_already_canceled = [] # Déjà annulée + transfers = [] # Pas déjà annulée required_perms = set() + stop_all = False cancel_duration = kfet_config.cancel_duration - - # Modifs à faire sur les balances des comptes - to_accounts_balances = defaultdict(int) + to_accounts_balances = defaultdict( + lambda: 0 + ) # Modifs à faire sur les balances des comptes for transfer in transfers_all: if transfer.canceled_at: # Transfert déjà annulé, va pour un warning en Response @@ -1963,22 +1642,16 @@ def cancel_transfers(request): amount=to_accounts_balances[account] ) required_perms |= perms + stop_all = stop_all or stop if stop: negative_accounts.append(account.trigramme) - if negative_accounts: - data["errors"].append( - { - "code": "negative", - "message": "Solde insuffisant pour les comptes suivants : {}".format( - ", ".join(negative_accounts) - ), - } - ) - return JsonResponse(data, status=400) - - if not request.user.has_perms(required_perms): - data["missing_perms"] = get_missing_perms(required_perms, request.user) + if stop_all or not request.user.has_perms(required_perms): + missing_perms = get_missing_perms(required_perms, request.user) + if missing_perms: + data["errors"]["missing_perms"] = missing_perms + if stop_all: + data["errors"]["negative"] = negative_accounts return JsonResponse(data, status=403) canceled_by = required_perms and request.user.profile.account_kfet or None @@ -1996,14 +1669,18 @@ def cancel_transfers(request): balance=F("balance") + to_accounts_balances[account] ) account.refresh_from_db() - account.update_negative() + if account.balance < 0: + if hasattr(account, "negative"): + if not account.negative.start: + account.negative.start = timezone.now() + account.negative.save() + else: + negative = AccountNegative(account=account, start=timezone.now()) + negative.save() + elif hasattr(account, "negative") and not account.negative.balance_offset: + account.negative.delete() - transfers = ( - Transfer.objects.values("id", "canceled_at", "canceled_by__trigramme") - .filter(pk__in=transfers) - .order_by("pk") - ) - data["canceled"] = list(transfers) + data["canceled"] = transfers if transfers_already_canceled: data["warnings"]["already_canceled"] = transfers_already_canceled return JsonResponse(data) @@ -2020,16 +1697,15 @@ class InventoryList(ListView): @teamkfet_required -@kfet_password_auth def inventory_create(request): + articles = Article.objects.select_related("category").order_by( - "-is_sold", "category__name", "name" + "category__name", "name" ) initial = [] for article in articles: initial.append( { - "is_sold": article.is_sold, "article": article.pk, "stock_old": article.stock, "name": article.name, @@ -2045,11 +1721,10 @@ def inventory_create(request): formset = cls_formset(request.POST, initial=initial) if not request.user.has_perm("kfet.add_inventory"): - messages.error( - request, "Permission refusée", extra_tags="permission-denied" - ) + messages.error(request, "Permission refusée") elif formset.is_valid(): with transaction.atomic(): + articles = Article.objects.select_for_update() inventory = Inventory() inventory.by = request.user.profile.account_kfet @@ -2090,63 +1765,15 @@ class InventoryRead(DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - output_field = DecimalField(max_digits=10, decimal_places=2, default=0) - inventory_articles = ( + inventoryarticles = ( InventoryArticle.objects.select_related("article", "article__category") .filter(inventory=self.object) - .annotate( - amount_error=ExpressionWrapper( - F("stock_error") * F("article__price"), output_field=output_field - ) - ) .order_by("article__category__name", "article__name") ) - context["inventoryarts"] = inventory_articles - stats = inventory_articles.aggregate( - new=ExpressionWrapper( - Sum(F("stock_new") * F("article__price")), output_field=output_field - ), - error=Sum("amount_error"), - old=ExpressionWrapper( - Sum(F("stock_old") * F("article__price")), output_field=output_field - ), - ) - context.update( - { - "total_amount_old": stats["old"], - "total_amount_new": stats["new"], - "total_amount_error": stats["error"], - } - ) + context["inventoryarts"] = inventoryarticles return context -class InventoryDelete(PermissionRequiredMixin, DeleteView): - model = Inventory - success_url = reverse_lazy("kfet.inventory") - success_message = "Inventaire annulé avec succès !" - permission_required = "kfet.delete_inventory" - - def get(self, request, *args, **kwargs): - return redirect("kfet.inventory.read", self.kwargs.get(self.pk_url_kwarg)) - - def delete(self, request, *args, **kwargs): - inv = self.get_object() - # On met à jour les articles dont c'est le dernier inventaire - # .get() ne marche pas avec OuterRef, donc on utilise .filter() avec [:1] - update_subquery = InventoryArticle.objects.filter( - inventory=inv, article=OuterRef("pk") - ).values("stock_old")[:1] - - Article.objects.annotate(last_env=Max("inventories__at")).filter( - last_env=inv.at - ).update(stock=Subquery(update_subquery)) - - # On a tout mis à jour, on peut delete (avec un message) - messages.success(request, self.success_message) - return super().delete(request, *args, **kwargs) - - # ----- # Order views # ----- @@ -2164,7 +1791,6 @@ class OrderList(ListView): @teamkfet_required -@kfet_password_auth def order_create(request, pk): supplier = get_object_or_404(Supplier, pk=pk) @@ -2172,7 +1798,7 @@ def order_create(request, pk): Article.objects.filter(suppliers=supplier.pk) .distinct() .select_related("category") - .order_by("-is_sold", "category__name", "name") + .order_by("category__name", "name") ) # Force hit to cache @@ -2229,7 +1855,6 @@ def order_create(request, pk): "v_et": round(v_et), "v_prev": round(v_prev), "c_rec": article.box_capacity and c_rec or round(c_rec_tot), - "is_sold": article.is_sold, } ) @@ -2239,9 +1864,7 @@ def order_create(request, pk): formset = cls_formset(request.POST, initial=initial) if not request.user.has_perm("kfet.add_order"): - messages.error( - request, "Permission refusée", extra_tags="permission-denied" - ) + messages.error(request, "Permission refusée") elif formset.is_valid(): order = Order() order.supplier = supplier @@ -2320,7 +1943,6 @@ class OrderRead(DetailView): @teamkfet_required -@kfet_password_auth def order_to_inventory(request, pk): order = get_object_or_404(Order, pk=pk) @@ -2365,9 +1987,7 @@ def order_to_inventory(request, pk): formset = cls_formset(request.POST, initial=initial) if not request.user.has_perm("kfet.order_to_inventory"): - messages.error( - request, "Permission refusée", extra_tags="permission-denied" - ) + messages.error(request, "Permission refusée") elif formset.is_valid(): with transaction.atomic(): inventory = Inventory.objects.create( @@ -2430,7 +2050,6 @@ def order_to_inventory(request, pk): ) -@method_decorator(kfet_password_auth, name="dispatch") class SupplierUpdate(SuccessMessageMixin, UpdateView): model = Supplier template_name = "kfet/supplier_form.html" @@ -2442,9 +2061,7 @@ class SupplierUpdate(SuccessMessageMixin, UpdateView): def form_valid(self, form): # Checking permission if not self.request.user.has_perm("kfet.change_supplier"): - form.add_error( - None, ValidationError("Permission refusée", code="permission-denied") - ) + form.add_error(None, "Permission refusée") return self.form_invalid(form) # Updating return super().form_valid(form) @@ -2454,12 +2071,11 @@ class SupplierUpdate(SuccessMessageMixin, UpdateView): # Statistics # ========== - # --------------- # Vues génériques # --------------- # source : docs.djangoproject.com/fr/1.10/topics/class-based-views/mixins/ -class JSONResponseMixin: +class JSONResponseMixin(object): """ A mixin that can be used to render a JSON response. """ @@ -2488,39 +2104,34 @@ class JSONDetailView(JSONResponseMixin, BaseDetailView): return self.render_to_json_response(context) +class PkUrlMixin(object): + def get_object(self, *args, **kwargs): + get_by = self.kwargs.get(self.pk_url_kwarg) + return get_object_or_404(self.model, **{self.pk_url_kwarg: get_by}) + + class SingleResumeStat(JSONDetailView): - """ - Génère l'interface de sélection pour les statistiques d'un compte/article. - L'interface est constituée d'une série de boutons, qui récupèrent et graphent - des statistiques du même type, sur le même objet mais avec des arguments différents. + """Manifest for a kind of a stat about an object. - Attributs : - - url_stat : URL où récupérer les statistiques - - stats : liste de dictionnaires avec les clés suivantes : - - label : texte du bouton - - url_params : paramètres GET à rajouter à `url_stat` - - default : si `True`, graphe à montrer par défaut + Returns JSON whose payload is an array containing descriptions of a stat: + url to retrieve data, label, ... - On peut aussi définir `stats` dynamiquement, via la fonction `get_stats`. """ - url_stat = None + id_prefix = "" + nb_default = 0 + stats = [] - - def get_stats(self): - return self.stats + url_stat = None def get_context_data(self, **kwargs): # On n'hérite pas + object_id = self.object.id context = {} stats = [] - # On peut avoir récupéré self.object via pk ou slug - if self.pk_url_kwarg in self.kwargs: + prefix = "{}_{}".format(self.id_prefix, object_id) + for i, stat_def in enumerate(self.stats): url_pk = getattr(self.object, self.pk_url_kwarg) - else: - url_pk = getattr(self.object, self.slug_url_kwarg) - - for stat_def in self.get_stats(): url_params_d = stat_def.get("url_params", {}) if len(url_params_d) > 0: url_params = "?{}".format(urlencode(url_params_d)) @@ -2529,83 +2140,64 @@ class SingleResumeStat(JSONDetailView): stats.append( { "label": stat_def["label"], + "btn": "btn_{}_{}".format(prefix, i), "url": "{url}{params}".format( url=reverse(self.url_stat, args=[url_pk]), params=url_params ), - "default": stat_def.get("default", False), } ) + context["id_prefix"] = prefix + context["content_id"] = "content_%s" % prefix context["stats"] = stats + context["default_stat"] = self.nb_default + context["object_id"] = object_id return context -class UserAccountMixin: - """ - Mixin qui vérifie que le compte traité par la vue est celui de l'utilisateur·ice - actuel·le. Dans le cas contraire, renvoie un Http404. - """ - - def get_object(self, *args, **kwargs): - obj = super().get_object(*args, **kwargs) - if self.request.user != obj.user: - raise Http404 - return obj - - -class ScaleMixin(object): - """Mixin pour utiliser les outils de `kfet.statistic`.""" - - def get_context_data(self, *args, **kwargs): - # On n'hérite pas - form = StatScaleForm(self.request.GET, prefix="scale") - - if not form.is_valid(): - raise SuspiciousOperation( - "Invalid StatScaleForm. Did someone tamper with the GET parameters ?" - ) - - scale_name = form.cleaned_data.pop("name") - scale_cls = SCALE_DICT.get(scale_name) - - self.scale = scale_cls(**form.cleaned_data) - - return {"labels": self.scale.get_labels()} - - # ----------------------- # Evolution Balance perso # ----------------------- +ID_PREFIX_ACC_BALANCE = "balance_acc" -@method_decorator(login_required, name="dispatch") -class AccountStatBalanceList(UserAccountMixin, SingleResumeStat): - """ - Menu général pour l'historique de balance d'un compte - """ +class AccountStatBalanceList(PkUrlMixin, SingleResumeStat): + """Manifest for balance stats of an account.""" model = Account - slug_url_kwarg = "trigramme" - slug_field = "trigramme" + context_object_name = "account" + pk_url_kwarg = "trigramme" url_stat = "kfet.account.stat.balance" + id_prefix = ID_PREFIX_ACC_BALANCE stats = [ {"label": "Tout le temps"}, {"label": "1 an", "url_params": {"last_days": 365}}, {"label": "6 mois", "url_params": {"last_days": 183}}, - {"label": "3 mois", "url_params": {"last_days": 90}, "default": True}, + {"label": "3 mois", "url_params": {"last_days": 90}}, {"label": "30 jours", "url_params": {"last_days": 30}}, ] + nb_default = 0 + + def get_object(self, *args, **kwargs): + obj = super().get_object(*args, **kwargs) + if self.request.user != obj.user: + raise PermissionDenied + return obj + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) -@method_decorator(login_required, name="dispatch") -class AccountStatBalance(UserAccountMixin, JSONDetailView): - """ - Statistiques (JSON) d'historique de balance d'un compte. - Prend en compte les opérations et transferts sur la période donnée. +class AccountStatBalance(PkUrlMixin, JSONDetailView): + """Datasets of balance of an account. + + Operations and Transfers are taken into account. + """ model = Account - slug_url_kwarg = "trigramme" - slug_field = "trigramme" + pk_url_kwarg = "trigramme" + context_object_name = "account" def get_changes_list(self, last_days=None, begin_date=None, end_date=None): account = self.object @@ -2684,14 +2276,15 @@ class AccountStatBalance(UserAccountMixin, JSONDetailView): def get_context_data(self, *args, **kwargs): context = {} - form = AccountStatForm(self.request.GET) + last_days = self.request.GET.get("last_days", None) + if last_days is not None: + last_days = int(last_days) + begin_date = self.request.GET.get("begin_date", None) + end_date = self.request.GET.get("end_date", None) - if not form.is_valid(): - raise SuspiciousOperation( - "Invalid AccountStatForm. Did someone tamper with the GET parameters ?" - ) - - changes = self.get_changes_list(**form.cleaned_data) + changes = self.get_changes_list( + last_days=last_days, begin_date=begin_date, end_date=end_date + ) context["charts"] = [ {"color": "rgb(200, 20, 60)", "label": "Balance", "values": changes} @@ -2703,63 +2296,90 @@ class AccountStatBalance(UserAccountMixin, JSONDetailView): # TODO: offset return context + def get_object(self, *args, **kwargs): + obj = super().get_object(*args, **kwargs) + if self.request.user != obj.user: + raise PermissionDenied + return obj + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + # ------------------------ # Consommation personnelle # ------------------------ +ID_PREFIX_ACC_LAST = "last_acc" +ID_PREFIX_ACC_LAST_DAYS = "last_days_acc" +ID_PREFIX_ACC_LAST_WEEKS = "last_weeks_acc" +ID_PREFIX_ACC_LAST_MONTHS = "last_months_acc" -@method_decorator(login_required, name="dispatch") -class AccountStatOperationList(UserAccountMixin, SingleResumeStat): - """ - Menu général pour l'historique de consommation d'un compte - """ +class AccountStatOperationList(PkUrlMixin, SingleResumeStat): + """Manifest for operations stats of an account.""" model = Account - slug_url_kwarg = "trigramme" - slug_field = "trigramme" + context_object_name = "account" + pk_url_kwarg = "trigramme" + id_prefix = ID_PREFIX_ACC_LAST + nb_default = 2 + stats = last_stats_manifest(types=[Operation.PURCHASE]) url_stat = "kfet.account.stat.operation" - def get_stats(self): - scales_def = [ - ( - "Tout le temps", - MonthScale, - {"last": True, "begin": self.object.created_at.replace(tzinfo=None)}, - False, - ), - ("1 an", MonthScale, {"last": True, "n_steps": 12}, False), - ("3 mois", WeekScale, {"last": True, "n_steps": 13}, True), - ("2 semaines", DayScale, {"last": True, "n_steps": 14}, False), - ] + def get_object(self, *args, **kwargs): + obj = super().get_object(*args, **kwargs) + if self.request.user != obj.user: + raise PermissionDenied + return obj - return scale_url_params(scales_def) + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) -@method_decorator(login_required, name="dispatch") -class AccountStatOperation(UserAccountMixin, ScaleMixin, JSONDetailView): - """ - Statistiques (JSON) de consommation (nb d'items achetés) d'un compte. - """ +class AccountStatOperation(ScaleMixin, PkUrlMixin, JSONDetailView): + """Datasets of operations of an account.""" model = Account - slug_url_kwarg = "trigramme" - slug_field = "trigramme" + pk_url_kwarg = "trigramme" + context_object_name = "account" + id_prefix = "" - def get_context_data(self, *args, **kwargs): - context = super().get_context_data(*args, **kwargs) - - operations = ( - Operation.objects.filter( - type=Operation.PURCHASE, group__on_acc=self.object, canceled_at=None - ) + def get_operations(self, scale, types=None): + # On selectionne les opérations qui correspondent + # à l'article en question et qui ne sont pas annulées + # puis on choisi pour chaques intervalle les opérations + # effectuées dans ces intervalles de temps + all_operations = ( + Operation.objects.filter(group__on_acc=self.object, canceled_at=None) .values("article_nb", "group__at") .order_by("group__at") ) - # On compte les opérations - nb_ventes = self.scale.chunkify_qs( - operations, field="group__at", aggregate=Sum("article_nb") + if types is not None: + all_operations = all_operations.filter(type__in=types) + chunks = scale.get_by_chunks( + all_operations, + field_db="group__at", + field_callback=(lambda d: d["group__at"]), ) + return chunks + + def get_context_data(self, *args, **kwargs): + old_ctx = super().get_context_data(*args, **kwargs) + context = {"labels": old_ctx["labels"]} + scale = self.scale + + types = self.request.GET.get("types", None) + if types is not None: + types = ast.literal_eval(types) + + operations = self.get_operations(types=types, scale=scale) + # On compte les opérations + nb_ventes = [] + for chunk in operations: + ventes = sum(ope["article_nb"] for ope in chunk) + nb_ventes.append(ventes) context["charts"] = [ { @@ -2770,59 +2390,50 @@ class AccountStatOperation(UserAccountMixin, ScaleMixin, JSONDetailView): ] return context + def get_object(self, *args, **kwargs): + obj = super().get_object(*args, **kwargs) + if self.request.user != obj.user: + raise PermissionDenied + return obj + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + # ------------------------ -# Article Statistiques Last +# Article Satistiques Last # ------------------------ +ID_PREFIX_ART_LAST = "last_art" +ID_PREFIX_ART_LAST_DAYS = "last_days_art" +ID_PREFIX_ART_LAST_WEEKS = "last_weeks_art" +ID_PREFIX_ART_LAST_MONTHS = "last_months_art" -@method_decorator(teamkfet_required, name="dispatch") class ArticleStatSalesList(SingleResumeStat): - """ - Menu pour les statistiques de vente d'un article. - """ + """Manifest for sales stats of an article.""" model = Article + context_object_name = "article" + id_prefix = ID_PREFIX_ART_LAST nb_default = 2 url_stat = "kfet.article.stat.sales" + stats = last_stats_manifest() - def get_stats(self): - first_conso = ( - Operation.objects.filter(article=self.object) - .order_by("group__at") - .values_list("group__at", flat=True) - .first() - ) - if first_conso is None: - # On le crée dans le passé au cas où - first_conso = timezone.now() - timedelta(seconds=1) - scales_def = [ - ( - "Tout le temps", - MonthScale, - {"last": True, "begin": first_conso.strftime("%Y-%m-%d %H:%M:%S")}, - False, - ), - ("1 an", MonthScale, {"last": True, "n_steps": 12}, False), - ("3 mois", WeekScale, {"last": True, "n_steps": 13}, True), - ("2 semaines", DayScale, {"last": True, "n_steps": 14}, False), - ] - - return scale_url_params(scales_def) + @method_decorator(teamkfet_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) -@method_decorator(teamkfet_required, name="dispatch") class ArticleStatSales(ScaleMixin, JSONDetailView): - """ - Statistiques (JSON) de vente d'un article. - Sépare LIQ et les comptes K-Fêt, et rajoute le total. - """ + """Datasets of sales of an article.""" model = Article context_object_name = "article" def get_context_data(self, *args, **kwargs): - context = super().get_context_data(*args, **kwargs) + old_ctx = super().get_context_data(*args, **kwargs) + context = {"labels": old_ctx["labels"]} scale = self.scale all_purchases = ( @@ -2832,16 +2443,26 @@ class ArticleStatSales(ScaleMixin, JSONDetailView): .values("group__at", "article_nb") .order_by("group__at") ) - cof_accts = all_purchases.filter(group__on_acc__cofprofile__is_cof=True) - noncof_accts = all_purchases.exclude(group__on_acc__cofprofile__is_cof=True) + liq_only = all_purchases.filter(group__on_acc__trigramme="LIQ") + liq_exclude = all_purchases.exclude(group__on_acc__trigramme="LIQ") - nb_cof = scale.chunkify_qs( - cof_accts, field="group__at", aggregate=Sum("article_nb") + chunks_liq = scale.get_by_chunks( + liq_only, field_db="group__at", field_callback=lambda d: d["group__at"] ) - nb_noncof = scale.chunkify_qs( - noncof_accts, field="group__at", aggregate=Sum("article_nb") + chunks_no_liq = scale.get_by_chunks( + liq_exclude, field_db="group__at", field_callback=lambda d: d["group__at"] ) - nb_ventes = [n1 + n2 for n1, n2 in zip(nb_cof, nb_noncof)] + + # On compte les opérations + nb_ventes = [] + nb_accounts = [] + nb_liq = [] + for chunk_liq, chunk_no_liq in zip(chunks_liq, chunks_no_liq): + sum_accounts = sum(ope["article_nb"] for ope in chunk_no_liq) + sum_liq = sum(ope["article_nb"] for ope in chunk_liq) + nb_ventes.append(sum_accounts + sum_liq) + nb_accounts.append(sum_accounts) + nb_liq.append(sum_liq) context["charts"] = [ { @@ -2849,27 +2470,15 @@ class ArticleStatSales(ScaleMixin, JSONDetailView): "label": "Toutes consommations", "values": nb_ventes, }, - {"color": "rgb(54, 162, 235)", "label": "Comptes K-Fêt", "values": nb_cof}, + {"color": "rgb(54, 162, 235)", "label": "LIQ", "values": nb_liq}, { "color": "rgb(255, 205, 86)", - "label": "LIQ", - "values": nb_noncof, + "label": "Comptes K-Fêt", + "values": nb_accounts, }, ] return context - -# --- -# Autocompletion views -# --- - - -class AccountCreateAutocompleteView(PermissionRequiredMixin, AutocompleteView): - template_name = "kfet/search_results.html" - permission_required = "kfet.is_team" - search_composer = kfet_autocomplete - - -class AccountSearchAutocompleteView(PermissionRequiredMixin, AutocompleteView): - permission_required = "kfet.is_team" - search_composer = kfet_account_only_autocomplete + @method_decorator(teamkfet_required) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) diff --git a/manage.py b/manage.py index 00e46405..094ec16f 100755 --- a/manage.py +++ b/manage.py @@ -3,7 +3,7 @@ import os import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gestioasso.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cof.settings.local") from django.core.management import execute_from_command_line diff --git a/npins/default.nix b/npins/default.nix deleted file mode 100644 index d256a275..00000000 --- a/npins/default.nix +++ /dev/null @@ -1,81 +0,0 @@ -# Generated by npins. Do not modify; will be overwritten regularly -let - data = builtins.fromJSON (builtins.readFile ./sources.json); - version = data.version; - - mkSource = - spec: - assert spec ? type; - let - path = - if spec.type == "Git" then - mkGitSource spec - else if spec.type == "GitRelease" then - mkGitSource spec - else if spec.type == "PyPi" then - mkPyPiSource spec - else if spec.type == "Channel" then - mkChannelSource spec - else - builtins.throw "Unknown source type ${spec.type}"; - in - spec // { outPath = path; }; - - mkGitSource = - { - repository, - revision, - url ? null, - hash, - branch ? null, - ... - }: - assert repository ? type; - # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository - # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else - assert repository.type == "Git"; - let - urlToName = - url: rev: - let - matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url; - - short = builtins.substring 0 7 rev; - - appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; - in - "${if matched == null then "source" else builtins.head matched}${appendShort}"; - name = urlToName repository.url revision; - in - builtins.fetchGit { - url = repository.url; - rev = revision; - inherit name; - allRefs = true; - # hash = hash; - }; - - mkPyPiSource = - { url, hash, ... }: - builtins.fetchurl { - inherit url; - sha256 = hash; - }; - - mkChannelSource = - { url, hash, ... }: - builtins.fetchTarball { - inherit url; - sha256 = hash; - }; -in -if version == 3 then - builtins.mapAttrs (_: mkSource) data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json deleted file mode 100644 index 9ed77931..00000000 --- a/npins/sources.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "pins": { - "kat-pkgs": { - "type": "Git", - "repository": { - "type": "Git", - "url": "https://git.dgnum.eu/lbailly/kat-pkgs.git" - }, - "branch": "master", - "revision": "6b600b716f409c6012b424de006eac3b02148b81", - "url": null, - "hash": "0204f91vxa5qglihpfkf3j5w3k7v98wry861xf2skl024faf9idf" - }, - "nix-pkgs": { - "type": "Git", - "repository": { - "type": "Git", - "url": "https://git.hubrecht.ovh/hubrecht/nix-pkgs" - }, - "branch": "main", - "revision": "ac4ff5a34789ae3398aff9501735b67b6a5a285a", - "url": null, - "hash": "16n37f74p6h30hhid98vab9w5b08xqj4qcshz2kc1jh67z5n49p6" - }, - "nixpkgs": { - "type": "Channel", - "name": "nixos-unstable", - "url": "https://releases.nixos.org/nixos/unstable/nixos-25.05beta719504.a73246e2eef4/nixexprs.tar.xz", - "hash": "1jjmg13jzbqxm5m5ql51n2kq1qggfyb0rhmjwhqhvqxhl350z58a" - } - }, - "version": 3 -} \ No newline at end of file diff --git a/petitscours/__init__.py b/petitscours/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/petitscours/forms.py b/petitscours/forms.py deleted file mode 100644 index 0d9f38bc..00000000 --- a/petitscours/forms.py +++ /dev/null @@ -1,52 +0,0 @@ -from django import forms -from django.contrib.auth.models import User -from django.forms import ModelForm -from django.forms.models import inlineformset_factory -from django.utils.translation import gettext_lazy as _ -from hcaptcha.fields import hCaptchaField - -from petitscours.models import PetitCoursAbility, PetitCoursDemande - - -class hCaptchaFieldWithErrors(hCaptchaField): - """ - Pour l'instant, hCaptchaField ne supporte pas le paramètre `error_messages` lors de - l'initialisation. Du coup, on les redéfinit à la main. - """ - - default_error_messages = { - "required": _("Veuillez vérifier que vous êtes bien humain·e."), - "error_hcaptcha": _("Erreur lors de la vérification."), - "invalid_hcaptcha": _("Échec de la vérification !"), - } - - -class DemandeForm(ModelForm): - captcha = hCaptchaFieldWithErrors() - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.fields["matieres"].help_text = "" - - class Meta: - model = PetitCoursDemande - fields = ( - "name", - "email", - "phone", - "quand", - "freq", - "lieu", - "matieres", - "agrege_requis", - "niveau", - "remarques", - ) - widgets = {"matieres": forms.CheckboxSelectMultiple} - - -MatieresFormSet = inlineformset_factory( - User, - PetitCoursAbility, - fields=("matiere", "niveau", "agrege"), -) diff --git a/petitscours/templates/petitscours/demande_detail.html b/petitscours/templates/petitscours/demande_detail.html deleted file mode 100644 index 8711fcda..00000000 --- a/petitscours/templates/petitscours/demande_detail.html +++ /dev/null @@ -1,50 +0,0 @@ -{% extends "petitscours/base_title.html" %} -{% load static %} - -{% block page_size %}col-sm-8{% endblock %} - -{% block realcontent %} -

    - Demande de petits cours  - - Modifier - -

    - {% include "petitscours/details_demande_infos.html" %} -
    -
    - - {% if demande.traitee %} - - - - - {% endif %} -
    Traitée
    Traitée par {{ demande.traitee_par }}
    Traitée le {{ demande.processed }}
    - Attributions -
      - {% for attrib in attributions %} -
    • {{ attrib.user.get_full_name }} pour {{ attrib.matiere }}, {{ attrib.date|date:"d E Y" }}
    • - {% endfor %} -
    -
    -
    - Retour à la liste des demandes - - {% if demande.traitee %} -
    - -
    - {% else %} -
    - -
    - {% endif %} -
    -{% endblock %} diff --git a/petitscours/templates/petitscours/mails/demandeur.txt b/petitscours/templates/petitscours/mails/demandeur.txt deleted file mode 100644 index 69fed436..00000000 --- a/petitscours/templates/petitscours/mails/demandeur.txt +++ /dev/null @@ -1,17 +0,0 @@ -Bonjour, - -Je vous contacte au sujet de votre annonce passée sur le site du COF pour rentrer en contact avec un élève normalien pour des cours particuliers. Voici les coordonnées d'élèves qui sont motivés par de tels cours et correspondent aux critères que vous nous aviez transmis : - -{% for matiere, proposed in proposals %}¤ {{ matiere }} :{% for user in proposed %} - ¤ {{ user.get_full_name }}{% if user.profile.phone %}, {{ user.profile.phone }}{% endif %}{% if user.email %}, {{ user.email }}{% endif %}{% endfor %} - -{% endfor %}{% if unsatisfied %}Nous n'avons cependant pas pu trouver d'élève disponible pour des cours de {% for matiere in unsatisfied %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}. - -{% endif %}Si pour une raison ou une autre ces numéros ne suffisaient pas, n'hésitez pas à répondre à cet e-mail et je vous en ferai parvenir d'autres sans problème. -{% if extra|length > 0 %} -{{ extra|safe }} -{% endif %} -Cordialement, - --- -Le COF, BdE de l'ENS \ No newline at end of file diff --git a/petitscours/templates/petitscours/mails/eleve.txt b/petitscours/templates/petitscours/mails/eleve.txt deleted file mode 100644 index 5f2d4750..00000000 --- a/petitscours/templates/petitscours/mails/eleve.txt +++ /dev/null @@ -1,28 +0,0 @@ -Salut, - -Le COF a reçu une demande de petit cours qui te correspond. Tu es en haut de la liste d'attente donc on a transmis tes coordonnées, ainsi que celles de 2 autres qui correspondaient aussi (c'est la vie, on donne les numéros 3 par 3 pour que ce soit plus souple). Voici quelques infos sur l'annonce en question : - -¤ Nom : {{ demande.name }} - -¤ Période : {{ demande.quand }} - -¤ Fréquence : {{ demande.freq }} - -¤ Lieu (si préféré) : {{ demande.lieu }} - -{% if matieres|length > 1 %}¤ Matières : -{% for matiere in matieres %} ¤ {{ matiere }} -{% endfor %}{% else %}¤ Matière : {% for matiere in matieres %}{{ matiere }} -{% endfor %}{% endif %} -¤ Niveau : {{ demande.get_niveau_display }} - -¤ Remarques diverses (désolé pour les balises HTML) : {{ demande.remarques }} - -Voilà, cette personne te contactera peut-être sous peu, tu pourras voir les détails directement avec elle (prix, modalités, ...). Pour indication, 30 Euro/h semble être la moyenne. - -Si tu te rends compte qu'en fait tu ne peux pas/plus donner de cours en ce moment, ça serait cool que tu décoches la case "Recevoir des propositions de petits cours" sur GestioCOF. Ensuite dès que tu voudras réapparaître tu pourras recocher la case et tu seras à nouveau sur la liste. - -À bientôt, - --- -Le COF, pour les petits cours \ No newline at end of file diff --git a/petitscours/tests/__init__.py b/petitscours/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/petitscours/tests/test_views.py b/petitscours/tests/test_views.py deleted file mode 100644 index 9367c258..00000000 --- a/petitscours/tests/test_views.py +++ /dev/null @@ -1,326 +0,0 @@ -import json -from unittest import mock - -from django.contrib.auth import get_user_model -from django.test import TestCase -from django.urls import reverse - -from gestioncof.tests.mixins import ViewTestCaseMixin - -from .utils import ( - create_petitcours_ability, - create_petitcours_demande, - create_petitcours_subject, -) - -User = get_user_model() - - -class PetitCoursDemandeListViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-demandes-list" - url_expected = "/gestion/petitcours/demandes" - - auth_user = "staff" - auth_forbidden = [None, "user", "member"] - - def setUp(self): - super().setUp() - self.demande1 = create_petitcours_demande() - self.demande2 = create_petitcours_demande() - self.demande3 = create_petitcours_demande() - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - self.assertEqual(len(resp.context["object_list"]), 3) - - -class PetitCoursDemandeDetailListViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-demande-details" - - auth_user = "staff" - auth_forbidden = [None, "user", "member"] - - @property - def url_kwargs(self): - return {"pk": self.demande.pk} - - @property - def url_expected(self): - return "/gestion/petitcours/demandes/{}".format(self.demande.pk) - - def setUp(self): - super().setUp() - self.demande = create_petitcours_demande() - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - - -class PetitCoursInscriptionViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-inscription" - url_expected = "/gestion/petitcours/inscription" - - http_methods = ["GET", "POST"] - - auth_user = "member" - # Also forbidden for "user". Test below. - auth_forbidden = [None] - - def setUp(self): - super().setUp() - self.user = self.users["member"] - self.cofprofile = self.user.profile - - self.subject1 = create_petitcours_subject(name="Matière 1") - self.subject2 = create_petitcours_subject(name="Matière 2") - - def test_get_forbidden_user_not_cof(self): - self.client.force_login( - self.users["user"], backend="django.contrib.auth.backends.ModelBackend" - ) - resp = self.client.get(self.url) - self.assertRedirects(resp, reverse("cof-denied")) - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - - @property - def base_post_data(self): - return { - "petitcoursability_set-TOTAL_FORMS": "3", - "petitcoursability_set-INITIAL_FORMS": "0", - "petitcoursability_set-MIN_NUM_FORMS": "0", - "petitcoursability_set-MAX_NUM_FORMS": "1000", - "remarques": "", - } - - def test_post(self): - data = dict( - self.base_post_data, - **{ - "petitcoursability_set-TOTAL_FORMS": "2", - "petitcoursability_set-0-id": "", - "petitcoursability_set-0-user": "", - "petitcoursability_set-0-matiere": str(self.subject1.pk), - "petitcoursability_set-0-niveau": "college", - "petitcoursability_set-0-agrege": "1", - # "petitcoursability_set-0-DELETE": "1", - "petitcoursability_set-1-id": "", - "petitcoursability_set-1-user": "", - "petitcoursability_set-1-matiere": str(self.subject2.pk), - "petitcoursability_set-1-niveau": "lycee", - # "petitcoursability_set-1-agrege": "1", - # "petitcoursability_set-1-DELETE": "1", - # "receive_proposals": "1", - "remarques": "Une remarque", - }, - ) - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 200) - self.cofprofile.refresh_from_db() - self.assertEqual(self.cofprofile.petits_cours_accept, False) - self.assertEqual(self.cofprofile.petits_cours_remarques, "Une remarque") - self.assertEqual(self.user.petitcoursability_set.count(), 2) - ability1 = self.user.petitcoursability_set.get(matiere=self.subject1) - self.assertEqual(ability1.niveau, "college") - self.assertTrue(ability1.agrege) - ability2 = self.user.petitcoursability_set.get(matiere=self.subject2) - self.assertEqual(ability2.niveau, "lycee") - self.assertFalse(ability2.agrege) - - def test_post_delete(self): - ability1 = create_petitcours_ability(user=self.user) - ability2 = create_petitcours_ability(user=self.user) - - data = dict( - self.base_post_data, - **{ - "petitcoursability_set-INITIAL_FORMS": "2", - "petitcoursability_set-TOTAL_FORMS": "2", - "petitcoursability_set-0-id": str(ability1.pk), - "petitcoursability_set-0-user": "", - "petitcoursability_set-0-matiere": str(self.subject1.pk), - "petitcoursability_set-0-niveau": "college", - "petitcoursability_set-0-agrege": "1", - "petitcoursability_set-0-DELETE": "1", - "petitcoursability_set-1-id": str(ability2.pk), - "petitcoursability_set-1-user": str(self.user.pk), - "petitcoursability_set-1-matiere": str(self.subject2.pk), - "petitcoursability_set-1-niveau": "lycee", - # "petitcoursability_set-1-agrege": "1", - "petitcoursability_set-1-DELETE": "1", - }, - ) - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 200) - self.assertFalse(self.user.petitcoursability_set.all()) - - -class PetitCoursTraitementViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-demande-traitement" - - http_methods = ["GET", "POST"] - - auth_user = "staff" - auth_forbidden = [None, "user", "member"] - - @property - def url_kwargs(self): - return {"demande_id": self.demande.pk} - - @property - def url_expected(self): - return "/gestion/petitcours/demandes/{}/traitement".format(self.demande.pk) - - def setUp(self): - super().setUp() - self.user = self.users["member"] - self.user.profile.petits_cours_accept = True - self.user.profile.save() - self.subject = create_petitcours_subject() - self.demande = create_petitcours_demande(niveau="college") - self.demande.matieres.add(self.subject) - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - - def test_get_with_match(self): - create_petitcours_ability( - user=self.user, matiere=self.subject, niveau="college" - ) - - resp = self.client.get(self.url) - - self.assertEqual(resp.status_code, 200) - self.assertListEqual( - list(resp.context["proposals"]), [(self.subject, [self.user])] - ) - self.assertEqual( - resp.context["attribdata"], json.dumps([(self.subject.id, [self.user.id])]) - ) - - def test_post_with_match(self): - create_petitcours_ability( - user=self.user, matiere=self.subject, niveau="college" - ) - - data = { - "attribdata": json.dumps([(self.subject.pk, [self.user.pk])]), - "extra": "", - } - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 200) - self.demande.refresh_from_db() - self.assertTrue(self.demande.traitee) - self.assertEqual(self.demande.traitee_par, self.users["staff"]) - self.assertIsNotNone(self.demande.processed) - - -class PetitCoursRetraitementViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-demande-retraitement" - - http_methods = ["GET", "POST"] - - auth_user = "staff" - auth_forbidden = [None, "user", "member"] - - @property - def url_kwargs(self): - return {"demande_id": self.demande.pk} - - @property - def url_expected(self): - return "/gestion/petitcours/demandes/{}/retraitement".format(self.demande.pk) - - def setUp(self): - super().setUp() - self.demande = create_petitcours_demande() - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - - -class PetitCoursDemandeViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-demande" - url_expected = "/gestion/petitcours/demande" - - http_methods = ["GET", "POST"] - - auth_user = None - auth_forbidden = [] - - def setUp(self): - super().setUp() - self.subject1 = create_petitcours_subject() - self.subject2 = create_petitcours_subject() - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - - @mock.patch("hcaptcha.fields.hCaptchaField.clean") - def test_post(self, mock_clean): - data = { - "name": "Le nom", - "email": "lemail@mail.net", - "phone": "0123456789", - "quand": "matin, midi et soir", - "freq": "tous les jours", - "lieu": "partout", - "matieres": [str(self.subject1.pk), str(self.subject2.pk)], - "agrege_requis": "1", - "niveau": "lycee", - "remarques": "no comment", - "h-captcha-response": 1, - } - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 200) - self.assertTrue(resp.context["success"], msg=str(resp.context["form"].errors)) - - -class PetitCoursDemandeRawViewTestCase(ViewTestCaseMixin, TestCase): - url_name = "petits-cours-demande-raw" - url_expected = "/gestion/petitcours/demande-raw" - - http_methods = ["GET", "POST"] - - auth_user = None - auth_forbidden = [] - - def setUp(self): - super().setUp() - self.subject1 = create_petitcours_subject() - self.subject2 = create_petitcours_subject() - - def test_get(self): - resp = self.client.get(self.url) - self.assertEqual(resp.status_code, 200) - - @mock.patch("hcaptcha.fields.hCaptchaField.clean") - def test_post(self, mock_clean): - data = { - "name": "Le nom", - "email": "lemail@mail.net", - "phone": "0123456789", - "quand": "matin, midi et soir", - "freq": "tous les jours", - "lieu": "partout", - "matieres": [str(self.subject1.pk), str(self.subject2.pk)], - "agrege_requis": "1", - "niveau": "lycee", - "remarques": "no comment", - "h-captcha-response": 1, - } - resp = self.client.post(self.url, data) - - self.assertEqual(resp.status_code, 200) - self.assertTrue(resp.context["success"], msg=str(resp.context["form"].errors)) diff --git a/petitscours/tests/utils.py b/petitscours/tests/utils.py deleted file mode 100644 index 131f14dc..00000000 --- a/petitscours/tests/utils.py +++ /dev/null @@ -1,27 +0,0 @@ -from gestioncof.tests.utils import create_user -from petitscours.models import ( - PetitCoursAbility, - PetitCoursAttributionCounter, - PetitCoursDemande, - PetitCoursSubject, -) - - -def create_petitcours_ability(**kwargs): - if "user" not in kwargs: - kwargs["user"] = create_user("toto") - if "matiere" not in kwargs: - kwargs["matiere"] = create_petitcours_subject() - if "niveau" not in kwargs: - kwargs["niveau"] = "college" - ability = PetitCoursAbility.objects.create(**kwargs) - PetitCoursAttributionCounter.get_uptodate(ability.user, ability.matiere) - return ability - - -def create_petitcours_demande(**kwargs): - return PetitCoursDemande.objects.create(**kwargs) - - -def create_petitcours_subject(**kwargs): - return PetitCoursSubject.objects.create(**kwargs) diff --git a/petitscours/urls.py b/petitscours/urls.py deleted file mode 100644 index b4bf1538..00000000 --- a/petitscours/urls.py +++ /dev/null @@ -1,37 +0,0 @@ -from django.urls import path - -from gestioncof.decorators import buro_required -from petitscours import views -from petitscours.views import DemandeDetailView, DemandeListView - -urlpatterns = [ - path("inscription", views.inscription, name="petits-cours-inscription"), - path("demande", views.demande, name="petits-cours-demande"), - path( - "demande-raw", - views.demande, - kwargs={"raw": True}, - name="petits-cours-demande-raw", - ), - path( - "demandes", - buro_required(DemandeListView.as_view()), - name="petits-cours-demandes-list", - ), - path( - "demandes/", - buro_required(DemandeDetailView.as_view()), - name="petits-cours-demande-details", - ), - path( - "demandes//traitement", - views.traitement, - name="petits-cours-demande-traitement", - ), - path( - "demandes//retraitement", - views.traitement, - kwargs={"redo": True}, - name="petits-cours-demande-retraitement", - ), -] diff --git a/provisioning/bootstrap.sh b/provisioning/bootstrap.sh index a298dfae..cb6917a7 100644 --- a/provisioning/bootstrap.sh +++ b/provisioning/bootstrap.sh @@ -1,141 +1,74 @@ #!/bin/sh -# Arête le script quand : -# - une erreur survient -# - on essaie d'utiliser une variable non définie -# - on essaie d'écraser un fichier avec une redirection (>). -set -euC +# Stop if an error is encountered +set -e -# Configuration de la base de données, redis, Django, etc. -# Tous les mots de passe sont constant et en clair dans le fichier car c'est +# Configuration de la base de données. Le mot de passe est constant car c'est # pour une installation de dév locale qui ne sera accessible que depuis la # machine virtuelle. -readonly DBUSER="cof_gestion" -readonly DBNAME="cof_gestion" -readonly DBPASSWD="4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4" -readonly REDIS_PASSWD="dummy" -readonly DJANGO_SETTINGS_MODULE="gestioasso.settings.dev" +DBUSER="cof_gestion" +DBNAME="cof_gestion" +DBPASSWD="4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4" - -# --- -# Installation des paquets systèmes -# --- - -get_packages_list () { - sed 's/#.*$//' /vagrant/provisioning/packages.list | grep -v '^ *$' -} - -# https://github.com/chef/bento/issues/661 -export DEBIAN_FRONTEND=noninteractive - -apt-get update -apt-get -y upgrade -get_packages_list | xargs apt-get install -y - - -# --- -# Configuration de la base de données -# --- +# Installation de paquets utiles +apt-get update && apt-get upgrade -y +apt-get install -y python3-pip python3-dev python3-venv libpq-dev postgresql \ + postgresql-contrib libjpeg-dev nginx git redis-server # Postgresql -pg_user_exists () { - sudo -u postgres psql postgres -tAc \ - "SELECT 1 FROM pg_roles WHERE rolname='$1'" \ - | grep -q '^1$' -} - -pg_db_exists () { - sudo -u postgres psql postgres -tAc \ - "SELECT 1 FROM pg_database WHERE datname='$1'" \ - | grep -q '^1$' -} - -pg_db_exists "$DBNAME" || sudo -u postgres createdb "$DBNAME" -pg_user_exists "$DBUSER" || sudo -u postgres createuser -SdR "$DBUSER" +sudo -u postgres createdb $DBNAME +sudo -u postgres createuser -SdR $DBUSER sudo -u postgres psql -c "ALTER USER $DBUSER WITH PASSWORD '$DBPASSWD';" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DBNAME TO $DBUSER;" -# --- -# Configuration de redis (pour django-channels) -# --- - # Redis -redis-cli CONFIG SET requirepass "$REDIS_PASSWD" -redis-cli -a "$REDIS_PASSWD" CONFIG REWRITE +REDIS_PASSWD="dummy" +redis-cli CONFIG SET requirepass $REDIS_PASSWD +redis-cli -a $REDIS_PASSWD CONFIG REWRITE - -# --- -# Préparation de Django -# --- - -# Dossiers pour le contenu statique +# Contenu statique mkdir -p /srv/gestiocof/media mkdir -p /srv/gestiocof/static -chown -R vagrant:www-data /srv/gestiocof +chown -R ubuntu:www-data /srv/gestiocof + +# Nginx +ln -s -f /vagrant/provisioning/nginx.conf /etc/nginx/sites-enabled/gestiocof.conf +rm -f /etc/nginx/sites-enabled/default +systemctl reload nginx # Environnement virtuel python -sudo -H -u vagrant python3 -m venv ~vagrant/venv -sudo -H -u vagrant ~vagrant/venv/bin/pip install -U pip -sudo -H -u vagrant ~vagrant/venv/bin/pip install \ - -r /vagrant/requirements-prod.txt \ - -r /vagrant/requirements-devel.txt \ +sudo -H -u ubuntu python3 -m venv ~ubuntu/venv +sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -U pip +sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -r /vagrant/requirements-devel.txt # Préparation de Django cd /vagrant -ln -s -f secret_example.py gestioasso/settings/secret.py -sudo -H -u vagrant \ - DJANGO_SETTINGS_MODULE="$DJANGO_SETTINGS_MODULE"\ - /bin/sh -c ". ~vagrant/venv/bin/activate && /bin/sh provisioning/prepare_django.sh" -~vagrant/venv/bin/python manage.py collectstatic \ - --noinput \ - --settings "$DJANGO_SETTINGS_MODULE" +ln -s -f secret_example.py cof/settings/secret.py +sudo -H -u ubuntu \ + DJANGO_SETTINGS_MODULE='cof.settings.dev' \ + bash -c ". ~/venv/bin/activate && bash provisioning/prepare_django.sh" +/home/ubuntu/venv/bin/python manage.py collectstatic --noinput --settings cof.settings.dev +# Installation du cron pour les mails de rappels +sudo -H -u ubuntu crontab provisioning/cron.dev -# --- -# Units systemd -# --- +# Daphne + runworker +cp /vagrant/provisioning/daphne.service /etc/systemd/system/daphne.service +cp /vagrant/provisioning/worker.service /etc/systemd/system/worker.service +systemctl enable daphne.service +systemctl enable worker.service +systemctl start daphne.service +systemctl start worker.service -# - Daphne fait tourner le serveur asgi -# - worker = https://channels.readthedocs.io/en/stable/topics/worker.html -# - Mails de rappels du BdA -# - Mails de revente du BdA -ln -sf /vagrant/provisioning/systemd/daphne.service /etc/systemd/system/daphne.service -ln -sf /vagrant/provisioning/systemd/worker.service /etc/systemd/system/worker.service -ln -sf /vagrant/provisioning/systemd/reventes.service /etc/systemd/system/reventes.service -ln -sf /vagrant/provisioning/systemd/rappels.service /etc/systemd/system/rappels.service -ln -sf /vagrant/provisioning/systemd/reventes.timer /etc/systemd/system/reventes.timer -ln -sf /vagrant/provisioning/systemd/rappels.timer /etc/systemd/system/rappels.timer -systemctl enable --now daphne.service -systemctl enable --now worker.service -systemctl enable rappels.timer -systemctl enable reventes.timer - - -# --- -# Configuration du shell de l'utilisateur 'vagrant' pour utiliser le bon fichier -# de settings et et bon virtualenv. -# --- - -# On utilise .bash_aliases au lieu de .bashrc pour ne pas écraser la -# configuration par défaut. -rm -f ~vagrant/.bash_aliases -cat > ~vagrant/.bash_aliases <> ~ubuntu/.bashrc <> /vagrant/rappels.log ; /ubuntu/home/venv/bin/python /vagrant/manage.py sendrappels >> /vagrant/rappels.log 2>&1 +*/5 * * * * /ubuntu/home/venv/bin/python /vagrant/manage.py manage_revente >> /vagrant/reventes.log 2>&1 diff --git a/provisioning/daphne.service b/provisioning/daphne.service new file mode 100644 index 00000000..41327ce5 --- /dev/null +++ b/provisioning/daphne.service @@ -0,0 +1,16 @@ +Description="GestioCOF" +After=syslog.target +After=network.target + +[Service] +Type=simple +User=ubuntu +Group=ubuntu +TimeoutSec=300 +WorkingDirectory=/vagrant +Environment="DJANGO_SETTINGS_MODULE=cof.settings.dev" +ExecStart=/home/ubuntu/venv/bin/daphne -u /srv/gestiocof/gestiocof.sock \ + cof.asgi:channel_layer + +[Install] +WantedBy=multi-user.target diff --git a/provisioning/nginx.conf b/provisioning/nginx.conf new file mode 100644 index 00000000..015e1712 --- /dev/null +++ b/provisioning/nginx.conf @@ -0,0 +1,56 @@ +upstream gestiocof { + # Daphne listens on a unix socket + server unix:/srv/gestiocof/gestiocof.sock; +} + +server { + listen 80; + + server_name localhost; + root /srv/gestiocof/; + + # / → /gestion/ + # /gestion → /gestion/ + rewrite ^/$ /gestion/; + rewrite ^/gestion$ /gestion/; + + # Static files + location /static/ { + access_log off; + add_header Cache-Control "public"; + expires 7d; + } + + # Uploaded media + location /media/ { + access_log off; + add_header Cache-Control "public"; + expires 7d; + } + + location /gestion/ { + # A copy-paste of what we have in production + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-SSL-Client-Serial $ssl_client_serial; + proxy_set_header X-SSL-Client-Verify $ssl_client_verify; + proxy_set_header X-SSL-Client-S-DN $ssl_client_s_dn; + proxy_set_header Daphne-Root-Path /gestion; + + location /gestion/ws/ { + # See http://nginx.org/en/docs/http/websocket.html + proxy_buffering off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + proxy_pass http://gestiocof/ws/; + } + + location /gestion/ { + proxy_pass http://gestiocof; + } + } +} diff --git a/provisioning/nginx/gestiocof.conf b/provisioning/nginx/gestiocof.conf deleted file mode 100644 index 7d7567c6..00000000 --- a/provisioning/nginx/gestiocof.conf +++ /dev/null @@ -1,42 +0,0 @@ -upstream gestiocof { - # Daphne listens on a unix socket - server unix:/srv/gestiocof/gestiocof.sock; -} - -server { - listen 80; - listen [::]:80; - - server_name _; - root /srv/gestiocof/; - - # Redirection: - rewrite ^/$ http://localhost:8080/gestion/ redirect; - rewrite ^/gestion$ http://localhost:8080/gestion/ redirect; - - # Les pages statiques sont servies à part. - location /static { try_files $uri $uri/ =404; } - location /media { try_files $uri $uri/ =404; } - - # On proxy-pass les requêtes vers les pages dynamiques à daphne - location / { - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-SSL-Client-Serial $ssl_client_serial; - proxy_set_header X-SSL-Client-Verify $ssl_client_verify; - proxy_set_header X-SSL-Client-S-DN $ssl_client_s_dn; - proxy_pass http://gestiocof; - } - - # Pour les websockets : - # See http://nginx.org/en/docs/http/websocket.html. - location /ws/ { - proxy_buffering off; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_pass http://gestiocof/ws/; - } -} diff --git a/provisioning/packages.list b/provisioning/packages.list deleted file mode 100644 index 34714442..00000000 --- a/provisioning/packages.list +++ /dev/null @@ -1,25 +0,0 @@ -# Python -python3-pip -python3-dev -python3-venv - -# Pour installer authens depuis git.eleves -git - -# Postgres -libpq-dev -postgresql -postgresql-contrib - -# Pour Pillow -libjpeg-dev - -# Outils de prod -nginx # Test -redis-server - -# Le LDAP -libldap2-dev -libsasl2-dev -slapd -ldap-utils diff --git a/provisioning/prepare_django.sh b/provisioning/prepare_django.sh index 87cc70b3..891108e8 100644 --- a/provisioning/prepare_django.sh +++ b/provisioning/prepare_django.sh @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash -set -euC +# Stop if an error is encountered. +set -e -python manage.py migrate --noinput -python manage.py sync_page_translation_fields -python manage.py update_translation_fields +python manage.py migrate python manage.py loaddata gestion sites articles python manage.py loaddevdata +python manage.py syncmails diff --git a/provisioning/systemd/daphne.service b/provisioning/systemd/daphne.service deleted file mode 100644 index bae9f3ca..00000000 --- a/provisioning/systemd/daphne.service +++ /dev/null @@ -1,17 +0,0 @@ -Description="GestioCOF - Daphne" -After=syslog.target -After=network.target - -[Service] -Type=simple -User=vagrant -Group=vagrant -TimeoutSec=300 -WorkingDirectory=/vagrant -Environment="DJANGO_SETTINGS_MODULE=gestioasso.settings.dev" -ExecStart=/home/vagrant/venv/bin/daphne \ - -u /srv/gestiocof/gestiocof.sock \ - gestioasso.asgi:application - -[Install] -WantedBy=multi-user.target diff --git a/provisioning/systemd/rappels.service b/provisioning/systemd/rappels.service deleted file mode 100644 index 0a4986f9..00000000 --- a/provisioning/systemd/rappels.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Envoi des mails de rappel des spectales BdA - -[Service] -Type=oneshot -User=vagrant -Environment="DJANGO_SETTINGS_MODULE=gestioasso.settings.dev" -ExecStart=/home/vagrant/venv/bin/python /vagrant/manage.py sendrappels diff --git a/provisioning/systemd/rappels.timer b/provisioning/systemd/rappels.timer deleted file mode 100644 index f05c54e0..00000000 --- a/provisioning/systemd/rappels.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Envoi des mails de rappel des spectales BdA - -[Timer] -OnBootSec=10min -OnUnitActiveSec=3h - -[Install] -WantedBy=timers.target diff --git a/provisioning/systemd/reventes.service b/provisioning/systemd/reventes.service deleted file mode 100644 index 266c0646..00000000 --- a/provisioning/systemd/reventes.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Envoi des mails de BdA-Revente - -[Service] -Type=oneshot -User=vagrant -Environment="DJANGO_SETTINGS_MODULE=gestioasso.settings.dev" -ExecStart=/home/vagrant/venv/bin/python /vagrant/manage.py manage_reventes diff --git a/provisioning/systemd/reventes.timer b/provisioning/systemd/reventes.timer deleted file mode 100644 index 2ccaf7bf..00000000 --- a/provisioning/systemd/reventes.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Envoi des mails de BdA-Revente - -[Timer] -OnBootSec=15min -OnUnitActiveSec=15min - -[Install] -WantedBy=timers.target diff --git a/provisioning/systemd/worker.service b/provisioning/systemd/worker.service deleted file mode 100644 index 0d97e9a4..00000000 --- a/provisioning/systemd/worker.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description="GestioCOF" -After=syslog.target -After=network.target - -[Service] -Type=simple -User=vagrant -Group=vagrant -TimeoutSec=300 -WorkingDirectory=/vagrant -Environment="DJANGO_SETTINGS_MODULE=gestioasso.settings.dev" -ExecStart=/home/vagrant/venv/bin/python manage.py runworker \ - 'kfet.open.team' \ - 'kfet.open.base' \ - 'kpsul' - -[Install] -WantedBy=multi-user.target diff --git a/provisioning/worker.service b/provisioning/worker.service new file mode 100644 index 00000000..42836cfe --- /dev/null +++ b/provisioning/worker.service @@ -0,0 +1,16 @@ +[Unit] +Description="GestioCOF" +After=syslog.target +After=network.target + +[Service] +Type=simple +User=ubuntu +Group=ubuntu +TimeoutSec=300 +WorkingDirectory=/vagrant +Environment="DJANGO_SETTINGS_MODULE=cof.settings.dev" +ExecStart=/home/ubuntu/venv/bin/python manage.py runworker + +[Install] +WantedBy=multi-user.target diff --git a/requirements-devel.txt b/requirements-devel.txt index 2de02a5d..6a5acdd7 100644 --- a/requirements-devel.txt +++ b/requirements-devel.txt @@ -1,8 +1,9 @@ -r requirements.txt -django-debug-toolbar==4.4.6 +django-debug-toolbar +django-debug-panel ipython # Tools -black==22.3.0 +# black # Uncomment when GC & most distros run with Python>=3.6 flake8 isort diff --git a/requirements-prod.txt b/requirements-prod.txt deleted file mode 100644 index 45ac4920..00000000 --- a/requirements-prod.txt +++ /dev/null @@ -1,15 +0,0 @@ --r requirements.txt - -# Postgresql bindings -psycopg2==2.9.10 - -# Redis -django-redis-cache==3.0.1 -redis==3.5.3 -channels-redis==3.4.1 - -# ASGI protocol and HTTP server -daphne==3.0.2 - -# ldap bindings -python-ldap diff --git a/requirements.txt b/requirements.txt index 65d1d380..19b185c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,28 @@ -Django==4.2.17 -Pillow==11.0.0 -authens==0.2.0 -channels==3.0.5 -configparser==7.1.0 -django-autocomplete-light==3.11.0 -django-bootstrap-form==3.4 -django-cas-ng==5.0.1 -django-cors-headers==4.6.0 -django-djconfig==0.11.0 -django-hCaptcha==0.2.0 -django-js-reverse==0.10.2 -django-widget-tweaks==1.5.0 -icalendar==6.1.0 -python-dateutil==2.9.0.post0 +configparser==3.5.0 +Django==1.11.* +django-autocomplete-light==3.1.3 +django-autoslug==1.9.3 +django-cas-ng==3.5.7 +django-djconfig==0.5.3 +django-recaptcha==1.4.0 +django-redis-cache==1.7.1 +icalendar +psycopg2 +Pillow +unicodecsv +django-bootstrap-form==3.3 +asgiref==1.1.1 +daphne==1.3.0 +asgi-redis==1.3.0 statistics==1.0.3.5 -wagtail-modeltranslation==0.15.1 -wagtail==6.3.1 -wagtailmenus==4.0.1 +django-widget-tweaks==1.4.1 +git+https://git.eleves.ens.fr/cof-geek/django_custommail.git#egg=django_custommail +ldap3 +channels==1.1.5 +python-dateutil +wagtail==1.10.* +wagtailmenus==2.2.* +django-cors-headers==2.2.0 + +# Production tools +wheel diff --git a/setup.cfg b/setup.cfg index 9b1c72d0..ec29c73c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,14 +1,11 @@ [coverage:run] source = bda - bds - clubs - events - gestioasso + cof gestioncof kfet - petitscours shared + utils omit = *migrations* *test*.py @@ -35,7 +32,9 @@ combine_as_imports = true default_section = THIRDPARTY force_grid_wrap = 0 include_trailing_comma = true -known_first_party = bda,bds,clubs,cof,events,gestioncof,kfet,petitscours,shared +known_django = django +known_first_party = bda,cof,gestioncof,kfet,shared,utils line_length = 88 multi_line_output = 3 +not_skip = __init__.py sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER diff --git a/shared/__init__.py b/shared/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/shared/autocomplete.py b/shared/autocomplete.py deleted file mode 100644 index a601d5f9..00000000 --- a/shared/autocomplete.py +++ /dev/null @@ -1,251 +0,0 @@ -import logging -from collections import namedtuple - -from django.conf import settings -from django.db.models import Q -from django.utils.translation import gettext_lazy as _ - -if getattr(settings, "LDAP_SERVER_URL", None): - import ldap -else: - # shared.tests.testcases.TestCaseMixin.mockLDAP needs - # an ldap object to be in the scope - ldap = None - - -django_logger = logging.getLogger("django.request") - - -class SearchUnit: - """Base class for all the search utilities. - - A search unit should implement a `search` method taking a list of keywords as - argument and returning an iterable of search results. - - It might optionally implement the following methods and attributes: - - - verbose_name (attribute): a nice name to refer to the results of this search unit - in templates. Examples: "COF Members", "K-Fêt accounts", etc. - - - result_verbose_name (method): a callable that takes one search result as an input - and returns a nice name to refer to this particular result in templates. - Example: `lambda user: user.get_full_name()` - - - result_link (method): a callable that takes one search result and returns a url - to make this particular search result clickable on the search page. For instance - this can be a link to a detail view of the object. - - - result_uuid (method): a callable that takes one result as an input and returns an - identifier that is globally unique across search units for this object. - This is used to compare results coming from different search units in the - `Compose` class. For instance, if the same user can be returned by the LDAP - search and a model search instance, using the clipper login as a UUID in both - units avoids this user to be returned twice by `Compose`. - Returning `None` means that the object should be considered unique. - """ - - # Mandatory method - - def search(self, _keywords): - raise NotImplementedError( - "Class implementing the SearchUnit interface should implement the search " - "method" - ) - - # Optional attributes and methods - - verbose_name = None - - def result_verbose_name(self, result): - """Hook to customize the way results are displayed.""" - return str(result) - - def result_link(self, result): - """Hook to add a link on individual results on the search page.""" - return None - - def result_uuid(self, result): - """A universal unique identifier for the search results.""" - return None - - -# --- -# Model-based search -# --- - - -class ModelSearch(SearchUnit): - """Basic search engine for models based on filtering. - - The class should be configured through its `model` class attribute: the `search` - method will return a queryset of instances of this model. The `search_fields` - attributes indicates which fields to search in. - - Example: - - >>> from django.contrib.auth.models import User - >>> - >>> class UserSearch(ModelSearch): - ... model = User - ... search_fields = ["username", "first_name", "last_name"] - >>> - >>> user_search = UserSearch() # has type ModelSearch[User] - >>> user_search.search(["toto", "foo"]) # returns a queryset of Users - """ - - model = None - search_fields = [] - - def __init__(self): - if self.verbose_name is None: - self.verbose_name = "{} search".format(self.model._meta.verbose_name) - - def get_queryset_filter(self, keywords): - filter_q = Q() - - if not keywords: - return filter_q - - for keyword in keywords: - kw_filter = Q() - for field in self.search_fields: - kw_filter |= Q(**{"{}__icontains".format(field): keyword}) - filter_q &= kw_filter - - return filter_q - - def search(self, keywords): - """Returns the queryset of model instances matching all the keywords. - - The semantic of the search is the following: a model instance appears in the - search results iff all of the keywords given as arguments occur in at least one - of the search fields. - """ - - return self.model.objects.filter(self.get_queryset_filter(keywords)) - - -# --- -# LDAP search -# --- - -Clipper = namedtuple("Clipper", ["clipper", "fullname", "mail"]) - - -class LDAPSearch(SearchUnit): - ldap_server_url = getattr(settings, "LDAP_SERVER_URL", None) - domain_component = "dc=spi,dc=ens,dc=fr" - search_fields = ["cn", "uid"] - attr_list = ["cn", "uid", "mail"] - - verbose_name = _("Comptes clippers") - - def get_ldap_query(self, keywords): - """Return a search query with the following semantics: - - A Clipper appears in the search results iff all of the keywords given as - arguments occur in at least one of the search fields. - """ - - # Dumb but safe - keywords = filter(str.isalnum, keywords) - - ldap_filters = [] - - for keyword in keywords: - ldap_filter = "(|{})".format( - "".join( - "({}=*{}*)".format(field, keyword) for field in self.search_fields - ) - ) - ldap_filters.append(ldap_filter) - - return "(&{})".format("".join(ldap_filters)) - - def search(self, keywords): - """Return a list of Clipper objects matching all the keywords.""" - - query = self.get_ldap_query(keywords) - - if ldap is None or query == "(&)": - return [] - - try: - ldap_obj = ldap.initialize(self.ldap_server_url) - res = ldap_obj.search_s( - self.domain_component, ldap.SCOPE_SUBTREE, query, self.attr_list - ) - return [ - Clipper( - clipper=attrs["uid"][0].decode("utf-8"), - fullname=attrs["cn"][0].decode("utf-8"), - mail=attrs["mail"][0].decode("utf-8"), - ) - for (_, attrs) in res - if "uid" in attrs # Hack to discard weird accounts like root - ] - except ldap.LDAPError as err: - django_logger.error("An LDAP error occurred", exc_info=err) - return [] - - def result_verbose_name(self, clipper): - return "{} ({})".format(clipper.fullname, clipper.clipper) - - def result_uuid(self, clipper): - return clipper.clipper - - -# --- -# Composition of autocomplete units -# --- - - -class Compose: - """Search with several units and remove duplicate results. - - The `search_units` class attribute should be a list of pairs of the form `(name, - search_unit)`. - - The `search` method produces a dictionary whose keys are the `name`s given in - `search_units` and whose values are iterables produced by the different search - units. - - Typical Example: - - >>> from django.contrib.auth.models import User - >>> - >>> class UserSearch(ModelSearch): - ... model = User - ... search_fields = ["username", "first_name", "last_name"] - ... - ... def result_uuid(self, user): - ... # Assuming that `.username` stores the clipper login of already - ... # registered users, this avoids showing the same user twice (here and in - ... # then ldap unit). - ... return user.username - >>> - >>> class UserAndClipperSearch(Compose): - ... search_units = [ - ... ("users", UserSearch()), - ... ("clippers", LDAPSearch()), - ... ] - - In this example, clipper accounts that already have an associated user (i.e. with a - username equal to the clipper login), will not appear in the results. - """ - - search_units = [] - - def search(self, keywords): - seen_uuids = set() - results = {} - for name, search_unit in self.search_units: - uniq_res = [] - for r in search_unit.search(keywords): - uuid = search_unit.result_uuid(r) - if uuid is None or uuid not in seen_uuids: - uniq_res.append(r) - if uuid is not None: - seen_uuids.add(uuid) - results[name] = uniq_res - return results diff --git a/shared/channels.py b/shared/channels.py deleted file mode 100644 index ae8c1248..00000000 --- a/shared/channels.py +++ /dev/null @@ -1,45 +0,0 @@ -import datetime -import random -from decimal import Decimal - -import msgpack -from channels_redis.core import RedisChannelLayer - - -def encode_kf(obj): - if isinstance(obj, Decimal): - return {"__decimal__": True, "as_str": str(obj)} - elif isinstance(obj, datetime.datetime): - return {"__datetime__": True, "as_str": obj.strftime("%Y%m%dT%H:%M:%S.%f")} - return obj - - -def decode_kf(obj): - if "__decimal__" in obj: - obj = Decimal(obj["as_str"]) - elif "__datetime__" in obj: - obj = datetime.datetime.strptime(obj["as_str"], "%Y%m%dT%H:%M:%S.%f") - return obj - - -class ChannelLayer(RedisChannelLayer): - def serialize(self, message): - """Serializes to a byte string.""" - value = msgpack.packb(message, default=encode_kf, use_bin_type=True) - - if self.crypter: - value = self.crypter.encrypt(value) - - # As we use an sorted set to expire messages - # we need to guarantee uniqueness, with 12 bytes. - random_prefix = random.getrandbits(8 * 12).to_bytes(12, "big") - return random_prefix + value - - def deserialize(self, message): - """Deserializes from a byte string.""" - # Removes the random prefix - message = message[12:] - - if self.crypter: - message = self.crypter.decrypt(message, self.expiry + 10) - return msgpack.unpackb(message, object_hook=decode_kf, raw=False) diff --git a/shared/forms.py b/shared/forms.py deleted file mode 100644 index 97094e29..00000000 --- a/shared/forms.py +++ /dev/null @@ -1,50 +0,0 @@ -from django.forms.models import ModelForm - - -class ProtectedModelForm(ModelForm): - """ - Extension de `ModelForm` - - Quand on save un champ `ManyToMany` dans un `ModelForm`, la méthode appelée - est .set(), qui écrase l'intégralité du contenu. - Le problème survient quand le `field` a un queryset restreint, et qu'on ne - veut pas toucher aux choix qui ne sont pas dans ce queryset... - C'est le but de ce mixin. - - Attributs : - - `protected_fields` : champs qu'on souhaite protéger. - """ - - protected_fields = [] - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - for field_name in self.protected_fields: - if field_name not in self.fields: - raise ValueError("Le champ %s n'existe pas !" % field_name) - - def _get_protected_elts(self, field_name): - """ - Renvoie tous les éléments de `instance.` qui ne sont pas - dans `self..queryset` (et sont donc à conserver). - - NB : on "désordonne" tous les querysets via `.order_by()` car Django - ne peut pas effectuer une union de QS ordonnés. - """ - if self.instance.pk: - previous = getattr(self.instance, field_name).order_by() - selectable = self.fields[field_name].queryset.order_by() - return previous.difference(selectable) - else: - # Nouvelle instance, rien à protéger. - return self.fields[field_name].queryset.none() - - def clean(self): - cleaned_data = super().clean() - for field_name in self.protected_fields: - selected_elts = cleaned_data[field_name].order_by() - protected_elts = self._get_protected_elts(field_name) - cleaned_data[field_name] = selected_elts.union(protected_elts) - - return cleaned_data diff --git a/shared/static/fonts/CarterOne/carterOne.css b/shared/static/fonts/CarterOne/carterOne.css deleted file mode 100644 index 1380934a..00000000 --- a/shared/static/fonts/CarterOne/carterOne.css +++ /dev/null @@ -1,10 +0,0 @@ -/* carter-one-regular - latin */ -@font-face { - font-family: 'Carter One'; - font-style: normal; - font-weight: 400; - src: local('Carter One'), local('CarterOne'), - url('./fonts/carter-one-v11-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/carter-one-v11-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - diff --git a/shared/static/fonts/CarterOne/fonts/carter-one-v11-latin-regular.woff b/shared/static/fonts/CarterOne/fonts/carter-one-v11-latin-regular.woff deleted file mode 100644 index 851ed743..00000000 Binary files a/shared/static/fonts/CarterOne/fonts/carter-one-v11-latin-regular.woff and /dev/null differ diff --git a/shared/static/fonts/CarterOne/fonts/carter-one-v11-latin-regular.woff2 b/shared/static/fonts/CarterOne/fonts/carter-one-v11-latin-regular.woff2 deleted file mode 100644 index 132f3c5a..00000000 Binary files a/shared/static/fonts/CarterOne/fonts/carter-one-v11-latin-regular.woff2 and /dev/null differ diff --git a/shared/static/fonts/Dosis/dosis.css b/shared/static/fonts/Dosis/dosis.css deleted file mode 100644 index 72464077..00000000 --- a/shared/static/fonts/Dosis/dosis.css +++ /dev/null @@ -1,19 +0,0 @@ -/* dosis-regular - latin */ -@font-face { - font-family: 'Dosis'; - font-style: normal; - font-weight: 400; - src: local('Dosis Regular'), local('Dosis-Regular'), - url('./fonts/dosis-v7-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/dosis-v7-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* dosis-700 - latin */ -@font-face { - font-family: 'Dosis'; - font-style: normal; - font-weight: 700; - src: local('Dosis Bold'), local('Dosis-Bold'), - url('./fonts/dosis-v7-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/dosis-v7-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} diff --git a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-700.woff b/shared/static/fonts/Dosis/fonts/dosis-v7-latin-700.woff deleted file mode 100644 index fd6b68fa..00000000 Binary files a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-700.woff and /dev/null differ diff --git a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-700.woff2 b/shared/static/fonts/Dosis/fonts/dosis-v7-latin-700.woff2 deleted file mode 100644 index 8fa881a1..00000000 Binary files a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-700.woff2 and /dev/null differ diff --git a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-regular.woff b/shared/static/fonts/Dosis/fonts/dosis-v7-latin-regular.woff deleted file mode 100644 index 3a3de075..00000000 Binary files a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-regular.woff and /dev/null differ diff --git a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-regular.woff2 b/shared/static/fonts/Dosis/fonts/dosis-v7-latin-regular.woff2 deleted file mode 100644 index 684c17a2..00000000 Binary files a/shared/static/fonts/Dosis/fonts/dosis-v7-latin-regular.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-700.woff b/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-700.woff deleted file mode 100644 index 5c09bba8..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-700.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-700.woff2 b/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-700.woff2 deleted file mode 100644 index d4c3305c..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-700.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-regular.woff b/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-regular.woff deleted file mode 100644 index 0ea5db89..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-regular.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-regular.woff2 b/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-regular.woff2 deleted file mode 100644 index 6163de7b..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-mono-v5-latin-regular.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-700.woff b/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-700.woff deleted file mode 100644 index 7b16b547..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-700.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-700.woff2 b/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-700.woff2 deleted file mode 100644 index 0f8c258b..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-700.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-regular.woff b/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-regular.woff deleted file mode 100644 index b576dda8..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-regular.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-regular.woff2 b/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-regular.woff2 deleted file mode 100644 index 5802e971..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-slab-v7-latin-regular.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300.woff b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300.woff deleted file mode 100644 index 96663f07..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300.woff2 b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300.woff2 deleted file mode 100644 index 52c5845a..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300italic.woff b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300italic.woff deleted file mode 100644 index a3bfbe35..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300italic.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300italic.woff2 b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300italic.woff2 deleted file mode 100644 index db95c87d..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-300italic.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-700.woff b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-700.woff deleted file mode 100644 index a0d26516..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-700.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-700.woff2 b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-700.woff2 deleted file mode 100644 index e327dc95..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-700.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-regular.woff b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-regular.woff deleted file mode 100644 index 92dfacc6..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-regular.woff and /dev/null differ diff --git a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-regular.woff2 b/shared/static/fonts/Roboto/fonts/roboto-v18-latin-regular.woff2 deleted file mode 100644 index 7e854e66..00000000 Binary files a/shared/static/fonts/Roboto/fonts/roboto-v18-latin-regular.woff2 and /dev/null differ diff --git a/shared/static/fonts/Roboto/roboto.css b/shared/static/fonts/Roboto/roboto.css deleted file mode 100644 index ac0e2c37..00000000 --- a/shared/static/fonts/Roboto/roboto.css +++ /dev/null @@ -1,79 +0,0 @@ -/* roboto-300 - latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - src: local('Roboto Light'), local('Roboto-Light'), - url('./fonts/roboto-v18-latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-v18-latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-regular - latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), - url('./fonts/roboto-v18-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-v18-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-300italic - latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - src: local('Roboto Light Italic'), local('Roboto-LightItalic'), - url('./fonts/roboto-v18-latin-300italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-v18-latin-300italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-700 - latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - src: local('Roboto Bold'), local('Roboto-Bold'), - url('./fonts/roboto-v18-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-v18-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-mono-regular - latin */ -@font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: local('Roboto Mono'), local('RobotoMono-Regular'), - url('./fonts/roboto-mono-v5-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-mono-v5-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-mono-700 - latin */ -@font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 700; - src: local('Roboto Mono Bold'), local('RobotoMono-Bold'), - url('./fonts/roboto-mono-v5-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-mono-v5-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-slab-regular - latin */ -@font-face { - font-family: 'Roboto Slab'; - font-style: normal; - font-weight: 400; - src: local('Roboto Slab Regular'), local('RobotoSlab-Regular'), - url('./fonts/roboto-slab-v7-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-slab-v7-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* roboto-slab-700 - latin */ -@font-face { - font-family: 'Roboto Slab'; - font-style: normal; - font-weight: 700; - src: local('Roboto Slab Bold'), local('RobotoSlab-Bold'), - url('./fonts/roboto-slab-v7-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/roboto-slab-v7-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} \ No newline at end of file diff --git a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300.woff b/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300.woff deleted file mode 100644 index 98bafe5e..00000000 Binary files a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300.woff and /dev/null differ diff --git a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300.woff2 b/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300.woff2 deleted file mode 100644 index af998cac..00000000 Binary files a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300.woff2 and /dev/null differ diff --git a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300italic.woff b/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300italic.woff deleted file mode 100644 index 42232ee2..00000000 Binary files a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300italic.woff and /dev/null differ diff --git a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300italic.woff2 b/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300italic.woff2 deleted file mode 100644 index 6daac0dd..00000000 Binary files a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-300italic.woff2 and /dev/null differ diff --git a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-700.woff b/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-700.woff deleted file mode 100644 index f2a7dd34..00000000 Binary files a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-700.woff and /dev/null differ diff --git a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-700.woff2 b/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-700.woff2 deleted file mode 100644 index ce34a9fe..00000000 Binary files a/shared/static/fonts/SourceSansPro/fonts/source-sans-pro-v13-latin-700.woff2 and /dev/null differ diff --git a/shared/static/fonts/SourceSansPro/sourceSansPro.css b/shared/static/fonts/SourceSansPro/sourceSansPro.css deleted file mode 100644 index f7bfbe2f..00000000 --- a/shared/static/fonts/SourceSansPro/sourceSansPro.css +++ /dev/null @@ -1,30 +0,0 @@ -/* source-sans-pro-300 - latin */ -@font-face { - font-family: 'Source Sans Pro'; - font-style: normal; - font-weight: 300; - src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), - url('./fonts/source-sans-pro-v13-latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/source-sans-pro-v13-latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* source-sans-pro-300italic - latin */ -@font-face { - font-family: 'Source Sans Pro'; - font-style: italic; - font-weight: 300; - src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), - url('./fonts/source-sans-pro-v13-latin-300italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/source-sans-pro-v13-latin-300italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - -/* source-sans-pro-700 - latin */ -@font-face { - font-family: 'Source Sans Pro'; - font-style: normal; - font-weight: 700; - src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), - url('./fonts/source-sans-pro-v13-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */ - url('./fonts/source-sans-pro-v13-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ -} - diff --git a/shared/static/src/bootstrap/css/bootstrap.css b/shared/static/src/bootstrap/css/bootstrap.css deleted file mode 100644 index 2321718e..00000000 --- a/shared/static/src/bootstrap/css/bootstrap.css +++ /dev/null @@ -1,6834 +0,0 @@ -/*! - * Bootstrap v3.4.0 (https://getbootstrap.com/) - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ -/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ -html { - font-family: sans-serif; - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; -} -body { - margin: 0; -} -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} -audio, -canvas, -progress, -video { - display: inline-block; - vertical-align: baseline; -} -audio:not([controls]) { - display: none; - height: 0; -} -[hidden], -template { - display: none; -} -a { - background-color: transparent; -} -a:active, -a:hover { - outline: 0; -} -abbr[title] { - border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; - -moz-text-decoration: underline dotted; - text-decoration: underline dotted; -} -b, -strong { - font-weight: bold; -} -dfn { - font-style: italic; -} -h1 { - font-size: 2em; - margin: 0.67em 0; -} -mark { - background: #ff0; - color: #000; -} -small { - font-size: 80%; -} -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} -sup { - top: -0.5em; -} -sub { - bottom: -0.25em; -} -img { - border: 0; -} -svg:not(:root) { - overflow: hidden; -} -figure { - margin: 1em 40px; -} -hr { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} -pre { - overflow: auto; -} -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} -button, -input, -optgroup, -select, -textarea { - color: inherit; - font: inherit; - margin: 0; -} -button { - overflow: visible; -} -button, -select { - text-transform: none; -} -button, -html input[type="button"], -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; - cursor: pointer; -} -button[disabled], -html input[disabled] { - cursor: default; -} -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} -input { - line-height: normal; -} -input[type="checkbox"], -input[type="radio"] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 0; -} -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} -input[type="search"] { - -webkit-appearance: textfield; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} -legend { - border: 0; - padding: 0; -} -textarea { - overflow: auto; -} -optgroup { - font-weight: bold; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -td, -th { - padding: 0; -} -/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ -@media print { - *, - *:before, - *:after { - color: #000 !important; - text-shadow: none !important; - background: transparent !important; - -webkit-box-shadow: none !important; - box-shadow: none !important; - } - a, - a:visited { - text-decoration: underline; - } - a[href]:after { - content: " (" attr(href) ")"; - } - abbr[title]:after { - content: " (" attr(title) ")"; - } - a[href^="#"]:after, - a[href^="javascript:"]:after { - content: ""; - } - pre, - blockquote { - border: 1px solid #999; - page-break-inside: avoid; - } - thead { - display: table-header-group; - } - tr, - img { - page-break-inside: avoid; - } - img { - max-width: 100% !important; - } - p, - h2, - h3 { - orphans: 3; - widows: 3; - } - h2, - h3 { - page-break-after: avoid; - } - .navbar { - display: none; - } - .btn > .caret, - .dropup > .btn > .caret { - border-top-color: #000 !important; - } - .label { - border: 1px solid #000; - } - .table { - border-collapse: collapse !important; - } - .table td, - .table th { - background-color: #fff !important; - } - .table-bordered th, - .table-bordered td { - border: 1px solid #ddd !important; - } -} -@font-face { - font-family: "Glyphicons Halflings"; - src: url("../fonts/glyphicons-halflings-regular.eot"); - src: url("../fonts/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("../fonts/glyphicons-halflings-regular.woff2") format("woff2"), url("../fonts/glyphicons-halflings-regular.woff") format("woff"), url("../fonts/glyphicons-halflings-regular.ttf") format("truetype"), url("../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg"); -} -.glyphicon { - position: relative; - top: 1px; - display: inline-block; - font-family: "Glyphicons Halflings"; - font-style: normal; - font-weight: 400; - line-height: 1; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -.glyphicon-asterisk:before { - content: "\002a"; -} -.glyphicon-plus:before { - content: "\002b"; -} -.glyphicon-euro:before, -.glyphicon-eur:before { - content: "\20ac"; -} -.glyphicon-minus:before { - content: "\2212"; -} -.glyphicon-cloud:before { - content: "\2601"; -} -.glyphicon-envelope:before { - content: "\2709"; -} -.glyphicon-pencil:before { - content: "\270f"; -} -.glyphicon-glass:before { - content: "\e001"; -} -.glyphicon-music:before { - content: "\e002"; -} -.glyphicon-search:before { - content: "\e003"; -} -.glyphicon-heart:before { - content: "\e005"; -} -.glyphicon-star:before { - content: "\e006"; -} -.glyphicon-star-empty:before { - content: "\e007"; -} -.glyphicon-user:before { - content: "\e008"; -} -.glyphicon-film:before { - content: "\e009"; -} -.glyphicon-th-large:before { - content: "\e010"; -} -.glyphicon-th:before { - content: "\e011"; -} -.glyphicon-th-list:before { - content: "\e012"; -} -.glyphicon-ok:before { - content: "\e013"; -} -.glyphicon-remove:before { - content: "\e014"; -} -.glyphicon-zoom-in:before { - content: "\e015"; -} -.glyphicon-zoom-out:before { - content: "\e016"; -} -.glyphicon-off:before { - content: "\e017"; -} -.glyphicon-signal:before { - content: "\e018"; -} -.glyphicon-cog:before { - content: "\e019"; -} -.glyphicon-trash:before { - content: "\e020"; -} -.glyphicon-home:before { - content: "\e021"; -} -.glyphicon-file:before { - content: "\e022"; -} -.glyphicon-time:before { - content: "\e023"; -} -.glyphicon-road:before { - content: "\e024"; -} -.glyphicon-download-alt:before { - content: "\e025"; -} -.glyphicon-download:before { - content: "\e026"; -} -.glyphicon-upload:before { - content: "\e027"; -} -.glyphicon-inbox:before { - content: "\e028"; -} -.glyphicon-play-circle:before { - content: "\e029"; -} -.glyphicon-repeat:before { - content: "\e030"; -} -.glyphicon-refresh:before { - content: "\e031"; -} -.glyphicon-list-alt:before { - content: "\e032"; -} -.glyphicon-lock:before { - content: "\e033"; -} -.glyphicon-flag:before { - content: "\e034"; -} -.glyphicon-headphones:before { - content: "\e035"; -} -.glyphicon-volume-off:before { - content: "\e036"; -} -.glyphicon-volume-down:before { - content: "\e037"; -} -.glyphicon-volume-up:before { - content: "\e038"; -} -.glyphicon-qrcode:before { - content: "\e039"; -} -.glyphicon-barcode:before { - content: "\e040"; -} -.glyphicon-tag:before { - content: "\e041"; -} -.glyphicon-tags:before { - content: "\e042"; -} -.glyphicon-book:before { - content: "\e043"; -} -.glyphicon-bookmark:before { - content: "\e044"; -} -.glyphicon-print:before { - content: "\e045"; -} -.glyphicon-camera:before { - content: "\e046"; -} -.glyphicon-font:before { - content: "\e047"; -} -.glyphicon-bold:before { - content: "\e048"; -} -.glyphicon-italic:before { - content: "\e049"; -} -.glyphicon-text-height:before { - content: "\e050"; -} -.glyphicon-text-width:before { - content: "\e051"; -} -.glyphicon-align-left:before { - content: "\e052"; -} -.glyphicon-align-center:before { - content: "\e053"; -} -.glyphicon-align-right:before { - content: "\e054"; -} -.glyphicon-align-justify:before { - content: "\e055"; -} -.glyphicon-list:before { - content: "\e056"; -} -.glyphicon-indent-left:before { - content: "\e057"; -} -.glyphicon-indent-right:before { - content: "\e058"; -} -.glyphicon-facetime-video:before { - content: "\e059"; -} -.glyphicon-picture:before { - content: "\e060"; -} -.glyphicon-map-marker:before { - content: "\e062"; -} -.glyphicon-adjust:before { - content: "\e063"; -} -.glyphicon-tint:before { - content: "\e064"; -} -.glyphicon-edit:before { - content: "\e065"; -} -.glyphicon-share:before { - content: "\e066"; -} -.glyphicon-check:before { - content: "\e067"; -} -.glyphicon-move:before { - content: "\e068"; -} -.glyphicon-step-backward:before { - content: "\e069"; -} -.glyphicon-fast-backward:before { - content: "\e070"; -} -.glyphicon-backward:before { - content: "\e071"; -} -.glyphicon-play:before { - content: "\e072"; -} -.glyphicon-pause:before { - content: "\e073"; -} -.glyphicon-stop:before { - content: "\e074"; -} -.glyphicon-forward:before { - content: "\e075"; -} -.glyphicon-fast-forward:before { - content: "\e076"; -} -.glyphicon-step-forward:before { - content: "\e077"; -} -.glyphicon-eject:before { - content: "\e078"; -} -.glyphicon-chevron-left:before { - content: "\e079"; -} -.glyphicon-chevron-right:before { - content: "\e080"; -} -.glyphicon-plus-sign:before { - content: "\e081"; -} -.glyphicon-minus-sign:before { - content: "\e082"; -} -.glyphicon-remove-sign:before { - content: "\e083"; -} -.glyphicon-ok-sign:before { - content: "\e084"; -} -.glyphicon-question-sign:before { - content: "\e085"; -} -.glyphicon-info-sign:before { - content: "\e086"; -} -.glyphicon-screenshot:before { - content: "\e087"; -} -.glyphicon-remove-circle:before { - content: "\e088"; -} -.glyphicon-ok-circle:before { - content: "\e089"; -} -.glyphicon-ban-circle:before { - content: "\e090"; -} -.glyphicon-arrow-left:before { - content: "\e091"; -} -.glyphicon-arrow-right:before { - content: "\e092"; -} -.glyphicon-arrow-up:before { - content: "\e093"; -} -.glyphicon-arrow-down:before { - content: "\e094"; -} -.glyphicon-share-alt:before { - content: "\e095"; -} -.glyphicon-resize-full:before { - content: "\e096"; -} -.glyphicon-resize-small:before { - content: "\e097"; -} -.glyphicon-exclamation-sign:before { - content: "\e101"; -} -.glyphicon-gift:before { - content: "\e102"; -} -.glyphicon-leaf:before { - content: "\e103"; -} -.glyphicon-fire:before { - content: "\e104"; -} -.glyphicon-eye-open:before { - content: "\e105"; -} -.glyphicon-eye-close:before { - content: "\e106"; -} -.glyphicon-warning-sign:before { - content: "\e107"; -} -.glyphicon-plane:before { - content: "\e108"; -} -.glyphicon-calendar:before { - content: "\e109"; -} -.glyphicon-random:before { - content: "\e110"; -} -.glyphicon-comment:before { - content: "\e111"; -} -.glyphicon-magnet:before { - content: "\e112"; -} -.glyphicon-chevron-up:before { - content: "\e113"; -} -.glyphicon-chevron-down:before { - content: "\e114"; -} -.glyphicon-retweet:before { - content: "\e115"; -} -.glyphicon-shopping-cart:before { - content: "\e116"; -} -.glyphicon-folder-close:before { - content: "\e117"; -} -.glyphicon-folder-open:before { - content: "\e118"; -} -.glyphicon-resize-vertical:before { - content: "\e119"; -} -.glyphicon-resize-horizontal:before { - content: "\e120"; -} -.glyphicon-hdd:before { - content: "\e121"; -} -.glyphicon-bullhorn:before { - content: "\e122"; -} -.glyphicon-bell:before { - content: "\e123"; -} -.glyphicon-certificate:before { - content: "\e124"; -} -.glyphicon-thumbs-up:before { - content: "\e125"; -} -.glyphicon-thumbs-down:before { - content: "\e126"; -} -.glyphicon-hand-right:before { - content: "\e127"; -} -.glyphicon-hand-left:before { - content: "\e128"; -} -.glyphicon-hand-up:before { - content: "\e129"; -} -.glyphicon-hand-down:before { - content: "\e130"; -} -.glyphicon-circle-arrow-right:before { - content: "\e131"; -} -.glyphicon-circle-arrow-left:before { - content: "\e132"; -} -.glyphicon-circle-arrow-up:before { - content: "\e133"; -} -.glyphicon-circle-arrow-down:before { - content: "\e134"; -} -.glyphicon-globe:before { - content: "\e135"; -} -.glyphicon-wrench:before { - content: "\e136"; -} -.glyphicon-tasks:before { - content: "\e137"; -} -.glyphicon-filter:before { - content: "\e138"; -} -.glyphicon-briefcase:before { - content: "\e139"; -} -.glyphicon-fullscreen:before { - content: "\e140"; -} -.glyphicon-dashboard:before { - content: "\e141"; -} -.glyphicon-paperclip:before { - content: "\e142"; -} -.glyphicon-heart-empty:before { - content: "\e143"; -} -.glyphicon-link:before { - content: "\e144"; -} -.glyphicon-phone:before { - content: "\e145"; -} -.glyphicon-pushpin:before { - content: "\e146"; -} -.glyphicon-usd:before { - content: "\e148"; -} -.glyphicon-gbp:before { - content: "\e149"; -} -.glyphicon-sort:before { - content: "\e150"; -} -.glyphicon-sort-by-alphabet:before { - content: "\e151"; -} -.glyphicon-sort-by-alphabet-alt:before { - content: "\e152"; -} -.glyphicon-sort-by-order:before { - content: "\e153"; -} -.glyphicon-sort-by-order-alt:before { - content: "\e154"; -} -.glyphicon-sort-by-attributes:before { - content: "\e155"; -} -.glyphicon-sort-by-attributes-alt:before { - content: "\e156"; -} -.glyphicon-unchecked:before { - content: "\e157"; -} -.glyphicon-expand:before { - content: "\e158"; -} -.glyphicon-collapse-down:before { - content: "\e159"; -} -.glyphicon-collapse-up:before { - content: "\e160"; -} -.glyphicon-log-in:before { - content: "\e161"; -} -.glyphicon-flash:before { - content: "\e162"; -} -.glyphicon-log-out:before { - content: "\e163"; -} -.glyphicon-new-window:before { - content: "\e164"; -} -.glyphicon-record:before { - content: "\e165"; -} -.glyphicon-save:before { - content: "\e166"; -} -.glyphicon-open:before { - content: "\e167"; -} -.glyphicon-saved:before { - content: "\e168"; -} -.glyphicon-import:before { - content: "\e169"; -} -.glyphicon-export:before { - content: "\e170"; -} -.glyphicon-send:before { - content: "\e171"; -} -.glyphicon-floppy-disk:before { - content: "\e172"; -} -.glyphicon-floppy-saved:before { - content: "\e173"; -} -.glyphicon-floppy-remove:before { - content: "\e174"; -} -.glyphicon-floppy-save:before { - content: "\e175"; -} -.glyphicon-floppy-open:before { - content: "\e176"; -} -.glyphicon-credit-card:before { - content: "\e177"; -} -.glyphicon-transfer:before { - content: "\e178"; -} -.glyphicon-cutlery:before { - content: "\e179"; -} -.glyphicon-header:before { - content: "\e180"; -} -.glyphicon-compressed:before { - content: "\e181"; -} -.glyphicon-earphone:before { - content: "\e182"; -} -.glyphicon-phone-alt:before { - content: "\e183"; -} -.glyphicon-tower:before { - content: "\e184"; -} -.glyphicon-stats:before { - content: "\e185"; -} -.glyphicon-sd-video:before { - content: "\e186"; -} -.glyphicon-hd-video:before { - content: "\e187"; -} -.glyphicon-subtitles:before { - content: "\e188"; -} -.glyphicon-sound-stereo:before { - content: "\e189"; -} -.glyphicon-sound-dolby:before { - content: "\e190"; -} -.glyphicon-sound-5-1:before { - content: "\e191"; -} -.glyphicon-sound-6-1:before { - content: "\e192"; -} -.glyphicon-sound-7-1:before { - content: "\e193"; -} -.glyphicon-copyright-mark:before { - content: "\e194"; -} -.glyphicon-registration-mark:before { - content: "\e195"; -} -.glyphicon-cloud-download:before { - content: "\e197"; -} -.glyphicon-cloud-upload:before { - content: "\e198"; -} -.glyphicon-tree-conifer:before { - content: "\e199"; -} -.glyphicon-tree-deciduous:before { - content: "\e200"; -} -.glyphicon-cd:before { - content: "\e201"; -} -.glyphicon-save-file:before { - content: "\e202"; -} -.glyphicon-open-file:before { - content: "\e203"; -} -.glyphicon-level-up:before { - content: "\e204"; -} -.glyphicon-copy:before { - content: "\e205"; -} -.glyphicon-paste:before { - content: "\e206"; -} -.glyphicon-alert:before { - content: "\e209"; -} -.glyphicon-equalizer:before { - content: "\e210"; -} -.glyphicon-king:before { - content: "\e211"; -} -.glyphicon-queen:before { - content: "\e212"; -} -.glyphicon-pawn:before { - content: "\e213"; -} -.glyphicon-bishop:before { - content: "\e214"; -} -.glyphicon-knight:before { - content: "\e215"; -} -.glyphicon-baby-formula:before { - content: "\e216"; -} -.glyphicon-tent:before { - content: "\26fa"; -} -.glyphicon-blackboard:before { - content: "\e218"; -} -.glyphicon-bed:before { - content: "\e219"; -} -.glyphicon-apple:before { - content: "\f8ff"; -} -.glyphicon-erase:before { - content: "\e221"; -} -.glyphicon-hourglass:before { - content: "\231b"; -} -.glyphicon-lamp:before { - content: "\e223"; -} -.glyphicon-duplicate:before { - content: "\e224"; -} -.glyphicon-piggy-bank:before { - content: "\e225"; -} -.glyphicon-scissors:before { - content: "\e226"; -} -.glyphicon-bitcoin:before { - content: "\e227"; -} -.glyphicon-btc:before { - content: "\e227"; -} -.glyphicon-xbt:before { - content: "\e227"; -} -.glyphicon-yen:before { - content: "\00a5"; -} -.glyphicon-jpy:before { - content: "\00a5"; -} -.glyphicon-ruble:before { - content: "\20bd"; -} -.glyphicon-rub:before { - content: "\20bd"; -} -.glyphicon-scale:before { - content: "\e230"; -} -.glyphicon-ice-lolly:before { - content: "\e231"; -} -.glyphicon-ice-lolly-tasted:before { - content: "\e232"; -} -.glyphicon-education:before { - content: "\e233"; -} -.glyphicon-option-horizontal:before { - content: "\e234"; -} -.glyphicon-option-vertical:before { - content: "\e235"; -} -.glyphicon-menu-hamburger:before { - content: "\e236"; -} -.glyphicon-modal-window:before { - content: "\e237"; -} -.glyphicon-oil:before { - content: "\e238"; -} -.glyphicon-grain:before { - content: "\e239"; -} -.glyphicon-sunglasses:before { - content: "\e240"; -} -.glyphicon-text-size:before { - content: "\e241"; -} -.glyphicon-text-color:before { - content: "\e242"; -} -.glyphicon-text-background:before { - content: "\e243"; -} -.glyphicon-object-align-top:before { - content: "\e244"; -} -.glyphicon-object-align-bottom:before { - content: "\e245"; -} -.glyphicon-object-align-horizontal:before { - content: "\e246"; -} -.glyphicon-object-align-left:before { - content: "\e247"; -} -.glyphicon-object-align-vertical:before { - content: "\e248"; -} -.glyphicon-object-align-right:before { - content: "\e249"; -} -.glyphicon-triangle-right:before { - content: "\e250"; -} -.glyphicon-triangle-left:before { - content: "\e251"; -} -.glyphicon-triangle-bottom:before { - content: "\e252"; -} -.glyphicon-triangle-top:before { - content: "\e253"; -} -.glyphicon-console:before { - content: "\e254"; -} -.glyphicon-superscript:before { - content: "\e255"; -} -.glyphicon-subscript:before { - content: "\e256"; -} -.glyphicon-menu-left:before { - content: "\e257"; -} -.glyphicon-menu-right:before { - content: "\e258"; -} -.glyphicon-menu-down:before { - content: "\e259"; -} -.glyphicon-menu-up:before { - content: "\e260"; -} -* { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -*:before, -*:after { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -html { - font-size: 10px; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; - line-height: 1.42857143; - color: #333333; - background-color: #fff; -} -input, -button, -select, -textarea { - font-family: inherit; - font-size: inherit; - line-height: inherit; -} -a { - color: #337ab7; - text-decoration: none; -} -a:hover, -a:focus { - color: #23527c; - text-decoration: underline; -} -a:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -figure { - margin: 0; -} -img { - vertical-align: middle; -} -.img-responsive, -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.img-rounded { - border-radius: 6px; -} -.img-thumbnail { - padding: 4px; - line-height: 1.42857143; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - -webkit-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; - display: inline-block; - max-width: 100%; - height: auto; -} -.img-circle { - border-radius: 50%; -} -hr { - margin-top: 20px; - margin-bottom: 20px; - border: 0; - border-top: 1px solid #eeeeee; -} -.sr-only { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} -.sr-only-focusable:active, -.sr-only-focusable:focus { - position: static; - width: auto; - height: auto; - margin: 0; - overflow: visible; - clip: auto; -} -[role="button"] { - cursor: pointer; -} -h1, -h2, -h3, -h4, -h5, -h6, -.h1, -.h2, -.h3, -.h4, -.h5, -.h6 { - font-family: inherit; - font-weight: 500; - line-height: 1.1; - color: inherit; -} -h1 small, -h2 small, -h3 small, -h4 small, -h5 small, -h6 small, -.h1 small, -.h2 small, -.h3 small, -.h4 small, -.h5 small, -.h6 small, -h1 .small, -h2 .small, -h3 .small, -h4 .small, -h5 .small, -h6 .small, -.h1 .small, -.h2 .small, -.h3 .small, -.h4 .small, -.h5 .small, -.h6 .small { - font-weight: 400; - line-height: 1; - color: #777777; -} -h1, -.h1, -h2, -.h2, -h3, -.h3 { - margin-top: 20px; - margin-bottom: 10px; -} -h1 small, -.h1 small, -h2 small, -.h2 small, -h3 small, -.h3 small, -h1 .small, -.h1 .small, -h2 .small, -.h2 .small, -h3 .small, -.h3 .small { - font-size: 65%; -} -h4, -.h4, -h5, -.h5, -h6, -.h6 { - margin-top: 10px; - margin-bottom: 10px; -} -h4 small, -.h4 small, -h5 small, -.h5 small, -h6 small, -.h6 small, -h4 .small, -.h4 .small, -h5 .small, -.h5 .small, -h6 .small, -.h6 .small { - font-size: 75%; -} -h1, -.h1 { - font-size: 36px; -} -h2, -.h2 { - font-size: 30px; -} -h3, -.h3 { - font-size: 24px; -} -h4, -.h4 { - font-size: 18px; -} -h5, -.h5 { - font-size: 14px; -} -h6, -.h6 { - font-size: 12px; -} -p { - margin: 0 0 10px; -} -.lead { - margin-bottom: 20px; - font-size: 16px; - font-weight: 300; - line-height: 1.4; -} -@media (min-width: 768px) { - .lead { - font-size: 21px; - } -} -small, -.small { - font-size: 85%; -} -mark, -.mark { - padding: 0.2em; - background-color: #fcf8e3; -} -.text-left { - text-align: left; -} -.text-right { - text-align: right; -} -.text-center { - text-align: center; -} -.text-justify { - text-align: justify; -} -.text-nowrap { - white-space: nowrap; -} -.text-lowercase { - text-transform: lowercase; -} -.text-uppercase { - text-transform: uppercase; -} -.text-capitalize { - text-transform: capitalize; -} -.text-muted { - color: #777777; -} -.text-primary { - color: #337ab7; -} -a.text-primary:hover, -a.text-primary:focus { - color: #286090; -} -.text-success { - color: #3c763d; -} -a.text-success:hover, -a.text-success:focus { - color: #2b542c; -} -.text-info { - color: #31708f; -} -a.text-info:hover, -a.text-info:focus { - color: #245269; -} -.text-warning { - color: #8a6d3b; -} -a.text-warning:hover, -a.text-warning:focus { - color: #66512c; -} -.text-danger { - color: #a94442; -} -a.text-danger:hover, -a.text-danger:focus { - color: #843534; -} -.bg-primary { - color: #fff; - background-color: #337ab7; -} -a.bg-primary:hover, -a.bg-primary:focus { - background-color: #286090; -} -.bg-success { - background-color: #dff0d8; -} -a.bg-success:hover, -a.bg-success:focus { - background-color: #c1e2b3; -} -.bg-info { - background-color: #d9edf7; -} -a.bg-info:hover, -a.bg-info:focus { - background-color: #afd9ee; -} -.bg-warning { - background-color: #fcf8e3; -} -a.bg-warning:hover, -a.bg-warning:focus { - background-color: #f7ecb5; -} -.bg-danger { - background-color: #f2dede; -} -a.bg-danger:hover, -a.bg-danger:focus { - background-color: #e4b9b9; -} -.page-header { - padding-bottom: 9px; - margin: 40px 0 20px; - border-bottom: 1px solid #eeeeee; -} -ul, -ol { - margin-top: 0; - margin-bottom: 10px; -} -ul ul, -ol ul, -ul ol, -ol ol { - margin-bottom: 0; -} -.list-unstyled { - padding-left: 0; - list-style: none; -} -.list-inline { - padding-left: 0; - list-style: none; - margin-left: -5px; -} -.list-inline > li { - display: inline-block; - padding-right: 5px; - padding-left: 5px; -} -dl { - margin-top: 0; - margin-bottom: 20px; -} -dt, -dd { - line-height: 1.42857143; -} -dt { - font-weight: 700; -} -dd { - margin-left: 0; -} -@media (min-width: 768px) { - .dl-horizontal dt { - float: left; - width: 160px; - clear: left; - text-align: right; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .dl-horizontal dd { - margin-left: 180px; - } -} -abbr[title], -abbr[data-original-title] { - cursor: help; -} -.initialism { - font-size: 90%; - text-transform: uppercase; -} -blockquote { - padding: 10px 20px; - margin: 0 0 20px; - font-size: 17.5px; - border-left: 5px solid #eeeeee; -} -blockquote p:last-child, -blockquote ul:last-child, -blockquote ol:last-child { - margin-bottom: 0; -} -blockquote footer, -blockquote small, -blockquote .small { - display: block; - font-size: 80%; - line-height: 1.42857143; - color: #777777; -} -blockquote footer:before, -blockquote small:before, -blockquote .small:before { - content: "\2014 \00A0"; -} -.blockquote-reverse, -blockquote.pull-right { - padding-right: 15px; - padding-left: 0; - text-align: right; - border-right: 5px solid #eeeeee; - border-left: 0; -} -.blockquote-reverse footer:before, -blockquote.pull-right footer:before, -.blockquote-reverse small:before, -blockquote.pull-right small:before, -.blockquote-reverse .small:before, -blockquote.pull-right .small:before { - content: ""; -} -.blockquote-reverse footer:after, -blockquote.pull-right footer:after, -.blockquote-reverse small:after, -blockquote.pull-right small:after, -.blockquote-reverse .small:after, -blockquote.pull-right .small:after { - content: "\00A0 \2014"; -} -address { - margin-bottom: 20px; - font-style: normal; - line-height: 1.42857143; -} -code, -kbd, -pre, -samp { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; -} -code { - padding: 2px 4px; - font-size: 90%; - color: #c7254e; - background-color: #f9f2f4; - border-radius: 4px; -} -kbd { - padding: 2px 4px; - font-size: 90%; - color: #fff; - background-color: #333; - border-radius: 3px; - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); -} -kbd kbd { - padding: 0; - font-size: 100%; - font-weight: 700; - -webkit-box-shadow: none; - box-shadow: none; -} -pre { - display: block; - padding: 9.5px; - margin: 0 0 10px; - font-size: 13px; - line-height: 1.42857143; - color: #333333; - word-break: break-all; - word-wrap: break-word; - background-color: #f5f5f5; - border: 1px solid #ccc; - border-radius: 4px; -} -pre code { - padding: 0; - font-size: inherit; - color: inherit; - white-space: pre-wrap; - background-color: transparent; - border-radius: 0; -} -.pre-scrollable { - max-height: 340px; - overflow-y: scroll; -} -.container { - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} -@media (min-width: 768px) { - .container { - width: 750px; - } -} -@media (min-width: 992px) { - .container { - width: 970px; - } -} -@media (min-width: 1200px) { - .container { - width: 1170px; - } -} -.container-fluid { - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} -.row { - margin-right: -15px; - margin-left: -15px; -} -.row-no-gutters { - margin-right: 0; - margin-left: 0; -} -.row-no-gutters [class*="col-"] { - padding-right: 0; - padding-left: 0; -} -.col-xs-1, -.col-sm-1, -.col-md-1, -.col-lg-1, -.col-xs-2, -.col-sm-2, -.col-md-2, -.col-lg-2, -.col-xs-3, -.col-sm-3, -.col-md-3, -.col-lg-3, -.col-xs-4, -.col-sm-4, -.col-md-4, -.col-lg-4, -.col-xs-5, -.col-sm-5, -.col-md-5, -.col-lg-5, -.col-xs-6, -.col-sm-6, -.col-md-6, -.col-lg-6, -.col-xs-7, -.col-sm-7, -.col-md-7, -.col-lg-7, -.col-xs-8, -.col-sm-8, -.col-md-8, -.col-lg-8, -.col-xs-9, -.col-sm-9, -.col-md-9, -.col-lg-9, -.col-xs-10, -.col-sm-10, -.col-md-10, -.col-lg-10, -.col-xs-11, -.col-sm-11, -.col-md-11, -.col-lg-11, -.col-xs-12, -.col-sm-12, -.col-md-12, -.col-lg-12 { - position: relative; - min-height: 1px; - padding-right: 15px; - padding-left: 15px; -} -.col-xs-1, -.col-xs-2, -.col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, -.col-xs-9, -.col-xs-10, -.col-xs-11, -.col-xs-12 { - float: left; -} -.col-xs-12 { - width: 100%; -} -.col-xs-11 { - width: 91.66666667%; -} -.col-xs-10 { - width: 83.33333333%; -} -.col-xs-9 { - width: 75%; -} -.col-xs-8 { - width: 66.66666667%; -} -.col-xs-7 { - width: 58.33333333%; -} -.col-xs-6 { - width: 50%; -} -.col-xs-5 { - width: 41.66666667%; -} -.col-xs-4 { - width: 33.33333333%; -} -.col-xs-3 { - width: 25%; -} -.col-xs-2 { - width: 16.66666667%; -} -.col-xs-1 { - width: 8.33333333%; -} -.col-xs-pull-12 { - right: 100%; -} -.col-xs-pull-11 { - right: 91.66666667%; -} -.col-xs-pull-10 { - right: 83.33333333%; -} -.col-xs-pull-9 { - right: 75%; -} -.col-xs-pull-8 { - right: 66.66666667%; -} -.col-xs-pull-7 { - right: 58.33333333%; -} -.col-xs-pull-6 { - right: 50%; -} -.col-xs-pull-5 { - right: 41.66666667%; -} -.col-xs-pull-4 { - right: 33.33333333%; -} -.col-xs-pull-3 { - right: 25%; -} -.col-xs-pull-2 { - right: 16.66666667%; -} -.col-xs-pull-1 { - right: 8.33333333%; -} -.col-xs-pull-0 { - right: auto; -} -.col-xs-push-12 { - left: 100%; -} -.col-xs-push-11 { - left: 91.66666667%; -} -.col-xs-push-10 { - left: 83.33333333%; -} -.col-xs-push-9 { - left: 75%; -} -.col-xs-push-8 { - left: 66.66666667%; -} -.col-xs-push-7 { - left: 58.33333333%; -} -.col-xs-push-6 { - left: 50%; -} -.col-xs-push-5 { - left: 41.66666667%; -} -.col-xs-push-4 { - left: 33.33333333%; -} -.col-xs-push-3 { - left: 25%; -} -.col-xs-push-2 { - left: 16.66666667%; -} -.col-xs-push-1 { - left: 8.33333333%; -} -.col-xs-push-0 { - left: auto; -} -.col-xs-offset-12 { - margin-left: 100%; -} -.col-xs-offset-11 { - margin-left: 91.66666667%; -} -.col-xs-offset-10 { - margin-left: 83.33333333%; -} -.col-xs-offset-9 { - margin-left: 75%; -} -.col-xs-offset-8 { - margin-left: 66.66666667%; -} -.col-xs-offset-7 { - margin-left: 58.33333333%; -} -.col-xs-offset-6 { - margin-left: 50%; -} -.col-xs-offset-5 { - margin-left: 41.66666667%; -} -.col-xs-offset-4 { - margin-left: 33.33333333%; -} -.col-xs-offset-3 { - margin-left: 25%; -} -.col-xs-offset-2 { - margin-left: 16.66666667%; -} -.col-xs-offset-1 { - margin-left: 8.33333333%; -} -.col-xs-offset-0 { - margin-left: 0%; -} -@media (min-width: 768px) { - .col-sm-1, - .col-sm-2, - .col-sm-3, - .col-sm-4, - .col-sm-5, - .col-sm-6, - .col-sm-7, - .col-sm-8, - .col-sm-9, - .col-sm-10, - .col-sm-11, - .col-sm-12 { - float: left; - } - .col-sm-12 { - width: 100%; - } - .col-sm-11 { - width: 91.66666667%; - } - .col-sm-10 { - width: 83.33333333%; - } - .col-sm-9 { - width: 75%; - } - .col-sm-8 { - width: 66.66666667%; - } - .col-sm-7 { - width: 58.33333333%; - } - .col-sm-6 { - width: 50%; - } - .col-sm-5 { - width: 41.66666667%; - } - .col-sm-4 { - width: 33.33333333%; - } - .col-sm-3 { - width: 25%; - } - .col-sm-2 { - width: 16.66666667%; - } - .col-sm-1 { - width: 8.33333333%; - } - .col-sm-pull-12 { - right: 100%; - } - .col-sm-pull-11 { - right: 91.66666667%; - } - .col-sm-pull-10 { - right: 83.33333333%; - } - .col-sm-pull-9 { - right: 75%; - } - .col-sm-pull-8 { - right: 66.66666667%; - } - .col-sm-pull-7 { - right: 58.33333333%; - } - .col-sm-pull-6 { - right: 50%; - } - .col-sm-pull-5 { - right: 41.66666667%; - } - .col-sm-pull-4 { - right: 33.33333333%; - } - .col-sm-pull-3 { - right: 25%; - } - .col-sm-pull-2 { - right: 16.66666667%; - } - .col-sm-pull-1 { - right: 8.33333333%; - } - .col-sm-pull-0 { - right: auto; - } - .col-sm-push-12 { - left: 100%; - } - .col-sm-push-11 { - left: 91.66666667%; - } - .col-sm-push-10 { - left: 83.33333333%; - } - .col-sm-push-9 { - left: 75%; - } - .col-sm-push-8 { - left: 66.66666667%; - } - .col-sm-push-7 { - left: 58.33333333%; - } - .col-sm-push-6 { - left: 50%; - } - .col-sm-push-5 { - left: 41.66666667%; - } - .col-sm-push-4 { - left: 33.33333333%; - } - .col-sm-push-3 { - left: 25%; - } - .col-sm-push-2 { - left: 16.66666667%; - } - .col-sm-push-1 { - left: 8.33333333%; - } - .col-sm-push-0 { - left: auto; - } - .col-sm-offset-12 { - margin-left: 100%; - } - .col-sm-offset-11 { - margin-left: 91.66666667%; - } - .col-sm-offset-10 { - margin-left: 83.33333333%; - } - .col-sm-offset-9 { - margin-left: 75%; - } - .col-sm-offset-8 { - margin-left: 66.66666667%; - } - .col-sm-offset-7 { - margin-left: 58.33333333%; - } - .col-sm-offset-6 { - margin-left: 50%; - } - .col-sm-offset-5 { - margin-left: 41.66666667%; - } - .col-sm-offset-4 { - margin-left: 33.33333333%; - } - .col-sm-offset-3 { - margin-left: 25%; - } - .col-sm-offset-2 { - margin-left: 16.66666667%; - } - .col-sm-offset-1 { - margin-left: 8.33333333%; - } - .col-sm-offset-0 { - margin-left: 0%; - } -} -@media (min-width: 992px) { - .col-md-1, - .col-md-2, - .col-md-3, - .col-md-4, - .col-md-5, - .col-md-6, - .col-md-7, - .col-md-8, - .col-md-9, - .col-md-10, - .col-md-11, - .col-md-12 { - float: left; - } - .col-md-12 { - width: 100%; - } - .col-md-11 { - width: 91.66666667%; - } - .col-md-10 { - width: 83.33333333%; - } - .col-md-9 { - width: 75%; - } - .col-md-8 { - width: 66.66666667%; - } - .col-md-7 { - width: 58.33333333%; - } - .col-md-6 { - width: 50%; - } - .col-md-5 { - width: 41.66666667%; - } - .col-md-4 { - width: 33.33333333%; - } - .col-md-3 { - width: 25%; - } - .col-md-2 { - width: 16.66666667%; - } - .col-md-1 { - width: 8.33333333%; - } - .col-md-pull-12 { - right: 100%; - } - .col-md-pull-11 { - right: 91.66666667%; - } - .col-md-pull-10 { - right: 83.33333333%; - } - .col-md-pull-9 { - right: 75%; - } - .col-md-pull-8 { - right: 66.66666667%; - } - .col-md-pull-7 { - right: 58.33333333%; - } - .col-md-pull-6 { - right: 50%; - } - .col-md-pull-5 { - right: 41.66666667%; - } - .col-md-pull-4 { - right: 33.33333333%; - } - .col-md-pull-3 { - right: 25%; - } - .col-md-pull-2 { - right: 16.66666667%; - } - .col-md-pull-1 { - right: 8.33333333%; - } - .col-md-pull-0 { - right: auto; - } - .col-md-push-12 { - left: 100%; - } - .col-md-push-11 { - left: 91.66666667%; - } - .col-md-push-10 { - left: 83.33333333%; - } - .col-md-push-9 { - left: 75%; - } - .col-md-push-8 { - left: 66.66666667%; - } - .col-md-push-7 { - left: 58.33333333%; - } - .col-md-push-6 { - left: 50%; - } - .col-md-push-5 { - left: 41.66666667%; - } - .col-md-push-4 { - left: 33.33333333%; - } - .col-md-push-3 { - left: 25%; - } - .col-md-push-2 { - left: 16.66666667%; - } - .col-md-push-1 { - left: 8.33333333%; - } - .col-md-push-0 { - left: auto; - } - .col-md-offset-12 { - margin-left: 100%; - } - .col-md-offset-11 { - margin-left: 91.66666667%; - } - .col-md-offset-10 { - margin-left: 83.33333333%; - } - .col-md-offset-9 { - margin-left: 75%; - } - .col-md-offset-8 { - margin-left: 66.66666667%; - } - .col-md-offset-7 { - margin-left: 58.33333333%; - } - .col-md-offset-6 { - margin-left: 50%; - } - .col-md-offset-5 { - margin-left: 41.66666667%; - } - .col-md-offset-4 { - margin-left: 33.33333333%; - } - .col-md-offset-3 { - margin-left: 25%; - } - .col-md-offset-2 { - margin-left: 16.66666667%; - } - .col-md-offset-1 { - margin-left: 8.33333333%; - } - .col-md-offset-0 { - margin-left: 0%; - } -} -@media (min-width: 1200px) { - .col-lg-1, - .col-lg-2, - .col-lg-3, - .col-lg-4, - .col-lg-5, - .col-lg-6, - .col-lg-7, - .col-lg-8, - .col-lg-9, - .col-lg-10, - .col-lg-11, - .col-lg-12 { - float: left; - } - .col-lg-12 { - width: 100%; - } - .col-lg-11 { - width: 91.66666667%; - } - .col-lg-10 { - width: 83.33333333%; - } - .col-lg-9 { - width: 75%; - } - .col-lg-8 { - width: 66.66666667%; - } - .col-lg-7 { - width: 58.33333333%; - } - .col-lg-6 { - width: 50%; - } - .col-lg-5 { - width: 41.66666667%; - } - .col-lg-4 { - width: 33.33333333%; - } - .col-lg-3 { - width: 25%; - } - .col-lg-2 { - width: 16.66666667%; - } - .col-lg-1 { - width: 8.33333333%; - } - .col-lg-pull-12 { - right: 100%; - } - .col-lg-pull-11 { - right: 91.66666667%; - } - .col-lg-pull-10 { - right: 83.33333333%; - } - .col-lg-pull-9 { - right: 75%; - } - .col-lg-pull-8 { - right: 66.66666667%; - } - .col-lg-pull-7 { - right: 58.33333333%; - } - .col-lg-pull-6 { - right: 50%; - } - .col-lg-pull-5 { - right: 41.66666667%; - } - .col-lg-pull-4 { - right: 33.33333333%; - } - .col-lg-pull-3 { - right: 25%; - } - .col-lg-pull-2 { - right: 16.66666667%; - } - .col-lg-pull-1 { - right: 8.33333333%; - } - .col-lg-pull-0 { - right: auto; - } - .col-lg-push-12 { - left: 100%; - } - .col-lg-push-11 { - left: 91.66666667%; - } - .col-lg-push-10 { - left: 83.33333333%; - } - .col-lg-push-9 { - left: 75%; - } - .col-lg-push-8 { - left: 66.66666667%; - } - .col-lg-push-7 { - left: 58.33333333%; - } - .col-lg-push-6 { - left: 50%; - } - .col-lg-push-5 { - left: 41.66666667%; - } - .col-lg-push-4 { - left: 33.33333333%; - } - .col-lg-push-3 { - left: 25%; - } - .col-lg-push-2 { - left: 16.66666667%; - } - .col-lg-push-1 { - left: 8.33333333%; - } - .col-lg-push-0 { - left: auto; - } - .col-lg-offset-12 { - margin-left: 100%; - } - .col-lg-offset-11 { - margin-left: 91.66666667%; - } - .col-lg-offset-10 { - margin-left: 83.33333333%; - } - .col-lg-offset-9 { - margin-left: 75%; - } - .col-lg-offset-8 { - margin-left: 66.66666667%; - } - .col-lg-offset-7 { - margin-left: 58.33333333%; - } - .col-lg-offset-6 { - margin-left: 50%; - } - .col-lg-offset-5 { - margin-left: 41.66666667%; - } - .col-lg-offset-4 { - margin-left: 33.33333333%; - } - .col-lg-offset-3 { - margin-left: 25%; - } - .col-lg-offset-2 { - margin-left: 16.66666667%; - } - .col-lg-offset-1 { - margin-left: 8.33333333%; - } - .col-lg-offset-0 { - margin-left: 0%; - } -} -table { - background-color: transparent; -} -table col[class*="col-"] { - position: static; - display: table-column; - float: none; -} -table td[class*="col-"], -table th[class*="col-"] { - position: static; - display: table-cell; - float: none; -} -caption { - padding-top: 8px; - padding-bottom: 8px; - color: #777777; - text-align: left; -} -th { - text-align: left; -} -.table { - width: 100%; - max-width: 100%; - margin-bottom: 20px; -} -.table > thead > tr > th, -.table > tbody > tr > th, -.table > tfoot > tr > th, -.table > thead > tr > td, -.table > tbody > tr > td, -.table > tfoot > tr > td { - padding: 8px; - line-height: 1.42857143; - vertical-align: top; - border-top: 1px solid #ddd; -} -.table > thead > tr > th { - vertical-align: bottom; - border-bottom: 2px solid #ddd; -} -.table > caption + thead > tr:first-child > th, -.table > colgroup + thead > tr:first-child > th, -.table > thead:first-child > tr:first-child > th, -.table > caption + thead > tr:first-child > td, -.table > colgroup + thead > tr:first-child > td, -.table > thead:first-child > tr:first-child > td { - border-top: 0; -} -.table > tbody + tbody { - border-top: 2px solid #ddd; -} -.table .table { - background-color: #fff; -} -.table-condensed > thead > tr > th, -.table-condensed > tbody > tr > th, -.table-condensed > tfoot > tr > th, -.table-condensed > thead > tr > td, -.table-condensed > tbody > tr > td, -.table-condensed > tfoot > tr > td { - padding: 5px; -} -.table-bordered { - border: 1px solid #ddd; -} -.table-bordered > thead > tr > th, -.table-bordered > tbody > tr > th, -.table-bordered > tfoot > tr > th, -.table-bordered > thead > tr > td, -.table-bordered > tbody > tr > td, -.table-bordered > tfoot > tr > td { - border: 1px solid #ddd; -} -.table-bordered > thead > tr > th, -.table-bordered > thead > tr > td { - border-bottom-width: 2px; -} -.table-striped > tbody > tr:nth-of-type(odd) { - background-color: #f9f9f9; -} -.table-hover > tbody > tr:hover { - background-color: #f5f5f5; -} -.table > thead > tr > td.active, -.table > tbody > tr > td.active, -.table > tfoot > tr > td.active, -.table > thead > tr > th.active, -.table > tbody > tr > th.active, -.table > tfoot > tr > th.active, -.table > thead > tr.active > td, -.table > tbody > tr.active > td, -.table > tfoot > tr.active > td, -.table > thead > tr.active > th, -.table > tbody > tr.active > th, -.table > tfoot > tr.active > th { - background-color: #f5f5f5; -} -.table-hover > tbody > tr > td.active:hover, -.table-hover > tbody > tr > th.active:hover, -.table-hover > tbody > tr.active:hover > td, -.table-hover > tbody > tr:hover > .active, -.table-hover > tbody > tr.active:hover > th { - background-color: #e8e8e8; -} -.table > thead > tr > td.success, -.table > tbody > tr > td.success, -.table > tfoot > tr > td.success, -.table > thead > tr > th.success, -.table > tbody > tr > th.success, -.table > tfoot > tr > th.success, -.table > thead > tr.success > td, -.table > tbody > tr.success > td, -.table > tfoot > tr.success > td, -.table > thead > tr.success > th, -.table > tbody > tr.success > th, -.table > tfoot > tr.success > th { - background-color: #dff0d8; -} -.table-hover > tbody > tr > td.success:hover, -.table-hover > tbody > tr > th.success:hover, -.table-hover > tbody > tr.success:hover > td, -.table-hover > tbody > tr:hover > .success, -.table-hover > tbody > tr.success:hover > th { - background-color: #d0e9c6; -} -.table > thead > tr > td.info, -.table > tbody > tr > td.info, -.table > tfoot > tr > td.info, -.table > thead > tr > th.info, -.table > tbody > tr > th.info, -.table > tfoot > tr > th.info, -.table > thead > tr.info > td, -.table > tbody > tr.info > td, -.table > tfoot > tr.info > td, -.table > thead > tr.info > th, -.table > tbody > tr.info > th, -.table > tfoot > tr.info > th { - background-color: #d9edf7; -} -.table-hover > tbody > tr > td.info:hover, -.table-hover > tbody > tr > th.info:hover, -.table-hover > tbody > tr.info:hover > td, -.table-hover > tbody > tr:hover > .info, -.table-hover > tbody > tr.info:hover > th { - background-color: #c4e3f3; -} -.table > thead > tr > td.warning, -.table > tbody > tr > td.warning, -.table > tfoot > tr > td.warning, -.table > thead > tr > th.warning, -.table > tbody > tr > th.warning, -.table > tfoot > tr > th.warning, -.table > thead > tr.warning > td, -.table > tbody > tr.warning > td, -.table > tfoot > tr.warning > td, -.table > thead > tr.warning > th, -.table > tbody > tr.warning > th, -.table > tfoot > tr.warning > th { - background-color: #fcf8e3; -} -.table-hover > tbody > tr > td.warning:hover, -.table-hover > tbody > tr > th.warning:hover, -.table-hover > tbody > tr.warning:hover > td, -.table-hover > tbody > tr:hover > .warning, -.table-hover > tbody > tr.warning:hover > th { - background-color: #faf2cc; -} -.table > thead > tr > td.danger, -.table > tbody > tr > td.danger, -.table > tfoot > tr > td.danger, -.table > thead > tr > th.danger, -.table > tbody > tr > th.danger, -.table > tfoot > tr > th.danger, -.table > thead > tr.danger > td, -.table > tbody > tr.danger > td, -.table > tfoot > tr.danger > td, -.table > thead > tr.danger > th, -.table > tbody > tr.danger > th, -.table > tfoot > tr.danger > th { - background-color: #f2dede; -} -.table-hover > tbody > tr > td.danger:hover, -.table-hover > tbody > tr > th.danger:hover, -.table-hover > tbody > tr.danger:hover > td, -.table-hover > tbody > tr:hover > .danger, -.table-hover > tbody > tr.danger:hover > th { - background-color: #ebcccc; -} -.table-responsive { - min-height: 0.01%; - overflow-x: auto; -} -@media screen and (max-width: 767px) { - .table-responsive { - width: 100%; - margin-bottom: 15px; - overflow-y: hidden; - -ms-overflow-style: -ms-autohiding-scrollbar; - border: 1px solid #ddd; - } - .table-responsive > .table { - margin-bottom: 0; - } - .table-responsive > .table > thead > tr > th, - .table-responsive > .table > tbody > tr > th, - .table-responsive > .table > tfoot > tr > th, - .table-responsive > .table > thead > tr > td, - .table-responsive > .table > tbody > tr > td, - .table-responsive > .table > tfoot > tr > td { - white-space: nowrap; - } - .table-responsive > .table-bordered { - border: 0; - } - .table-responsive > .table-bordered > thead > tr > th:first-child, - .table-responsive > .table-bordered > tbody > tr > th:first-child, - .table-responsive > .table-bordered > tfoot > tr > th:first-child, - .table-responsive > .table-bordered > thead > tr > td:first-child, - .table-responsive > .table-bordered > tbody > tr > td:first-child, - .table-responsive > .table-bordered > tfoot > tr > td:first-child { - border-left: 0; - } - .table-responsive > .table-bordered > thead > tr > th:last-child, - .table-responsive > .table-bordered > tbody > tr > th:last-child, - .table-responsive > .table-bordered > tfoot > tr > th:last-child, - .table-responsive > .table-bordered > thead > tr > td:last-child, - .table-responsive > .table-bordered > tbody > tr > td:last-child, - .table-responsive > .table-bordered > tfoot > tr > td:last-child { - border-right: 0; - } - .table-responsive > .table-bordered > tbody > tr:last-child > th, - .table-responsive > .table-bordered > tfoot > tr:last-child > th, - .table-responsive > .table-bordered > tbody > tr:last-child > td, - .table-responsive > .table-bordered > tfoot > tr:last-child > td { - border-bottom: 0; - } -} -fieldset { - min-width: 0; - padding: 0; - margin: 0; - border: 0; -} -legend { - display: block; - width: 100%; - padding: 0; - margin-bottom: 20px; - font-size: 21px; - line-height: inherit; - color: #333333; - border: 0; - border-bottom: 1px solid #e5e5e5; -} -label { - display: inline-block; - max-width: 100%; - margin-bottom: 5px; - font-weight: 700; -} -input[type="search"] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} -input[type="radio"], -input[type="checkbox"] { - margin: 4px 0 0; - margin-top: 1px \9; - line-height: normal; -} -input[type="radio"][disabled], -input[type="checkbox"][disabled], -input[type="radio"].disabled, -input[type="checkbox"].disabled, -fieldset[disabled] input[type="radio"], -fieldset[disabled] input[type="checkbox"] { - cursor: not-allowed; -} -input[type="file"] { - display: block; -} -input[type="range"] { - display: block; - width: 100%; -} -select[multiple], -select[size] { - height: auto; -} -input[type="file"]:focus, -input[type="radio"]:focus, -input[type="checkbox"]:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -output { - display: block; - padding-top: 7px; - font-size: 14px; - line-height: 1.42857143; - color: #555555; -} -.form-control { - display: block; - width: 100%; - height: 34px; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - color: #555555; - background-color: #fff; - background-image: none; - border: 1px solid #ccc; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; -} -.form-control:focus { - border-color: #66afe9; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); -} -.form-control::-moz-placeholder { - color: #999; - opacity: 1; -} -.form-control:-ms-input-placeholder { - color: #999; -} -.form-control::-webkit-input-placeholder { - color: #999; -} -.form-control::-ms-expand { - background-color: transparent; - border: 0; -} -.form-control[disabled], -.form-control[readonly], -fieldset[disabled] .form-control { - background-color: #eeeeee; - opacity: 1; -} -.form-control[disabled], -fieldset[disabled] .form-control { - cursor: not-allowed; -} -textarea.form-control { - height: auto; -} -@media screen and (-webkit-min-device-pixel-ratio: 0) { - input[type="date"].form-control, - input[type="time"].form-control, - input[type="datetime-local"].form-control, - input[type="month"].form-control { - line-height: 34px; - } - input[type="date"].input-sm, - input[type="time"].input-sm, - input[type="datetime-local"].input-sm, - input[type="month"].input-sm, - .input-group-sm input[type="date"], - .input-group-sm input[type="time"], - .input-group-sm input[type="datetime-local"], - .input-group-sm input[type="month"] { - line-height: 30px; - } - input[type="date"].input-lg, - input[type="time"].input-lg, - input[type="datetime-local"].input-lg, - input[type="month"].input-lg, - .input-group-lg input[type="date"], - .input-group-lg input[type="time"], - .input-group-lg input[type="datetime-local"], - .input-group-lg input[type="month"] { - line-height: 46px; - } -} -.form-group { - margin-bottom: 15px; -} -.radio, -.checkbox { - position: relative; - display: block; - margin-top: 10px; - margin-bottom: 10px; -} -.radio.disabled label, -.checkbox.disabled label, -fieldset[disabled] .radio label, -fieldset[disabled] .checkbox label { - cursor: not-allowed; -} -.radio label, -.checkbox label { - min-height: 20px; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - cursor: pointer; -} -.radio input[type="radio"], -.radio-inline input[type="radio"], -.checkbox input[type="checkbox"], -.checkbox-inline input[type="checkbox"] { - position: absolute; - margin-top: 4px \9; - margin-left: -20px; -} -.radio + .radio, -.checkbox + .checkbox { - margin-top: -5px; -} -.radio-inline, -.checkbox-inline { - position: relative; - display: inline-block; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - vertical-align: middle; - cursor: pointer; -} -.radio-inline.disabled, -.checkbox-inline.disabled, -fieldset[disabled] .radio-inline, -fieldset[disabled] .checkbox-inline { - cursor: not-allowed; -} -.radio-inline + .radio-inline, -.checkbox-inline + .checkbox-inline { - margin-top: 0; - margin-left: 10px; -} -.form-control-static { - min-height: 34px; - padding-top: 7px; - padding-bottom: 7px; - margin-bottom: 0; -} -.form-control-static.input-lg, -.form-control-static.input-sm { - padding-right: 0; - padding-left: 0; -} -.input-sm { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -select.input-sm { - height: 30px; - line-height: 30px; -} -textarea.input-sm, -select[multiple].input-sm { - height: auto; -} -.form-group-sm .form-control { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.form-group-sm select.form-control { - height: 30px; - line-height: 30px; -} -.form-group-sm textarea.form-control, -.form-group-sm select[multiple].form-control { - height: auto; -} -.form-group-sm .form-control-static { - height: 30px; - min-height: 32px; - padding: 6px 10px; - font-size: 12px; - line-height: 1.5; -} -.input-lg { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -select.input-lg { - height: 46px; - line-height: 46px; -} -textarea.input-lg, -select[multiple].input-lg { - height: auto; -} -.form-group-lg .form-control { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -.form-group-lg select.form-control { - height: 46px; - line-height: 46px; -} -.form-group-lg textarea.form-control, -.form-group-lg select[multiple].form-control { - height: auto; -} -.form-group-lg .form-control-static { - height: 46px; - min-height: 38px; - padding: 11px 16px; - font-size: 18px; - line-height: 1.3333333; -} -.has-feedback { - position: relative; -} -.has-feedback .form-control { - padding-right: 42.5px; -} -.form-control-feedback { - position: absolute; - top: 0; - right: 0; - z-index: 2; - display: block; - width: 34px; - height: 34px; - line-height: 34px; - text-align: center; - pointer-events: none; -} -.input-lg + .form-control-feedback, -.input-group-lg + .form-control-feedback, -.form-group-lg .form-control + .form-control-feedback { - width: 46px; - height: 46px; - line-height: 46px; -} -.input-sm + .form-control-feedback, -.input-group-sm + .form-control-feedback, -.form-group-sm .form-control + .form-control-feedback { - width: 30px; - height: 30px; - line-height: 30px; -} -.has-success .help-block, -.has-success .control-label, -.has-success .radio, -.has-success .checkbox, -.has-success .radio-inline, -.has-success .checkbox-inline, -.has-success.radio label, -.has-success.checkbox label, -.has-success.radio-inline label, -.has-success.checkbox-inline label { - color: #3c763d; -} -.has-success .form-control { - border-color: #3c763d; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.has-success .form-control:focus { - border-color: #2b542c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; -} -.has-success .input-group-addon { - color: #3c763d; - background-color: #dff0d8; - border-color: #3c763d; -} -.has-success .form-control-feedback { - color: #3c763d; -} -.has-warning .help-block, -.has-warning .control-label, -.has-warning .radio, -.has-warning .checkbox, -.has-warning .radio-inline, -.has-warning .checkbox-inline, -.has-warning.radio label, -.has-warning.checkbox label, -.has-warning.radio-inline label, -.has-warning.checkbox-inline label { - color: #8a6d3b; -} -.has-warning .form-control { - border-color: #8a6d3b; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.has-warning .form-control:focus { - border-color: #66512c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; -} -.has-warning .input-group-addon { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #8a6d3b; -} -.has-warning .form-control-feedback { - color: #8a6d3b; -} -.has-error .help-block, -.has-error .control-label, -.has-error .radio, -.has-error .checkbox, -.has-error .radio-inline, -.has-error .checkbox-inline, -.has-error.radio label, -.has-error.checkbox label, -.has-error.radio-inline label, -.has-error.checkbox-inline label { - color: #a94442; -} -.has-error .form-control { - border-color: #a94442; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.has-error .form-control:focus { - border-color: #843534; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; -} -.has-error .input-group-addon { - color: #a94442; - background-color: #f2dede; - border-color: #a94442; -} -.has-error .form-control-feedback { - color: #a94442; -} -.has-feedback label ~ .form-control-feedback { - top: 25px; -} -.has-feedback label.sr-only ~ .form-control-feedback { - top: 0; -} -.help-block { - display: block; - margin-top: 5px; - margin-bottom: 10px; - color: #737373; -} -@media (min-width: 768px) { - .form-inline .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle; - } - .form-inline .form-control { - display: inline-block; - width: auto; - vertical-align: middle; - } - .form-inline .form-control-static { - display: inline-block; - } - .form-inline .input-group { - display: inline-table; - vertical-align: middle; - } - .form-inline .input-group .input-group-addon, - .form-inline .input-group .input-group-btn, - .form-inline .input-group .form-control { - width: auto; - } - .form-inline .input-group > .form-control { - width: 100%; - } - .form-inline .control-label { - margin-bottom: 0; - vertical-align: middle; - } - .form-inline .radio, - .form-inline .checkbox { - display: inline-block; - margin-top: 0; - margin-bottom: 0; - vertical-align: middle; - } - .form-inline .radio label, - .form-inline .checkbox label { - padding-left: 0; - } - .form-inline .radio input[type="radio"], - .form-inline .checkbox input[type="checkbox"] { - position: relative; - margin-left: 0; - } - .form-inline .has-feedback .form-control-feedback { - top: 0; - } -} -.form-horizontal .radio, -.form-horizontal .checkbox, -.form-horizontal .radio-inline, -.form-horizontal .checkbox-inline { - padding-top: 7px; - margin-top: 0; - margin-bottom: 0; -} -.form-horizontal .radio, -.form-horizontal .checkbox { - min-height: 27px; -} -.form-horizontal .form-group { - margin-right: -15px; - margin-left: -15px; -} -@media (min-width: 768px) { - .form-horizontal .control-label { - padding-top: 7px; - margin-bottom: 0; - text-align: right; - } -} -.form-horizontal .has-feedback .form-control-feedback { - right: 15px; -} -@media (min-width: 768px) { - .form-horizontal .form-group-lg .control-label { - padding-top: 11px; - font-size: 18px; - } -} -@media (min-width: 768px) { - .form-horizontal .form-group-sm .control-label { - padding-top: 6px; - font-size: 12px; - } -} -.btn { - display: inline-block; - margin-bottom: 0; - font-weight: normal; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -ms-touch-action: manipulation; - touch-action: manipulation; - cursor: pointer; - background-image: none; - border: 1px solid transparent; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - border-radius: 4px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.btn:focus, -.btn:active:focus, -.btn.active:focus, -.btn.focus, -.btn:active.focus, -.btn.active.focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -.btn:hover, -.btn:focus, -.btn.focus { - color: #333; - text-decoration: none; -} -.btn:active, -.btn.active { - background-image: none; - outline: 0; - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); -} -.btn.disabled, -.btn[disabled], -fieldset[disabled] .btn { - cursor: not-allowed; - filter: alpha(opacity=65); - opacity: 0.65; - -webkit-box-shadow: none; - box-shadow: none; -} -a.btn.disabled, -fieldset[disabled] a.btn { - pointer-events: none; -} -.btn-default { - color: #333; - background-color: #fff; - border-color: #ccc; -} -.btn-default:focus, -.btn-default.focus { - color: #333; - background-color: #e6e6e6; - border-color: #8c8c8c; -} -.btn-default:hover { - color: #333; - background-color: #e6e6e6; - border-color: #adadad; -} -.btn-default:active, -.btn-default.active, -.open > .dropdown-toggle.btn-default { - color: #333; - background-color: #e6e6e6; - background-image: none; - border-color: #adadad; -} -.btn-default:active:hover, -.btn-default.active:hover, -.open > .dropdown-toggle.btn-default:hover, -.btn-default:active:focus, -.btn-default.active:focus, -.open > .dropdown-toggle.btn-default:focus, -.btn-default:active.focus, -.btn-default.active.focus, -.open > .dropdown-toggle.btn-default.focus { - color: #333; - background-color: #d4d4d4; - border-color: #8c8c8c; -} -.btn-default.disabled:hover, -.btn-default[disabled]:hover, -fieldset[disabled] .btn-default:hover, -.btn-default.disabled:focus, -.btn-default[disabled]:focus, -fieldset[disabled] .btn-default:focus, -.btn-default.disabled.focus, -.btn-default[disabled].focus, -fieldset[disabled] .btn-default.focus { - background-color: #fff; - border-color: #ccc; -} -.btn-default .badge { - color: #fff; - background-color: #333; -} -.btn-primary { - color: #fff; - background-color: #337ab7; - border-color: #2e6da4; -} -.btn-primary:focus, -.btn-primary.focus { - color: #fff; - background-color: #286090; - border-color: #122b40; -} -.btn-primary:hover { - color: #fff; - background-color: #286090; - border-color: #204d74; -} -.btn-primary:active, -.btn-primary.active, -.open > .dropdown-toggle.btn-primary { - color: #fff; - background-color: #286090; - background-image: none; - border-color: #204d74; -} -.btn-primary:active:hover, -.btn-primary.active:hover, -.open > .dropdown-toggle.btn-primary:hover, -.btn-primary:active:focus, -.btn-primary.active:focus, -.open > .dropdown-toggle.btn-primary:focus, -.btn-primary:active.focus, -.btn-primary.active.focus, -.open > .dropdown-toggle.btn-primary.focus { - color: #fff; - background-color: #204d74; - border-color: #122b40; -} -.btn-primary.disabled:hover, -.btn-primary[disabled]:hover, -fieldset[disabled] .btn-primary:hover, -.btn-primary.disabled:focus, -.btn-primary[disabled]:focus, -fieldset[disabled] .btn-primary:focus, -.btn-primary.disabled.focus, -.btn-primary[disabled].focus, -fieldset[disabled] .btn-primary.focus { - background-color: #337ab7; - border-color: #2e6da4; -} -.btn-primary .badge { - color: #337ab7; - background-color: #fff; -} -.btn-success { - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c; -} -.btn-success:focus, -.btn-success.focus { - color: #fff; - background-color: #449d44; - border-color: #255625; -} -.btn-success:hover { - color: #fff; - background-color: #449d44; - border-color: #398439; -} -.btn-success:active, -.btn-success.active, -.open > .dropdown-toggle.btn-success { - color: #fff; - background-color: #449d44; - background-image: none; - border-color: #398439; -} -.btn-success:active:hover, -.btn-success.active:hover, -.open > .dropdown-toggle.btn-success:hover, -.btn-success:active:focus, -.btn-success.active:focus, -.open > .dropdown-toggle.btn-success:focus, -.btn-success:active.focus, -.btn-success.active.focus, -.open > .dropdown-toggle.btn-success.focus { - color: #fff; - background-color: #398439; - border-color: #255625; -} -.btn-success.disabled:hover, -.btn-success[disabled]:hover, -fieldset[disabled] .btn-success:hover, -.btn-success.disabled:focus, -.btn-success[disabled]:focus, -fieldset[disabled] .btn-success:focus, -.btn-success.disabled.focus, -.btn-success[disabled].focus, -fieldset[disabled] .btn-success.focus { - background-color: #5cb85c; - border-color: #4cae4c; -} -.btn-success .badge { - color: #5cb85c; - background-color: #fff; -} -.btn-info { - color: #fff; - background-color: #5bc0de; - border-color: #46b8da; -} -.btn-info:focus, -.btn-info.focus { - color: #fff; - background-color: #31b0d5; - border-color: #1b6d85; -} -.btn-info:hover { - color: #fff; - background-color: #31b0d5; - border-color: #269abc; -} -.btn-info:active, -.btn-info.active, -.open > .dropdown-toggle.btn-info { - color: #fff; - background-color: #31b0d5; - background-image: none; - border-color: #269abc; -} -.btn-info:active:hover, -.btn-info.active:hover, -.open > .dropdown-toggle.btn-info:hover, -.btn-info:active:focus, -.btn-info.active:focus, -.open > .dropdown-toggle.btn-info:focus, -.btn-info:active.focus, -.btn-info.active.focus, -.open > .dropdown-toggle.btn-info.focus { - color: #fff; - background-color: #269abc; - border-color: #1b6d85; -} -.btn-info.disabled:hover, -.btn-info[disabled]:hover, -fieldset[disabled] .btn-info:hover, -.btn-info.disabled:focus, -.btn-info[disabled]:focus, -fieldset[disabled] .btn-info:focus, -.btn-info.disabled.focus, -.btn-info[disabled].focus, -fieldset[disabled] .btn-info.focus { - background-color: #5bc0de; - border-color: #46b8da; -} -.btn-info .badge { - color: #5bc0de; - background-color: #fff; -} -.btn-warning { - color: #fff; - background-color: #f0ad4e; - border-color: #eea236; -} -.btn-warning:focus, -.btn-warning.focus { - color: #fff; - background-color: #ec971f; - border-color: #985f0d; -} -.btn-warning:hover { - color: #fff; - background-color: #ec971f; - border-color: #d58512; -} -.btn-warning:active, -.btn-warning.active, -.open > .dropdown-toggle.btn-warning { - color: #fff; - background-color: #ec971f; - background-image: none; - border-color: #d58512; -} -.btn-warning:active:hover, -.btn-warning.active:hover, -.open > .dropdown-toggle.btn-warning:hover, -.btn-warning:active:focus, -.btn-warning.active:focus, -.open > .dropdown-toggle.btn-warning:focus, -.btn-warning:active.focus, -.btn-warning.active.focus, -.open > .dropdown-toggle.btn-warning.focus { - color: #fff; - background-color: #d58512; - border-color: #985f0d; -} -.btn-warning.disabled:hover, -.btn-warning[disabled]:hover, -fieldset[disabled] .btn-warning:hover, -.btn-warning.disabled:focus, -.btn-warning[disabled]:focus, -fieldset[disabled] .btn-warning:focus, -.btn-warning.disabled.focus, -.btn-warning[disabled].focus, -fieldset[disabled] .btn-warning.focus { - background-color: #f0ad4e; - border-color: #eea236; -} -.btn-warning .badge { - color: #f0ad4e; - background-color: #fff; -} -.btn-danger { - color: #fff; - background-color: #d9534f; - border-color: #d43f3a; -} -.btn-danger:focus, -.btn-danger.focus { - color: #fff; - background-color: #c9302c; - border-color: #761c19; -} -.btn-danger:hover { - color: #fff; - background-color: #c9302c; - border-color: #ac2925; -} -.btn-danger:active, -.btn-danger.active, -.open > .dropdown-toggle.btn-danger { - color: #fff; - background-color: #c9302c; - background-image: none; - border-color: #ac2925; -} -.btn-danger:active:hover, -.btn-danger.active:hover, -.open > .dropdown-toggle.btn-danger:hover, -.btn-danger:active:focus, -.btn-danger.active:focus, -.open > .dropdown-toggle.btn-danger:focus, -.btn-danger:active.focus, -.btn-danger.active.focus, -.open > .dropdown-toggle.btn-danger.focus { - color: #fff; - background-color: #ac2925; - border-color: #761c19; -} -.btn-danger.disabled:hover, -.btn-danger[disabled]:hover, -fieldset[disabled] .btn-danger:hover, -.btn-danger.disabled:focus, -.btn-danger[disabled]:focus, -fieldset[disabled] .btn-danger:focus, -.btn-danger.disabled.focus, -.btn-danger[disabled].focus, -fieldset[disabled] .btn-danger.focus { - background-color: #d9534f; - border-color: #d43f3a; -} -.btn-danger .badge { - color: #d9534f; - background-color: #fff; -} -.btn-link { - font-weight: 400; - color: #337ab7; - border-radius: 0; -} -.btn-link, -.btn-link:active, -.btn-link.active, -.btn-link[disabled], -fieldset[disabled] .btn-link { - background-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} -.btn-link, -.btn-link:hover, -.btn-link:focus, -.btn-link:active { - border-color: transparent; -} -.btn-link:hover, -.btn-link:focus { - color: #23527c; - text-decoration: underline; - background-color: transparent; -} -.btn-link[disabled]:hover, -fieldset[disabled] .btn-link:hover, -.btn-link[disabled]:focus, -fieldset[disabled] .btn-link:focus { - color: #777777; - text-decoration: none; -} -.btn-lg, -.btn-group-lg > .btn { - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -.btn-sm, -.btn-group-sm > .btn { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-xs, -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-block { - display: block; - width: 100%; -} -.btn-block + .btn-block { - margin-top: 5px; -} -input[type="submit"].btn-block, -input[type="reset"].btn-block, -input[type="button"].btn-block { - width: 100%; -} -.fade { - opacity: 0; - -webkit-transition: opacity 0.15s linear; - -o-transition: opacity 0.15s linear; - transition: opacity 0.15s linear; -} -.fade.in { - opacity: 1; -} -.collapse { - display: none; -} -.collapse.in { - display: block; -} -tr.collapse.in { - display: table-row; -} -tbody.collapse.in { - display: table-row-group; -} -.collapsing { - position: relative; - height: 0; - overflow: hidden; - -webkit-transition-property: height, visibility; - -o-transition-property: height, visibility; - transition-property: height, visibility; - -webkit-transition-duration: 0.35s; - -o-transition-duration: 0.35s; - transition-duration: 0.35s; - -webkit-transition-timing-function: ease; - -o-transition-timing-function: ease; - transition-timing-function: ease; -} -.caret { - display: inline-block; - width: 0; - height: 0; - margin-left: 2px; - vertical-align: middle; - border-top: 4px dashed; - border-top: 4px solid \9; - border-right: 4px solid transparent; - border-left: 4px solid transparent; -} -.dropup, -.dropdown { - position: relative; -} -.dropdown-toggle:focus { - outline: 0; -} -.dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - font-size: 14px; - text-align: left; - list-style: none; - background-color: #fff; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); -} -.dropdown-menu.pull-right { - right: 0; - left: auto; -} -.dropdown-menu .divider { - height: 1px; - margin: 9px 0; - overflow: hidden; - background-color: #e5e5e5; -} -.dropdown-menu > li > a { - display: block; - padding: 3px 20px; - clear: both; - font-weight: 400; - line-height: 1.42857143; - color: #333333; - white-space: nowrap; -} -.dropdown-menu > li > a:hover, -.dropdown-menu > li > a:focus { - color: #262626; - text-decoration: none; - background-color: #f5f5f5; -} -.dropdown-menu > .active > a, -.dropdown-menu > .active > a:hover, -.dropdown-menu > .active > a:focus { - color: #fff; - text-decoration: none; - background-color: #337ab7; - outline: 0; -} -.dropdown-menu > .disabled > a, -.dropdown-menu > .disabled > a:hover, -.dropdown-menu > .disabled > a:focus { - color: #777777; -} -.dropdown-menu > .disabled > a:hover, -.dropdown-menu > .disabled > a:focus { - text-decoration: none; - cursor: not-allowed; - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -} -.open > .dropdown-menu { - display: block; -} -.open > a { - outline: 0; -} -.dropdown-menu-right { - right: 0; - left: auto; -} -.dropdown-menu-left { - right: auto; - left: 0; -} -.dropdown-header { - display: block; - padding: 3px 20px; - font-size: 12px; - line-height: 1.42857143; - color: #777777; - white-space: nowrap; -} -.dropdown-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 990; -} -.pull-right > .dropdown-menu { - right: 0; - left: auto; -} -.dropup .caret, -.navbar-fixed-bottom .dropdown .caret { - content: ""; - border-top: 0; - border-bottom: 4px dashed; - border-bottom: 4px solid \9; -} -.dropup .dropdown-menu, -.navbar-fixed-bottom .dropdown .dropdown-menu { - top: auto; - bottom: 100%; - margin-bottom: 2px; -} -@media (min-width: 768px) { - .navbar-right .dropdown-menu { - right: 0; - left: auto; - } - .navbar-right .dropdown-menu-left { - right: auto; - left: 0; - } -} -.btn-group, -.btn-group-vertical { - position: relative; - display: inline-block; - vertical-align: middle; -} -.btn-group > .btn, -.btn-group-vertical > .btn { - position: relative; - float: left; -} -.btn-group > .btn:hover, -.btn-group-vertical > .btn:hover, -.btn-group > .btn:focus, -.btn-group-vertical > .btn:focus, -.btn-group > .btn:active, -.btn-group-vertical > .btn:active, -.btn-group > .btn.active, -.btn-group-vertical > .btn.active { - z-index: 2; -} -.btn-group .btn + .btn, -.btn-group .btn + .btn-group, -.btn-group .btn-group + .btn, -.btn-group .btn-group + .btn-group { - margin-left: -1px; -} -.btn-toolbar { - margin-left: -5px; -} -.btn-toolbar .btn, -.btn-toolbar .btn-group, -.btn-toolbar .input-group { - float: left; -} -.btn-toolbar > .btn, -.btn-toolbar > .btn-group, -.btn-toolbar > .input-group { - margin-left: 5px; -} -.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { - border-radius: 0; -} -.btn-group > .btn:first-child { - margin-left: 0; -} -.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.btn-group > .btn:last-child:not(:first-child), -.btn-group > .dropdown-toggle:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group > .btn-group { - float: left; -} -.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { - border-radius: 0; -} -.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, -.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group .dropdown-toggle:active, -.btn-group.open .dropdown-toggle { - outline: 0; -} -.btn-group > .btn + .dropdown-toggle { - padding-right: 8px; - padding-left: 8px; -} -.btn-group > .btn-lg + .dropdown-toggle { - padding-right: 12px; - padding-left: 12px; -} -.btn-group.open .dropdown-toggle { - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); -} -.btn-group.open .dropdown-toggle.btn-link { - -webkit-box-shadow: none; - box-shadow: none; -} -.btn .caret { - margin-left: 0; -} -.btn-lg .caret { - border-width: 5px 5px 0; - border-bottom-width: 0; -} -.dropup .btn-lg .caret { - border-width: 0 5px 5px; -} -.btn-group-vertical > .btn, -.btn-group-vertical > .btn-group, -.btn-group-vertical > .btn-group > .btn { - display: block; - float: none; - width: 100%; - max-width: 100%; -} -.btn-group-vertical > .btn-group > .btn { - float: none; -} -.btn-group-vertical > .btn + .btn, -.btn-group-vertical > .btn + .btn-group, -.btn-group-vertical > .btn-group + .btn, -.btn-group-vertical > .btn-group + .btn-group { - margin-top: -1px; - margin-left: 0; -} -.btn-group-vertical > .btn:not(:first-child):not(:last-child) { - border-radius: 0; -} -.btn-group-vertical > .btn:first-child:not(:last-child) { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group-vertical > .btn:last-child:not(:first-child) { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; -} -.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { - border-radius: 0; -} -.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, -.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.btn-group-justified { - display: table; - width: 100%; - table-layout: fixed; - border-collapse: separate; -} -.btn-group-justified > .btn, -.btn-group-justified > .btn-group { - display: table-cell; - float: none; - width: 1%; -} -.btn-group-justified > .btn-group .btn { - width: 100%; -} -.btn-group-justified > .btn-group .dropdown-menu { - left: auto; -} -[data-toggle="buttons"] > .btn input[type="radio"], -[data-toggle="buttons"] > .btn-group > .btn input[type="radio"], -[data-toggle="buttons"] > .btn input[type="checkbox"], -[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { - position: absolute; - clip: rect(0, 0, 0, 0); - pointer-events: none; -} -.input-group { - position: relative; - display: table; - border-collapse: separate; -} -.input-group[class*="col-"] { - float: none; - padding-right: 0; - padding-left: 0; -} -.input-group .form-control { - position: relative; - z-index: 2; - float: left; - width: 100%; - margin-bottom: 0; -} -.input-group .form-control:focus { - z-index: 3; -} -.input-group-lg > .form-control, -.input-group-lg > .input-group-addon, -.input-group-lg > .input-group-btn > .btn { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -select.input-group-lg > .form-control, -select.input-group-lg > .input-group-addon, -select.input-group-lg > .input-group-btn > .btn { - height: 46px; - line-height: 46px; -} -textarea.input-group-lg > .form-control, -textarea.input-group-lg > .input-group-addon, -textarea.input-group-lg > .input-group-btn > .btn, -select[multiple].input-group-lg > .form-control, -select[multiple].input-group-lg > .input-group-addon, -select[multiple].input-group-lg > .input-group-btn > .btn { - height: auto; -} -.input-group-sm > .form-control, -.input-group-sm > .input-group-addon, -.input-group-sm > .input-group-btn > .btn { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -select.input-group-sm > .form-control, -select.input-group-sm > .input-group-addon, -select.input-group-sm > .input-group-btn > .btn { - height: 30px; - line-height: 30px; -} -textarea.input-group-sm > .form-control, -textarea.input-group-sm > .input-group-addon, -textarea.input-group-sm > .input-group-btn > .btn, -select[multiple].input-group-sm > .form-control, -select[multiple].input-group-sm > .input-group-addon, -select[multiple].input-group-sm > .input-group-btn > .btn { - height: auto; -} -.input-group-addon, -.input-group-btn, -.input-group .form-control { - display: table-cell; -} -.input-group-addon:not(:first-child):not(:last-child), -.input-group-btn:not(:first-child):not(:last-child), -.input-group .form-control:not(:first-child):not(:last-child) { - border-radius: 0; -} -.input-group-addon, -.input-group-btn { - width: 1%; - white-space: nowrap; - vertical-align: middle; -} -.input-group-addon { - padding: 6px 12px; - font-size: 14px; - font-weight: 400; - line-height: 1; - color: #555555; - text-align: center; - background-color: #eeeeee; - border: 1px solid #ccc; - border-radius: 4px; -} -.input-group-addon.input-sm { - padding: 5px 10px; - font-size: 12px; - border-radius: 3px; -} -.input-group-addon.input-lg { - padding: 10px 16px; - font-size: 18px; - border-radius: 6px; -} -.input-group-addon input[type="radio"], -.input-group-addon input[type="checkbox"] { - margin-top: 0; -} -.input-group .form-control:first-child, -.input-group-addon:first-child, -.input-group-btn:first-child > .btn, -.input-group-btn:first-child > .btn-group > .btn, -.input-group-btn:first-child > .dropdown-toggle, -.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), -.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.input-group-addon:first-child { - border-right: 0; -} -.input-group .form-control:last-child, -.input-group-addon:last-child, -.input-group-btn:last-child > .btn, -.input-group-btn:last-child > .btn-group > .btn, -.input-group-btn:last-child > .dropdown-toggle, -.input-group-btn:first-child > .btn:not(:first-child), -.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} -.input-group-addon:last-child { - border-left: 0; -} -.input-group-btn { - position: relative; - font-size: 0; - white-space: nowrap; -} -.input-group-btn > .btn { - position: relative; -} -.input-group-btn > .btn + .btn { - margin-left: -1px; -} -.input-group-btn > .btn:hover, -.input-group-btn > .btn:focus, -.input-group-btn > .btn:active { - z-index: 2; -} -.input-group-btn:first-child > .btn, -.input-group-btn:first-child > .btn-group { - margin-right: -1px; -} -.input-group-btn:last-child > .btn, -.input-group-btn:last-child > .btn-group { - z-index: 2; - margin-left: -1px; -} -.nav { - padding-left: 0; - margin-bottom: 0; - list-style: none; -} -.nav > li { - position: relative; - display: block; -} -.nav > li > a { - position: relative; - display: block; - padding: 10px 15px; -} -.nav > li > a:hover, -.nav > li > a:focus { - text-decoration: none; - background-color: #eeeeee; -} -.nav > li.disabled > a { - color: #777777; -} -.nav > li.disabled > a:hover, -.nav > li.disabled > a:focus { - color: #777777; - text-decoration: none; - cursor: not-allowed; - background-color: transparent; -} -.nav .open > a, -.nav .open > a:hover, -.nav .open > a:focus { - background-color: #eeeeee; - border-color: #337ab7; -} -.nav .nav-divider { - height: 1px; - margin: 9px 0; - overflow: hidden; - background-color: #e5e5e5; -} -.nav > li > a > img { - max-width: none; -} -.nav-tabs { - border-bottom: 1px solid #ddd; -} -.nav-tabs > li { - float: left; - margin-bottom: -1px; -} -.nav-tabs > li > a { - margin-right: 2px; - line-height: 1.42857143; - border: 1px solid transparent; - border-radius: 4px 4px 0 0; -} -.nav-tabs > li > a:hover { - border-color: #eeeeee #eeeeee #ddd; -} -.nav-tabs > li.active > a, -.nav-tabs > li.active > a:hover, -.nav-tabs > li.active > a:focus { - color: #555555; - cursor: default; - background-color: #fff; - border: 1px solid #ddd; - border-bottom-color: transparent; -} -.nav-tabs.nav-justified { - width: 100%; - border-bottom: 0; -} -.nav-tabs.nav-justified > li { - float: none; -} -.nav-tabs.nav-justified > li > a { - margin-bottom: 5px; - text-align: center; -} -.nav-tabs.nav-justified > .dropdown .dropdown-menu { - top: auto; - left: auto; -} -@media (min-width: 768px) { - .nav-tabs.nav-justified > li { - display: table-cell; - width: 1%; - } - .nav-tabs.nav-justified > li > a { - margin-bottom: 0; - } -} -.nav-tabs.nav-justified > li > a { - margin-right: 0; - border-radius: 4px; -} -.nav-tabs.nav-justified > .active > a, -.nav-tabs.nav-justified > .active > a:hover, -.nav-tabs.nav-justified > .active > a:focus { - border: 1px solid #ddd; -} -@media (min-width: 768px) { - .nav-tabs.nav-justified > li > a { - border-bottom: 1px solid #ddd; - border-radius: 4px 4px 0 0; - } - .nav-tabs.nav-justified > .active > a, - .nav-tabs.nav-justified > .active > a:hover, - .nav-tabs.nav-justified > .active > a:focus { - border-bottom-color: #fff; - } -} -.nav-pills > li { - float: left; -} -.nav-pills > li > a { - border-radius: 4px; -} -.nav-pills > li + li { - margin-left: 2px; -} -.nav-pills > li.active > a, -.nav-pills > li.active > a:hover, -.nav-pills > li.active > a:focus { - color: #fff; - background-color: #337ab7; -} -.nav-stacked > li { - float: none; -} -.nav-stacked > li + li { - margin-top: 2px; - margin-left: 0; -} -.nav-justified { - width: 100%; -} -.nav-justified > li { - float: none; -} -.nav-justified > li > a { - margin-bottom: 5px; - text-align: center; -} -.nav-justified > .dropdown .dropdown-menu { - top: auto; - left: auto; -} -@media (min-width: 768px) { - .nav-justified > li { - display: table-cell; - width: 1%; - } - .nav-justified > li > a { - margin-bottom: 0; - } -} -.nav-tabs-justified { - border-bottom: 0; -} -.nav-tabs-justified > li > a { - margin-right: 0; - border-radius: 4px; -} -.nav-tabs-justified > .active > a, -.nav-tabs-justified > .active > a:hover, -.nav-tabs-justified > .active > a:focus { - border: 1px solid #ddd; -} -@media (min-width: 768px) { - .nav-tabs-justified > li > a { - border-bottom: 1px solid #ddd; - border-radius: 4px 4px 0 0; - } - .nav-tabs-justified > .active > a, - .nav-tabs-justified > .active > a:hover, - .nav-tabs-justified > .active > a:focus { - border-bottom-color: #fff; - } -} -.tab-content > .tab-pane { - display: none; -} -.tab-content > .active { - display: block; -} -.nav-tabs .dropdown-menu { - margin-top: -1px; - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.navbar { - position: relative; - min-height: 50px; - margin-bottom: 20px; - border: 1px solid transparent; -} -@media (min-width: 768px) { - .navbar { - border-radius: 4px; - } -} -@media (min-width: 768px) { - .navbar-header { - float: left; - } -} -.navbar-collapse { - padding-right: 15px; - padding-left: 15px; - overflow-x: visible; - border-top: 1px solid transparent; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); - -webkit-overflow-scrolling: touch; -} -.navbar-collapse.in { - overflow-y: auto; -} -@media (min-width: 768px) { - .navbar-collapse { - width: auto; - border-top: 0; - -webkit-box-shadow: none; - box-shadow: none; - } - .navbar-collapse.collapse { - display: block !important; - height: auto !important; - padding-bottom: 0; - overflow: visible !important; - } - .navbar-collapse.in { - overflow-y: visible; - } - .navbar-fixed-top .navbar-collapse, - .navbar-static-top .navbar-collapse, - .navbar-fixed-bottom .navbar-collapse { - padding-right: 0; - padding-left: 0; - } -} -.navbar-fixed-top, -.navbar-fixed-bottom { - position: fixed; - right: 0; - left: 0; - z-index: 1030; -} -.navbar-fixed-top .navbar-collapse, -.navbar-fixed-bottom .navbar-collapse { - max-height: 340px; -} -@media (max-device-width: 480px) and (orientation: landscape) { - .navbar-fixed-top .navbar-collapse, - .navbar-fixed-bottom .navbar-collapse { - max-height: 200px; - } -} -@media (min-width: 768px) { - .navbar-fixed-top, - .navbar-fixed-bottom { - border-radius: 0; - } -} -.navbar-fixed-top { - top: 0; - border-width: 0 0 1px; -} -.navbar-fixed-bottom { - bottom: 0; - margin-bottom: 0; - border-width: 1px 0 0; -} -.container > .navbar-header, -.container-fluid > .navbar-header, -.container > .navbar-collapse, -.container-fluid > .navbar-collapse { - margin-right: -15px; - margin-left: -15px; -} -@media (min-width: 768px) { - .container > .navbar-header, - .container-fluid > .navbar-header, - .container > .navbar-collapse, - .container-fluid > .navbar-collapse { - margin-right: 0; - margin-left: 0; - } -} -.navbar-static-top { - z-index: 1000; - border-width: 0 0 1px; -} -@media (min-width: 768px) { - .navbar-static-top { - border-radius: 0; - } -} -.navbar-brand { - float: left; - height: 50px; - padding: 15px 15px; - font-size: 18px; - line-height: 20px; -} -.navbar-brand:hover, -.navbar-brand:focus { - text-decoration: none; -} -.navbar-brand > img { - display: block; -} -@media (min-width: 768px) { - .navbar > .container .navbar-brand, - .navbar > .container-fluid .navbar-brand { - margin-left: -15px; - } -} -.navbar-toggle { - position: relative; - float: right; - padding: 9px 10px; - margin-right: 15px; - margin-top: 8px; - margin-bottom: 8px; - background-color: transparent; - background-image: none; - border: 1px solid transparent; - border-radius: 4px; -} -.navbar-toggle:focus { - outline: 0; -} -.navbar-toggle .icon-bar { - display: block; - width: 22px; - height: 2px; - border-radius: 1px; -} -.navbar-toggle .icon-bar + .icon-bar { - margin-top: 4px; -} -@media (min-width: 768px) { - .navbar-toggle { - display: none; - } -} -.navbar-nav { - margin: 7.5px -15px; -} -.navbar-nav > li > a { - padding-top: 10px; - padding-bottom: 10px; - line-height: 20px; -} -@media (max-width: 767px) { - .navbar-nav .open .dropdown-menu { - position: static; - float: none; - width: auto; - margin-top: 0; - background-color: transparent; - border: 0; - -webkit-box-shadow: none; - box-shadow: none; - } - .navbar-nav .open .dropdown-menu > li > a, - .navbar-nav .open .dropdown-menu .dropdown-header { - padding: 5px 15px 5px 25px; - } - .navbar-nav .open .dropdown-menu > li > a { - line-height: 20px; - } - .navbar-nav .open .dropdown-menu > li > a:hover, - .navbar-nav .open .dropdown-menu > li > a:focus { - background-image: none; - } -} -@media (min-width: 768px) { - .navbar-nav { - float: left; - margin: 0; - } - .navbar-nav > li { - float: left; - } - .navbar-nav > li > a { - padding-top: 15px; - padding-bottom: 15px; - } -} -.navbar-form { - padding: 10px 15px; - margin-right: -15px; - margin-left: -15px; - border-top: 1px solid transparent; - border-bottom: 1px solid transparent; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); - margin-top: 8px; - margin-bottom: 8px; -} -@media (min-width: 768px) { - .navbar-form .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle; - } - .navbar-form .form-control { - display: inline-block; - width: auto; - vertical-align: middle; - } - .navbar-form .form-control-static { - display: inline-block; - } - .navbar-form .input-group { - display: inline-table; - vertical-align: middle; - } - .navbar-form .input-group .input-group-addon, - .navbar-form .input-group .input-group-btn, - .navbar-form .input-group .form-control { - width: auto; - } - .navbar-form .input-group > .form-control { - width: 100%; - } - .navbar-form .control-label { - margin-bottom: 0; - vertical-align: middle; - } - .navbar-form .radio, - .navbar-form .checkbox { - display: inline-block; - margin-top: 0; - margin-bottom: 0; - vertical-align: middle; - } - .navbar-form .radio label, - .navbar-form .checkbox label { - padding-left: 0; - } - .navbar-form .radio input[type="radio"], - .navbar-form .checkbox input[type="checkbox"] { - position: relative; - margin-left: 0; - } - .navbar-form .has-feedback .form-control-feedback { - top: 0; - } -} -@media (max-width: 767px) { - .navbar-form .form-group { - margin-bottom: 5px; - } - .navbar-form .form-group:last-child { - margin-bottom: 0; - } -} -@media (min-width: 768px) { - .navbar-form { - width: auto; - padding-top: 0; - padding-bottom: 0; - margin-right: 0; - margin-left: 0; - border: 0; - -webkit-box-shadow: none; - box-shadow: none; - } -} -.navbar-nav > li > .dropdown-menu { - margin-top: 0; - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { - margin-bottom: 0; - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} -.navbar-btn { - margin-top: 8px; - margin-bottom: 8px; -} -.navbar-btn.btn-sm { - margin-top: 10px; - margin-bottom: 10px; -} -.navbar-btn.btn-xs { - margin-top: 14px; - margin-bottom: 14px; -} -.navbar-text { - margin-top: 15px; - margin-bottom: 15px; -} -@media (min-width: 768px) { - .navbar-text { - float: left; - margin-right: 15px; - margin-left: 15px; - } -} -@media (min-width: 768px) { - .navbar-left { - float: left !important; - } - .navbar-right { - float: right !important; - margin-right: -15px; - } - .navbar-right ~ .navbar-right { - margin-right: 0; - } -} -.navbar-default { - background-color: #f8f8f8; - border-color: #e7e7e7; -} -.navbar-default .navbar-brand { - color: #777; -} -.navbar-default .navbar-brand:hover, -.navbar-default .navbar-brand:focus { - color: #5e5e5e; - background-color: transparent; -} -.navbar-default .navbar-text { - color: #777; -} -.navbar-default .navbar-nav > li > a { - color: #777; -} -.navbar-default .navbar-nav > li > a:hover, -.navbar-default .navbar-nav > li > a:focus { - color: #333; - background-color: transparent; -} -.navbar-default .navbar-nav > .active > a, -.navbar-default .navbar-nav > .active > a:hover, -.navbar-default .navbar-nav > .active > a:focus { - color: #555; - background-color: #e7e7e7; -} -.navbar-default .navbar-nav > .disabled > a, -.navbar-default .navbar-nav > .disabled > a:hover, -.navbar-default .navbar-nav > .disabled > a:focus { - color: #ccc; - background-color: transparent; -} -.navbar-default .navbar-nav > .open > a, -.navbar-default .navbar-nav > .open > a:hover, -.navbar-default .navbar-nav > .open > a:focus { - color: #555; - background-color: #e7e7e7; -} -@media (max-width: 767px) { - .navbar-default .navbar-nav .open .dropdown-menu > li > a { - color: #777; - } - .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, - .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { - color: #333; - background-color: transparent; - } - .navbar-default .navbar-nav .open .dropdown-menu > .active > a, - .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, - .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #555; - background-color: #e7e7e7; - } - .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, - .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, - .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { - color: #ccc; - background-color: transparent; - } -} -.navbar-default .navbar-toggle { - border-color: #ddd; -} -.navbar-default .navbar-toggle:hover, -.navbar-default .navbar-toggle:focus { - background-color: #ddd; -} -.navbar-default .navbar-toggle .icon-bar { - background-color: #888; -} -.navbar-default .navbar-collapse, -.navbar-default .navbar-form { - border-color: #e7e7e7; -} -.navbar-default .navbar-link { - color: #777; -} -.navbar-default .navbar-link:hover { - color: #333; -} -.navbar-default .btn-link { - color: #777; -} -.navbar-default .btn-link:hover, -.navbar-default .btn-link:focus { - color: #333; -} -.navbar-default .btn-link[disabled]:hover, -fieldset[disabled] .navbar-default .btn-link:hover, -.navbar-default .btn-link[disabled]:focus, -fieldset[disabled] .navbar-default .btn-link:focus { - color: #ccc; -} -.navbar-inverse { - background-color: #222; - border-color: #080808; -} -.navbar-inverse .navbar-brand { - color: #9d9d9d; -} -.navbar-inverse .navbar-brand:hover, -.navbar-inverse .navbar-brand:focus { - color: #fff; - background-color: transparent; -} -.navbar-inverse .navbar-text { - color: #9d9d9d; -} -.navbar-inverse .navbar-nav > li > a { - color: #9d9d9d; -} -.navbar-inverse .navbar-nav > li > a:hover, -.navbar-inverse .navbar-nav > li > a:focus { - color: #fff; - background-color: transparent; -} -.navbar-inverse .navbar-nav > .active > a, -.navbar-inverse .navbar-nav > .active > a:hover, -.navbar-inverse .navbar-nav > .active > a:focus { - color: #fff; - background-color: #080808; -} -.navbar-inverse .navbar-nav > .disabled > a, -.navbar-inverse .navbar-nav > .disabled > a:hover, -.navbar-inverse .navbar-nav > .disabled > a:focus { - color: #444; - background-color: transparent; -} -.navbar-inverse .navbar-nav > .open > a, -.navbar-inverse .navbar-nav > .open > a:hover, -.navbar-inverse .navbar-nav > .open > a:focus { - color: #fff; - background-color: #080808; -} -@media (max-width: 767px) { - .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { - border-color: #080808; - } - .navbar-inverse .navbar-nav .open .dropdown-menu .divider { - background-color: #080808; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { - color: #9d9d9d; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, - .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { - color: #fff; - background-color: transparent; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, - .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, - .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #fff; - background-color: #080808; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, - .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, - .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { - color: #444; - background-color: transparent; - } -} -.navbar-inverse .navbar-toggle { - border-color: #333; -} -.navbar-inverse .navbar-toggle:hover, -.navbar-inverse .navbar-toggle:focus { - background-color: #333; -} -.navbar-inverse .navbar-toggle .icon-bar { - background-color: #fff; -} -.navbar-inverse .navbar-collapse, -.navbar-inverse .navbar-form { - border-color: #101010; -} -.navbar-inverse .navbar-link { - color: #9d9d9d; -} -.navbar-inverse .navbar-link:hover { - color: #fff; -} -.navbar-inverse .btn-link { - color: #9d9d9d; -} -.navbar-inverse .btn-link:hover, -.navbar-inverse .btn-link:focus { - color: #fff; -} -.navbar-inverse .btn-link[disabled]:hover, -fieldset[disabled] .navbar-inverse .btn-link:hover, -.navbar-inverse .btn-link[disabled]:focus, -fieldset[disabled] .navbar-inverse .btn-link:focus { - color: #444; -} -.breadcrumb { - padding: 8px 15px; - margin-bottom: 20px; - list-style: none; - background-color: #f5f5f5; - border-radius: 4px; -} -.breadcrumb > li { - display: inline-block; -} -.breadcrumb > li + li:before { - padding: 0 5px; - color: #ccc; - content: "/\00a0"; -} -.breadcrumb > .active { - color: #777777; -} -.pagination { - display: inline-block; - padding-left: 0; - margin: 20px 0; - border-radius: 4px; -} -.pagination > li { - display: inline; -} -.pagination > li > a, -.pagination > li > span { - position: relative; - float: left; - padding: 6px 12px; - margin-left: -1px; - line-height: 1.42857143; - color: #337ab7; - text-decoration: none; - background-color: #fff; - border: 1px solid #ddd; -} -.pagination > li > a:hover, -.pagination > li > span:hover, -.pagination > li > a:focus, -.pagination > li > span:focus { - z-index: 2; - color: #23527c; - background-color: #eeeeee; - border-color: #ddd; -} -.pagination > li:first-child > a, -.pagination > li:first-child > span { - margin-left: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; -} -.pagination > li:last-child > a, -.pagination > li:last-child > span { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} -.pagination > .active > a, -.pagination > .active > span, -.pagination > .active > a:hover, -.pagination > .active > span:hover, -.pagination > .active > a:focus, -.pagination > .active > span:focus { - z-index: 3; - color: #fff; - cursor: default; - background-color: #337ab7; - border-color: #337ab7; -} -.pagination > .disabled > span, -.pagination > .disabled > span:hover, -.pagination > .disabled > span:focus, -.pagination > .disabled > a, -.pagination > .disabled > a:hover, -.pagination > .disabled > a:focus { - color: #777777; - cursor: not-allowed; - background-color: #fff; - border-color: #ddd; -} -.pagination-lg > li > a, -.pagination-lg > li > span { - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; -} -.pagination-lg > li:first-child > a, -.pagination-lg > li:first-child > span { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; -} -.pagination-lg > li:last-child > a, -.pagination-lg > li:last-child > span { - border-top-right-radius: 6px; - border-bottom-right-radius: 6px; -} -.pagination-sm > li > a, -.pagination-sm > li > span { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; -} -.pagination-sm > li:first-child > a, -.pagination-sm > li:first-child > span { - border-top-left-radius: 3px; - border-bottom-left-radius: 3px; -} -.pagination-sm > li:last-child > a, -.pagination-sm > li:last-child > span { - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; -} -.pager { - padding-left: 0; - margin: 20px 0; - text-align: center; - list-style: none; -} -.pager li { - display: inline; -} -.pager li > a, -.pager li > span { - display: inline-block; - padding: 5px 14px; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 15px; -} -.pager li > a:hover, -.pager li > a:focus { - text-decoration: none; - background-color: #eeeeee; -} -.pager .next > a, -.pager .next > span { - float: right; -} -.pager .previous > a, -.pager .previous > span { - float: left; -} -.pager .disabled > a, -.pager .disabled > a:hover, -.pager .disabled > a:focus, -.pager .disabled > span { - color: #777777; - cursor: not-allowed; - background-color: #fff; -} -.label { - display: inline; - padding: 0.2em 0.6em 0.3em; - font-size: 75%; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: 0.25em; -} -a.label:hover, -a.label:focus { - color: #fff; - text-decoration: none; - cursor: pointer; -} -.label:empty { - display: none; -} -.btn .label { - position: relative; - top: -1px; -} -.label-default { - background-color: #777777; -} -.label-default[href]:hover, -.label-default[href]:focus { - background-color: #5e5e5e; -} -.label-primary { - background-color: #337ab7; -} -.label-primary[href]:hover, -.label-primary[href]:focus { - background-color: #286090; -} -.label-success { - background-color: #5cb85c; -} -.label-success[href]:hover, -.label-success[href]:focus { - background-color: #449d44; -} -.label-info { - background-color: #5bc0de; -} -.label-info[href]:hover, -.label-info[href]:focus { - background-color: #31b0d5; -} -.label-warning { - background-color: #f0ad4e; -} -.label-warning[href]:hover, -.label-warning[href]:focus { - background-color: #ec971f; -} -.label-danger { - background-color: #d9534f; -} -.label-danger[href]:hover, -.label-danger[href]:focus { - background-color: #c9302c; -} -.badge { - display: inline-block; - min-width: 10px; - padding: 3px 7px; - font-size: 12px; - font-weight: bold; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: middle; - background-color: #777777; - border-radius: 10px; -} -.badge:empty { - display: none; -} -.btn .badge { - position: relative; - top: -1px; -} -.btn-xs .badge, -.btn-group-xs > .btn .badge { - top: 0; - padding: 1px 5px; -} -a.badge:hover, -a.badge:focus { - color: #fff; - text-decoration: none; - cursor: pointer; -} -.list-group-item.active > .badge, -.nav-pills > .active > a > .badge { - color: #337ab7; - background-color: #fff; -} -.list-group-item > .badge { - float: right; -} -.list-group-item > .badge + .badge { - margin-right: 5px; -} -.nav-pills > li > a > .badge { - margin-left: 3px; -} -.jumbotron { - padding-top: 30px; - padding-bottom: 30px; - margin-bottom: 30px; - color: inherit; - background-color: #eeeeee; -} -.jumbotron h1, -.jumbotron .h1 { - color: inherit; -} -.jumbotron p { - margin-bottom: 15px; - font-size: 21px; - font-weight: 200; -} -.jumbotron > hr { - border-top-color: #d5d5d5; -} -.container .jumbotron, -.container-fluid .jumbotron { - padding-right: 15px; - padding-left: 15px; - border-radius: 6px; -} -.jumbotron .container { - max-width: 100%; -} -@media screen and (min-width: 768px) { - .jumbotron { - padding-top: 48px; - padding-bottom: 48px; - } - .container .jumbotron, - .container-fluid .jumbotron { - padding-right: 60px; - padding-left: 60px; - } - .jumbotron h1, - .jumbotron .h1 { - font-size: 63px; - } -} -.thumbnail { - display: block; - padding: 4px; - margin-bottom: 20px; - line-height: 1.42857143; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - -webkit-transition: border 0.2s ease-in-out; - -o-transition: border 0.2s ease-in-out; - transition: border 0.2s ease-in-out; -} -.thumbnail > img, -.thumbnail a > img { - margin-right: auto; - margin-left: auto; -} -a.thumbnail:hover, -a.thumbnail:focus, -a.thumbnail.active { - border-color: #337ab7; -} -.thumbnail .caption { - padding: 9px; - color: #333333; -} -.alert { - padding: 15px; - margin-bottom: 20px; - border: 1px solid transparent; - border-radius: 4px; -} -.alert h4 { - margin-top: 0; - color: inherit; -} -.alert .alert-link { - font-weight: bold; -} -.alert > p, -.alert > ul { - margin-bottom: 0; -} -.alert > p + p { - margin-top: 5px; -} -.alert-dismissable, -.alert-dismissible { - padding-right: 35px; -} -.alert-dismissable .close, -.alert-dismissible .close { - position: relative; - top: -2px; - right: -21px; - color: inherit; -} -.alert-success { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6; -} -.alert-success hr { - border-top-color: #c9e2b3; -} -.alert-success .alert-link { - color: #2b542c; -} -.alert-info { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1; -} -.alert-info hr { - border-top-color: #a6e1ec; -} -.alert-info .alert-link { - color: #245269; -} -.alert-warning { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc; -} -.alert-warning hr { - border-top-color: #f7e1b5; -} -.alert-warning .alert-link { - color: #66512c; -} -.alert-danger { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1; -} -.alert-danger hr { - border-top-color: #e4b9c0; -} -.alert-danger .alert-link { - color: #843534; -} -@-webkit-keyframes progress-bar-stripes { - from { - background-position: 40px 0; - } - to { - background-position: 0 0; - } -} -@-o-keyframes progress-bar-stripes { - from { - background-position: 40px 0; - } - to { - background-position: 0 0; - } -} -@keyframes progress-bar-stripes { - from { - background-position: 40px 0; - } - to { - background-position: 0 0; - } -} -.progress { - height: 20px; - margin-bottom: 20px; - overflow: hidden; - background-color: #f5f5f5; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -} -.progress-bar { - float: left; - width: 0%; - height: 100%; - font-size: 12px; - line-height: 20px; - color: #fff; - text-align: center; - background-color: #337ab7; - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - -webkit-transition: width 0.6s ease; - -o-transition: width 0.6s ease; - transition: width 0.6s ease; -} -.progress-striped .progress-bar, -.progress-bar-striped { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - -webkit-background-size: 40px 40px; - background-size: 40px 40px; -} -.progress.active .progress-bar, -.progress-bar.active { - -webkit-animation: progress-bar-stripes 2s linear infinite; - -o-animation: progress-bar-stripes 2s linear infinite; - animation: progress-bar-stripes 2s linear infinite; -} -.progress-bar-success { - background-color: #5cb85c; -} -.progress-striped .progress-bar-success { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.progress-bar-info { - background-color: #5bc0de; -} -.progress-striped .progress-bar-info { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.progress-bar-warning { - background-color: #f0ad4e; -} -.progress-striped .progress-bar-warning { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.progress-bar-danger { - background-color: #d9534f; -} -.progress-striped .progress-bar-danger { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.media { - margin-top: 15px; -} -.media:first-child { - margin-top: 0; -} -.media, -.media-body { - overflow: hidden; - zoom: 1; -} -.media-body { - width: 10000px; -} -.media-object { - display: block; -} -.media-object.img-thumbnail { - max-width: none; -} -.media-right, -.media > .pull-right { - padding-left: 10px; -} -.media-left, -.media > .pull-left { - padding-right: 10px; -} -.media-left, -.media-right, -.media-body { - display: table-cell; - vertical-align: top; -} -.media-middle { - vertical-align: middle; -} -.media-bottom { - vertical-align: bottom; -} -.media-heading { - margin-top: 0; - margin-bottom: 5px; -} -.media-list { - padding-left: 0; - list-style: none; -} -.list-group { - padding-left: 0; - margin-bottom: 20px; -} -.list-group-item { - position: relative; - display: block; - padding: 10px 15px; - margin-bottom: -1px; - background-color: #fff; - border: 1px solid #ddd; -} -.list-group-item:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} -.list-group-item:last-child { - margin-bottom: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; -} -.list-group-item.disabled, -.list-group-item.disabled:hover, -.list-group-item.disabled:focus { - color: #777777; - cursor: not-allowed; - background-color: #eeeeee; -} -.list-group-item.disabled .list-group-item-heading, -.list-group-item.disabled:hover .list-group-item-heading, -.list-group-item.disabled:focus .list-group-item-heading { - color: inherit; -} -.list-group-item.disabled .list-group-item-text, -.list-group-item.disabled:hover .list-group-item-text, -.list-group-item.disabled:focus .list-group-item-text { - color: #777777; -} -.list-group-item.active, -.list-group-item.active:hover, -.list-group-item.active:focus { - z-index: 2; - color: #fff; - background-color: #337ab7; - border-color: #337ab7; -} -.list-group-item.active .list-group-item-heading, -.list-group-item.active:hover .list-group-item-heading, -.list-group-item.active:focus .list-group-item-heading, -.list-group-item.active .list-group-item-heading > small, -.list-group-item.active:hover .list-group-item-heading > small, -.list-group-item.active:focus .list-group-item-heading > small, -.list-group-item.active .list-group-item-heading > .small, -.list-group-item.active:hover .list-group-item-heading > .small, -.list-group-item.active:focus .list-group-item-heading > .small { - color: inherit; -} -.list-group-item.active .list-group-item-text, -.list-group-item.active:hover .list-group-item-text, -.list-group-item.active:focus .list-group-item-text { - color: #c7ddef; -} -a.list-group-item, -button.list-group-item { - color: #555; -} -a.list-group-item .list-group-item-heading, -button.list-group-item .list-group-item-heading { - color: #333; -} -a.list-group-item:hover, -button.list-group-item:hover, -a.list-group-item:focus, -button.list-group-item:focus { - color: #555; - text-decoration: none; - background-color: #f5f5f5; -} -button.list-group-item { - width: 100%; - text-align: left; -} -.list-group-item-success { - color: #3c763d; - background-color: #dff0d8; -} -a.list-group-item-success, -button.list-group-item-success { - color: #3c763d; -} -a.list-group-item-success .list-group-item-heading, -button.list-group-item-success .list-group-item-heading { - color: inherit; -} -a.list-group-item-success:hover, -button.list-group-item-success:hover, -a.list-group-item-success:focus, -button.list-group-item-success:focus { - color: #3c763d; - background-color: #d0e9c6; -} -a.list-group-item-success.active, -button.list-group-item-success.active, -a.list-group-item-success.active:hover, -button.list-group-item-success.active:hover, -a.list-group-item-success.active:focus, -button.list-group-item-success.active:focus { - color: #fff; - background-color: #3c763d; - border-color: #3c763d; -} -.list-group-item-info { - color: #31708f; - background-color: #d9edf7; -} -a.list-group-item-info, -button.list-group-item-info { - color: #31708f; -} -a.list-group-item-info .list-group-item-heading, -button.list-group-item-info .list-group-item-heading { - color: inherit; -} -a.list-group-item-info:hover, -button.list-group-item-info:hover, -a.list-group-item-info:focus, -button.list-group-item-info:focus { - color: #31708f; - background-color: #c4e3f3; -} -a.list-group-item-info.active, -button.list-group-item-info.active, -a.list-group-item-info.active:hover, -button.list-group-item-info.active:hover, -a.list-group-item-info.active:focus, -button.list-group-item-info.active:focus { - color: #fff; - background-color: #31708f; - border-color: #31708f; -} -.list-group-item-warning { - color: #8a6d3b; - background-color: #fcf8e3; -} -a.list-group-item-warning, -button.list-group-item-warning { - color: #8a6d3b; -} -a.list-group-item-warning .list-group-item-heading, -button.list-group-item-warning .list-group-item-heading { - color: inherit; -} -a.list-group-item-warning:hover, -button.list-group-item-warning:hover, -a.list-group-item-warning:focus, -button.list-group-item-warning:focus { - color: #8a6d3b; - background-color: #faf2cc; -} -a.list-group-item-warning.active, -button.list-group-item-warning.active, -a.list-group-item-warning.active:hover, -button.list-group-item-warning.active:hover, -a.list-group-item-warning.active:focus, -button.list-group-item-warning.active:focus { - color: #fff; - background-color: #8a6d3b; - border-color: #8a6d3b; -} -.list-group-item-danger { - color: #a94442; - background-color: #f2dede; -} -a.list-group-item-danger, -button.list-group-item-danger { - color: #a94442; -} -a.list-group-item-danger .list-group-item-heading, -button.list-group-item-danger .list-group-item-heading { - color: inherit; -} -a.list-group-item-danger:hover, -button.list-group-item-danger:hover, -a.list-group-item-danger:focus, -button.list-group-item-danger:focus { - color: #a94442; - background-color: #ebcccc; -} -a.list-group-item-danger.active, -button.list-group-item-danger.active, -a.list-group-item-danger.active:hover, -button.list-group-item-danger.active:hover, -a.list-group-item-danger.active:focus, -button.list-group-item-danger.active:focus { - color: #fff; - background-color: #a94442; - border-color: #a94442; -} -.list-group-item-heading { - margin-top: 0; - margin-bottom: 5px; -} -.list-group-item-text { - margin-bottom: 0; - line-height: 1.3; -} -.panel { - margin-bottom: 20px; - background-color: #fff; - border: 1px solid transparent; - border-radius: 4px; - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); -} -.panel-body { - padding: 15px; -} -.panel-heading { - padding: 10px 15px; - border-bottom: 1px solid transparent; - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel-heading > .dropdown .dropdown-toggle { - color: inherit; -} -.panel-title { - margin-top: 0; - margin-bottom: 0; - font-size: 16px; - color: inherit; -} -.panel-title > a, -.panel-title > small, -.panel-title > .small, -.panel-title > small > a, -.panel-title > .small > a { - color: inherit; -} -.panel-footer { - padding: 10px 15px; - background-color: #f5f5f5; - border-top: 1px solid #ddd; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .list-group, -.panel > .panel-collapse > .list-group { - margin-bottom: 0; -} -.panel > .list-group .list-group-item, -.panel > .panel-collapse > .list-group .list-group-item { - border-width: 1px 0; - border-radius: 0; -} -.panel > .list-group:first-child .list-group-item:first-child, -.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { - border-top: 0; - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel > .list-group:last-child .list-group-item:last-child, -.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { - border-bottom: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.panel-heading + .list-group .list-group-item:first-child { - border-top-width: 0; -} -.list-group + .panel-footer { - border-top-width: 0; -} -.panel > .table, -.panel > .table-responsive > .table, -.panel > .panel-collapse > .table { - margin-bottom: 0; -} -.panel > .table caption, -.panel > .table-responsive > .table caption, -.panel > .panel-collapse > .table caption { - padding-right: 15px; - padding-left: 15px; -} -.panel > .table:first-child, -.panel > .table-responsive:first-child > .table:first-child { - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel > .table:first-child > thead:first-child > tr:first-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, -.panel > .table:first-child > tbody:first-child > tr:first-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child { - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, -.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, -.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, -.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { - border-top-left-radius: 3px; -} -.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, -.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, -.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, -.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { - border-top-right-radius: 3px; -} -.panel > .table:last-child, -.panel > .table-responsive:last-child > .table:last-child { - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .table:last-child > tbody:last-child > tr:last-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child { - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, -.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { - border-bottom-left-radius: 3px; -} -.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, -.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { - border-bottom-right-radius: 3px; -} -.panel > .panel-body + .table, -.panel > .panel-body + .table-responsive, -.panel > .table + .panel-body, -.panel > .table-responsive + .panel-body { - border-top: 1px solid #ddd; -} -.panel > .table > tbody:first-child > tr:first-child th, -.panel > .table > tbody:first-child > tr:first-child td { - border-top: 0; -} -.panel > .table-bordered, -.panel > .table-responsive > .table-bordered { - border: 0; -} -.panel > .table-bordered > thead > tr > th:first-child, -.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, -.panel > .table-bordered > tbody > tr > th:first-child, -.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, -.panel > .table-bordered > tfoot > tr > th:first-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, -.panel > .table-bordered > thead > tr > td:first-child, -.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, -.panel > .table-bordered > tbody > tr > td:first-child, -.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, -.panel > .table-bordered > tfoot > tr > td:first-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { - border-left: 0; -} -.panel > .table-bordered > thead > tr > th:last-child, -.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, -.panel > .table-bordered > tbody > tr > th:last-child, -.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, -.panel > .table-bordered > tfoot > tr > th:last-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, -.panel > .table-bordered > thead > tr > td:last-child, -.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, -.panel > .table-bordered > tbody > tr > td:last-child, -.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, -.panel > .table-bordered > tfoot > tr > td:last-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { - border-right: 0; -} -.panel > .table-bordered > thead > tr:first-child > td, -.panel > .table-responsive > .table-bordered > thead > tr:first-child > td, -.panel > .table-bordered > tbody > tr:first-child > td, -.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, -.panel > .table-bordered > thead > tr:first-child > th, -.panel > .table-responsive > .table-bordered > thead > tr:first-child > th, -.panel > .table-bordered > tbody > tr:first-child > th, -.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { - border-bottom: 0; -} -.panel > .table-bordered > tbody > tr:last-child > td, -.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, -.panel > .table-bordered > tfoot > tr:last-child > td, -.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, -.panel > .table-bordered > tbody > tr:last-child > th, -.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, -.panel > .table-bordered > tfoot > tr:last-child > th, -.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { - border-bottom: 0; -} -.panel > .table-responsive { - margin-bottom: 0; - border: 0; -} -.panel-group { - margin-bottom: 20px; -} -.panel-group .panel { - margin-bottom: 0; - border-radius: 4px; -} -.panel-group .panel + .panel { - margin-top: 5px; -} -.panel-group .panel-heading { - border-bottom: 0; -} -.panel-group .panel-heading + .panel-collapse > .panel-body, -.panel-group .panel-heading + .panel-collapse > .list-group { - border-top: 1px solid #ddd; -} -.panel-group .panel-footer { - border-top: 0; -} -.panel-group .panel-footer + .panel-collapse .panel-body { - border-bottom: 1px solid #ddd; -} -.panel-default { - border-color: #ddd; -} -.panel-default > .panel-heading { - color: #333333; - background-color: #f5f5f5; - border-color: #ddd; -} -.panel-default > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #ddd; -} -.panel-default > .panel-heading .badge { - color: #f5f5f5; - background-color: #333333; -} -.panel-default > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #ddd; -} -.panel-primary { - border-color: #337ab7; -} -.panel-primary > .panel-heading { - color: #fff; - background-color: #337ab7; - border-color: #337ab7; -} -.panel-primary > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #337ab7; -} -.panel-primary > .panel-heading .badge { - color: #337ab7; - background-color: #fff; -} -.panel-primary > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #337ab7; -} -.panel-success { - border-color: #d6e9c6; -} -.panel-success > .panel-heading { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6; -} -.panel-success > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #d6e9c6; -} -.panel-success > .panel-heading .badge { - color: #dff0d8; - background-color: #3c763d; -} -.panel-success > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #d6e9c6; -} -.panel-info { - border-color: #bce8f1; -} -.panel-info > .panel-heading { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1; -} -.panel-info > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #bce8f1; -} -.panel-info > .panel-heading .badge { - color: #d9edf7; - background-color: #31708f; -} -.panel-info > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #bce8f1; -} -.panel-warning { - border-color: #faebcc; -} -.panel-warning > .panel-heading { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc; -} -.panel-warning > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #faebcc; -} -.panel-warning > .panel-heading .badge { - color: #fcf8e3; - background-color: #8a6d3b; -} -.panel-warning > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #faebcc; -} -.panel-danger { - border-color: #ebccd1; -} -.panel-danger > .panel-heading { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1; -} -.panel-danger > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #ebccd1; -} -.panel-danger > .panel-heading .badge { - color: #f2dede; - background-color: #a94442; -} -.panel-danger > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #ebccd1; -} -.embed-responsive { - position: relative; - display: block; - height: 0; - padding: 0; - overflow: hidden; -} -.embed-responsive .embed-responsive-item, -.embed-responsive iframe, -.embed-responsive embed, -.embed-responsive object, -.embed-responsive video { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; -} -.embed-responsive-16by9 { - padding-bottom: 56.25%; -} -.embed-responsive-4by3 { - padding-bottom: 75%; -} -.well { - min-height: 20px; - padding: 19px; - margin-bottom: 20px; - background-color: #f5f5f5; - border: 1px solid #e3e3e3; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -} -.well blockquote { - border-color: #ddd; - border-color: rgba(0, 0, 0, 0.15); -} -.well-lg { - padding: 24px; - border-radius: 6px; -} -.well-sm { - padding: 9px; - border-radius: 3px; -} -.close { - float: right; - font-size: 21px; - font-weight: bold; - line-height: 1; - color: #000; - text-shadow: 0 1px 0 #fff; - filter: alpha(opacity=20); - opacity: 0.2; -} -.close:hover, -.close:focus { - color: #000; - text-decoration: none; - cursor: pointer; - filter: alpha(opacity=50); - opacity: 0.5; -} -button.close { - padding: 0; - cursor: pointer; - background: transparent; - border: 0; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} -.modal-open { - overflow: hidden; -} -.modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1050; - display: none; - overflow: hidden; - -webkit-overflow-scrolling: touch; - outline: 0; -} -.modal.fade .modal-dialog { - -webkit-transform: translate(0, -25%); - -ms-transform: translate(0, -25%); - -o-transform: translate(0, -25%); - transform: translate(0, -25%); - -webkit-transition: -webkit-transform 0.3s ease-out; - -o-transition: -o-transform 0.3s ease-out; - transition: -webkit-transform 0.3s ease-out; - transition: transform 0.3s ease-out; - transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out, -o-transform 0.3s ease-out; -} -.modal.in .modal-dialog { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); -} -.modal-open .modal { - overflow-x: hidden; - overflow-y: auto; -} -.modal-dialog { - position: relative; - width: auto; - margin: 10px; -} -.modal-content { - position: relative; - background-color: #fff; - background-clip: padding-box; - border: 1px solid #999; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); - outline: 0; -} -.modal-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1040; - background-color: #000; -} -.modal-backdrop.fade { - filter: alpha(opacity=0); - opacity: 0; -} -.modal-backdrop.in { - filter: alpha(opacity=50); - opacity: 0.5; -} -.modal-header { - padding: 15px; - border-bottom: 1px solid #e5e5e5; -} -.modal-header .close { - margin-top: -2px; -} -.modal-title { - margin: 0; - line-height: 1.42857143; -} -.modal-body { - position: relative; - padding: 15px; -} -.modal-footer { - padding: 15px; - text-align: right; - border-top: 1px solid #e5e5e5; -} -.modal-footer .btn + .btn { - margin-bottom: 0; - margin-left: 5px; -} -.modal-footer .btn-group .btn + .btn { - margin-left: -1px; -} -.modal-footer .btn-block + .btn-block { - margin-left: 0; -} -.modal-scrollbar-measure { - position: absolute; - top: -9999px; - width: 50px; - height: 50px; - overflow: scroll; -} -@media (min-width: 768px) { - .modal-dialog { - width: 600px; - margin: 30px auto; - } - .modal-content { - -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); - } - .modal-sm { - width: 300px; - } -} -@media (min-width: 992px) { - .modal-lg { - width: 900px; - } -} -.tooltip { - position: absolute; - z-index: 1070; - display: block; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-style: normal; - font-weight: 400; - line-height: 1.42857143; - line-break: auto; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - word-wrap: normal; - white-space: normal; - font-size: 12px; - filter: alpha(opacity=0); - opacity: 0; -} -.tooltip.in { - filter: alpha(opacity=90); - opacity: 0.9; -} -.tooltip.top { - padding: 5px 0; - margin-top: -3px; -} -.tooltip.right { - padding: 0 5px; - margin-left: 3px; -} -.tooltip.bottom { - padding: 5px 0; - margin-top: 3px; -} -.tooltip.left { - padding: 0 5px; - margin-left: -3px; -} -.tooltip.top .tooltip-arrow { - bottom: 0; - left: 50%; - margin-left: -5px; - border-width: 5px 5px 0; - border-top-color: #000; -} -.tooltip.top-left .tooltip-arrow { - right: 5px; - bottom: 0; - margin-bottom: -5px; - border-width: 5px 5px 0; - border-top-color: #000; -} -.tooltip.top-right .tooltip-arrow { - bottom: 0; - left: 5px; - margin-bottom: -5px; - border-width: 5px 5px 0; - border-top-color: #000; -} -.tooltip.right .tooltip-arrow { - top: 50%; - left: 0; - margin-top: -5px; - border-width: 5px 5px 5px 0; - border-right-color: #000; -} -.tooltip.left .tooltip-arrow { - top: 50%; - right: 0; - margin-top: -5px; - border-width: 5px 0 5px 5px; - border-left-color: #000; -} -.tooltip.bottom .tooltip-arrow { - top: 0; - left: 50%; - margin-left: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000; -} -.tooltip.bottom-left .tooltip-arrow { - top: 0; - right: 5px; - margin-top: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000; -} -.tooltip.bottom-right .tooltip-arrow { - top: 0; - left: 5px; - margin-top: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000; -} -.tooltip-inner { - max-width: 200px; - padding: 3px 8px; - color: #fff; - text-align: center; - background-color: #000; - border-radius: 4px; -} -.tooltip-arrow { - position: absolute; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; -} -.popover { - position: absolute; - top: 0; - left: 0; - z-index: 1060; - display: none; - max-width: 276px; - padding: 1px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-style: normal; - font-weight: 400; - line-height: 1.42857143; - line-break: auto; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - word-wrap: normal; - white-space: normal; - font-size: 14px; - background-color: #fff; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -} -.popover.top { - margin-top: -10px; -} -.popover.right { - margin-left: 10px; -} -.popover.bottom { - margin-top: 10px; -} -.popover.left { - margin-left: -10px; -} -.popover > .arrow { - border-width: 11px; -} -.popover > .arrow, -.popover > .arrow:after { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; -} -.popover > .arrow:after { - content: ""; - border-width: 10px; -} -.popover.top > .arrow { - bottom: -11px; - left: 50%; - margin-left: -11px; - border-top-color: #999999; - border-top-color: rgba(0, 0, 0, 0.25); - border-bottom-width: 0; -} -.popover.top > .arrow:after { - bottom: 1px; - margin-left: -10px; - content: " "; - border-top-color: #fff; - border-bottom-width: 0; -} -.popover.right > .arrow { - top: 50%; - left: -11px; - margin-top: -11px; - border-right-color: #999999; - border-right-color: rgba(0, 0, 0, 0.25); - border-left-width: 0; -} -.popover.right > .arrow:after { - bottom: -10px; - left: 1px; - content: " "; - border-right-color: #fff; - border-left-width: 0; -} -.popover.bottom > .arrow { - top: -11px; - left: 50%; - margin-left: -11px; - border-top-width: 0; - border-bottom-color: #999999; - border-bottom-color: rgba(0, 0, 0, 0.25); -} -.popover.bottom > .arrow:after { - top: 1px; - margin-left: -10px; - content: " "; - border-top-width: 0; - border-bottom-color: #fff; -} -.popover.left > .arrow { - top: 50%; - right: -11px; - margin-top: -11px; - border-right-width: 0; - border-left-color: #999999; - border-left-color: rgba(0, 0, 0, 0.25); -} -.popover.left > .arrow:after { - right: 1px; - bottom: -10px; - content: " "; - border-right-width: 0; - border-left-color: #fff; -} -.popover-title { - padding: 8px 14px; - margin: 0; - font-size: 14px; - background-color: #f7f7f7; - border-bottom: 1px solid #ebebeb; - border-radius: 5px 5px 0 0; -} -.popover-content { - padding: 9px 14px; -} -.carousel { - position: relative; -} -.carousel-inner { - position: relative; - width: 100%; - overflow: hidden; -} -.carousel-inner > .item { - position: relative; - display: none; - -webkit-transition: 0.6s ease-in-out left; - -o-transition: 0.6s ease-in-out left; - transition: 0.6s ease-in-out left; -} -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - line-height: 1; -} -@media all and (transform-3d), (-webkit-transform-3d) { - .carousel-inner > .item { - -webkit-transition: -webkit-transform 0.6s ease-in-out; - -o-transition: -o-transform 0.6s ease-in-out; - transition: -webkit-transform 0.6s ease-in-out; - transition: transform 0.6s ease-in-out; - transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out, -o-transform 0.6s ease-in-out; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - -webkit-perspective: 1000px; - perspective: 1000px; - } - .carousel-inner > .item.next, - .carousel-inner > .item.active.right { - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - left: 0; - } - .carousel-inner > .item.prev, - .carousel-inner > .item.active.left { - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - left: 0; - } - .carousel-inner > .item.next.left, - .carousel-inner > .item.prev.right, - .carousel-inner > .item.active { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - left: 0; - } -} -.carousel-inner > .active, -.carousel-inner > .next, -.carousel-inner > .prev { - display: block; -} -.carousel-inner > .active { - left: 0; -} -.carousel-inner > .next, -.carousel-inner > .prev { - position: absolute; - top: 0; - width: 100%; -} -.carousel-inner > .next { - left: 100%; -} -.carousel-inner > .prev { - left: -100%; -} -.carousel-inner > .next.left, -.carousel-inner > .prev.right { - left: 0; -} -.carousel-inner > .active.left { - left: -100%; -} -.carousel-inner > .active.right { - left: 100%; -} -.carousel-control { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 15%; - font-size: 20px; - color: #fff; - text-align: center; - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); - background-color: rgba(0, 0, 0, 0); - filter: alpha(opacity=50); - opacity: 0.5; -} -.carousel-control.left { - background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); - background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); - background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.0001))); - background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); - background-repeat: repeat-x; -} -.carousel-control.right { - right: 0; - left: auto; - background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); - background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); - background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.0001)), to(rgba(0, 0, 0, 0.5))); - background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); - background-repeat: repeat-x; -} -.carousel-control:hover, -.carousel-control:focus { - color: #fff; - text-decoration: none; - outline: 0; - filter: alpha(opacity=90); - opacity: 0.9; -} -.carousel-control .icon-prev, -.carousel-control .icon-next, -.carousel-control .glyphicon-chevron-left, -.carousel-control .glyphicon-chevron-right { - position: absolute; - top: 50%; - z-index: 5; - display: inline-block; - margin-top: -10px; -} -.carousel-control .icon-prev, -.carousel-control .glyphicon-chevron-left { - left: 50%; - margin-left: -10px; -} -.carousel-control .icon-next, -.carousel-control .glyphicon-chevron-right { - right: 50%; - margin-right: -10px; -} -.carousel-control .icon-prev, -.carousel-control .icon-next { - width: 20px; - height: 20px; - font-family: serif; - line-height: 1; -} -.carousel-control .icon-prev:before { - content: "\2039"; -} -.carousel-control .icon-next:before { - content: "\203a"; -} -.carousel-indicators { - position: absolute; - bottom: 10px; - left: 50%; - z-index: 15; - width: 60%; - padding-left: 0; - margin-left: -30%; - text-align: center; - list-style: none; -} -.carousel-indicators li { - display: inline-block; - width: 10px; - height: 10px; - margin: 1px; - text-indent: -999px; - cursor: pointer; - background-color: #000 \9; - background-color: rgba(0, 0, 0, 0); - border: 1px solid #fff; - border-radius: 10px; -} -.carousel-indicators .active { - width: 12px; - height: 12px; - margin: 0; - background-color: #fff; -} -.carousel-caption { - position: absolute; - right: 15%; - bottom: 20px; - left: 15%; - z-index: 10; - padding-top: 20px; - padding-bottom: 20px; - color: #fff; - text-align: center; - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); -} -.carousel-caption .btn { - text-shadow: none; -} -@media screen and (min-width: 768px) { - .carousel-control .glyphicon-chevron-left, - .carousel-control .glyphicon-chevron-right, - .carousel-control .icon-prev, - .carousel-control .icon-next { - width: 30px; - height: 30px; - margin-top: -10px; - font-size: 30px; - } - .carousel-control .glyphicon-chevron-left, - .carousel-control .icon-prev { - margin-left: -10px; - } - .carousel-control .glyphicon-chevron-right, - .carousel-control .icon-next { - margin-right: -10px; - } - .carousel-caption { - right: 20%; - left: 20%; - padding-bottom: 30px; - } - .carousel-indicators { - bottom: 20px; - } -} -.clearfix:before, -.clearfix:after, -.dl-horizontal dd:before, -.dl-horizontal dd:after, -.container:before, -.container:after, -.container-fluid:before, -.container-fluid:after, -.row:before, -.row:after, -.form-horizontal .form-group:before, -.form-horizontal .form-group:after, -.btn-toolbar:before, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:before, -.btn-group-vertical > .btn-group:after, -.nav:before, -.nav:after, -.navbar:before, -.navbar:after, -.navbar-header:before, -.navbar-header:after, -.navbar-collapse:before, -.navbar-collapse:after, -.pager:before, -.pager:after, -.panel-body:before, -.panel-body:after, -.modal-header:before, -.modal-header:after, -.modal-footer:before, -.modal-footer:after { - display: table; - content: " "; -} -.clearfix:after, -.dl-horizontal dd:after, -.container:after, -.container-fluid:after, -.row:after, -.form-horizontal .form-group:after, -.btn-toolbar:after, -.btn-group-vertical > .btn-group:after, -.nav:after, -.navbar:after, -.navbar-header:after, -.navbar-collapse:after, -.pager:after, -.panel-body:after, -.modal-header:after, -.modal-footer:after { - clear: both; -} -.center-block { - display: block; - margin-right: auto; - margin-left: auto; -} -.pull-right { - float: right !important; -} -.pull-left { - float: left !important; -} -.hide { - display: none !important; -} -.show { - display: block !important; -} -.invisible { - visibility: hidden; -} -.text-hide { - font: 0/0 a; - color: transparent; - text-shadow: none; - background-color: transparent; - border: 0; -} -.hidden { - display: none !important; -} -.affix { - position: fixed; -} -@-ms-viewport { - width: device-width; -} -.visible-xs, -.visible-sm, -.visible-md, -.visible-lg { - display: none !important; -} -.visible-xs-block, -.visible-xs-inline, -.visible-xs-inline-block, -.visible-sm-block, -.visible-sm-inline, -.visible-sm-inline-block, -.visible-md-block, -.visible-md-inline, -.visible-md-inline-block, -.visible-lg-block, -.visible-lg-inline, -.visible-lg-inline-block { - display: none !important; -} -@media (max-width: 767px) { - .visible-xs { - display: block !important; - } - table.visible-xs { - display: table !important; - } - tr.visible-xs { - display: table-row !important; - } - th.visible-xs, - td.visible-xs { - display: table-cell !important; - } -} -@media (max-width: 767px) { - .visible-xs-block { - display: block !important; - } -} -@media (max-width: 767px) { - .visible-xs-inline { - display: inline !important; - } -} -@media (max-width: 767px) { - .visible-xs-inline-block { - display: inline-block !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm { - display: block !important; - } - table.visible-sm { - display: table !important; - } - tr.visible-sm { - display: table-row !important; - } - th.visible-sm, - td.visible-sm { - display: table-cell !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm-block { - display: block !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm-inline { - display: inline !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm-inline-block { - display: inline-block !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md { - display: block !important; - } - table.visible-md { - display: table !important; - } - tr.visible-md { - display: table-row !important; - } - th.visible-md, - td.visible-md { - display: table-cell !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md-block { - display: block !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md-inline { - display: inline !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md-inline-block { - display: inline-block !important; - } -} -@media (min-width: 1200px) { - .visible-lg { - display: block !important; - } - table.visible-lg { - display: table !important; - } - tr.visible-lg { - display: table-row !important; - } - th.visible-lg, - td.visible-lg { - display: table-cell !important; - } -} -@media (min-width: 1200px) { - .visible-lg-block { - display: block !important; - } -} -@media (min-width: 1200px) { - .visible-lg-inline { - display: inline !important; - } -} -@media (min-width: 1200px) { - .visible-lg-inline-block { - display: inline-block !important; - } -} -@media (max-width: 767px) { - .hidden-xs { - display: none !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .hidden-sm { - display: none !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .hidden-md { - display: none !important; - } -} -@media (min-width: 1200px) { - .hidden-lg { - display: none !important; - } -} -.visible-print { - display: none !important; -} -@media print { - .visible-print { - display: block !important; - } - table.visible-print { - display: table !important; - } - tr.visible-print { - display: table-row !important; - } - th.visible-print, - td.visible-print { - display: table-cell !important; - } -} -.visible-print-block { - display: none !important; -} -@media print { - .visible-print-block { - display: block !important; - } -} -.visible-print-inline { - display: none !important; -} -@media print { - .visible-print-inline { - display: inline !important; - } -} -.visible-print-inline-block { - display: none !important; -} -@media print { - .visible-print-inline-block { - display: inline-block !important; - } -} -@media print { - .hidden-print { - display: none !important; - } -} -/*# sourceMappingURL=bootstrap.css.map */ \ No newline at end of file diff --git a/shared/static/src/bootstrap/js/bootstrap.js b/shared/static/src/bootstrap/js/bootstrap.js deleted file mode 100644 index 8066073b..00000000 --- a/shared/static/src/bootstrap/js/bootstrap.js +++ /dev/null @@ -1,2408 +0,0 @@ -/*! - * Bootstrap v3.4.0 (https://getbootstrap.com/) - * Copyright 2011-2018 Twitter, Inc. - * Licensed under the MIT license - */ - -if (typeof jQuery === 'undefined') { - throw new Error('Bootstrap\'s JavaScript requires jQuery') -} - -+function ($) { - 'use strict'; - var version = $.fn.jquery.split(' ')[0].split('.') - if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) { - throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4') - } -}(jQuery); - -/* ======================================================================== - * Bootstrap: transition.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#transitions - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/) - // ============================================================ - - function transitionEnd() { - var el = document.createElement('bootstrap') - - 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 ( ._.) - } - - // https://blog.alexmaccaw.com/css-transitions - $.fn.emulateTransitionEnd = function (duration) { - var called = false - var $el = this - $(this).one('bsTransitionEnd', function () { called = true }) - var callback = function () { if (!called) $($el).trigger($.support.transition.end) } - setTimeout(callback, duration) - return this - } - - $(function () { - $.support.transition = transitionEnd() - - if (!$.support.transition) return - - $.event.special.bsTransitionEnd = { - bindType: $.support.transition.end, - delegateType: $.support.transition.end, - handle: function (e) { - if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) - } - } - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: alert.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#alerts - * ======================================================================== - * Copyright 2011-2018 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.VERSION = '3.4.0' - - Alert.TRANSITION_DURATION = 150 - - 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 - } - - selector = selector === '#' ? [] : selector - var $parent = $(document).find(selector) - - if (e) e.preventDefault() - - if (!$parent.length) { - $parent = $this.closest('.alert') - } - - $parent.trigger(e = $.Event('close.bs.alert')) - - if (e.isDefaultPrevented()) return - - $parent.removeClass('in') - - function removeElement() { - // detach from parent, fire event then clean up data - $parent.detach().trigger('closed.bs.alert').remove() - } - - $.support.transition && $parent.hasClass('fade') ? - $parent - .one('bsTransitionEnd', removeElement) - .emulateTransitionEnd(Alert.TRANSITION_DURATION) : - removeElement() - } - - - // ALERT PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(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) - }) - } - - var old = $.fn.alert - - $.fn.alert = Plugin - $.fn.alert.Constructor = Alert - - - // ALERT NO CONFLICT - // ================= - - $.fn.alert.noConflict = function () { - $.fn.alert = old - return this - } - - - // ALERT DATA-API - // ============== - - $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: button.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#buttons - * ======================================================================== - * Copyright 2011-2018 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.VERSION = '3.4.0' - - 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 += 'Text' - - if (data.resetText == null) $el.data('resetText', $el[val]()) - - // push to event loop to allow forms to submit - setTimeout($.proxy(function () { - $el[val](data[state] == null ? this.options[state] : data[state]) - - if (state == 'loadingText') { - this.isLoading = true - $el.addClass(d).attr(d, d).prop(d, true) - } else if (this.isLoading) { - this.isLoading = false - $el.removeClass(d).removeAttr(d).prop(d, false) - } - }, 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')) changed = false - $parent.find('.active').removeClass('active') - this.$element.addClass('active') - } else if ($input.prop('type') == 'checkbox') { - if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false - this.$element.toggleClass('active') - } - $input.prop('checked', this.$element.hasClass('active')) - if (changed) $input.trigger('change') - } else { - this.$element.attr('aria-pressed', !this.$element.hasClass('active')) - this.$element.toggleClass('active') - } - } - - - // BUTTON PLUGIN DEFINITION - // ======================== - - function Plugin(option) { - return this.each(function () { - 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) - }) - } - - var old = $.fn.button - - $.fn.button = Plugin - $.fn.button.Constructor = Button - - - // BUTTON NO CONFLICT - // ================== - - $.fn.button.noConflict = function () { - $.fn.button = old - return this - } - - - // BUTTON DATA-API - // =============== - - $(document) - .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { - var $btn = $(e.target).closest('.btn') - Plugin.call($btn, 'toggle') - if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { - // Prevent double click on radios, and the double selections (so cancellation) on checkboxes - e.preventDefault() - // The target component still receive the focus - if ($btn.is('input,button')) $btn.trigger('focus') - else $btn.find('input:visible,button:visible').first().trigger('focus') - } - }) - .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: carousel.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#carousel - * ======================================================================== - * Copyright 2011-2018 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 = null - this.sliding = null - this.interval = null - this.$active = null - this.$items = null - - this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) - - this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element - .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) - .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) - } - - Carousel.VERSION = '3.4.0' - - Carousel.TRANSITION_DURATION = 600 - - Carousel.DEFAULTS = { - interval: 5000, - pause: 'hover', - wrap: true, - keyboard: true - } - - Carousel.prototype.keydown = function (e) { - if (/input|textarea/i.test(e.target.tagName)) return - switch (e.which) { - case 37: this.prev(); break - case 39: this.next(); break - default: return - } - - e.preventDefault() - } - - 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.getItemIndex = function (item) { - this.$items = item.parent().children('.item') - return this.$items.index(item || this.$active) - } - - Carousel.prototype.getItemForDirection = function (direction, active) { - var activeIndex = this.getItemIndex(active) - var willWrap = (direction == 'prev' && activeIndex === 0) - || (direction == 'next' && activeIndex == (this.$items.length - 1)) - if (willWrap && !this.options.wrap) return active - var delta = direction == 'prev' ? -1 : 1 - var itemIndex = (activeIndex + delta) % this.$items.length - return this.$items.eq(itemIndex) - } - - Carousel.prototype.to = function (pos) { - var that = this - var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) - - if (pos > (this.$items.length - 1) || pos < 0) return - - if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" - if (activeIndex == pos) return this.pause().cycle() - - return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(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) - } - - this.interval = clearInterval(this.interval) - - return this - } - - Carousel.prototype.next = function () { - if (this.sliding) return - return this.slide('next') - } - - Carousel.prototype.prev = function () { - if (this.sliding) return - return this.slide('prev') - } - - Carousel.prototype.slide = function (type, next) { - var $active = this.$element.find('.item.active') - var $next = next || this.getItemForDirection(type, $active) - var isCycling = this.interval - var direction = type == 'next' ? 'left' : 'right' - var that = this - - if ($next.hasClass('active')) return (this.sliding = false) - - var relatedTarget = $next[0] - var slideEvent = $.Event('slide.bs.carousel', { - relatedTarget: relatedTarget, - direction: direction - }) - this.$element.trigger(slideEvent) - if (slideEvent.isDefaultPrevented()) return - - this.sliding = true - - isCycling && this.pause() - - if (this.$indicators.length) { - this.$indicators.find('.active').removeClass('active') - var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) - $nextIndicator && $nextIndicator.addClass('active') - } - - var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" - if ($.support.transition && this.$element.hasClass('slide')) { - $next.addClass(type) - if (typeof $next === 'object' && $next.length) { - $next[0].offsetWidth // force reflow - } - $active.addClass(direction) - $next.addClass(direction) - $active - .one('bsTransitionEnd', function () { - $next.removeClass([type, direction].join(' ')).addClass('active') - $active.removeClass(['active', direction].join(' ')) - that.sliding = false - setTimeout(function () { - that.$element.trigger(slidEvent) - }, 0) - }) - .emulateTransitionEnd(Carousel.TRANSITION_DURATION) - } else { - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger(slidEvent) - } - - isCycling && this.cycle() - - return this - } - - - // CAROUSEL PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - 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 - - 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() - }) - } - - var old = $.fn.carousel - - $.fn.carousel = Plugin - $.fn.carousel.Constructor = Carousel - - - // CAROUSEL NO CONFLICT - // ==================== - - $.fn.carousel.noConflict = function () { - $.fn.carousel = old - return this - } - - - // CAROUSEL DATA-API - // ================= - - var clickHandler = function (e) { - var $this = $(this) - var href = $this.attr('href') - if (href) { - href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 - } - - var target = $this.attr('data-target') || href - var $target = $(document).find(target) - - if (!$target.hasClass('carousel')) return - - var options = $.extend({}, $target.data(), $this.data()) - var slideIndex = $this.attr('data-slide-to') - if (slideIndex) options.interval = false - - Plugin.call($target, options) - - if (slideIndex) { - $target.data('bs.carousel').to(slideIndex) - } - - e.preventDefault() - } - - $(document) - .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) - .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) - - $(window).on('load', function () { - $('[data-ride="carousel"]').each(function () { - var $carousel = $(this) - Plugin.call($carousel, $carousel.data()) - }) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: collapse.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#collapse - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - -/* jshint latedef: false */ - -+function ($) { - 'use strict'; - - // COLLAPSE PUBLIC CLASS DEFINITION - // ================================ - - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Collapse.DEFAULTS, options) - this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + - '[data-toggle="collapse"][data-target="#' + element.id + '"]') - this.transitioning = null - - if (this.options.parent) { - this.$parent = this.getParent() - } else { - this.addAriaAndCollapsedClass(this.$element, this.$trigger) - } - - if (this.options.toggle) this.toggle() - } - - Collapse.VERSION = '3.4.0' - - Collapse.TRANSITION_DURATION = 350 - - Collapse.DEFAULTS = { - toggle: true - } - - Collapse.prototype.dimension = function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } - - Collapse.prototype.show = function () { - if (this.transitioning || this.$element.hasClass('in')) return - - var activesData - var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') - - if (actives && actives.length) { - activesData = actives.data('bs.collapse') - if (activesData && activesData.transitioning) return - } - - var startEvent = $.Event('show.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return - - if (actives && actives.length) { - Plugin.call(actives, 'hide') - activesData || actives.data('bs.collapse', null) - } - - var dimension = this.dimension() - - this.$element - .removeClass('collapse') - .addClass('collapsing')[dimension](0) - .attr('aria-expanded', true) - - this.$trigger - .removeClass('collapsed') - .attr('aria-expanded', true) - - this.transitioning = 1 - - var complete = function () { - this.$element - .removeClass('collapsing') - .addClass('collapse in')[dimension]('') - 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('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[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 in') - .attr('aria-expanded', false) - - this.$trigger - .addClass('collapsed') - .attr('aria-expanded', false) - - this.transitioning = 1 - - var complete = function () { - this.transitioning = 0 - this.$element - .removeClass('collapsing') - .addClass('collapse') - .trigger('hidden.bs.collapse') - } - - if (!$.support.transition) return complete.call(this) - - this.$element - [dimension](0) - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(Collapse.TRANSITION_DURATION) - } - - Collapse.prototype.toggle = function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - - Collapse.prototype.getParent = function () { - return $(document).find(this.options.parent) - .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') - .each($.proxy(function (i, element) { - var $element = $(element) - this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) - }, this)) - .end() - } - - Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { - var isOpen = $element.hasClass('in') - - $element.attr('aria-expanded', isOpen) - $trigger - .toggleClass('collapsed', !isOpen) - .attr('aria-expanded', isOpen) - } - - function getTargetFromTrigger($trigger) { - var href - var target = $trigger.attr('data-target') - || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 - - return $(document).find(target) - } - - - // COLLAPSE PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.collapse') - var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - - if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false - if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.collapse - - $.fn.collapse = Plugin - $.fn.collapse.Constructor = Collapse - - - // COLLAPSE NO CONFLICT - // ==================== - - $.fn.collapse.noConflict = function () { - $.fn.collapse = old - return this - } - - - // COLLAPSE DATA-API - // ================= - - $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { - var $this = $(this) - - if (!$this.attr('data-target')) e.preventDefault() - - var $target = getTargetFromTrigger($this) - var data = $target.data('bs.collapse') - var option = data ? 'toggle' : $this.data() - - Plugin.call($target, option) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: dropdown.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#dropdowns - * ======================================================================== - * Copyright 2011-2018 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) - } - - Dropdown.VERSION = '3.4.0' - - function getParent($this) { - var selector = $this.attr('data-target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - var $parent = selector && $(document).find(selector) - - return $parent && $parent.length ? $parent : $this.parent() - } - - function clearMenus(e) { - if (e && e.which === 3) return - $(backdrop).remove() - $(toggle).each(function () { - var $this = $(this) - var $parent = getParent($this) - var relatedTarget = { relatedTarget: this } - - if (!$parent.hasClass('open')) return - - if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return - - $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) - - if (e.isDefaultPrevented()) return - - $this.attr('aria-expanded', 'false') - $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) - }) - } - - 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 - $(document.createElement('div')) - .addClass('dropdown-backdrop') - .insertAfter($(this)) - .on('click', clearMenus) - } - - var relatedTarget = { relatedTarget: this } - $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) - - if (e.isDefaultPrevented()) return - - $this - .trigger('focus') - .attr('aria-expanded', 'true') - - $parent - .toggleClass('open') - .trigger($.Event('shown.bs.dropdown', relatedTarget)) - } - - return false - } - - Dropdown.prototype.keydown = function (e) { - if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return - - var $this = $(this) - - e.preventDefault() - e.stopPropagation() - - if ($this.is('.disabled, :disabled')) return - - var $parent = getParent($this) - var isActive = $parent.hasClass('open') - - if (!isActive && e.which != 27 || isActive && e.which == 27) { - if (e.which == 27) $parent.find(toggle).trigger('focus') - return $this.trigger('click') - } - - var desc = ' li:not(.disabled):visible a' - var $items = $parent.find('.dropdown-menu' + desc) - - if (!$items.length) return - - var index = $items.index(e.target) - - if (e.which == 38 && index > 0) index-- // up - if (e.which == 40 && index < $items.length - 1) index++ // down - if (!~index) index = 0 - - $items.eq(index).trigger('focus') - } - - - // DROPDOWN PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.dropdown') - - if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - var old = $.fn.dropdown - - $.fn.dropdown = Plugin - $.fn.dropdown.Constructor = Dropdown - - - // DROPDOWN NO CONFLICT - // ==================== - - $.fn.dropdown.noConflict = function () { - $.fn.dropdown = old - return this - } - - - // APPLY TO STANDARD DROPDOWN ELEMENTS - // =================================== - - $(document) - .on('click.bs.dropdown.data-api', clearMenus) - .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) - .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) - .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) - .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: modal.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#modals - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // MODAL CLASS DEFINITION - // ====================== - - var Modal = function (element, options) { - this.options = options - this.$body = $(document.body) - this.$element = $(element) - this.$dialog = this.$element.find('.modal-dialog') - this.$backdrop = null - this.isShown = null - this.originalBodyPad = null - this.scrollbarWidth = 0 - this.ignoreBackdropClick = false - this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom' - - if (this.options.remote) { - this.$element - .find('.modal-content') - .load(this.options.remote, $.proxy(function () { - this.$element.trigger('loaded.bs.modal') - }, this)) - } - } - - Modal.VERSION = '3.4.0' - - Modal.TRANSITION_DURATION = 300 - Modal.BACKDROP_TRANSITION_DURATION = 150 - - Modal.DEFAULTS = { - backdrop: true, - keyboard: true, - show: true - } - - Modal.prototype.toggle = function (_relatedTarget) { - return this.isShown ? this.hide() : this.show(_relatedTarget) - } - - Modal.prototype.show = function (_relatedTarget) { - var that = this - var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) - - this.$element.trigger(e) - - if (this.isShown || e.isDefaultPrevented()) return - - this.isShown = true - - this.checkScrollbar() - this.setScrollbar() - this.$body.addClass('modal-open') - - this.escape() - this.resize() - - this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) - - this.$dialog.on('mousedown.dismiss.bs.modal', function () { - that.$element.one('mouseup.dismiss.bs.modal', function (e) { - if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true - }) - }) - - this.backdrop(function () { - var transition = $.support.transition && that.$element.hasClass('fade') - - if (!that.$element.parent().length) { - that.$element.appendTo(that.$body) // don't move modals dom position - } - - that.$element - .show() - .scrollTop(0) - - that.adjustDialog() - - if (transition) { - that.$element[0].offsetWidth // force reflow - } - - that.$element.addClass('in') - - that.enforceFocus() - - var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) - - transition ? - that.$dialog // wait for modal to slide in - .one('bsTransitionEnd', function () { - that.$element.trigger('focus').trigger(e) - }) - .emulateTransitionEnd(Modal.TRANSITION_DURATION) : - that.$element.trigger('focus').trigger(e) - }) - } - - Modal.prototype.hide = function (e) { - if (e) e.preventDefault() - - e = $.Event('hide.bs.modal') - - this.$element.trigger(e) - - if (!this.isShown || e.isDefaultPrevented()) return - - this.isShown = false - - this.escape() - this.resize() - - $(document).off('focusin.bs.modal') - - this.$element - .removeClass('in') - .off('click.dismiss.bs.modal') - .off('mouseup.dismiss.bs.modal') - - this.$dialog.off('mousedown.dismiss.bs.modal') - - $.support.transition && this.$element.hasClass('fade') ? - this.$element - .one('bsTransitionEnd', $.proxy(this.hideModal, this)) - .emulateTransitionEnd(Modal.TRANSITION_DURATION) : - this.hideModal() - } - - Modal.prototype.enforceFocus = function () { - $(document) - .off('focusin.bs.modal') // guard against infinite focus loop - .on('focusin.bs.modal', $.proxy(function (e) { - if (document !== e.target && - this.$element[0] !== e.target && - !this.$element.has(e.target).length) { - this.$element.trigger('focus') - } - }, this)) - } - - Modal.prototype.escape = function () { - if (this.isShown && this.options.keyboard) { - this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { - e.which == 27 && this.hide() - }, this)) - } else if (!this.isShown) { - this.$element.off('keydown.dismiss.bs.modal') - } - } - - Modal.prototype.resize = function () { - if (this.isShown) { - $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) - } else { - $(window).off('resize.bs.modal') - } - } - - Modal.prototype.hideModal = function () { - var that = this - this.$element.hide() - this.backdrop(function () { - that.$body.removeClass('modal-open') - that.resetAdjustments() - that.resetScrollbar() - that.$element.trigger('hidden.bs.modal') - }) - } - - Modal.prototype.removeBackdrop = function () { - this.$backdrop && this.$backdrop.remove() - this.$backdrop = null - } - - Modal.prototype.backdrop = function (callback) { - var that = this - var animate = this.$element.hasClass('fade') ? 'fade' : '' - - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate - - this.$backdrop = $(document.createElement('div')) - .addClass('modal-backdrop ' + animate) - .appendTo(this.$body) - - this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { - if (this.ignoreBackdropClick) { - this.ignoreBackdropClick = false - return - } - if (e.target !== e.currentTarget) return - this.options.backdrop == 'static' - ? this.$element[0].focus() - : this.hide() - }, this)) - - if (doAnimate) this.$backdrop[0].offsetWidth // force reflow - - this.$backdrop.addClass('in') - - if (!callback) return - - doAnimate ? - this.$backdrop - .one('bsTransitionEnd', callback) - .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : - callback() - - } else if (!this.isShown && this.$backdrop) { - this.$backdrop.removeClass('in') - - var callbackRemove = function () { - that.removeBackdrop() - callback && callback() - } - $.support.transition && this.$element.hasClass('fade') ? - this.$backdrop - .one('bsTransitionEnd', callbackRemove) - .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : - callbackRemove() - - } else if (callback) { - callback() - } - } - - // these following methods are used to handle overflowing modals - - Modal.prototype.handleUpdate = function () { - this.adjustDialog() - } - - Modal.prototype.adjustDialog = function () { - var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight - - this.$element.css({ - paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', - paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' - }) - } - - Modal.prototype.resetAdjustments = function () { - this.$element.css({ - paddingLeft: '', - paddingRight: '' - }) - } - - Modal.prototype.checkScrollbar = function () { - var fullWindowWidth = window.innerWidth - if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 - var documentElementRect = document.documentElement.getBoundingClientRect() - fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) - } - this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth - this.scrollbarWidth = this.measureScrollbar() - } - - Modal.prototype.setScrollbar = function () { - var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) - this.originalBodyPad = document.body.style.paddingRight || '' - var scrollbarWidth = this.scrollbarWidth - if (this.bodyIsOverflowing) { - this.$body.css('padding-right', bodyPad + scrollbarWidth) - $(this.fixedContent).each(function (index, element) { - var actualPadding = element.style.paddingRight - var calculatedPadding = $(element).css('padding-right') - $(element) - .data('padding-right', actualPadding) - .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px') - }) - } - } - - Modal.prototype.resetScrollbar = function () { - this.$body.css('padding-right', this.originalBodyPad) - $(this.fixedContent).each(function (index, element) { - var padding = $(element).data('padding-right') - $(element).removeData('padding-right') - element.style.paddingRight = padding ? padding : '' - }) - } - - Modal.prototype.measureScrollbar = function () { // thx walsh - var scrollDiv = document.createElement('div') - scrollDiv.className = 'modal-scrollbar-measure' - this.$body.append(scrollDiv) - var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth - this.$body[0].removeChild(scrollDiv) - return scrollbarWidth - } - - - // MODAL PLUGIN DEFINITION - // ======================= - - function Plugin(option, _relatedTarget) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.modal') - var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) - - if (!data) $this.data('bs.modal', (data = new Modal(this, options))) - if (typeof option == 'string') data[option](_relatedTarget) - else if (options.show) data.show(_relatedTarget) - }) - } - - var old = $.fn.modal - - $.fn.modal = Plugin - $.fn.modal.Constructor = Modal - - - // MODAL NO CONFLICT - // ================= - - $.fn.modal.noConflict = function () { - $.fn.modal = old - return this - } - - - // MODAL DATA-API - // ============== - - $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { - var $this = $(this) - var href = $this.attr('href') - var target = $this.attr('data-target') || - (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 - - var $target = $(document).find(target) - var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) - - if ($this.is('a')) e.preventDefault() - - $target.one('show.bs.modal', function (showEvent) { - if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown - $target.one('hidden.bs.modal', function () { - $this.is(':visible') && $this.trigger('focus') - }) - }) - Plugin.call($target, option, this) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: tooltip.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#tooltip - * Inspired by the original jQuery.tipsy by Jason Frame - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // TOOLTIP PUBLIC CLASS DEFINITION - // =============================== - - var Tooltip = function (element, options) { - this.type = null - this.options = null - this.enabled = null - this.timeout = null - this.hoverState = null - this.$element = null - this.inState = null - - this.init('tooltip', element, options) - } - - Tooltip.VERSION = '3.4.0' - - Tooltip.TRANSITION_DURATION = 150 - - Tooltip.DEFAULTS = { - animation: true, - placement: 'top', - selector: false, - template: '', - trigger: 'hover focus', - title: '', - delay: 0, - html: false, - container: false, - viewport: { - selector: 'body', - padding: 0 - } - } - - Tooltip.prototype.init = function (type, element, options) { - this.enabled = true - this.type = type - this.$element = $(element) - this.options = this.getOptions(options) - this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) - this.inState = { click: false, hover: false, focus: false } - - if (this.$element[0] instanceof document.constructor && !this.options.selector) { - throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') - } - - var triggers = this.options.trigger.split(' ') - - for (var i = triggers.length; i--;) { - var trigger = triggers[i] - - if (trigger == 'click') { - this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) - } else if (trigger != 'manual') { - var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' - var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' - - this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) - } - } - - this.options.selector ? - (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : - this.fixTitle() - } - - Tooltip.prototype.getDefaults = function () { - return Tooltip.DEFAULTS - } - - Tooltip.prototype.getOptions = function (options) { - options = $.extend({}, this.getDefaults(), this.$element.data(), options) - - if (options.delay && typeof options.delay == 'number') { - options.delay = { - show: options.delay, - hide: options.delay - } - } - - return options - } - - Tooltip.prototype.getDelegateOptions = function () { - var options = {} - var defaults = this.getDefaults() - - this._options && $.each(this._options, function (key, value) { - if (defaults[key] != value) options[key] = value - }) - - return options - } - - Tooltip.prototype.enter = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget).data('bs.' + this.type) - - if (!self) { - self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) - $(obj.currentTarget).data('bs.' + this.type, self) - } - - if (obj instanceof $.Event) { - self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true - } - - if (self.tip().hasClass('in') || self.hoverState == 'in') { - self.hoverState = 'in' - return - } - - clearTimeout(self.timeout) - - self.hoverState = 'in' - - if (!self.options.delay || !self.options.delay.show) return self.show() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'in') self.show() - }, self.options.delay.show) - } - - Tooltip.prototype.isInStateTrue = function () { - for (var key in this.inState) { - if (this.inState[key]) return true - } - - return false - } - - Tooltip.prototype.leave = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget).data('bs.' + this.type) - - if (!self) { - self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) - $(obj.currentTarget).data('bs.' + this.type, self) - } - - if (obj instanceof $.Event) { - self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false - } - - if (self.isInStateTrue()) return - - clearTimeout(self.timeout) - - self.hoverState = 'out' - - if (!self.options.delay || !self.options.delay.hide) return self.hide() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'out') self.hide() - }, self.options.delay.hide) - } - - Tooltip.prototype.show = function () { - var e = $.Event('show.bs.' + this.type) - - if (this.hasContent() && this.enabled) { - this.$element.trigger(e) - - var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) - if (e.isDefaultPrevented() || !inDom) return - var that = this - - var $tip = this.tip() - - var tipId = this.getUID(this.type) - - this.setContent() - $tip.attr('id', tipId) - this.$element.attr('aria-describedby', tipId) - - if (this.options.animation) $tip.addClass('fade') - - var placement = typeof this.options.placement == 'function' ? - this.options.placement.call(this, $tip[0], this.$element[0]) : - this.options.placement - - var autoToken = /\s?auto?\s?/i - var autoPlace = autoToken.test(placement) - if (autoPlace) placement = placement.replace(autoToken, '') || 'top' - - $tip - .detach() - .css({ top: 0, left: 0, display: 'block' }) - .addClass(placement) - .data('bs.' + this.type, this) - - this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element) - this.$element.trigger('inserted.bs.' + this.type) - - var pos = this.getPosition() - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (autoPlace) { - var orgPlacement = placement - var viewportDim = this.getPosition(this.$viewport) - - placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : - placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : - placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : - placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : - placement - - $tip - .removeClass(orgPlacement) - .addClass(placement) - } - - var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) - - this.applyPlacement(calculatedOffset, placement) - - var complete = function () { - var prevHoverState = that.hoverState - that.$element.trigger('shown.bs.' + that.type) - that.hoverState = null - - if (prevHoverState == 'out') that.leave(that) - } - - $.support.transition && this.$tip.hasClass('fade') ? - $tip - .one('bsTransitionEnd', complete) - .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : - complete() - } - } - - Tooltip.prototype.applyPlacement = function (offset, placement) { - var $tip = this.tip() - var width = $tip[0].offsetWidth - var height = $tip[0].offsetHeight - - // manually read margins because getBoundingClientRect includes difference - var marginTop = parseInt($tip.css('margin-top'), 10) - var marginLeft = parseInt($tip.css('margin-left'), 10) - - // we must check for NaN for ie 8/9 - if (isNaN(marginTop)) marginTop = 0 - if (isNaN(marginLeft)) marginLeft = 0 - - offset.top += marginTop - offset.left += marginLeft - - // $.fn.offset doesn't round pixel values - // so we use setOffset directly with our own function B-0 - $.offset.setOffset($tip[0], $.extend({ - using: function (props) { - $tip.css({ - top: Math.round(props.top), - left: Math.round(props.left) - }) - } - }, offset), 0) - - $tip.addClass('in') - - // check to see if placing tip in new offset caused the tip to resize itself - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (placement == 'top' && actualHeight != height) { - offset.top = offset.top + height - actualHeight - } - - var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) - - if (delta.left) offset.left += delta.left - else offset.top += delta.top - - var isVertical = /top|bottom/.test(placement) - var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight - var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' - - $tip.offset(offset) - this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) - } - - Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { - this.arrow() - .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') - .css(isVertical ? 'top' : 'left', '') - } - - Tooltip.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - - $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) - $tip.removeClass('fade in top bottom left right') - } - - Tooltip.prototype.hide = function (callback) { - var that = this - var $tip = $(this.$tip) - var e = $.Event('hide.bs.' + this.type) - - function complete() { - if (that.hoverState != 'in') $tip.detach() - if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary. - that.$element - .removeAttr('aria-describedby') - .trigger('hidden.bs.' + that.type) - } - callback && callback() - } - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - $tip.removeClass('in') - - $.support.transition && $tip.hasClass('fade') ? - $tip - .one('bsTransitionEnd', complete) - .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : - complete() - - this.hoverState = null - - return this - } - - Tooltip.prototype.fixTitle = function () { - var $e = this.$element - if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { - $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') - } - } - - Tooltip.prototype.hasContent = function () { - return this.getTitle() - } - - Tooltip.prototype.getPosition = function ($element) { - $element = $element || this.$element - - var el = $element[0] - var isBody = el.tagName == 'BODY' - - var elRect = el.getBoundingClientRect() - if (elRect.width == null) { - // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 - elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) - } - var isSvg = window.SVGElement && el instanceof window.SVGElement - // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. - // See https://github.com/twbs/bootstrap/issues/20280 - var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) - var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } - var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null - - return $.extend({}, elRect, scroll, outerDims, elOffset) - } - - Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { - return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : - /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } - - } - - Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { - var delta = { top: 0, left: 0 } - if (!this.$viewport) return delta - - var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 - var viewportDimensions = this.getPosition(this.$viewport) - - if (/right|left/.test(placement)) { - var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll - var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight - if (topEdgeOffset < viewportDimensions.top) { // top overflow - delta.top = viewportDimensions.top - topEdgeOffset - } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow - delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset - } - } else { - var leftEdgeOffset = pos.left - viewportPadding - var rightEdgeOffset = pos.left + viewportPadding + actualWidth - if (leftEdgeOffset < viewportDimensions.left) { // left overflow - delta.left = viewportDimensions.left - leftEdgeOffset - } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow - delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset - } - } - - return delta - } - - Tooltip.prototype.getTitle = function () { - var title - var $e = this.$element - var o = this.options - - title = $e.attr('data-original-title') - || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) - - return title - } - - Tooltip.prototype.getUID = function (prefix) { - do prefix += ~~(Math.random() * 1000000) - while (document.getElementById(prefix)) - return prefix - } - - Tooltip.prototype.tip = function () { - if (!this.$tip) { - this.$tip = $(this.options.template) - if (this.$tip.length != 1) { - throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') - } - } - return this.$tip - } - - Tooltip.prototype.arrow = function () { - return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) - } - - Tooltip.prototype.enable = function () { - this.enabled = true - } - - Tooltip.prototype.disable = function () { - this.enabled = false - } - - Tooltip.prototype.toggleEnabled = function () { - this.enabled = !this.enabled - } - - Tooltip.prototype.toggle = function (e) { - var self = this - if (e) { - self = $(e.currentTarget).data('bs.' + this.type) - if (!self) { - self = new this.constructor(e.currentTarget, this.getDelegateOptions()) - $(e.currentTarget).data('bs.' + this.type, self) - } - } - - if (e) { - self.inState.click = !self.inState.click - if (self.isInStateTrue()) self.enter(self) - else self.leave(self) - } else { - self.tip().hasClass('in') ? self.leave(self) : self.enter(self) - } - } - - Tooltip.prototype.destroy = function () { - var that = this - clearTimeout(this.timeout) - this.hide(function () { - that.$element.off('.' + that.type).removeData('bs.' + that.type) - if (that.$tip) { - that.$tip.detach() - } - that.$tip = null - that.$arrow = null - that.$viewport = null - that.$element = null - }) - } - - - // TOOLTIP PLUGIN DEFINITION - // ========================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tooltip') - var options = typeof option == 'object' && option - - if (!data && /destroy|hide/.test(option)) return - if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.tooltip - - $.fn.tooltip = Plugin - $.fn.tooltip.Constructor = Tooltip - - - // TOOLTIP NO CONFLICT - // =================== - - $.fn.tooltip.noConflict = function () { - $.fn.tooltip = old - return this - } - -}(jQuery); - -/* ======================================================================== - * Bootstrap: popover.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#popovers - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // POPOVER PUBLIC CLASS DEFINITION - // =============================== - - var Popover = function (element, options) { - this.init('popover', element, options) - } - - if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') - - Popover.VERSION = '3.4.0' - - Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { - placement: 'right', - trigger: 'click', - content: '', - template: '' - }) - - - // NOTE: POPOVER EXTENDS tooltip.js - // ================================ - - Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) - - Popover.prototype.constructor = Popover - - Popover.prototype.getDefaults = function () { - return Popover.DEFAULTS - } - - Popover.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - var content = this.getContent() - - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events - this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' - ](content) - - $tip.removeClass('fade top bottom left right in') - - // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do - // this manually by checking the contents. - if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() - } - - Popover.prototype.hasContent = function () { - return this.getTitle() || this.getContent() - } - - Popover.prototype.getContent = function () { - var $e = this.$element - var o = this.options - - return $e.attr('data-content') - || (typeof o.content == 'function' ? - o.content.call($e[0]) : - o.content) - } - - Popover.prototype.arrow = function () { - return (this.$arrow = this.$arrow || this.tip().find('.arrow')) - } - - - // POPOVER PLUGIN DEFINITION - // ========================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.popover') - var options = typeof option == 'object' && option - - if (!data && /destroy|hide/.test(option)) return - if (!data) $this.data('bs.popover', (data = new Popover(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.popover - - $.fn.popover = Plugin - $.fn.popover.Constructor = Popover - - - // POPOVER NO CONFLICT - // =================== - - $.fn.popover.noConflict = function () { - $.fn.popover = old - return this - } - -}(jQuery); - -/* ======================================================================== - * Bootstrap: scrollspy.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#scrollspy - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // SCROLLSPY CLASS DEFINITION - // ========================== - - function ScrollSpy(element, options) { - this.$body = $(document.body) - this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) - this.options = $.extend({}, ScrollSpy.DEFAULTS, options) - this.selector = (this.options.target || '') + ' .nav li > a' - this.offsets = [] - this.targets = [] - this.activeTarget = null - this.scrollHeight = 0 - - this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) - this.refresh() - this.process() - } - - ScrollSpy.VERSION = '3.4.0' - - ScrollSpy.DEFAULTS = { - offset: 10 - } - - ScrollSpy.prototype.getScrollHeight = function () { - return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) - } - - ScrollSpy.prototype.refresh = function () { - var that = this - var offsetMethod = 'offset' - var offsetBase = 0 - - this.offsets = [] - this.targets = [] - this.scrollHeight = this.getScrollHeight() - - if (!$.isWindow(this.$scrollElement[0])) { - offsetMethod = 'position' - offsetBase = this.$scrollElement.scrollTop() - } - - this.$body - .find(this.selector) - .map(function () { - var $el = $(this) - var href = $el.data('target') || $el.attr('href') - var $href = /^#./.test(href) && $(href) - - return ($href - && $href.length - && $href.is(':visible') - && [[$href[offsetMethod]().top + offsetBase, href]]) || null - }) - .sort(function (a, b) { return a[0] - b[0] }) - .each(function () { - that.offsets.push(this[0]) - that.targets.push(this[1]) - }) - } - - ScrollSpy.prototype.process = function () { - var scrollTop = this.$scrollElement.scrollTop() + this.options.offset - var scrollHeight = this.getScrollHeight() - var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() - var offsets = this.offsets - var targets = this.targets - var activeTarget = this.activeTarget - var i - - if (this.scrollHeight != scrollHeight) { - this.refresh() - } - - if (scrollTop >= maxScroll) { - return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) - } - - if (activeTarget && scrollTop < offsets[0]) { - this.activeTarget = null - return this.clear() - } - - for (i = offsets.length; i--;) { - activeTarget != targets[i] - && scrollTop >= offsets[i] - && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) - && this.activate(targets[i]) - } - } - - ScrollSpy.prototype.activate = function (target) { - this.activeTarget = target - - this.clear() - - var selector = this.selector + - '[data-target="' + target + '"],' + - this.selector + '[href="' + target + '"]' - - var active = $(selector) - .parents('li') - .addClass('active') - - if (active.parent('.dropdown-menu').length) { - active = active - .closest('li.dropdown') - .addClass('active') - } - - active.trigger('activate.bs.scrollspy') - } - - ScrollSpy.prototype.clear = function () { - $(this.selector) - .parentsUntil(this.options.target, '.active') - .removeClass('active') - } - - - // SCROLLSPY PLUGIN DEFINITION - // =========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.scrollspy') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.scrollspy - - $.fn.scrollspy = Plugin - $.fn.scrollspy.Constructor = ScrollSpy - - - // SCROLLSPY NO CONFLICT - // ===================== - - $.fn.scrollspy.noConflict = function () { - $.fn.scrollspy = old - return this - } - - - // SCROLLSPY DATA-API - // ================== - - $(window).on('load.bs.scrollspy.data-api', function () { - $('[data-spy="scroll"]').each(function () { - var $spy = $(this) - Plugin.call($spy, $spy.data()) - }) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: tab.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#tabs - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // TAB CLASS DEFINITION - // ==================== - - var Tab = function (element) { - // jscs:disable requireDollarBeforejQueryAssignment - this.element = $(element) - // jscs:enable requireDollarBeforejQueryAssignment - } - - Tab.VERSION = '3.4.0' - - Tab.TRANSITION_DURATION = 150 - - Tab.prototype.show = function () { - var $this = this.element - var $ul = $this.closest('ul:not(.dropdown-menu)') - var selector = $this.data('target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - if ($this.parent('li').hasClass('active')) return - - var $previous = $ul.find('.active:last a') - var hideEvent = $.Event('hide.bs.tab', { - relatedTarget: $this[0] - }) - var showEvent = $.Event('show.bs.tab', { - relatedTarget: $previous[0] - }) - - $previous.trigger(hideEvent) - $this.trigger(showEvent) - - if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return - - var $target = $(document).find(selector) - - this.activate($this.closest('li'), $ul) - this.activate($target, $target.parent(), function () { - $previous.trigger({ - type: 'hidden.bs.tab', - relatedTarget: $this[0] - }) - $this.trigger({ - type: 'shown.bs.tab', - relatedTarget: $previous[0] - }) - }) - } - - Tab.prototype.activate = function (element, container, callback) { - var $active = container.find('> .active') - var transition = callback - && $.support.transition - && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) - - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', false) - - element - .addClass('active') - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } - - if (element.parent('.dropdown-menu').length) { - element - .closest('li.dropdown') - .addClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - } - - callback && callback() - } - - $active.length && transition ? - $active - .one('bsTransitionEnd', next) - .emulateTransitionEnd(Tab.TRANSITION_DURATION) : - next() - - $active.removeClass('in') - } - - - // TAB PLUGIN DEFINITION - // ===================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tab') - - if (!data) $this.data('bs.tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.tab - - $.fn.tab = Plugin - $.fn.tab.Constructor = Tab - - - // TAB NO CONFLICT - // =============== - - $.fn.tab.noConflict = function () { - $.fn.tab = old - return this - } - - - // TAB DATA-API - // ============ - - var clickHandler = function (e) { - e.preventDefault() - Plugin.call($(this), 'show') - } - - $(document) - .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) - .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: affix.js v3.4.0 - * https://getbootstrap.com/docs/3.4/javascript/#affix - * ======================================================================== - * Copyright 2011-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // AFFIX CLASS DEFINITION - // ====================== - - var Affix = function (element, options) { - this.options = $.extend({}, Affix.DEFAULTS, options) - - var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target) - - this.$target = target - .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) - .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) - - this.$element = $(element) - this.affixed = null - this.unpin = null - this.pinnedOffset = null - - this.checkPosition() - } - - Affix.VERSION = '3.4.0' - - Affix.RESET = 'affix affix-top affix-bottom' - - Affix.DEFAULTS = { - offset: 0, - target: window - } - - Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - var targetHeight = this.$target.height() - - if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false - - if (this.affixed == 'bottom') { - if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' - return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' - } - - var initializing = this.affixed == null - var colliderTop = initializing ? scrollTop : position.top - var colliderHeight = initializing ? targetHeight : height - - if (offsetTop != null && scrollTop <= offsetTop) return 'top' - if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' - - return false - } - - Affix.prototype.getPinnedOffset = function () { - if (this.pinnedOffset) return this.pinnedOffset - this.$element.removeClass(Affix.RESET).addClass('affix') - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - return (this.pinnedOffset = position.top - scrollTop) - } - - Affix.prototype.checkPositionWithEventLoop = function () { - setTimeout($.proxy(this.checkPosition, this), 1) - } - - Affix.prototype.checkPosition = function () { - if (!this.$element.is(':visible')) return - - var height = this.$element.height() - var offset = this.options.offset - var offsetTop = offset.top - var offsetBottom = offset.bottom - var scrollHeight = Math.max($(document).height(), $(document.body).height()) - - if (typeof offset != 'object') offsetBottom = offsetTop = offset - if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) - if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) - - var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) - - if (this.affixed != affix) { - if (this.unpin != null) this.$element.css('top', '') - - var affixType = 'affix' + (affix ? '-' + affix : '') - var e = $.Event(affixType + '.bs.affix') - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - this.affixed = affix - this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null - - this.$element - .removeClass(Affix.RESET) - .addClass(affixType) - .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') - } - - if (affix == 'bottom') { - this.$element.offset({ - top: scrollHeight - height - offsetBottom - }) - } - } - - - // AFFIX PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.affix') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.affix', (data = new Affix(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.affix - - $.fn.affix = Plugin - $.fn.affix.Constructor = Affix - - - // AFFIX NO CONFLICT - // ================= - - $.fn.affix.noConflict = function () { - $.fn.affix = old - return this - } - - - // AFFIX DATA-API - // ============== - - $(window).on('load', function () { - $('[data-spy="affix"]').each(function () { - var $spy = $(this) - var data = $spy.data() - - data.offset = data.offset || {} - - if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom - if (data.offsetTop != null) data.offset.top = data.offsetTop - - Plugin.call($spy, data) - }) - }) - -}(jQuery); diff --git a/shared/static/src/bulma/bulma-rtl.sass b/shared/static/src/bulma/bulma-rtl.sass deleted file mode 100644 index daeba985..00000000 --- a/shared/static/src/bulma/bulma-rtl.sass +++ /dev/null @@ -1,3 +0,0 @@ -@charset "utf-8" -$rtl: true -@import "bulma" diff --git a/shared/static/src/bulma/bulma.sass b/shared/static/src/bulma/bulma.sass deleted file mode 100644 index 4b7b7a66..00000000 --- a/shared/static/src/bulma/bulma.sass +++ /dev/null @@ -1,10 +0,0 @@ -@charset "utf-8" -/*! bulma.io v0.9.0 | MIT License | github.com/jgthms/bulma */ -@import "sass/utilities/_all" -@import "sass/base/_all" -@import "sass/elements/_all" -@import "sass/form/_all" -@import "sass/components/_all" -@import "sass/grid/_all" -@import "sass/helpers/_all" -@import "sass/layout/_all" diff --git a/shared/static/src/bulma/sass/base/_all.sass b/shared/static/src/bulma/sass/base/_all.sass deleted file mode 100644 index ce1dddc9..00000000 --- a/shared/static/src/bulma/sass/base/_all.sass +++ /dev/null @@ -1,4 +0,0 @@ -@charset "utf-8" - -@import "minireset.sass" -@import "generic.sass" diff --git a/shared/static/src/bulma/sass/base/generic.sass b/shared/static/src/bulma/sass/base/generic.sass deleted file mode 100644 index 75d6efd8..00000000 --- a/shared/static/src/bulma/sass/base/generic.sass +++ /dev/null @@ -1,142 +0,0 @@ -$body-background-color: $scheme-main !default -$body-size: 16px !default -$body-min-width: 300px !default -$body-rendering: optimizeLegibility !default -$body-family: $family-primary !default -$body-overflow-x: hidden !default -$body-overflow-y: scroll !default - -$body-color: $text !default -$body-font-size: 1em !default -$body-weight: $weight-normal !default -$body-line-height: 1.5 !default - -$code-family: $family-code !default -$code-padding: 0.25em 0.5em 0.25em !default -$code-weight: normal !default -$code-size: 0.875em !default - -$small-font-size: 0.875em !default - -$hr-background-color: $background !default -$hr-height: 2px !default -$hr-margin: 1.5rem 0 !default - -$strong-color: $text-strong !default -$strong-weight: $weight-bold !default - -$pre-font-size: 0.875em !default -$pre-padding: 1.25rem 1.5rem !default -$pre-code-font-size: 1em !default - -html - background-color: $body-background-color - font-size: $body-size - -moz-osx-font-smoothing: grayscale - -webkit-font-smoothing: antialiased - min-width: $body-min-width - overflow-x: $body-overflow-x - overflow-y: $body-overflow-y - text-rendering: $body-rendering - text-size-adjust: 100% - -article, -aside, -figure, -footer, -header, -hgroup, -section - display: block - -body, -button, -input, -select, -textarea - font-family: $body-family - -code, -pre - -moz-osx-font-smoothing: auto - -webkit-font-smoothing: auto - font-family: $code-family - -body - color: $body-color - font-size: $body-font-size - font-weight: $body-weight - line-height: $body-line-height - -// Inline - -a - color: $link - cursor: pointer - text-decoration: none - strong - color: currentColor - &:hover - color: $link-hover - -code - background-color: $code-background - color: $code - font-size: $code-size - font-weight: $code-weight - padding: $code-padding - -hr - background-color: $hr-background-color - border: none - display: block - height: $hr-height - margin: $hr-margin - -img - height: auto - max-width: 100% - -input[type="checkbox"], -input[type="radio"] - vertical-align: baseline - -small - font-size: $small-font-size - -span - font-style: inherit - font-weight: inherit - -strong - color: $strong-color - font-weight: $strong-weight - -// Block - -fieldset - border: none - -pre - +overflow-touch - background-color: $pre-background - color: $pre - font-size: $pre-font-size - overflow-x: auto - padding: $pre-padding - white-space: pre - word-wrap: normal - code - background-color: transparent - color: currentColor - font-size: $pre-code-font-size - padding: 0 - -table - td, - th - vertical-align: top - &:not([align]) - text-align: inherit - th - color: $text-strong diff --git a/shared/static/src/bulma/sass/base/helpers.sass b/shared/static/src/bulma/sass/base/helpers.sass deleted file mode 100644 index e356830f..00000000 --- a/shared/static/src/bulma/sass/base/helpers.sass +++ /dev/null @@ -1 +0,0 @@ -@warn "The helpers.sass file is DEPRECATED. It has moved into its own /helpers folder. Please import sass/helpers/_all instead." diff --git a/shared/static/src/bulma/sass/base/minireset.sass b/shared/static/src/bulma/sass/base/minireset.sass deleted file mode 100644 index aa2b6f3a..00000000 --- a/shared/static/src/bulma/sass/base/minireset.sass +++ /dev/null @@ -1,79 +0,0 @@ -/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */ -// Blocks -html, -body, -p, -ol, -ul, -li, -dl, -dt, -dd, -blockquote, -figure, -fieldset, -legend, -textarea, -pre, -iframe, -hr, -h1, -h2, -h3, -h4, -h5, -h6 - margin: 0 - padding: 0 - -// Headings -h1, -h2, -h3, -h4, -h5, -h6 - font-size: 100% - font-weight: normal - -// List -ul - list-style: none - -// Form -button, -input, -select, -textarea - margin: 0 - -// Box sizing -html - box-sizing: border-box - -* - &, - &::before, - &::after - box-sizing: inherit - -// Media -img, -video - height: auto - max-width: 100% - -// Iframe -iframe - border: 0 - -// Table -table - border-collapse: collapse - border-spacing: 0 - -td, -th - padding: 0 - &:not([align]) - text-align: inherit diff --git a/shared/static/src/bulma/sass/components/_all.sass b/shared/static/src/bulma/sass/components/_all.sass deleted file mode 100644 index 1de2c214..00000000 --- a/shared/static/src/bulma/sass/components/_all.sass +++ /dev/null @@ -1,14 +0,0 @@ -@charset "utf-8" - -@import "breadcrumb.sass" -@import "card.sass" -@import "dropdown.sass" -@import "level.sass" -@import "media.sass" -@import "menu.sass" -@import "message.sass" -@import "modal.sass" -@import "navbar.sass" -@import "pagination.sass" -@import "panel.sass" -@import "tabs.sass" diff --git a/shared/static/src/bulma/sass/components/breadcrumb.sass b/shared/static/src/bulma/sass/components/breadcrumb.sass deleted file mode 100644 index f42b0b84..00000000 --- a/shared/static/src/bulma/sass/components/breadcrumb.sass +++ /dev/null @@ -1,75 +0,0 @@ -$breadcrumb-item-color: $link !default -$breadcrumb-item-hover-color: $link-hover !default -$breadcrumb-item-active-color: $text-strong !default - -$breadcrumb-item-padding-vertical: 0 !default -$breadcrumb-item-padding-horizontal: 0.75em !default - -$breadcrumb-item-separator-color: $border-hover !default - -.breadcrumb - @extend %block - @extend %unselectable - font-size: $size-normal - white-space: nowrap - a - align-items: center - color: $breadcrumb-item-color - display: flex - justify-content: center - padding: $breadcrumb-item-padding-vertical $breadcrumb-item-padding-horizontal - &:hover - color: $breadcrumb-item-hover-color - li - align-items: center - display: flex - &:first-child a - +ltr-property("padding", 0, false) - &.is-active - a - color: $breadcrumb-item-active-color - cursor: default - pointer-events: none - & + li::before - color: $breadcrumb-item-separator-color - content: "\0002f" - ul, - ol - align-items: flex-start - display: flex - flex-wrap: wrap - justify-content: flex-start - .icon - &:first-child - +ltr-property("margin", 0.5em) - &:last-child - +ltr-property("margin", 0.5em, false) - // Alignment - &.is-centered - ol, - ul - justify-content: center - &.is-right - ol, - ul - justify-content: flex-end - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large - // Styles - &.has-arrow-separator - li + li::before - content: "\02192" - &.has-bullet-separator - li + li::before - content: "\02022" - &.has-dot-separator - li + li::before - content: "\000b7" - &.has-succeeds-separator - li + li::before - content: "\0227B" diff --git a/shared/static/src/bulma/sass/components/card.sass b/shared/static/src/bulma/sass/components/card.sass deleted file mode 100644 index db1e5d9b..00000000 --- a/shared/static/src/bulma/sass/components/card.sass +++ /dev/null @@ -1,79 +0,0 @@ -$card-color: $text !default -$card-background-color: $scheme-main !default -$card-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default - -$card-header-background-color: transparent !default -$card-header-color: $text-strong !default -$card-header-padding: 0.75rem 1rem !default -$card-header-shadow: 0 0.125em 0.25em rgba($scheme-invert, 0.1) !default -$card-header-weight: $weight-bold !default - -$card-content-background-color: transparent !default -$card-content-padding: 1.5rem !default - -$card-footer-background-color: transparent !default -$card-footer-border-top: 1px solid $border-light !default -$card-footer-padding: 0.75rem !default - -$card-media-margin: $block-spacing !default - -.card - background-color: $card-background-color - box-shadow: $card-shadow - color: $card-color - max-width: 100% - position: relative - -.card-header - background-color: $card-header-background-color - align-items: stretch - box-shadow: $card-header-shadow - display: flex - -.card-header-title - align-items: center - color: $card-header-color - display: flex - flex-grow: 1 - font-weight: $card-header-weight - padding: $card-header-padding - &.is-centered - justify-content: center - -.card-header-icon - align-items: center - cursor: pointer - display: flex - justify-content: center - padding: $card-header-padding - -.card-image - display: block - position: relative - -.card-content - background-color: $card-content-background-color - padding: $card-content-padding - -.card-footer - background-color: $card-footer-background-color - border-top: $card-footer-border-top - align-items: stretch - display: flex - -.card-footer-item - align-items: center - display: flex - flex-basis: 0 - flex-grow: 1 - flex-shrink: 0 - justify-content: center - padding: $card-footer-padding - &:not(:last-child) - +ltr-property("border", $card-footer-border-top) - -// Combinations - -.card - .media:not(:last-child) - margin-bottom: $card-media-margin diff --git a/shared/static/src/bulma/sass/components/dropdown.sass b/shared/static/src/bulma/sass/components/dropdown.sass deleted file mode 100644 index 62cb66e4..00000000 --- a/shared/static/src/bulma/sass/components/dropdown.sass +++ /dev/null @@ -1,81 +0,0 @@ -$dropdown-menu-min-width: 12rem !default - -$dropdown-content-background-color: $scheme-main !default -$dropdown-content-arrow: $link !default -$dropdown-content-offset: 4px !default -$dropdown-content-padding-bottom: 0.5rem !default -$dropdown-content-padding-top: 0.5rem !default -$dropdown-content-radius: $radius !default -$dropdown-content-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default -$dropdown-content-z: 20 !default - -$dropdown-item-color: $text !default -$dropdown-item-hover-color: $scheme-invert !default -$dropdown-item-hover-background-color: $background !default -$dropdown-item-active-color: $link-invert !default -$dropdown-item-active-background-color: $link !default - -$dropdown-divider-background-color: $border-light !default - -.dropdown - display: inline-flex - position: relative - vertical-align: top - &.is-active, - &.is-hoverable:hover - .dropdown-menu - display: block - &.is-right - .dropdown-menu - left: auto - right: 0 - &.is-up - .dropdown-menu - bottom: 100% - padding-bottom: $dropdown-content-offset - padding-top: initial - top: auto - -.dropdown-menu - display: none - +ltr-position(0, false) - min-width: $dropdown-menu-min-width - padding-top: $dropdown-content-offset - position: absolute - top: 100% - z-index: $dropdown-content-z - -.dropdown-content - background-color: $dropdown-content-background-color - border-radius: $dropdown-content-radius - box-shadow: $dropdown-content-shadow - padding-bottom: $dropdown-content-padding-bottom - padding-top: $dropdown-content-padding-top - -.dropdown-item - color: $dropdown-item-color - display: block - font-size: 0.875rem - line-height: 1.5 - padding: 0.375rem 1rem - position: relative - -a.dropdown-item, -button.dropdown-item - +ltr-property("padding", 3rem) - text-align: inherit - white-space: nowrap - width: 100% - &:hover - background-color: $dropdown-item-hover-background-color - color: $dropdown-item-hover-color - &.is-active - background-color: $dropdown-item-active-background-color - color: $dropdown-item-active-color - -.dropdown-divider - background-color: $dropdown-divider-background-color - border: none - display: block - height: 1px - margin: 0.5rem 0 diff --git a/shared/static/src/bulma/sass/components/level.sass b/shared/static/src/bulma/sass/components/level.sass deleted file mode 100644 index 8f731202..00000000 --- a/shared/static/src/bulma/sass/components/level.sass +++ /dev/null @@ -1,77 +0,0 @@ -$level-item-spacing: ($block-spacing / 2) !default - -.level - @extend %block - align-items: center - justify-content: space-between - code - border-radius: $radius - img - display: inline-block - vertical-align: top - // Modifiers - &.is-mobile - display: flex - .level-left, - .level-right - display: flex - .level-left + .level-right - margin-top: 0 - .level-item - &:not(:last-child) - margin-bottom: 0 - +ltr-property("margin", $level-item-spacing) - &:not(.is-narrow) - flex-grow: 1 - // Responsiveness - +tablet - display: flex - & > .level-item - &:not(.is-narrow) - flex-grow: 1 - -.level-item - align-items: center - display: flex - flex-basis: auto - flex-grow: 0 - flex-shrink: 0 - justify-content: center - .title, - .subtitle - margin-bottom: 0 - // Responsiveness - +mobile - &:not(:last-child) - margin-bottom: $level-item-spacing - -.level-left, -.level-right - flex-basis: auto - flex-grow: 0 - flex-shrink: 0 - .level-item - // Modifiers - &.is-flexible - flex-grow: 1 - // Responsiveness - +tablet - &:not(:last-child) - +ltr-property("margin", $level-item-spacing) - -.level-left - align-items: center - justify-content: flex-start - // Responsiveness - +mobile - & + .level-right - margin-top: 1.5rem - +tablet - display: flex - -.level-right - align-items: center - justify-content: flex-end - // Responsiveness - +tablet - display: flex diff --git a/shared/static/src/bulma/sass/components/media.sass b/shared/static/src/bulma/sass/components/media.sass deleted file mode 100644 index 777755b2..00000000 --- a/shared/static/src/bulma/sass/components/media.sass +++ /dev/null @@ -1,52 +0,0 @@ -$media-border-color: bulmaRgba($border, 0.5) !default -$media-spacing: 1rem -$media-spacing-large: 1.5rem - -.media - align-items: flex-start - display: flex - text-align: inherit - .content:not(:last-child) - margin-bottom: 0.75rem - .media - border-top: 1px solid $media-border-color - display: flex - padding-top: 0.75rem - .content:not(:last-child), - .control:not(:last-child) - margin-bottom: 0.5rem - .media - padding-top: 0.5rem - & + .media - margin-top: 0.5rem - & + .media - border-top: 1px solid $media-border-color - margin-top: $media-spacing - padding-top: $media-spacing - // Sizes - &.is-large - & + .media - margin-top: $media-spacing-large - padding-top: $media-spacing-large - -.media-left, -.media-right - flex-basis: auto - flex-grow: 0 - flex-shrink: 0 - -.media-left - +ltr-property("margin", $media-spacing) - -.media-right - +ltr-property("margin", $media-spacing, false) - -.media-content - flex-basis: auto - flex-grow: 1 - flex-shrink: 1 - text-align: inherit - -+mobile - .media-content - overflow-x: auto diff --git a/shared/static/src/bulma/sass/components/menu.sass b/shared/static/src/bulma/sass/components/menu.sass deleted file mode 100644 index 1bf78297..00000000 --- a/shared/static/src/bulma/sass/components/menu.sass +++ /dev/null @@ -1,57 +0,0 @@ -$menu-item-color: $text !default -$menu-item-radius: $radius-small !default -$menu-item-hover-color: $text-strong !default -$menu-item-hover-background-color: $background !default -$menu-item-active-color: $link-invert !default -$menu-item-active-background-color: $link !default - -$menu-list-border-left: 1px solid $border !default -$menu-list-line-height: 1.25 !default -$menu-list-link-padding: 0.5em 0.75em !default -$menu-nested-list-margin: 0.75em !default -$menu-nested-list-padding-left: 0.75em !default - -$menu-label-color: $text-light !default -$menu-label-font-size: 0.75em !default -$menu-label-letter-spacing: 0.1em !default -$menu-label-spacing: 1em !default - -.menu - font-size: $size-normal - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large - -.menu-list - line-height: $menu-list-line-height - a - border-radius: $menu-item-radius - color: $menu-item-color - display: block - padding: $menu-list-link-padding - &:hover - background-color: $menu-item-hover-background-color - color: $menu-item-hover-color - // Modifiers - &.is-active - background-color: $menu-item-active-background-color - color: $menu-item-active-color - li - ul - +ltr-property("border", $menu-list-border-left, false) - margin: $menu-nested-list-margin - +ltr-property("padding", $menu-nested-list-padding-left, false) - -.menu-label - color: $menu-label-color - font-size: $menu-label-font-size - letter-spacing: $menu-label-letter-spacing - text-transform: uppercase - &:not(:first-child) - margin-top: $menu-label-spacing - &:not(:last-child) - margin-bottom: $menu-label-spacing diff --git a/shared/static/src/bulma/sass/components/message.sass b/shared/static/src/bulma/sass/components/message.sass deleted file mode 100644 index 180fbe94..00000000 --- a/shared/static/src/bulma/sass/components/message.sass +++ /dev/null @@ -1,99 +0,0 @@ -$message-background-color: $background !default -$message-radius: $radius !default - -$message-header-background-color: $text !default -$message-header-color: $text-invert !default -$message-header-weight: $weight-bold !default -$message-header-padding: 0.75em 1em !default -$message-header-radius: $radius !default - -$message-body-border-color: $border !default -$message-body-border-width: 0 0 0 4px !default -$message-body-color: $text !default -$message-body-padding: 1.25em 1.5em !default -$message-body-radius: $radius !default - -$message-body-pre-background-color: $scheme-main !default -$message-body-pre-code-background-color: transparent !default - -$message-header-body-border-width: 0 !default -$message-colors: $colors !default - -.message - @extend %block - background-color: $message-background-color - border-radius: $message-radius - font-size: $size-normal - strong - color: currentColor - a:not(.button):not(.tag):not(.dropdown-item) - color: currentColor - text-decoration: underline - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large - // Colors - @each $name, $components in $message-colors - $color: nth($components, 1) - $color-invert: nth($components, 2) - $color-light: null - $color-dark: null - - @if length($components) >= 3 - $color-light: nth($components, 3) - @if length($components) >= 4 - $color-dark: nth($components, 4) - @else - $color-luminance: colorLuminance($color) - $darken-percentage: $color-luminance * 70% - $desaturate-percentage: $color-luminance * 30% - $color-dark: desaturate(darken($color, $darken-percentage), $desaturate-percentage) - @else - $color-lightning: max((100% - lightness($color)) - 2%, 0%) - $color-light: lighten($color, $color-lightning) - - &.is-#{$name} - background-color: $color-light - .message-header - background-color: $color - color: $color-invert - .message-body - border-color: $color - color: $color-dark - -.message-header - align-items: center - background-color: $message-header-background-color - border-radius: $message-header-radius $message-header-radius 0 0 - color: $message-header-color - display: flex - font-weight: $message-header-weight - justify-content: space-between - line-height: 1.25 - padding: $message-header-padding - position: relative - .delete - flex-grow: 0 - flex-shrink: 0 - +ltr-property("margin", 0.75em, false) - & + .message-body - border-width: $message-header-body-border-width - border-top-left-radius: 0 - border-top-right-radius: 0 - -.message-body - border-color: $message-body-border-color - border-radius: $message-body-radius - border-style: solid - border-width: $message-body-border-width - color: $message-body-color - padding: $message-body-padding - code, - pre - background-color: $message-body-pre-background-color - pre code - background-color: $message-body-pre-code-background-color diff --git a/shared/static/src/bulma/sass/components/modal.sass b/shared/static/src/bulma/sass/components/modal.sass deleted file mode 100644 index f352744a..00000000 --- a/shared/static/src/bulma/sass/components/modal.sass +++ /dev/null @@ -1,113 +0,0 @@ -$modal-z: 40 !default - -$modal-background-background-color: bulmaRgba($scheme-invert, 0.86) !default - -$modal-content-width: 640px !default -$modal-content-margin-mobile: 20px !default -$modal-content-spacing-mobile: 160px !default -$modal-content-spacing-tablet: 40px !default - -$modal-close-dimensions: 40px !default -$modal-close-right: 20px !default -$modal-close-top: 20px !default - -$modal-card-spacing: 40px !default - -$modal-card-head-background-color: $background !default -$modal-card-head-border-bottom: 1px solid $border !default -$modal-card-head-padding: 20px !default -$modal-card-head-radius: $radius-large !default - -$modal-card-title-color: $text-strong !default -$modal-card-title-line-height: 1 !default -$modal-card-title-size: $size-4 !default - -$modal-card-foot-radius: $radius-large !default -$modal-card-foot-border-top: 1px solid $border !default - -$modal-card-body-background-color: $scheme-main !default -$modal-card-body-padding: 20px !default - -.modal - @extend %overlay - align-items: center - display: none - flex-direction: column - justify-content: center - overflow: hidden - position: fixed - z-index: $modal-z - // Modifiers - &.is-active - display: flex - -.modal-background - @extend %overlay - background-color: $modal-background-background-color - -.modal-content, -.modal-card - margin: 0 $modal-content-margin-mobile - max-height: calc(100vh - #{$modal-content-spacing-mobile}) - overflow: auto - position: relative - width: 100% - // Responsiveness - +tablet - margin: 0 auto - max-height: calc(100vh - #{$modal-content-spacing-tablet}) - width: $modal-content-width - -.modal-close - @extend %delete - background: none - height: $modal-close-dimensions - position: fixed - +ltr-position($modal-close-right) - top: $modal-close-top - width: $modal-close-dimensions - -.modal-card - display: flex - flex-direction: column - max-height: calc(100vh - #{$modal-card-spacing}) - overflow: hidden - -ms-overflow-y: visible - -.modal-card-head, -.modal-card-foot - align-items: center - background-color: $modal-card-head-background-color - display: flex - flex-shrink: 0 - justify-content: flex-start - padding: $modal-card-head-padding - position: relative - -.modal-card-head - border-bottom: $modal-card-head-border-bottom - border-top-left-radius: $modal-card-head-radius - border-top-right-radius: $modal-card-head-radius - -.modal-card-title - color: $modal-card-title-color - flex-grow: 1 - flex-shrink: 0 - font-size: $modal-card-title-size - line-height: $modal-card-title-line-height - -.modal-card-foot - border-bottom-left-radius: $modal-card-foot-radius - border-bottom-right-radius: $modal-card-foot-radius - border-top: $modal-card-foot-border-top - .button - &:not(:last-child) - +ltr-property("margin", 0.5em) - -.modal-card-body - +overflow-touch - background-color: $modal-card-body-background-color - flex-grow: 1 - flex-shrink: 1 - overflow: auto - padding: $modal-card-body-padding diff --git a/shared/static/src/bulma/sass/components/navbar.sass b/shared/static/src/bulma/sass/components/navbar.sass deleted file mode 100644 index a34718ec..00000000 --- a/shared/static/src/bulma/sass/components/navbar.sass +++ /dev/null @@ -1,441 +0,0 @@ -$navbar-background-color: $scheme-main !default -$navbar-box-shadow-size: 0 2px 0 0 !default -$navbar-box-shadow-color: $background !default -$navbar-height: 3.25rem !default -$navbar-padding-vertical: 1rem !default -$navbar-padding-horizontal: 2rem !default -$navbar-z: 30 !default -$navbar-fixed-z: 30 !default - -$navbar-item-color: $text !default -$navbar-item-hover-color: $link !default -$navbar-item-hover-background-color: $scheme-main-bis !default -$navbar-item-active-color: $scheme-invert !default -$navbar-item-active-background-color: transparent !default -$navbar-item-img-max-height: 1.75rem !default - -$navbar-burger-color: $navbar-item-color !default - -$navbar-tab-hover-background-color: transparent !default -$navbar-tab-hover-border-bottom-color: $link !default -$navbar-tab-active-color: $link !default -$navbar-tab-active-background-color: transparent !default -$navbar-tab-active-border-bottom-color: $link !default -$navbar-tab-active-border-bottom-style: solid !default -$navbar-tab-active-border-bottom-width: 3px !default - -$navbar-dropdown-background-color: $scheme-main !default -$navbar-dropdown-border-top: 2px solid $border !default -$navbar-dropdown-offset: -4px !default -$navbar-dropdown-arrow: $link !default -$navbar-dropdown-radius: $radius-large !default -$navbar-dropdown-z: 20 !default - -$navbar-dropdown-boxed-radius: $radius-large !default -$navbar-dropdown-boxed-shadow: 0 8px 8px bulmaRgba($scheme-invert, 0.1), 0 0 0 1px bulmaRgba($scheme-invert, 0.1) !default - -$navbar-dropdown-item-hover-color: $scheme-invert !default -$navbar-dropdown-item-hover-background-color: $background !default -$navbar-dropdown-item-active-color: $link !default -$navbar-dropdown-item-active-background-color: $background !default - -$navbar-divider-background-color: $background !default -$navbar-divider-height: 2px !default - -$navbar-bottom-box-shadow-size: 0 -2px 0 0 !default - -$navbar-breakpoint: $desktop !default - -=navbar-fixed - left: 0 - position: fixed - right: 0 - z-index: $navbar-fixed-z - -.navbar - background-color: $navbar-background-color - min-height: $navbar-height - position: relative - z-index: $navbar-z - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - background-color: $color - color: $color-invert - .navbar-brand - & > .navbar-item, - .navbar-link - color: $color-invert - & > a.navbar-item, - .navbar-link - &:focus, - &:hover, - &.is-active - background-color: bulmaDarken($color, 5%) - color: $color-invert - .navbar-link - &::after - border-color: $color-invert - .navbar-burger - color: $color-invert - +from($navbar-breakpoint) - .navbar-start, - .navbar-end - & > .navbar-item, - .navbar-link - color: $color-invert - & > a.navbar-item, - .navbar-link - &:focus, - &:hover, - &.is-active - background-color: bulmaDarken($color, 5%) - color: $color-invert - .navbar-link - &::after - border-color: $color-invert - .navbar-item.has-dropdown:focus .navbar-link, - .navbar-item.has-dropdown:hover .navbar-link, - .navbar-item.has-dropdown.is-active .navbar-link - background-color: bulmaDarken($color, 5%) - color: $color-invert - .navbar-dropdown - a.navbar-item - &.is-active - background-color: $color - color: $color-invert - & > .container - align-items: stretch - display: flex - min-height: $navbar-height - width: 100% - &.has-shadow - box-shadow: $navbar-box-shadow-size $navbar-box-shadow-color - &.is-fixed-bottom, - &.is-fixed-top - +navbar-fixed - &.is-fixed-bottom - bottom: 0 - &.has-shadow - box-shadow: $navbar-bottom-box-shadow-size $navbar-box-shadow-color - &.is-fixed-top - top: 0 - -html, -body - &.has-navbar-fixed-top - padding-top: $navbar-height - &.has-navbar-fixed-bottom - padding-bottom: $navbar-height - -.navbar-brand, -.navbar-tabs - align-items: stretch - display: flex - flex-shrink: 0 - min-height: $navbar-height - -.navbar-brand - a.navbar-item - &:focus, - &:hover - background-color: transparent - -.navbar-tabs - +overflow-touch - max-width: 100vw - overflow-x: auto - overflow-y: hidden - -.navbar-burger - color: $navbar-burger-color - +hamburger($navbar-height) - +ltr-property("margin", auto, false) - -.navbar-menu - display: none - -.navbar-item, -.navbar-link - color: $navbar-item-color - display: block - line-height: 1.5 - padding: 0.5rem 0.75rem - position: relative - .icon - &:only-child - margin-left: -0.25rem - margin-right: -0.25rem - -a.navbar-item, -.navbar-link - cursor: pointer - &:focus, - &:focus-within, - &:hover, - &.is-active - background-color: $navbar-item-hover-background-color - color: $navbar-item-hover-color - -.navbar-item - flex-grow: 0 - flex-shrink: 0 - img - max-height: $navbar-item-img-max-height - &.has-dropdown - padding: 0 - &.is-expanded - flex-grow: 1 - flex-shrink: 1 - &.is-tab - border-bottom: 1px solid transparent - min-height: $navbar-height - padding-bottom: calc(0.5rem - 1px) - &:focus, - &:hover - background-color: $navbar-tab-hover-background-color - border-bottom-color: $navbar-tab-hover-border-bottom-color - &.is-active - background-color: $navbar-tab-active-background-color - border-bottom-color: $navbar-tab-active-border-bottom-color - border-bottom-style: $navbar-tab-active-border-bottom-style - border-bottom-width: $navbar-tab-active-border-bottom-width - color: $navbar-tab-active-color - padding-bottom: calc(0.5rem - #{$navbar-tab-active-border-bottom-width}) - -.navbar-content - flex-grow: 1 - flex-shrink: 1 - -.navbar-link:not(.is-arrowless) - +ltr-property("padding", 2.5em) - &::after - @extend %arrow - border-color: $navbar-dropdown-arrow - margin-top: -0.375em - +ltr-position(1.125em) - -.navbar-dropdown - font-size: 0.875rem - padding-bottom: 0.5rem - padding-top: 0.5rem - .navbar-item - padding-left: 1.5rem - padding-right: 1.5rem - -.navbar-divider - background-color: $navbar-divider-background-color - border: none - display: none - height: $navbar-divider-height - margin: 0.5rem 0 - -+until($navbar-breakpoint) - .navbar > .container - display: block - .navbar-brand, - .navbar-tabs - .navbar-item - align-items: center - display: flex - .navbar-link - &::after - display: none - .navbar-menu - background-color: $navbar-background-color - box-shadow: 0 8px 16px bulmaRgba($scheme-invert, 0.1) - padding: 0.5rem 0 - &.is-active - display: block - // Fixed navbar - .navbar - &.is-fixed-bottom-touch, - &.is-fixed-top-touch - +navbar-fixed - &.is-fixed-bottom-touch - bottom: 0 - &.has-shadow - box-shadow: 0 -2px 3px bulmaRgba($scheme-invert, 0.1) - &.is-fixed-top-touch - top: 0 - &.is-fixed-top, - &.is-fixed-top-touch - .navbar-menu - +overflow-touch - max-height: calc(100vh - #{$navbar-height}) - overflow: auto - html, - body - &.has-navbar-fixed-top-touch - padding-top: $navbar-height - &.has-navbar-fixed-bottom-touch - padding-bottom: $navbar-height - -+from($navbar-breakpoint) - .navbar, - .navbar-menu, - .navbar-start, - .navbar-end - align-items: stretch - display: flex - .navbar - min-height: $navbar-height - &.is-spaced - padding: $navbar-padding-vertical $navbar-padding-horizontal - .navbar-start, - .navbar-end - align-items: center - a.navbar-item, - .navbar-link - border-radius: $radius - &.is-transparent - a.navbar-item, - .navbar-link - &:focus, - &:hover, - &.is-active - background-color: transparent !important - .navbar-item.has-dropdown - &.is-active, - &.is-hoverable:focus, - &.is-hoverable:focus-within, - &.is-hoverable:hover - .navbar-link - background-color: transparent !important - .navbar-dropdown - a.navbar-item - &:focus, - &:hover - background-color: $navbar-dropdown-item-hover-background-color - color: $navbar-dropdown-item-hover-color - &.is-active - background-color: $navbar-dropdown-item-active-background-color - color: $navbar-dropdown-item-active-color - .navbar-burger - display: none - .navbar-item, - .navbar-link - align-items: center - display: flex - .navbar-item - &.has-dropdown - align-items: stretch - &.has-dropdown-up - .navbar-link::after - transform: rotate(135deg) translate(0.25em, -0.25em) - .navbar-dropdown - border-bottom: $navbar-dropdown-border-top - border-radius: $navbar-dropdown-radius $navbar-dropdown-radius 0 0 - border-top: none - bottom: 100% - box-shadow: 0 -8px 8px bulmaRgba($scheme-invert, 0.1) - top: auto - &.is-active, - &.is-hoverable:focus, - &.is-hoverable:focus-within, - &.is-hoverable:hover - .navbar-dropdown - display: block - .navbar.is-spaced &, - &.is-boxed - opacity: 1 - pointer-events: auto - transform: translateY(0) - .navbar-menu - flex-grow: 1 - flex-shrink: 0 - .navbar-start - justify-content: flex-start - +ltr-property("margin", auto) - .navbar-end - justify-content: flex-end - +ltr-property("margin", auto, false) - .navbar-dropdown - background-color: $navbar-dropdown-background-color - border-bottom-left-radius: $navbar-dropdown-radius - border-bottom-right-radius: $navbar-dropdown-radius - border-top: $navbar-dropdown-border-top - box-shadow: 0 8px 8px bulmaRgba($scheme-invert, 0.1) - display: none - font-size: 0.875rem - +ltr-position(0, false) - min-width: 100% - position: absolute - top: 100% - z-index: $navbar-dropdown-z - .navbar-item - padding: 0.375rem 1rem - white-space: nowrap - a.navbar-item - +ltr-property("padding", 3rem) - &:focus, - &:hover - background-color: $navbar-dropdown-item-hover-background-color - color: $navbar-dropdown-item-hover-color - &.is-active - background-color: $navbar-dropdown-item-active-background-color - color: $navbar-dropdown-item-active-color - .navbar.is-spaced &, - &.is-boxed - border-radius: $navbar-dropdown-boxed-radius - border-top: none - box-shadow: $navbar-dropdown-boxed-shadow - display: block - opacity: 0 - pointer-events: none - top: calc(100% + (#{$navbar-dropdown-offset})) - transform: translateY(-5px) - transition-duration: $speed - transition-property: opacity, transform - &.is-right - left: auto - right: 0 - .navbar-divider - display: block - .navbar > .container, - .container > .navbar - .navbar-brand - +ltr-property("margin", -.75rem, false) - .navbar-menu - +ltr-property("margin", -.75rem) - // Fixed navbar - .navbar - &.is-fixed-bottom-desktop, - &.is-fixed-top-desktop - +navbar-fixed - &.is-fixed-bottom-desktop - bottom: 0 - &.has-shadow - box-shadow: 0 -2px 3px bulmaRgba($scheme-invert, 0.1) - &.is-fixed-top-desktop - top: 0 - html, - body - &.has-navbar-fixed-top-desktop - padding-top: $navbar-height - &.has-navbar-fixed-bottom-desktop - padding-bottom: $navbar-height - &.has-spaced-navbar-fixed-top - padding-top: $navbar-height + ($navbar-padding-vertical * 2) - &.has-spaced-navbar-fixed-bottom - padding-bottom: $navbar-height + ($navbar-padding-vertical * 2) - // Hover/Active states - a.navbar-item, - .navbar-link - &.is-active - color: $navbar-item-active-color - &.is-active:not(:focus):not(:hover) - background-color: $navbar-item-active-background-color - .navbar-item.has-dropdown - &:focus, - &:hover, - &.is-active - .navbar-link - background-color: $navbar-item-hover-background-color - -// Combination - -.hero - &.is-fullheight-with-navbar - min-height: calc(100vh - #{$navbar-height}) diff --git a/shared/static/src/bulma/sass/components/pagination.sass b/shared/static/src/bulma/sass/components/pagination.sass deleted file mode 100644 index 822c2e81..00000000 --- a/shared/static/src/bulma/sass/components/pagination.sass +++ /dev/null @@ -1,150 +0,0 @@ -$pagination-color: $text-strong !default -$pagination-border-color: $border !default -$pagination-margin: -0.25rem !default -$pagination-min-width: $control-height !default - -$pagination-item-font-size: 1em !default -$pagination-item-margin: 0.25rem !default -$pagination-item-padding-left: 0.5em !default -$pagination-item-padding-right: 0.5em !default - -$pagination-hover-color: $link-hover !default -$pagination-hover-border-color: $link-hover-border !default - -$pagination-focus-color: $link-focus !default -$pagination-focus-border-color: $link-focus-border !default - -$pagination-active-color: $link-active !default -$pagination-active-border-color: $link-active-border !default - -$pagination-disabled-color: $text-light !default -$pagination-disabled-background-color: $border !default -$pagination-disabled-border-color: $border !default - -$pagination-current-color: $link-invert !default -$pagination-current-background-color: $link !default -$pagination-current-border-color: $link !default - -$pagination-ellipsis-color: $grey-light !default - -$pagination-shadow-inset: inset 0 1px 2px rgba($scheme-invert, 0.2) - -.pagination - @extend %block - font-size: $size-normal - margin: $pagination-margin - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large - &.is-rounded - .pagination-previous, - .pagination-next - padding-left: 1em - padding-right: 1em - border-radius: $radius-rounded - .pagination-link - border-radius: $radius-rounded - -.pagination, -.pagination-list - align-items: center - display: flex - justify-content: center - text-align: center - -.pagination-previous, -.pagination-next, -.pagination-link, -.pagination-ellipsis - @extend %control - @extend %unselectable - font-size: $pagination-item-font-size - justify-content: center - margin: $pagination-item-margin - padding-left: $pagination-item-padding-left - padding-right: $pagination-item-padding-right - text-align: center - -.pagination-previous, -.pagination-next, -.pagination-link - border-color: $pagination-border-color - color: $pagination-color - min-width: $pagination-min-width - &:hover - border-color: $pagination-hover-border-color - color: $pagination-hover-color - &:focus - border-color: $pagination-focus-border-color - &:active - box-shadow: $pagination-shadow-inset - &[disabled] - background-color: $pagination-disabled-background-color - border-color: $pagination-disabled-border-color - box-shadow: none - color: $pagination-disabled-color - opacity: 0.5 - -.pagination-previous, -.pagination-next - padding-left: 0.75em - padding-right: 0.75em - white-space: nowrap - -.pagination-link - &.is-current - background-color: $pagination-current-background-color - border-color: $pagination-current-border-color - color: $pagination-current-color - -.pagination-ellipsis - color: $pagination-ellipsis-color - pointer-events: none - -.pagination-list - flex-wrap: wrap - -+mobile - .pagination - flex-wrap: wrap - .pagination-previous, - .pagination-next - flex-grow: 1 - flex-shrink: 1 - .pagination-list - li - flex-grow: 1 - flex-shrink: 1 - -+tablet - .pagination-list - flex-grow: 1 - flex-shrink: 1 - justify-content: flex-start - order: 1 - .pagination-previous - order: 2 - .pagination-next - order: 3 - .pagination - justify-content: space-between - &.is-centered - .pagination-previous - order: 1 - .pagination-list - justify-content: center - order: 2 - .pagination-next - order: 3 - &.is-right - .pagination-previous - order: 1 - .pagination-next - order: 2 - .pagination-list - justify-content: flex-end - order: 3 diff --git a/shared/static/src/bulma/sass/components/panel.sass b/shared/static/src/bulma/sass/components/panel.sass deleted file mode 100644 index 2f7e2754..00000000 --- a/shared/static/src/bulma/sass/components/panel.sass +++ /dev/null @@ -1,119 +0,0 @@ -$panel-margin: $block-spacing !default -$panel-item-border: 1px solid $border-light !default -$panel-radius: $radius-large !default -$panel-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default - -$panel-heading-background-color: $border-light !default -$panel-heading-color: $text-strong !default -$panel-heading-line-height: 1.25 !default -$panel-heading-padding: 0.75em 1em !default -$panel-heading-radius: $radius !default -$panel-heading-size: 1.25em !default -$panel-heading-weight: $weight-bold !default - -$panel-tabs-font-size: 0.875em !default -$panel-tab-border-bottom: 1px solid $border !default -$panel-tab-active-border-bottom-color: $link-active-border !default -$panel-tab-active-color: $link-active !default - -$panel-list-item-color: $text !default -$panel-list-item-hover-color: $link !default - -$panel-block-color: $text-strong !default -$panel-block-hover-background-color: $background !default -$panel-block-active-border-left-color: $link !default -$panel-block-active-color: $link-active !default -$panel-block-active-icon-color: $link !default - -$panel-icon-color: $text-light !default -$panel-colors: $colors !default - -.panel - border-radius: $panel-radius - box-shadow: $panel-shadow - font-size: $size-normal - &:not(:last-child) - margin-bottom: $panel-margin - // Colors - @each $name, $components in $panel-colors - $color: nth($components, 1) - $color-invert: nth($components, 2) - &.is-#{$name} - .panel-heading - background-color: $color - color: $color-invert - .panel-tabs a.is-active - border-bottom-color: $color - .panel-block.is-active .panel-icon - color: $color - -.panel-tabs, -.panel-block - &:not(:last-child) - border-bottom: $panel-item-border - -.panel-heading - background-color: $panel-heading-background-color - border-radius: $panel-radius $panel-radius 0 0 - color: $panel-heading-color - font-size: $panel-heading-size - font-weight: $panel-heading-weight - line-height: $panel-heading-line-height - padding: $panel-heading-padding - -.panel-tabs - align-items: flex-end - display: flex - font-size: $panel-tabs-font-size - justify-content: center - a - border-bottom: $panel-tab-border-bottom - margin-bottom: -1px - padding: 0.5em - // Modifiers - &.is-active - border-bottom-color: $panel-tab-active-border-bottom-color - color: $panel-tab-active-color - -.panel-list - a - color: $panel-list-item-color - &:hover - color: $panel-list-item-hover-color - -.panel-block - align-items: center - color: $panel-block-color - display: flex - justify-content: flex-start - padding: 0.5em 0.75em - input[type="checkbox"] - +ltr-property("margin", 0.75em) - & > .control - flex-grow: 1 - flex-shrink: 1 - width: 100% - &.is-wrapped - flex-wrap: wrap - &.is-active - border-left-color: $panel-block-active-border-left-color - color: $panel-block-active-color - .panel-icon - color: $panel-block-active-icon-color - &:last-child - border-bottom-left-radius: $panel-radius - border-bottom-right-radius: $panel-radius - -a.panel-block, -label.panel-block - cursor: pointer - &:hover - background-color: $panel-block-hover-background-color - -.panel-icon - +fa(14px, 1em) - color: $panel-icon-color - +ltr-property("margin", 0.75em) - .fa - font-size: inherit - line-height: inherit diff --git a/shared/static/src/bulma/sass/components/tabs.sass b/shared/static/src/bulma/sass/components/tabs.sass deleted file mode 100644 index 2308bf09..00000000 --- a/shared/static/src/bulma/sass/components/tabs.sass +++ /dev/null @@ -1,174 +0,0 @@ -$tabs-border-bottom-color: $border !default -$tabs-border-bottom-style: solid !default -$tabs-border-bottom-width: 1px !default -$tabs-link-color: $text !default -$tabs-link-hover-border-bottom-color: $text-strong !default -$tabs-link-hover-color: $text-strong !default -$tabs-link-active-border-bottom-color: $link !default -$tabs-link-active-color: $link !default -$tabs-link-padding: 0.5em 1em !default - -$tabs-boxed-link-radius: $radius !default -$tabs-boxed-link-hover-background-color: $background !default -$tabs-boxed-link-hover-border-bottom-color: $border !default - -$tabs-boxed-link-active-background-color: $scheme-main !default -$tabs-boxed-link-active-border-color: $border !default -$tabs-boxed-link-active-border-bottom-color: transparent !default - -$tabs-toggle-link-border-color: $border !default -$tabs-toggle-link-border-style: solid !default -$tabs-toggle-link-border-width: 1px !default -$tabs-toggle-link-hover-background-color: $background !default -$tabs-toggle-link-hover-border-color: $border-hover !default -$tabs-toggle-link-radius: $radius !default -$tabs-toggle-link-active-background-color: $link !default -$tabs-toggle-link-active-border-color: $link !default -$tabs-toggle-link-active-color: $link-invert !default - -.tabs - @extend %block - +overflow-touch - @extend %unselectable - align-items: stretch - display: flex - font-size: $size-normal - justify-content: space-between - overflow: hidden - overflow-x: auto - white-space: nowrap - a - align-items: center - border-bottom-color: $tabs-border-bottom-color - border-bottom-style: $tabs-border-bottom-style - border-bottom-width: $tabs-border-bottom-width - color: $tabs-link-color - display: flex - justify-content: center - margin-bottom: -#{$tabs-border-bottom-width} - padding: $tabs-link-padding - vertical-align: top - &:hover - border-bottom-color: $tabs-link-hover-border-bottom-color - color: $tabs-link-hover-color - li - display: block - &.is-active - a - border-bottom-color: $tabs-link-active-border-bottom-color - color: $tabs-link-active-color - ul - align-items: center - border-bottom-color: $tabs-border-bottom-color - border-bottom-style: $tabs-border-bottom-style - border-bottom-width: $tabs-border-bottom-width - display: flex - flex-grow: 1 - flex-shrink: 0 - justify-content: flex-start - &.is-left - padding-right: 0.75em - &.is-center - flex: none - justify-content: center - padding-left: 0.75em - padding-right: 0.75em - &.is-right - justify-content: flex-end - padding-left: 0.75em - .icon - &:first-child - +ltr-property("margin", 0.5em) - &:last-child - +ltr-property("margin", 0.5em, false) - // Alignment - &.is-centered - ul - justify-content: center - &.is-right - ul - justify-content: flex-end - // Styles - &.is-boxed - a - border: 1px solid transparent - +ltr - border-radius: $tabs-boxed-link-radius $tabs-boxed-link-radius 0 0 - +rtl - border-radius: 0 0 $tabs-boxed-link-radius $tabs-boxed-link-radius - &:hover - background-color: $tabs-boxed-link-hover-background-color - border-bottom-color: $tabs-boxed-link-hover-border-bottom-color - li - &.is-active - a - background-color: $tabs-boxed-link-active-background-color - border-color: $tabs-boxed-link-active-border-color - border-bottom-color: $tabs-boxed-link-active-border-bottom-color !important - &.is-fullwidth - li - flex-grow: 1 - flex-shrink: 0 - &.is-toggle - a - border-color: $tabs-toggle-link-border-color - border-style: $tabs-toggle-link-border-style - border-width: $tabs-toggle-link-border-width - margin-bottom: 0 - position: relative - &:hover - background-color: $tabs-toggle-link-hover-background-color - border-color: $tabs-toggle-link-hover-border-color - z-index: 2 - li - & + li - +ltr-property("margin", -#{$tabs-toggle-link-border-width}, false) - &:first-child a - +ltr - border-top-left-radius: $tabs-toggle-link-radius - border-bottom-left-radius: $tabs-toggle-link-radius - +rtl - border-top-right-radius: $tabs-toggle-link-radius - border-bottom-right-radius: $tabs-toggle-link-radius - &:last-child a - +ltr - border-top-right-radius: $tabs-toggle-link-radius - border-bottom-right-radius: $tabs-toggle-link-radius - +rtl - border-top-left-radius: $tabs-toggle-link-radius - border-bottom-left-radius: $tabs-toggle-link-radius - &.is-active - a - background-color: $tabs-toggle-link-active-background-color - border-color: $tabs-toggle-link-active-border-color - color: $tabs-toggle-link-active-color - z-index: 1 - ul - border-bottom: none - &.is-toggle-rounded - li - &:first-child a - +ltr - border-bottom-left-radius: $radius-rounded - border-top-left-radius: $radius-rounded - padding-left: 1.25em - +rtl - border-bottom-right-radius: $radius-rounded - border-top-right-radius: $radius-rounded - padding-right: 1.25em - &:last-child a - +ltr - border-bottom-right-radius: $radius-rounded - border-top-right-radius: $radius-rounded - padding-right: 1.25em - +rtl - border-bottom-left-radius: $radius-rounded - border-top-left-radius: $radius-rounded - padding-left: 1.25em - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large diff --git a/shared/static/src/bulma/sass/elements/_all.sass b/shared/static/src/bulma/sass/elements/_all.sass deleted file mode 100644 index 7490c00d..00000000 --- a/shared/static/src/bulma/sass/elements/_all.sass +++ /dev/null @@ -1,15 +0,0 @@ -@charset "utf-8" - -@import "box.sass" -@import "button.sass" -@import "container.sass" -@import "content.sass" -@import "icon.sass" -@import "image.sass" -@import "notification.sass" -@import "progress.sass" -@import "table.sass" -@import "tag.sass" -@import "title.sass" - -@import "other.sass" diff --git a/shared/static/src/bulma/sass/elements/box.sass b/shared/static/src/bulma/sass/elements/box.sass deleted file mode 100644 index 2fd18d49..00000000 --- a/shared/static/src/bulma/sass/elements/box.sass +++ /dev/null @@ -1,24 +0,0 @@ -$box-color: $text !default -$box-background-color: $scheme-main !default -$box-radius: $radius-large !default -$box-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default -$box-padding: 1.25rem !default - -$box-link-hover-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0 0 1px $link !default -$box-link-active-shadow: inset 0 1px 2px rgba($scheme-invert, 0.2), 0 0 0 1px $link !default - -.box - @extend %block - background-color: $box-background-color - border-radius: $box-radius - box-shadow: $box-shadow - color: $box-color - display: block - padding: $box-padding - -a.box - &:hover, - &:focus - box-shadow: $box-link-hover-shadow - &:active - box-shadow: $box-link-active-shadow diff --git a/shared/static/src/bulma/sass/elements/button.sass b/shared/static/src/bulma/sass/elements/button.sass deleted file mode 100644 index 4bdf2534..00000000 --- a/shared/static/src/bulma/sass/elements/button.sass +++ /dev/null @@ -1,323 +0,0 @@ -$button-color: $text-strong !default -$button-background-color: $scheme-main !default -$button-family: false !default - -$button-border-color: $border !default -$button-border-width: $control-border-width !default - -$button-padding-vertical: calc(0.5em - #{$button-border-width}) !default -$button-padding-horizontal: 1em !default - -$button-hover-color: $link-hover !default -$button-hover-border-color: $link-hover-border !default - -$button-focus-color: $link-focus !default -$button-focus-border-color: $link-focus-border !default -$button-focus-box-shadow-size: 0 0 0 0.125em !default -$button-focus-box-shadow-color: bulmaRgba($link, 0.25) !default - -$button-active-color: $link-active !default -$button-active-border-color: $link-active-border !default - -$button-text-color: $text !default -$button-text-decoration: underline !default -$button-text-hover-background-color: $background !default -$button-text-hover-color: $text-strong !default - -$button-disabled-background-color: $scheme-main !default -$button-disabled-border-color: $border !default -$button-disabled-shadow: none !default -$button-disabled-opacity: 0.5 !default - -$button-static-color: $text-light !default -$button-static-background-color: $scheme-main-ter !default -$button-static-border-color: $border !default - -// The button sizes use mixins so they can be used at different breakpoints -=button-small - border-radius: $radius-small - font-size: $size-small -=button-normal - font-size: $size-normal -=button-medium - font-size: $size-medium -=button-large - font-size: $size-large - -.button - @extend %control - @extend %unselectable - background-color: $button-background-color - border-color: $button-border-color - border-width: $button-border-width - color: $button-color - cursor: pointer - @if $button-family - font-family: $button-family - justify-content: center - padding-bottom: $button-padding-vertical - padding-left: $button-padding-horizontal - padding-right: $button-padding-horizontal - padding-top: $button-padding-vertical - text-align: center - white-space: nowrap - strong - color: inherit - .icon - &, - &.is-small, - &.is-medium, - &.is-large - height: 1.5em - width: 1.5em - &:first-child:not(:last-child) - +ltr-property("margin", calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}), false) - +ltr-property("margin", $button-padding-horizontal / 4) - &:last-child:not(:first-child) - +ltr-property("margin", $button-padding-horizontal / 4, false) - +ltr-property("margin", calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width})) - &:first-child:last-child - margin-left: calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}) - margin-right: calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}) - // States - &:hover, - &.is-hovered - border-color: $button-hover-border-color - color: $button-hover-color - &:focus, - &.is-focused - border-color: $button-focus-border-color - color: $button-focus-color - &:not(:active) - box-shadow: $button-focus-box-shadow-size $button-focus-box-shadow-color - &:active, - &.is-active - border-color: $button-active-border-color - color: $button-active-color - // Colors - &.is-text - background-color: transparent - border-color: transparent - color: $button-text-color - text-decoration: $button-text-decoration - &:hover, - &.is-hovered, - &:focus, - &.is-focused - background-color: $button-text-hover-background-color - color: $button-text-hover-color - &:active, - &.is-active - background-color: bulmaDarken($button-text-hover-background-color, 5%) - color: $button-text-hover-color - &[disabled], - fieldset[disabled] & - background-color: transparent - border-color: transparent - box-shadow: none - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - background-color: $color - border-color: transparent - color: $color-invert - &:hover, - &.is-hovered - background-color: bulmaDarken($color, 2.5%) - border-color: transparent - color: $color-invert - &:focus, - &.is-focused - border-color: transparent - color: $color-invert - &:not(:active) - box-shadow: $button-focus-box-shadow-size bulmaRgba($color, 0.25) - &:active, - &.is-active - background-color: bulmaDarken($color, 5%) - border-color: transparent - color: $color-invert - &[disabled], - fieldset[disabled] & - background-color: $color - border-color: transparent - box-shadow: none - &.is-inverted - background-color: $color-invert - color: $color - &:hover, - &.is-hovered - background-color: bulmaDarken($color-invert, 5%) - &[disabled], - fieldset[disabled] & - background-color: $color-invert - border-color: transparent - box-shadow: none - color: $color - &.is-loading - &::after - border-color: transparent transparent $color-invert $color-invert !important - &.is-outlined - background-color: transparent - border-color: $color - color: $color - &:hover, - &.is-hovered, - &:focus, - &.is-focused - background-color: $color - border-color: $color - color: $color-invert - &.is-loading - &::after - border-color: transparent transparent $color $color !important - &:hover, - &.is-hovered, - &:focus, - &.is-focused - &::after - border-color: transparent transparent $color-invert $color-invert !important - &[disabled], - fieldset[disabled] & - background-color: transparent - border-color: $color - box-shadow: none - color: $color - &.is-inverted.is-outlined - background-color: transparent - border-color: $color-invert - color: $color-invert - &:hover, - &.is-hovered, - &:focus, - &.is-focused - background-color: $color-invert - color: $color - &.is-loading - &:hover, - &.is-hovered, - &:focus, - &.is-focused - &::after - border-color: transparent transparent $color $color !important - &[disabled], - fieldset[disabled] & - background-color: transparent - border-color: $color-invert - box-shadow: none - color: $color-invert - // If light and dark colors are provided - @if length($pair) >= 4 - $color-light: nth($pair, 3) - $color-dark: nth($pair, 4) - &.is-light - background-color: $color-light - color: $color-dark - &:hover, - &.is-hovered - background-color: bulmaDarken($color-light, 2.5%) - border-color: transparent - color: $color-dark - &:active, - &.is-active - background-color: bulmaDarken($color-light, 5%) - border-color: transparent - color: $color-dark - // Sizes - &.is-small - +button-small - &.is-normal - +button-normal - &.is-medium - +button-medium - &.is-large - +button-large - // Modifiers - &[disabled], - fieldset[disabled] & - background-color: $button-disabled-background-color - border-color: $button-disabled-border-color - box-shadow: $button-disabled-shadow - opacity: $button-disabled-opacity - &.is-fullwidth - display: flex - width: 100% - &.is-loading - color: transparent !important - pointer-events: none - &::after - @extend %loader - +center(1em) - position: absolute !important - &.is-static - background-color: $button-static-background-color - border-color: $button-static-border-color - color: $button-static-color - box-shadow: none - pointer-events: none - &.is-rounded - border-radius: $radius-rounded - padding-left: calc(#{$button-padding-horizontal} + 0.25em) - padding-right: calc(#{$button-padding-horizontal} + 0.25em) - -.buttons - align-items: center - display: flex - flex-wrap: wrap - justify-content: flex-start - .button - margin-bottom: 0.5rem - &:not(:last-child):not(.is-fullwidth) - +ltr-property("margin", 0.5rem) - &:last-child - margin-bottom: -0.5rem - &:not(:last-child) - margin-bottom: 1rem - // Sizes - &.are-small - .button:not(.is-normal):not(.is-medium):not(.is-large) - +button-small - &.are-medium - .button:not(.is-small):not(.is-normal):not(.is-large) - +button-medium - &.are-large - .button:not(.is-small):not(.is-normal):not(.is-medium) - +button-large - &.has-addons - .button - &:not(:first-child) - border-bottom-left-radius: 0 - border-top-left-radius: 0 - &:not(:last-child) - border-bottom-right-radius: 0 - border-top-right-radius: 0 - +ltr-property("margin", -1px) - &:last-child - +ltr-property("margin", 0) - &:hover, - &.is-hovered - z-index: 2 - &:focus, - &.is-focused, - &:active, - &.is-active, - &.is-selected - z-index: 3 - &:hover - z-index: 4 - &.is-expanded - flex-grow: 1 - flex-shrink: 1 - &.is-centered - justify-content: center - &:not(.has-addons) - .button:not(.is-fullwidth) - margin-left: 0.25rem - margin-right: 0.25rem - &.is-right - justify-content: flex-end - &:not(.has-addons) - .button:not(.is-fullwidth) - margin-left: 0.25rem - margin-right: 0.25rem diff --git a/shared/static/src/bulma/sass/elements/container.sass b/shared/static/src/bulma/sass/elements/container.sass deleted file mode 100644 index d88eb94a..00000000 --- a/shared/static/src/bulma/sass/elements/container.sass +++ /dev/null @@ -1,24 +0,0 @@ -$container-offset: (2 * $gap) !default - -.container - flex-grow: 1 - margin: 0 auto - position: relative - width: auto - &.is-fluid - max-width: none - padding-left: $gap - padding-right: $gap - width: 100% - +desktop - max-width: $desktop - $container-offset - +until-widescreen - &.is-widescreen - max-width: $widescreen - $container-offset - +until-fullhd - &.is-fullhd - max-width: $fullhd - $container-offset - +widescreen - max-width: $widescreen - $container-offset - +fullhd - max-width: $fullhd - $container-offset diff --git a/shared/static/src/bulma/sass/elements/content.sass b/shared/static/src/bulma/sass/elements/content.sass deleted file mode 100644 index 800268b7..00000000 --- a/shared/static/src/bulma/sass/elements/content.sass +++ /dev/null @@ -1,155 +0,0 @@ -$content-heading-color: $text-strong !default -$content-heading-weight: $weight-semibold !default -$content-heading-line-height: 1.125 !default - -$content-blockquote-background-color: $background !default -$content-blockquote-border-left: 5px solid $border !default -$content-blockquote-padding: 1.25em 1.5em !default - -$content-pre-padding: 1.25em 1.5em !default - -$content-table-cell-border: 1px solid $border !default -$content-table-cell-border-width: 0 0 1px !default -$content-table-cell-padding: 0.5em 0.75em !default -$content-table-cell-heading-color: $text-strong !default -$content-table-head-cell-border-width: 0 0 2px !default -$content-table-head-cell-color: $text-strong !default -$content-table-foot-cell-border-width: 2px 0 0 !default -$content-table-foot-cell-color: $text-strong !default - -.content - @extend %block - // Inline - li + li - margin-top: 0.25em - // Block - p, - dl, - ol, - ul, - blockquote, - pre, - table - &:not(:last-child) - margin-bottom: 1em - h1, - h2, - h3, - h4, - h5, - h6 - color: $content-heading-color - font-weight: $content-heading-weight - line-height: $content-heading-line-height - h1 - font-size: 2em - margin-bottom: 0.5em - &:not(:first-child) - margin-top: 1em - h2 - font-size: 1.75em - margin-bottom: 0.5714em - &:not(:first-child) - margin-top: 1.1428em - h3 - font-size: 1.5em - margin-bottom: 0.6666em - &:not(:first-child) - margin-top: 1.3333em - h4 - font-size: 1.25em - margin-bottom: 0.8em - h5 - font-size: 1.125em - margin-bottom: 0.8888em - h6 - font-size: 1em - margin-bottom: 1em - blockquote - background-color: $content-blockquote-background-color - +ltr-property("border", $content-blockquote-border-left, false) - padding: $content-blockquote-padding - ol - list-style-position: outside - +ltr-property("margin", 2em, false) - margin-top: 1em - &:not([type]) - list-style-type: decimal - &.is-lower-alpha - list-style-type: lower-alpha - &.is-lower-roman - list-style-type: lower-roman - &.is-upper-alpha - list-style-type: upper-alpha - &.is-upper-roman - list-style-type: upper-roman - ul - list-style: disc outside - +ltr-property("margin", 2em, false) - margin-top: 1em - ul - list-style-type: circle - margin-top: 0.5em - ul - list-style-type: square - dd - +ltr-property("margin", 2em, false) - figure - margin-left: 2em - margin-right: 2em - text-align: center - &:not(:first-child) - margin-top: 2em - &:not(:last-child) - margin-bottom: 2em - img - display: inline-block - figcaption - font-style: italic - pre - +overflow-touch - overflow-x: auto - padding: $content-pre-padding - white-space: pre - word-wrap: normal - sup, - sub - font-size: 75% - table - width: 100% - td, - th - border: $content-table-cell-border - border-width: $content-table-cell-border-width - padding: $content-table-cell-padding - vertical-align: top - th - color: $content-table-cell-heading-color - &:not([align]) - text-align: inherit - thead - td, - th - border-width: $content-table-head-cell-border-width - color: $content-table-head-cell-color - tfoot - td, - th - border-width: $content-table-foot-cell-border-width - color: $content-table-foot-cell-color - tbody - tr - &:last-child - td, - th - border-bottom-width: 0 - .tabs - li + li - margin-top: 0 - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large diff --git a/shared/static/src/bulma/sass/elements/form.sass b/shared/static/src/bulma/sass/elements/form.sass deleted file mode 100644 index 3122dc4c..00000000 --- a/shared/static/src/bulma/sass/elements/form.sass +++ /dev/null @@ -1 +0,0 @@ -@warn "The form.sass file is DEPRECATED. It has moved into its own /form folder. Please import sass/form/_all instead." diff --git a/shared/static/src/bulma/sass/elements/icon.sass b/shared/static/src/bulma/sass/elements/icon.sass deleted file mode 100644 index 988546c7..00000000 --- a/shared/static/src/bulma/sass/elements/icon.sass +++ /dev/null @@ -1,21 +0,0 @@ -$icon-dimensions: 1.5rem !default -$icon-dimensions-small: 1rem !default -$icon-dimensions-medium: 2rem !default -$icon-dimensions-large: 3rem !default - -.icon - align-items: center - display: inline-flex - justify-content: center - height: $icon-dimensions - width: $icon-dimensions - // Sizes - &.is-small - height: $icon-dimensions-small - width: $icon-dimensions-small - &.is-medium - height: $icon-dimensions-medium - width: $icon-dimensions-medium - &.is-large - height: $icon-dimensions-large - width: $icon-dimensions-large diff --git a/shared/static/src/bulma/sass/elements/image.sass b/shared/static/src/bulma/sass/elements/image.sass deleted file mode 100644 index 7547abcf..00000000 --- a/shared/static/src/bulma/sass/elements/image.sass +++ /dev/null @@ -1,71 +0,0 @@ -$dimensions: 16 24 32 48 64 96 128 !default - -.image - display: block - position: relative - img - display: block - height: auto - width: 100% - &.is-rounded - border-radius: $radius-rounded - &.is-fullwidth - width: 100% - // Ratio - &.is-square, - &.is-1by1, - &.is-5by4, - &.is-4by3, - &.is-3by2, - &.is-5by3, - &.is-16by9, - &.is-2by1, - &.is-3by1, - &.is-4by5, - &.is-3by4, - &.is-2by3, - &.is-3by5, - &.is-9by16, - &.is-1by2, - &.is-1by3 - img, - .has-ratio - @extend %overlay - height: 100% - width: 100% - &.is-square, - &.is-1by1 - padding-top: 100% - &.is-5by4 - padding-top: 80% - &.is-4by3 - padding-top: 75% - &.is-3by2 - padding-top: 66.6666% - &.is-5by3 - padding-top: 60% - &.is-16by9 - padding-top: 56.25% - &.is-2by1 - padding-top: 50% - &.is-3by1 - padding-top: 33.3333% - &.is-4by5 - padding-top: 125% - &.is-3by4 - padding-top: 133.3333% - &.is-2by3 - padding-top: 150% - &.is-3by5 - padding-top: 166.6666% - &.is-9by16 - padding-top: 177.7777% - &.is-1by2 - padding-top: 200% - &.is-1by3 - padding-top: 300% - // Sizes - @each $dimension in $dimensions - &.is-#{$dimension}x#{$dimension} - height: $dimension * 1px - width: $dimension * 1px diff --git a/shared/static/src/bulma/sass/elements/notification.sass b/shared/static/src/bulma/sass/elements/notification.sass deleted file mode 100644 index af1c7be5..00000000 --- a/shared/static/src/bulma/sass/elements/notification.sass +++ /dev/null @@ -1,48 +0,0 @@ -$notification-background-color: $background !default -$notification-code-background-color: $scheme-main !default -$notification-radius: $radius !default -$notification-padding: 1.25rem 2.5rem 1.25rem 1.5rem !default -$notification-padding-ltr: 1.25rem 2.5rem 1.25rem 1.5rem !default -$notification-padding-rtl: 1.25rem 1.5rem 1.25rem 2.5rem !default - -.notification - @extend %block - background-color: $notification-background-color - border-radius: $notification-radius - position: relative - +ltr - padding: $notification-padding-ltr - +rtl - padding: $notification-padding-rtl - a:not(.button):not(.dropdown-item) - color: currentColor - text-decoration: underline - strong - color: currentColor - code, - pre - background: $notification-code-background-color - pre code - background: transparent - & > .delete - +ltr-position(0.5rem) - position: absolute - top: 0.5rem - .title, - .subtitle, - .content - color: currentColor - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - background-color: $color - color: $color-invert - // If light and dark colors are provided - @if length($pair) >= 4 - $color-light: nth($pair, 3) - $color-dark: nth($pair, 4) - &.is-light - background-color: $color-light - color: $color-dark diff --git a/shared/static/src/bulma/sass/elements/other.sass b/shared/static/src/bulma/sass/elements/other.sass deleted file mode 100644 index 5725617c..00000000 --- a/shared/static/src/bulma/sass/elements/other.sass +++ /dev/null @@ -1,39 +0,0 @@ -.block - @extend %block - -.delete - @extend %delete - -.heading - display: block - font-size: 11px - letter-spacing: 1px - margin-bottom: 5px - text-transform: uppercase - -.highlight - @extend %block - font-weight: $weight-normal - max-width: 100% - overflow: hidden - padding: 0 - pre - overflow: auto - max-width: 100% - -.loader - @extend %loader - -.number - align-items: center - background-color: $background - border-radius: $radius-rounded - display: inline-flex - font-size: $size-medium - height: 2em - justify-content: center - margin-right: 1.5rem - min-width: 2.5em - padding: 0.25rem 0.5rem - text-align: center - vertical-align: top diff --git a/shared/static/src/bulma/sass/elements/progress.sass b/shared/static/src/bulma/sass/elements/progress.sass deleted file mode 100644 index bb43bb60..00000000 --- a/shared/static/src/bulma/sass/elements/progress.sass +++ /dev/null @@ -1,67 +0,0 @@ -$progress-bar-background-color: $border-light !default -$progress-value-background-color: $text !default -$progress-border-radius: $radius-rounded !default - -$progress-indeterminate-duration: 1.5s !default - -.progress - @extend %block - -moz-appearance: none - -webkit-appearance: none - border: none - border-radius: $progress-border-radius - display: block - height: $size-normal - overflow: hidden - padding: 0 - width: 100% - &::-webkit-progress-bar - background-color: $progress-bar-background-color - &::-webkit-progress-value - background-color: $progress-value-background-color - &::-moz-progress-bar - background-color: $progress-value-background-color - &::-ms-fill - background-color: $progress-value-background-color - border: none - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - &.is-#{$name} - &::-webkit-progress-value - background-color: $color - &::-moz-progress-bar - background-color: $color - &::-ms-fill - background-color: $color - &:indeterminate - background-image: linear-gradient(to right, $color 30%, $progress-bar-background-color 30%) - - &:indeterminate - animation-duration: $progress-indeterminate-duration - animation-iteration-count: infinite - animation-name: moveIndeterminate - animation-timing-function: linear - background-color: $progress-bar-background-color - background-image: linear-gradient(to right, $text 30%, $progress-bar-background-color 30%) - background-position: top left - background-repeat: no-repeat - background-size: 150% 150% - &::-webkit-progress-bar - background-color: transparent - &::-moz-progress-bar - background-color: transparent - - // Sizes - &.is-small - height: $size-small - &.is-medium - height: $size-medium - &.is-large - height: $size-large - -@keyframes moveIndeterminate - from - background-position: 200% 0 - to - background-position: -200% 0 diff --git a/shared/static/src/bulma/sass/elements/table.sass b/shared/static/src/bulma/sass/elements/table.sass deleted file mode 100644 index 48d7d93e..00000000 --- a/shared/static/src/bulma/sass/elements/table.sass +++ /dev/null @@ -1,129 +0,0 @@ -$table-color: $text-strong !default -$table-background-color: $scheme-main !default - -$table-cell-border: 1px solid $border !default -$table-cell-border-width: 0 0 1px !default -$table-cell-padding: 0.5em 0.75em !default -$table-cell-heading-color: $text-strong !default - -$table-head-cell-border-width: 0 0 2px !default -$table-head-cell-color: $text-strong !default -$table-foot-cell-border-width: 2px 0 0 !default -$table-foot-cell-color: $text-strong !default - -$table-head-background-color: transparent !default -$table-body-background-color: transparent !default -$table-foot-background-color: transparent !default - -$table-row-hover-background-color: $scheme-main-bis !default - -$table-row-active-background-color: $primary !default -$table-row-active-color: $primary-invert !default - -$table-striped-row-even-background-color: $scheme-main-bis !default -$table-striped-row-even-hover-background-color: $scheme-main-ter !default - -.table - @extend %block - background-color: $table-background-color - color: $table-color - td, - th - border: $table-cell-border - border-width: $table-cell-border-width - padding: $table-cell-padding - vertical-align: top - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - background-color: $color - border-color: $color - color: $color-invert - // Modifiers - &.is-narrow - white-space: nowrap - width: 1% - &.is-selected - background-color: $table-row-active-background-color - color: $table-row-active-color - a, - strong - color: currentColor - &.is-vcentered - vertical-align: middle - th - color: $table-cell-heading-color - &:not([align]) - text-align: inherit - tr - &.is-selected - background-color: $table-row-active-background-color - color: $table-row-active-color - a, - strong - color: currentColor - td, - th - border-color: $table-row-active-color - color: currentColor - thead - background-color: $table-head-background-color - td, - th - border-width: $table-head-cell-border-width - color: $table-head-cell-color - tfoot - background-color: $table-foot-background-color - td, - th - border-width: $table-foot-cell-border-width - color: $table-foot-cell-color - tbody - background-color: $table-body-background-color - tr - &:last-child - td, - th - border-bottom-width: 0 - // Modifiers - &.is-bordered - td, - th - border-width: 1px - tr - &:last-child - td, - th - border-bottom-width: 1px - &.is-fullwidth - width: 100% - &.is-hoverable - tbody - tr:not(.is-selected) - &:hover - background-color: $table-row-hover-background-color - &.is-striped - tbody - tr:not(.is-selected) - &:hover - background-color: $table-row-hover-background-color - &:nth-child(even) - background-color: $table-striped-row-even-hover-background-color - &.is-narrow - td, - th - padding: 0.25em 0.5em - &.is-striped - tbody - tr:not(.is-selected) - &:nth-child(even) - background-color: $table-striped-row-even-background-color - -.table-container - @extend %block - +overflow-touch - overflow: auto - overflow-y: hidden - max-width: 100% diff --git a/shared/static/src/bulma/sass/elements/tag.sass b/shared/static/src/bulma/sass/elements/tag.sass deleted file mode 100644 index f3c20a21..00000000 --- a/shared/static/src/bulma/sass/elements/tag.sass +++ /dev/null @@ -1,136 +0,0 @@ -$tag-background-color: $background !default -$tag-color: $text !default -$tag-radius: $radius !default -$tag-delete-margin: 1px !default - -.tags - align-items: center - display: flex - flex-wrap: wrap - justify-content: flex-start - .tag - margin-bottom: 0.5rem - &:not(:last-child) - +ltr-property("margin", 0.5rem) - &:last-child - margin-bottom: -0.5rem - &:not(:last-child) - margin-bottom: 1rem - // Sizes - &.are-medium - .tag:not(.is-normal):not(.is-large) - font-size: $size-normal - &.are-large - .tag:not(.is-normal):not(.is-medium) - font-size: $size-medium - &.is-centered - justify-content: center - .tag - margin-right: 0.25rem - margin-left: 0.25rem - &.is-right - justify-content: flex-end - .tag - &:not(:first-child) - margin-left: 0.5rem - &:not(:last-child) - margin-right: 0 - &.has-addons - .tag - +ltr-property("margin", 0) - &:not(:first-child) - +ltr-property("margin", 0, false) - +ltr - border-top-left-radius: 0 - border-bottom-left-radius: 0 - +rtl - border-top-right-radius: 0 - border-bottom-right-radius: 0 - &:not(:last-child) - +ltr - border-top-right-radius: 0 - border-bottom-right-radius: 0 - +rtl - border-top-left-radius: 0 - border-bottom-left-radius: 0 - -.tag:not(body) - align-items: center - background-color: $tag-background-color - border-radius: $tag-radius - color: $tag-color - display: inline-flex - font-size: $size-small - height: 2em - justify-content: center - line-height: 1.5 - padding-left: 0.75em - padding-right: 0.75em - white-space: nowrap - .delete - +ltr-property("margin", 0.25rem, false) - +ltr-property("margin", -0.375rem) - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - background-color: $color - color: $color-invert - // If a light and dark colors are provided - @if length($pair) > 3 - $color-light: nth($pair, 3) - $color-dark: nth($pair, 4) - &.is-light - background-color: $color-light - color: $color-dark - // Sizes - &.is-normal - font-size: $size-small - &.is-medium - font-size: $size-normal - &.is-large - font-size: $size-medium - .icon - &:first-child:not(:last-child) - +ltr-property("margin", -0.375em, false) - +ltr-property("margin", 0.1875em) - &:last-child:not(:first-child) - +ltr-property("margin", 0.1875em, false) - +ltr-property("margin", -0.375em) - &:first-child:last-child - +ltr-property("margin", -0.375em, false) - +ltr-property("margin", -0.375em) - // Modifiers - &.is-delete - +ltr-property("margin", $tag-delete-margin, false) - padding: 0 - position: relative - width: 2em - &::before, - &::after - background-color: currentColor - content: "" - display: block - left: 50% - position: absolute - top: 50% - transform: translateX(-50%) translateY(-50%) rotate(45deg) - transform-origin: center center - &::before - height: 1px - width: 50% - &::after - height: 50% - width: 1px - &:hover, - &:focus - background-color: darken($tag-background-color, 5%) - &:active - background-color: darken($tag-background-color, 10%) - &.is-rounded - border-radius: $radius-rounded - -a.tag - &:hover - text-decoration: underline diff --git a/shared/static/src/bulma/sass/elements/title.sass b/shared/static/src/bulma/sass/elements/title.sass deleted file mode 100644 index fa9947dd..00000000 --- a/shared/static/src/bulma/sass/elements/title.sass +++ /dev/null @@ -1,70 +0,0 @@ -$title-color: $text-strong !default -$title-family: false !default -$title-size: $size-3 !default -$title-weight: $weight-semibold !default -$title-line-height: 1.125 !default -$title-strong-color: inherit !default -$title-strong-weight: inherit !default -$title-sub-size: 0.75em !default -$title-sup-size: 0.75em !default - -$subtitle-color: $text !default -$subtitle-family: false !default -$subtitle-size: $size-5 !default -$subtitle-weight: $weight-normal !default -$subtitle-line-height: 1.25 !default -$subtitle-strong-color: $text-strong !default -$subtitle-strong-weight: $weight-semibold !default -$subtitle-negative-margin: -1.25rem !default - -.title, -.subtitle - @extend %block - word-break: break-word - em, - span - font-weight: inherit - sub - font-size: $title-sub-size - sup - font-size: $title-sup-size - .tag - vertical-align: middle - -.title - color: $title-color - @if $title-family - font-family: $title-family - font-size: $title-size - font-weight: $title-weight - line-height: $title-line-height - strong - color: $title-strong-color - font-weight: $title-strong-weight - & + .highlight - margin-top: -0.75rem - &:not(.is-spaced) + .subtitle - margin-top: $subtitle-negative-margin - // Sizes - @each $size in $sizes - $i: index($sizes, $size) - &.is-#{$i} - font-size: $size - -.subtitle - color: $subtitle-color - @if $subtitle-family - font-family: $subtitle-family - font-size: $subtitle-size - font-weight: $subtitle-weight - line-height: $subtitle-line-height - strong - color: $subtitle-strong-color - font-weight: $subtitle-strong-weight - &:not(.is-spaced) + .title - margin-top: $subtitle-negative-margin - // Sizes - @each $size in $sizes - $i: index($sizes, $size) - &.is-#{$i} - font-size: $size diff --git a/shared/static/src/bulma/sass/form/_all.sass b/shared/static/src/bulma/sass/form/_all.sass deleted file mode 100644 index d9a2b955..00000000 --- a/shared/static/src/bulma/sass/form/_all.sass +++ /dev/null @@ -1,8 +0,0 @@ -@charset "utf-8" - -@import "shared.sass" -@import "input-textarea.sass" -@import "checkbox-radio.sass" -@import "select.sass" -@import "file.sass" -@import "tools.sass" diff --git a/shared/static/src/bulma/sass/form/checkbox-radio.sass b/shared/static/src/bulma/sass/form/checkbox-radio.sass deleted file mode 100644 index 96486673..00000000 --- a/shared/static/src/bulma/sass/form/checkbox-radio.sass +++ /dev/null @@ -1,21 +0,0 @@ -%checkbox-radio - cursor: pointer - display: inline-block - line-height: 1.25 - position: relative - input - cursor: pointer - &:hover - color: $input-hover-color - &[disabled], - fieldset[disabled] & - color: $input-disabled-color - cursor: not-allowed - -.checkbox - @extend %checkbox-radio - -.radio - @extend %checkbox-radio - & + .radio - +ltr-property("margin", 0.5em, false) diff --git a/shared/static/src/bulma/sass/form/file.sass b/shared/static/src/bulma/sass/form/file.sass deleted file mode 100644 index 5fe0eee2..00000000 --- a/shared/static/src/bulma/sass/form/file.sass +++ /dev/null @@ -1,180 +0,0 @@ -$file-border-color: $border !default -$file-radius: $radius !default - -$file-cta-background-color: $scheme-main-ter !default -$file-cta-color: $text !default -$file-cta-hover-color: $text-strong !default -$file-cta-active-color: $text-strong !default - -$file-name-border-color: $border !default -$file-name-border-style: solid !default -$file-name-border-width: 1px 1px 1px 0 !default -$file-name-max-width: 16em !default - -.file - @extend %unselectable - align-items: stretch - display: flex - justify-content: flex-start - position: relative - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - .file-cta - background-color: $color - border-color: transparent - color: $color-invert - &:hover, - &.is-hovered - .file-cta - background-color: bulmaDarken($color, 2.5%) - border-color: transparent - color: $color-invert - &:focus, - &.is-focused - .file-cta - border-color: transparent - box-shadow: 0 0 0.5em bulmaRgba($color, 0.25) - color: $color-invert - &:active, - &.is-active - .file-cta - background-color: bulmaDarken($color, 5%) - border-color: transparent - color: $color-invert - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - .file-icon - .fa - font-size: 21px - &.is-large - font-size: $size-large - .file-icon - .fa - font-size: 28px - // Modifiers - &.has-name - .file-cta - border-bottom-right-radius: 0 - border-top-right-radius: 0 - .file-name - border-bottom-left-radius: 0 - border-top-left-radius: 0 - &.is-empty - .file-cta - border-radius: $file-radius - .file-name - display: none - &.is-boxed - .file-label - flex-direction: column - .file-cta - flex-direction: column - height: auto - padding: 1em 3em - .file-name - border-width: 0 1px 1px - .file-icon - height: 1.5em - width: 1.5em - .fa - font-size: 21px - &.is-small - .file-icon .fa - font-size: 14px - &.is-medium - .file-icon .fa - font-size: 28px - &.is-large - .file-icon .fa - font-size: 35px - &.has-name - .file-cta - border-radius: $file-radius $file-radius 0 0 - .file-name - border-radius: 0 0 $file-radius $file-radius - border-width: 0 1px 1px - &.is-centered - justify-content: center - &.is-fullwidth - .file-label - width: 100% - .file-name - flex-grow: 1 - max-width: none - &.is-right - justify-content: flex-end - .file-cta - border-radius: 0 $file-radius $file-radius 0 - .file-name - border-radius: $file-radius 0 0 $file-radius - border-width: 1px 0 1px 1px - order: -1 - -.file-label - align-items: stretch - display: flex - cursor: pointer - justify-content: flex-start - overflow: hidden - position: relative - &:hover - .file-cta - background-color: bulmaDarken($file-cta-background-color, 2.5%) - color: $file-cta-hover-color - .file-name - border-color: bulmaDarken($file-name-border-color, 2.5%) - &:active - .file-cta - background-color: bulmaDarken($file-cta-background-color, 5%) - color: $file-cta-active-color - .file-name - border-color: bulmaDarken($file-name-border-color, 5%) - -.file-input - height: 100% - left: 0 - opacity: 0 - outline: none - position: absolute - top: 0 - width: 100% - -.file-cta, -.file-name - @extend %control - border-color: $file-border-color - border-radius: $file-radius - font-size: 1em - padding-left: 1em - padding-right: 1em - white-space: nowrap - -.file-cta - background-color: $file-cta-background-color - color: $file-cta-color - -.file-name - border-color: $file-name-border-color - border-style: $file-name-border-style - border-width: $file-name-border-width - display: block - max-width: $file-name-max-width - overflow: hidden - text-align: inherit - text-overflow: ellipsis - -.file-icon - align-items: center - display: flex - height: 1em - justify-content: center - +ltr-property("margin", 0.5em) - width: 1em - .fa - font-size: 14px diff --git a/shared/static/src/bulma/sass/form/input-textarea.sass b/shared/static/src/bulma/sass/form/input-textarea.sass deleted file mode 100644 index a5aef556..00000000 --- a/shared/static/src/bulma/sass/form/input-textarea.sass +++ /dev/null @@ -1,64 +0,0 @@ -$textarea-padding: $control-padding-horizontal !default -$textarea-max-height: 40em !default -$textarea-min-height: 8em !default - -%input-textarea - @extend %input - box-shadow: $input-shadow - max-width: 100% - width: 100% - &[readonly] - box-shadow: none - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - &.is-#{$name} - border-color: $color - &:focus, - &.is-focused, - &:active, - &.is-active - box-shadow: $input-focus-box-shadow-size bulmaRgba($color, 0.25) - // Sizes - &.is-small - +control-small - &.is-medium - +control-medium - &.is-large - +control-large - // Modifiers - &.is-fullwidth - display: block - width: 100% - &.is-inline - display: inline - width: auto - -.input - @extend %input-textarea - &.is-rounded - border-radius: $radius-rounded - padding-left: calc(#{$control-padding-horizontal} + 0.375em) - padding-right: calc(#{$control-padding-horizontal} + 0.375em) - &.is-static - background-color: transparent - border-color: transparent - box-shadow: none - padding-left: 0 - padding-right: 0 - -.textarea - @extend %input-textarea - display: block - max-width: 100% - min-width: 100% - padding: $textarea-padding - resize: vertical - &:not([rows]) - max-height: $textarea-max-height - min-height: $textarea-min-height - &[rows] - height: initial - // Modifiers - &.has-fixed-size - resize: none diff --git a/shared/static/src/bulma/sass/form/select.sass b/shared/static/src/bulma/sass/form/select.sass deleted file mode 100644 index 21d62d0b..00000000 --- a/shared/static/src/bulma/sass/form/select.sass +++ /dev/null @@ -1,85 +0,0 @@ -.select - display: inline-block - max-width: 100% - position: relative - vertical-align: top - &:not(.is-multiple) - height: $input-height - &:not(.is-multiple):not(.is-loading) - &::after - @extend %arrow - border-color: $input-arrow - +ltr-position(1.125em) - z-index: 4 - &.is-rounded - select - border-radius: $radius-rounded - +ltr-property("padding", 1em, false) - select - @extend %input - cursor: pointer - display: block - font-size: 1em - max-width: 100% - outline: none - &::-ms-expand - display: none - &[disabled]:hover, - fieldset[disabled] &:hover - border-color: $input-disabled-border-color - &:not([multiple]) - +ltr-property("padding", 2.5em) - &[multiple] - height: auto - padding: 0 - option - padding: 0.5em 1em - // States - &:not(.is-multiple):not(.is-loading):hover - &::after - border-color: $input-hover-color - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - &.is-#{$name} - &:not(:hover)::after - border-color: $color - select - border-color: $color - &:hover, - &.is-hovered - border-color: bulmaDarken($color, 5%) - &:focus, - &.is-focused, - &:active, - &.is-active - box-shadow: $input-focus-box-shadow-size bulmaRgba($color, 0.25) - // Sizes - &.is-small - +control-small - &.is-medium - +control-medium - &.is-large - +control-large - // Modifiers - &.is-disabled - &::after - border-color: $input-disabled-color - &.is-fullwidth - width: 100% - select - width: 100% - &.is-loading - &::after - @extend %loader - margin-top: 0 - position: absolute - +ltr-position(0.625em) - top: 0.625em - transform: none - &.is-small:after - font-size: $size-small - &.is-medium:after - font-size: $size-medium - &.is-large:after - font-size: $size-large diff --git a/shared/static/src/bulma/sass/form/shared.sass b/shared/static/src/bulma/sass/form/shared.sass deleted file mode 100644 index 230a00cb..00000000 --- a/shared/static/src/bulma/sass/form/shared.sass +++ /dev/null @@ -1,55 +0,0 @@ -$input-color: $text-strong !default -$input-background-color: $scheme-main !default -$input-border-color: $border !default -$input-height: $control-height !default -$input-shadow: inset 0 0.0625em 0.125em rgba($scheme-invert, 0.05) !default -$input-placeholder-color: bulmaRgba($input-color, 0.3) !default - -$input-hover-color: $text-strong !default -$input-hover-border-color: $border-hover !default - -$input-focus-color: $text-strong !default -$input-focus-border-color: $link !default -$input-focus-box-shadow-size: 0 0 0 0.125em !default -$input-focus-box-shadow-color: bulmaRgba($link, 0.25) !default - -$input-disabled-color: $text-light !default -$input-disabled-background-color: $background !default -$input-disabled-border-color: $background !default -$input-disabled-placeholder-color: bulmaRgba($input-disabled-color, 0.3) !default - -$input-arrow: $link !default - -$input-icon-color: $border !default -$input-icon-active-color: $text !default - -$input-radius: $radius !default - -=input - @extend %control - background-color: $input-background-color - border-color: $input-border-color - border-radius: $input-radius - color: $input-color - +placeholder - color: $input-placeholder-color - &:hover, - &.is-hovered - border-color: $input-hover-border-color - &:focus, - &.is-focused, - &:active, - &.is-active - border-color: $input-focus-border-color - box-shadow: $input-focus-box-shadow-size $input-focus-box-shadow-color - &[disabled], - fieldset[disabled] & - background-color: $input-disabled-background-color - border-color: $input-disabled-border-color - box-shadow: none - color: $input-disabled-color - +placeholder - color: $input-disabled-placeholder-color - -%input - +input diff --git a/shared/static/src/bulma/sass/form/tools.sass b/shared/static/src/bulma/sass/form/tools.sass deleted file mode 100644 index d97427c4..00000000 --- a/shared/static/src/bulma/sass/form/tools.sass +++ /dev/null @@ -1,213 +0,0 @@ -$label-color: $text-strong !default -$label-weight: $weight-bold !default - -$help-size: $size-small !default - -.label - color: $label-color - display: block - font-size: $size-normal - font-weight: $label-weight - &:not(:last-child) - margin-bottom: 0.5em - // Sizes - &.is-small - font-size: $size-small - &.is-medium - font-size: $size-medium - &.is-large - font-size: $size-large - -.help - display: block - font-size: $help-size - margin-top: 0.25rem - @each $name, $pair in $colors - $color: nth($pair, 1) - &.is-#{$name} - color: $color - -// Containers - -.field - &:not(:last-child) - margin-bottom: 0.75rem - // Modifiers - &.has-addons - display: flex - justify-content: flex-start - .control - &:not(:last-child) - +ltr-property("margin", -1px) - &:not(:first-child):not(:last-child) - .button, - .input, - .select select - border-radius: 0 - &:first-child:not(:only-child) - .button, - .input, - .select select - +ltr - border-bottom-right-radius: 0 - border-top-right-radius: 0 - +rtl - border-bottom-left-radius: 0 - border-top-left-radius: 0 - &:last-child:not(:only-child) - .button, - .input, - .select select - +ltr - border-bottom-left-radius: 0 - border-top-left-radius: 0 - +rtl - border-bottom-right-radius: 0 - border-top-right-radius: 0 - .button, - .input, - .select select - &:not([disabled]) - &:hover, - &.is-hovered - z-index: 2 - &:focus, - &.is-focused, - &:active, - &.is-active - z-index: 3 - &:hover - z-index: 4 - &.is-expanded - flex-grow: 1 - flex-shrink: 1 - &.has-addons-centered - justify-content: center - &.has-addons-right - justify-content: flex-end - &.has-addons-fullwidth - .control - flex-grow: 1 - flex-shrink: 0 - &.is-grouped - display: flex - justify-content: flex-start - & > .control - flex-shrink: 0 - &:not(:last-child) - margin-bottom: 0 - +ltr-property("margin", 0.75rem) - &.is-expanded - flex-grow: 1 - flex-shrink: 1 - &.is-grouped-centered - justify-content: center - &.is-grouped-right - justify-content: flex-end - &.is-grouped-multiline - flex-wrap: wrap - & > .control - &:last-child, - &:not(:last-child) - margin-bottom: 0.75rem - &:last-child - margin-bottom: -0.75rem - &:not(:last-child) - margin-bottom: 0 - &.is-horizontal - +tablet - display: flex - -.field-label - .label - font-size: inherit - +mobile - margin-bottom: 0.5rem - +tablet - flex-basis: 0 - flex-grow: 1 - flex-shrink: 0 - +ltr-property("margin", 1.5rem) - text-align: right - &.is-small - font-size: $size-small - padding-top: 0.375em - &.is-normal - padding-top: 0.375em - &.is-medium - font-size: $size-medium - padding-top: 0.375em - &.is-large - font-size: $size-large - padding-top: 0.375em - -.field-body - .field .field - margin-bottom: 0 - +tablet - display: flex - flex-basis: 0 - flex-grow: 5 - flex-shrink: 1 - .field - margin-bottom: 0 - & > .field - flex-shrink: 1 - &:not(.is-narrow) - flex-grow: 1 - &:not(:last-child) - +ltr-property("margin", 0.75rem) - -.control - box-sizing: border-box - clear: both - font-size: $size-normal - position: relative - text-align: inherit - // Modifiers - &.has-icons-left, - &.has-icons-right - .input, - .select - &:focus - & ~ .icon - color: $input-icon-active-color - &.is-small ~ .icon - font-size: $size-small - &.is-medium ~ .icon - font-size: $size-medium - &.is-large ~ .icon - font-size: $size-large - .icon - color: $input-icon-color - height: $input-height - pointer-events: none - position: absolute - top: 0 - width: $input-height - z-index: 4 - &.has-icons-left - .input, - .select select - padding-left: $input-height - .icon.is-left - left: 0 - &.has-icons-right - .input, - .select select - padding-right: $input-height - .icon.is-right - right: 0 - &.is-loading - &::after - @extend %loader - position: absolute !important - +ltr-position(0.625em) - top: 0.625em - z-index: 4 - &.is-small:after - font-size: $size-small - &.is-medium:after - font-size: $size-medium - &.is-large:after - font-size: $size-large diff --git a/shared/static/src/bulma/sass/grid/_all.sass b/shared/static/src/bulma/sass/grid/_all.sass deleted file mode 100644 index e53070f6..00000000 --- a/shared/static/src/bulma/sass/grid/_all.sass +++ /dev/null @@ -1,4 +0,0 @@ -@charset "utf-8" - -@import "columns.sass" -@import "tiles.sass" diff --git a/shared/static/src/bulma/sass/grid/columns.sass b/shared/static/src/bulma/sass/grid/columns.sass deleted file mode 100644 index 34a83533..00000000 --- a/shared/static/src/bulma/sass/grid/columns.sass +++ /dev/null @@ -1,504 +0,0 @@ -$column-gap: 0.75rem !default - -.column - display: block - flex-basis: 0 - flex-grow: 1 - flex-shrink: 1 - padding: $column-gap - .columns.is-mobile > &.is-narrow - flex: none - .columns.is-mobile > &.is-full - flex: none - width: 100% - .columns.is-mobile > &.is-three-quarters - flex: none - width: 75% - .columns.is-mobile > &.is-two-thirds - flex: none - width: 66.6666% - .columns.is-mobile > &.is-half - flex: none - width: 50% - .columns.is-mobile > &.is-one-third - flex: none - width: 33.3333% - .columns.is-mobile > &.is-one-quarter - flex: none - width: 25% - .columns.is-mobile > &.is-one-fifth - flex: none - width: 20% - .columns.is-mobile > &.is-two-fifths - flex: none - width: 40% - .columns.is-mobile > &.is-three-fifths - flex: none - width: 60% - .columns.is-mobile > &.is-four-fifths - flex: none - width: 80% - .columns.is-mobile > &.is-offset-three-quarters - margin-left: 75% - .columns.is-mobile > &.is-offset-two-thirds - margin-left: 66.6666% - .columns.is-mobile > &.is-offset-half - margin-left: 50% - .columns.is-mobile > &.is-offset-one-third - margin-left: 33.3333% - .columns.is-mobile > &.is-offset-one-quarter - margin-left: 25% - .columns.is-mobile > &.is-offset-one-fifth - margin-left: 20% - .columns.is-mobile > &.is-offset-two-fifths - margin-left: 40% - .columns.is-mobile > &.is-offset-three-fifths - margin-left: 60% - .columns.is-mobile > &.is-offset-four-fifths - margin-left: 80% - @for $i from 0 through 12 - .columns.is-mobile > &.is-#{$i} - flex: none - width: percentage($i / 12) - .columns.is-mobile > &.is-offset-#{$i} - margin-left: percentage($i / 12) - +mobile - &.is-narrow-mobile - flex: none - &.is-full-mobile - flex: none - width: 100% - &.is-three-quarters-mobile - flex: none - width: 75% - &.is-two-thirds-mobile - flex: none - width: 66.6666% - &.is-half-mobile - flex: none - width: 50% - &.is-one-third-mobile - flex: none - width: 33.3333% - &.is-one-quarter-mobile - flex: none - width: 25% - &.is-one-fifth-mobile - flex: none - width: 20% - &.is-two-fifths-mobile - flex: none - width: 40% - &.is-three-fifths-mobile - flex: none - width: 60% - &.is-four-fifths-mobile - flex: none - width: 80% - &.is-offset-three-quarters-mobile - margin-left: 75% - &.is-offset-two-thirds-mobile - margin-left: 66.6666% - &.is-offset-half-mobile - margin-left: 50% - &.is-offset-one-third-mobile - margin-left: 33.3333% - &.is-offset-one-quarter-mobile - margin-left: 25% - &.is-offset-one-fifth-mobile - margin-left: 20% - &.is-offset-two-fifths-mobile - margin-left: 40% - &.is-offset-three-fifths-mobile - margin-left: 60% - &.is-offset-four-fifths-mobile - margin-left: 80% - @for $i from 0 through 12 - &.is-#{$i}-mobile - flex: none - width: percentage($i / 12) - &.is-offset-#{$i}-mobile - margin-left: percentage($i / 12) - +tablet - &.is-narrow, - &.is-narrow-tablet - flex: none - &.is-full, - &.is-full-tablet - flex: none - width: 100% - &.is-three-quarters, - &.is-three-quarters-tablet - flex: none - width: 75% - &.is-two-thirds, - &.is-two-thirds-tablet - flex: none - width: 66.6666% - &.is-half, - &.is-half-tablet - flex: none - width: 50% - &.is-one-third, - &.is-one-third-tablet - flex: none - width: 33.3333% - &.is-one-quarter, - &.is-one-quarter-tablet - flex: none - width: 25% - &.is-one-fifth, - &.is-one-fifth-tablet - flex: none - width: 20% - &.is-two-fifths, - &.is-two-fifths-tablet - flex: none - width: 40% - &.is-three-fifths, - &.is-three-fifths-tablet - flex: none - width: 60% - &.is-four-fifths, - &.is-four-fifths-tablet - flex: none - width: 80% - &.is-offset-three-quarters, - &.is-offset-three-quarters-tablet - margin-left: 75% - &.is-offset-two-thirds, - &.is-offset-two-thirds-tablet - margin-left: 66.6666% - &.is-offset-half, - &.is-offset-half-tablet - margin-left: 50% - &.is-offset-one-third, - &.is-offset-one-third-tablet - margin-left: 33.3333% - &.is-offset-one-quarter, - &.is-offset-one-quarter-tablet - margin-left: 25% - &.is-offset-one-fifth, - &.is-offset-one-fifth-tablet - margin-left: 20% - &.is-offset-two-fifths, - &.is-offset-two-fifths-tablet - margin-left: 40% - &.is-offset-three-fifths, - &.is-offset-three-fifths-tablet - margin-left: 60% - &.is-offset-four-fifths, - &.is-offset-four-fifths-tablet - margin-left: 80% - @for $i from 0 through 12 - &.is-#{$i}, - &.is-#{$i}-tablet - flex: none - width: percentage($i / 12) - &.is-offset-#{$i}, - &.is-offset-#{$i}-tablet - margin-left: percentage($i / 12) - +touch - &.is-narrow-touch - flex: none - &.is-full-touch - flex: none - width: 100% - &.is-three-quarters-touch - flex: none - width: 75% - &.is-two-thirds-touch - flex: none - width: 66.6666% - &.is-half-touch - flex: none - width: 50% - &.is-one-third-touch - flex: none - width: 33.3333% - &.is-one-quarter-touch - flex: none - width: 25% - &.is-one-fifth-touch - flex: none - width: 20% - &.is-two-fifths-touch - flex: none - width: 40% - &.is-three-fifths-touch - flex: none - width: 60% - &.is-four-fifths-touch - flex: none - width: 80% - &.is-offset-three-quarters-touch - margin-left: 75% - &.is-offset-two-thirds-touch - margin-left: 66.6666% - &.is-offset-half-touch - margin-left: 50% - &.is-offset-one-third-touch - margin-left: 33.3333% - &.is-offset-one-quarter-touch - margin-left: 25% - &.is-offset-one-fifth-touch - margin-left: 20% - &.is-offset-two-fifths-touch - margin-left: 40% - &.is-offset-three-fifths-touch - margin-left: 60% - &.is-offset-four-fifths-touch - margin-left: 80% - @for $i from 0 through 12 - &.is-#{$i}-touch - flex: none - width: percentage($i / 12) - &.is-offset-#{$i}-touch - margin-left: percentage($i / 12) - +desktop - &.is-narrow-desktop - flex: none - &.is-full-desktop - flex: none - width: 100% - &.is-three-quarters-desktop - flex: none - width: 75% - &.is-two-thirds-desktop - flex: none - width: 66.6666% - &.is-half-desktop - flex: none - width: 50% - &.is-one-third-desktop - flex: none - width: 33.3333% - &.is-one-quarter-desktop - flex: none - width: 25% - &.is-one-fifth-desktop - flex: none - width: 20% - &.is-two-fifths-desktop - flex: none - width: 40% - &.is-three-fifths-desktop - flex: none - width: 60% - &.is-four-fifths-desktop - flex: none - width: 80% - &.is-offset-three-quarters-desktop - margin-left: 75% - &.is-offset-two-thirds-desktop - margin-left: 66.6666% - &.is-offset-half-desktop - margin-left: 50% - &.is-offset-one-third-desktop - margin-left: 33.3333% - &.is-offset-one-quarter-desktop - margin-left: 25% - &.is-offset-one-fifth-desktop - margin-left: 20% - &.is-offset-two-fifths-desktop - margin-left: 40% - &.is-offset-three-fifths-desktop - margin-left: 60% - &.is-offset-four-fifths-desktop - margin-left: 80% - @for $i from 0 through 12 - &.is-#{$i}-desktop - flex: none - width: percentage($i / 12) - &.is-offset-#{$i}-desktop - margin-left: percentage($i / 12) - +widescreen - &.is-narrow-widescreen - flex: none - &.is-full-widescreen - flex: none - width: 100% - &.is-three-quarters-widescreen - flex: none - width: 75% - &.is-two-thirds-widescreen - flex: none - width: 66.6666% - &.is-half-widescreen - flex: none - width: 50% - &.is-one-third-widescreen - flex: none - width: 33.3333% - &.is-one-quarter-widescreen - flex: none - width: 25% - &.is-one-fifth-widescreen - flex: none - width: 20% - &.is-two-fifths-widescreen - flex: none - width: 40% - &.is-three-fifths-widescreen - flex: none - width: 60% - &.is-four-fifths-widescreen - flex: none - width: 80% - &.is-offset-three-quarters-widescreen - margin-left: 75% - &.is-offset-two-thirds-widescreen - margin-left: 66.6666% - &.is-offset-half-widescreen - margin-left: 50% - &.is-offset-one-third-widescreen - margin-left: 33.3333% - &.is-offset-one-quarter-widescreen - margin-left: 25% - &.is-offset-one-fifth-widescreen - margin-left: 20% - &.is-offset-two-fifths-widescreen - margin-left: 40% - &.is-offset-three-fifths-widescreen - margin-left: 60% - &.is-offset-four-fifths-widescreen - margin-left: 80% - @for $i from 0 through 12 - &.is-#{$i}-widescreen - flex: none - width: percentage($i / 12) - &.is-offset-#{$i}-widescreen - margin-left: percentage($i / 12) - +fullhd - &.is-narrow-fullhd - flex: none - &.is-full-fullhd - flex: none - width: 100% - &.is-three-quarters-fullhd - flex: none - width: 75% - &.is-two-thirds-fullhd - flex: none - width: 66.6666% - &.is-half-fullhd - flex: none - width: 50% - &.is-one-third-fullhd - flex: none - width: 33.3333% - &.is-one-quarter-fullhd - flex: none - width: 25% - &.is-one-fifth-fullhd - flex: none - width: 20% - &.is-two-fifths-fullhd - flex: none - width: 40% - &.is-three-fifths-fullhd - flex: none - width: 60% - &.is-four-fifths-fullhd - flex: none - width: 80% - &.is-offset-three-quarters-fullhd - margin-left: 75% - &.is-offset-two-thirds-fullhd - margin-left: 66.6666% - &.is-offset-half-fullhd - margin-left: 50% - &.is-offset-one-third-fullhd - margin-left: 33.3333% - &.is-offset-one-quarter-fullhd - margin-left: 25% - &.is-offset-one-fifth-fullhd - margin-left: 20% - &.is-offset-two-fifths-fullhd - margin-left: 40% - &.is-offset-three-fifths-fullhd - margin-left: 60% - &.is-offset-four-fifths-fullhd - margin-left: 80% - @for $i from 0 through 12 - &.is-#{$i}-fullhd - flex: none - width: percentage($i / 12) - &.is-offset-#{$i}-fullhd - margin-left: percentage($i / 12) - -.columns - margin-left: (-$column-gap) - margin-right: (-$column-gap) - margin-top: (-$column-gap) - &:last-child - margin-bottom: (-$column-gap) - &:not(:last-child) - margin-bottom: calc(1.5rem - #{$column-gap}) - // Modifiers - &.is-centered - justify-content: center - &.is-gapless - margin-left: 0 - margin-right: 0 - margin-top: 0 - & > .column - margin: 0 - padding: 0 !important - &:not(:last-child) - margin-bottom: 1.5rem - &:last-child - margin-bottom: 0 - &.is-mobile - display: flex - &.is-multiline - flex-wrap: wrap - &.is-vcentered - align-items: center - // Responsiveness - +tablet - &:not(.is-desktop) - display: flex - +desktop - // Modifiers - &.is-desktop - display: flex - -@if $variable-columns - .columns.is-variable - --columnGap: 0.75rem - margin-left: calc(-1 * var(--columnGap)) - margin-right: calc(-1 * var(--columnGap)) - .column - padding-left: var(--columnGap) - padding-right: var(--columnGap) - @for $i from 0 through 8 - &.is-#{$i} - --columnGap: #{$i * 0.25rem} - +mobile - &.is-#{$i}-mobile - --columnGap: #{$i * 0.25rem} - +tablet - &.is-#{$i}-tablet - --columnGap: #{$i * 0.25rem} - +tablet-only - &.is-#{$i}-tablet-only - --columnGap: #{$i * 0.25rem} - +touch - &.is-#{$i}-touch - --columnGap: #{$i * 0.25rem} - +desktop - &.is-#{$i}-desktop - --columnGap: #{$i * 0.25rem} - +desktop-only - &.is-#{$i}-desktop-only - --columnGap: #{$i * 0.25rem} - +widescreen - &.is-#{$i}-widescreen - --columnGap: #{$i * 0.25rem} - +widescreen-only - &.is-#{$i}-widescreen-only - --columnGap: #{$i * 0.25rem} - +fullhd - &.is-#{$i}-fullhd - --columnGap: #{$i * 0.25rem} diff --git a/shared/static/src/bulma/sass/grid/tiles.sass b/shared/static/src/bulma/sass/grid/tiles.sass deleted file mode 100644 index 15648c29..00000000 --- a/shared/static/src/bulma/sass/grid/tiles.sass +++ /dev/null @@ -1,34 +0,0 @@ -$tile-spacing: 0.75rem !default - -.tile - align-items: stretch - display: block - flex-basis: 0 - flex-grow: 1 - flex-shrink: 1 - min-height: min-content - // Modifiers - &.is-ancestor - margin-left: $tile-spacing * -1 - margin-right: $tile-spacing * -1 - margin-top: $tile-spacing * -1 - &:last-child - margin-bottom: $tile-spacing * -1 - &:not(:last-child) - margin-bottom: $tile-spacing - &.is-child - margin: 0 !important - &.is-parent - padding: $tile-spacing - &.is-vertical - flex-direction: column - & > .tile.is-child:not(:last-child) - margin-bottom: 1.5rem !important - // Responsiveness - +tablet - &:not(.is-child) - display: flex - @for $i from 1 through 12 - &.is-#{$i} - flex: none - width: ($i / 12) * 100% diff --git a/shared/static/src/bulma/sass/helpers/_all.sass b/shared/static/src/bulma/sass/helpers/_all.sass deleted file mode 100644 index 89ef0a7f..00000000 --- a/shared/static/src/bulma/sass/helpers/_all.sass +++ /dev/null @@ -1,10 +0,0 @@ -@charset "utf-8" - -@import "color.sass" -@import "float.sass" -@import "other.sass" -@import "overflow.sass" -@import "position.sass" -@import "spacing.sass" -@import "typography.sass" -@import "visibility.sass" diff --git a/shared/static/src/bulma/sass/helpers/color.sass b/shared/static/src/bulma/sass/helpers/color.sass deleted file mode 100644 index 22ac8c51..00000000 --- a/shared/static/src/bulma/sass/helpers/color.sass +++ /dev/null @@ -1,37 +0,0 @@ -@each $name, $pair in $colors - $color: nth($pair, 1) - .has-text-#{$name} - color: $color !important - a.has-text-#{$name} - &:hover, - &:focus - color: bulmaDarken($color, 10%) !important - .has-background-#{$name} - background-color: $color !important - @if length($pair) >= 4 - $color-light: nth($pair, 3) - $color-dark: nth($pair, 4) - // Light - .has-text-#{$name}-light - color: $color-light !important - a.has-text-#{$name}-light - &:hover, - &:focus - color: bulmaDarken($color-light, 10%) !important - .has-background-#{$name}-light - background-color: $color-light !important - // Dark - .has-text-#{$name}-dark - color: $color-dark !important - a.has-text-#{$name}-dark - &:hover, - &:focus - color: bulmaLighten($color-dark, 10%) !important - .has-background-#{$name}-dark - background-color: $color-dark !important - -@each $name, $shade in $shades - .has-text-#{$name} - color: $shade !important - .has-background-#{$name} - background-color: $shade !important diff --git a/shared/static/src/bulma/sass/helpers/float.sass b/shared/static/src/bulma/sass/helpers/float.sass deleted file mode 100644 index fc77f179..00000000 --- a/shared/static/src/bulma/sass/helpers/float.sass +++ /dev/null @@ -1,8 +0,0 @@ -.is-clearfix - +clearfix - -.is-pulled-left - float: left !important - -.is-pulled-right - float: right !important diff --git a/shared/static/src/bulma/sass/helpers/other.sass b/shared/static/src/bulma/sass/helpers/other.sass deleted file mode 100644 index 9aa271b3..00000000 --- a/shared/static/src/bulma/sass/helpers/other.sass +++ /dev/null @@ -1,8 +0,0 @@ -.is-radiusless - border-radius: 0 !important - -.is-shadowless - box-shadow: none !important - -.is-unselectable - @extend %unselectable diff --git a/shared/static/src/bulma/sass/helpers/overflow.sass b/shared/static/src/bulma/sass/helpers/overflow.sass deleted file mode 100644 index ef1e3ef0..00000000 --- a/shared/static/src/bulma/sass/helpers/overflow.sass +++ /dev/null @@ -1,2 +0,0 @@ -.is-clipped - overflow: hidden !important diff --git a/shared/static/src/bulma/sass/helpers/position.sass b/shared/static/src/bulma/sass/helpers/position.sass deleted file mode 100644 index 083b36b7..00000000 --- a/shared/static/src/bulma/sass/helpers/position.sass +++ /dev/null @@ -1,5 +0,0 @@ -.is-overlay - @extend %overlay - -.is-relative - position: relative !important diff --git a/shared/static/src/bulma/sass/helpers/spacing.sass b/shared/static/src/bulma/sass/helpers/spacing.sass deleted file mode 100644 index b7e571e8..00000000 --- a/shared/static/src/bulma/sass/helpers/spacing.sass +++ /dev/null @@ -1,28 +0,0 @@ -.is-marginless - margin: 0 !important - -.is-paddingless - padding: 0 !important - -$spacing-shortcuts: ("margin": "m", "padding": "p") !default -$spacing-directions: ("top": "t", "right": "r", "bottom": "b", "left": "l") !default -$spacing-horizontal: "x" !default -$spacing-vertical: "y" !default -$spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5": 1.5rem, "6": 3rem) !default - -@each $property, $shortcut in $spacing-shortcuts - @each $name, $value in $spacing-values - // Cardinal directions - @each $direction, $suffix in $spacing-directions - .#{$shortcut}#{$suffix}-#{$name} - #{$property}-#{$direction}: $value !important - // Horizontal axis - @if $spacing-horizontal != null - .#{$shortcut}#{$spacing-horizontal}-#{$name} - #{$property}-left: $value !important - #{$property}-right: $value !important - // Vertical axis - @if $spacing-vertical != null - .#{$shortcut}#{$spacing-vertical}-#{$name} - #{$property}-top: $value !important - #{$property}-bottom: $value !important diff --git a/shared/static/src/bulma/sass/helpers/typography.sass b/shared/static/src/bulma/sass/helpers/typography.sass deleted file mode 100644 index eafd7e09..00000000 --- a/shared/static/src/bulma/sass/helpers/typography.sass +++ /dev/null @@ -1,98 +0,0 @@ -=typography-size($target:'') - @each $size in $sizes - $i: index($sizes, $size) - .is-size-#{$i}#{if($target == '', '', '-' + $target)} - font-size: $size !important - -+typography-size() - -+mobile - +typography-size('mobile') - -+tablet - +typography-size('tablet') - -+touch - +typography-size('touch') - -+desktop - +typography-size('desktop') - -+widescreen - +typography-size('widescreen') - -+fullhd - +typography-size('fullhd') - -$alignments: ('centered': 'center', 'justified': 'justify', 'left': 'left', 'right': 'right') - -@each $alignment, $text-align in $alignments - .has-text-#{$alignment} - text-align: #{$text-align} !important - -@each $alignment, $text-align in $alignments - +mobile - .has-text-#{$alignment}-mobile - text-align: #{$text-align} !important - +tablet - .has-text-#{$alignment}-tablet - text-align: #{$text-align} !important - +tablet-only - .has-text-#{$alignment}-tablet-only - text-align: #{$text-align} !important - +touch - .has-text-#{$alignment}-touch - text-align: #{$text-align} !important - +desktop - .has-text-#{$alignment}-desktop - text-align: #{$text-align} !important - +desktop-only - .has-text-#{$alignment}-desktop-only - text-align: #{$text-align} !important - +widescreen - .has-text-#{$alignment}-widescreen - text-align: #{$text-align} !important - +widescreen-only - .has-text-#{$alignment}-widescreen-only - text-align: #{$text-align} !important - +fullhd - .has-text-#{$alignment}-fullhd - text-align: #{$text-align} !important - -.is-capitalized - text-transform: capitalize !important - -.is-lowercase - text-transform: lowercase !important - -.is-uppercase - text-transform: uppercase !important - -.is-italic - font-style: italic !important - -.has-text-weight-light - font-weight: $weight-light !important -.has-text-weight-normal - font-weight: $weight-normal !important -.has-text-weight-medium - font-weight: $weight-medium !important -.has-text-weight-semibold - font-weight: $weight-semibold !important -.has-text-weight-bold - font-weight: $weight-bold !important - -.is-family-primary - font-family: $family-primary !important - -.is-family-secondary - font-family: $family-secondary !important - -.is-family-sans-serif - font-family: $family-sans-serif !important - -.is-family-monospace - font-family: $family-monospace !important - -.is-family-code - font-family: $family-code !important diff --git a/shared/static/src/bulma/sass/helpers/visibility.sass b/shared/static/src/bulma/sass/helpers/visibility.sass deleted file mode 100644 index 92477f3a..00000000 --- a/shared/static/src/bulma/sass/helpers/visibility.sass +++ /dev/null @@ -1,122 +0,0 @@ - - -$displays: 'block' 'flex' 'inline' 'inline-block' 'inline-flex' - -@each $display in $displays - .is-#{$display} - display: #{$display} !important - +mobile - .is-#{$display}-mobile - display: #{$display} !important - +tablet - .is-#{$display}-tablet - display: #{$display} !important - +tablet-only - .is-#{$display}-tablet-only - display: #{$display} !important - +touch - .is-#{$display}-touch - display: #{$display} !important - +desktop - .is-#{$display}-desktop - display: #{$display} !important - +desktop-only - .is-#{$display}-desktop-only - display: #{$display} !important - +widescreen - .is-#{$display}-widescreen - display: #{$display} !important - +widescreen-only - .is-#{$display}-widescreen-only - display: #{$display} !important - +fullhd - .is-#{$display}-fullhd - display: #{$display} !important - -.is-hidden - display: none !important - -.is-sr-only - border: none !important - clip: rect(0, 0, 0, 0) !important - height: 0.01em !important - overflow: hidden !important - padding: 0 !important - position: absolute !important - white-space: nowrap !important - width: 0.01em !important - -+mobile - .is-hidden-mobile - display: none !important - -+tablet - .is-hidden-tablet - display: none !important - -+tablet-only - .is-hidden-tablet-only - display: none !important - -+touch - .is-hidden-touch - display: none !important - -+desktop - .is-hidden-desktop - display: none !important - -+desktop-only - .is-hidden-desktop-only - display: none !important - -+widescreen - .is-hidden-widescreen - display: none !important - -+widescreen-only - .is-hidden-widescreen-only - display: none !important - -+fullhd - .is-hidden-fullhd - display: none !important - -.is-invisible - visibility: hidden !important - -+mobile - .is-invisible-mobile - visibility: hidden !important - -+tablet - .is-invisible-tablet - visibility: hidden !important - -+tablet-only - .is-invisible-tablet-only - visibility: hidden !important - -+touch - .is-invisible-touch - visibility: hidden !important - -+desktop - .is-invisible-desktop - visibility: hidden !important - -+desktop-only - .is-invisible-desktop-only - visibility: hidden !important - -+widescreen - .is-invisible-widescreen - visibility: hidden !important - -+widescreen-only - .is-invisible-widescreen-only - visibility: hidden !important - -+fullhd - .is-invisible-fullhd - visibility: hidden !important diff --git a/shared/static/src/bulma/sass/layout/_all.sass b/shared/static/src/bulma/sass/layout/_all.sass deleted file mode 100644 index 143ada35..00000000 --- a/shared/static/src/bulma/sass/layout/_all.sass +++ /dev/null @@ -1,5 +0,0 @@ -@charset "utf-8" - -@import "hero.sass" -@import "section.sass" -@import "footer.sass" diff --git a/shared/static/src/bulma/sass/layout/footer.sass b/shared/static/src/bulma/sass/layout/footer.sass deleted file mode 100644 index 8faa11ed..00000000 --- a/shared/static/src/bulma/sass/layout/footer.sass +++ /dev/null @@ -1,9 +0,0 @@ -$footer-background-color: $scheme-main-bis !default -$footer-color: false !default -$footer-padding: 3rem 1.5rem 6rem !default - -.footer - background-color: $footer-background-color - padding: $footer-padding - @if $footer-color - color: $footer-color diff --git a/shared/static/src/bulma/sass/layout/hero.sass b/shared/static/src/bulma/sass/layout/hero.sass deleted file mode 100644 index 925c98c2..00000000 --- a/shared/static/src/bulma/sass/layout/hero.sass +++ /dev/null @@ -1,145 +0,0 @@ -$hero-body-padding: 3rem 1.5rem !default -$hero-body-padding-small: 1.5rem !default -$hero-body-padding-medium: 9rem 1.5rem !default -$hero-body-padding-large: 18rem 1.5rem !default - -// Main container -.hero - align-items: stretch - display: flex - flex-direction: column - justify-content: space-between - .navbar - background: none - .tabs - ul - border-bottom: none - // Colors - @each $name, $pair in $colors - $color: nth($pair, 1) - $color-invert: nth($pair, 2) - &.is-#{$name} - background-color: $color - color: $color-invert - a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current), - strong - color: inherit - .title - color: $color-invert - .subtitle - color: bulmaRgba($color-invert, 0.9) - a:not(.button), - strong - color: $color-invert - .navbar-menu - +touch - background-color: $color - .navbar-item, - .navbar-link - color: bulmaRgba($color-invert, 0.7) - a.navbar-item, - .navbar-link - &:hover, - &.is-active - background-color: bulmaDarken($color, 5%) - color: $color-invert - .tabs - a - color: $color-invert - opacity: 0.9 - &:hover - opacity: 1 - li - &.is-active a - opacity: 1 - &.is-boxed, - &.is-toggle - a - color: $color-invert - &:hover - background-color: bulmaRgba($scheme-invert, 0.1) - li.is-active a - &, - &:hover - background-color: $color-invert - border-color: $color-invert - color: $color - // Modifiers - @if type-of($color) == 'color' - &.is-bold - $gradient-top-left: darken(saturate(adjust-hue($color, -10deg), 10%), 10%) - $gradient-bottom-right: lighten(saturate(adjust-hue($color, 10deg), 5%), 5%) - background-image: linear-gradient(141deg, $gradient-top-left 0%, $color 71%, $gradient-bottom-right 100%) - +mobile - .navbar-menu - background-image: linear-gradient(141deg, $gradient-top-left 0%, $color 71%, $gradient-bottom-right 100%) - // Sizes - &.is-small - .hero-body - padding: $hero-body-padding-small - &.is-medium - +tablet - .hero-body - padding: $hero-body-padding-medium - &.is-large - +tablet - .hero-body - padding: $hero-body-padding-large - &.is-halfheight, - &.is-fullheight, - &.is-fullheight-with-navbar - .hero-body - align-items: center - display: flex - & > .container - flex-grow: 1 - flex-shrink: 1 - &.is-halfheight - min-height: 50vh - &.is-fullheight - min-height: 100vh - -// Components - -.hero-video - @extend %overlay - overflow: hidden - video - left: 50% - min-height: 100% - min-width: 100% - position: absolute - top: 50% - transform: translate3d(-50%, -50%, 0) - // Modifiers - &.is-transparent - opacity: 0.3 - // Responsiveness - +mobile - display: none - -.hero-buttons - margin-top: 1.5rem - // Responsiveness - +mobile - .button - display: flex - &:not(:last-child) - margin-bottom: 0.75rem - +tablet - display: flex - justify-content: center - .button:not(:last-child) - +ltr-property("margin", 1.5rem) - -// Containers - -.hero-head, -.hero-foot - flex-grow: 0 - flex-shrink: 0 - -.hero-body - flex-grow: 1 - flex-shrink: 0 - padding: $hero-body-padding diff --git a/shared/static/src/bulma/sass/layout/section.sass b/shared/static/src/bulma/sass/layout/section.sass deleted file mode 100644 index 6f2d3523..00000000 --- a/shared/static/src/bulma/sass/layout/section.sass +++ /dev/null @@ -1,13 +0,0 @@ -$section-padding: 3rem 1.5rem !default -$section-padding-medium: 9rem 1.5rem !default -$section-padding-large: 18rem 1.5rem !default - -.section - padding: $section-padding - // Responsiveness - +desktop - // Sizes - &.is-medium - padding: $section-padding-medium - &.is-large - padding: $section-padding-large diff --git a/shared/static/src/bulma/sass/utilities/_all.sass b/shared/static/src/bulma/sass/utilities/_all.sass deleted file mode 100644 index b471577c..00000000 --- a/shared/static/src/bulma/sass/utilities/_all.sass +++ /dev/null @@ -1,8 +0,0 @@ -@charset "utf-8" - -@import "initial-variables.sass" -@import "functions.sass" -@import "derived-variables.scss" -@import "animations.sass" -@import "mixins.sass" -@import "controls.sass" diff --git a/shared/static/src/bulma/sass/utilities/animations.sass b/shared/static/src/bulma/sass/utilities/animations.sass deleted file mode 100644 index a14525d7..00000000 --- a/shared/static/src/bulma/sass/utilities/animations.sass +++ /dev/null @@ -1,5 +0,0 @@ -@keyframes spinAround - from - transform: rotate(0deg) - to - transform: rotate(359deg) diff --git a/shared/static/src/bulma/sass/utilities/controls.sass b/shared/static/src/bulma/sass/utilities/controls.sass deleted file mode 100644 index cc7672a1..00000000 --- a/shared/static/src/bulma/sass/utilities/controls.sass +++ /dev/null @@ -1,50 +0,0 @@ -$control-radius: $radius !default -$control-radius-small: $radius-small !default - -$control-border-width: 1px !default - -$control-height: 2.5em !default -$control-line-height: 1.5 !default - -$control-padding-vertical: calc(0.5em - #{$control-border-width}) !default -$control-padding-horizontal: calc(0.75em - #{$control-border-width}) !default - -=control - -moz-appearance: none - -webkit-appearance: none - align-items: center - border: $control-border-width solid transparent - border-radius: $control-radius - box-shadow: none - display: inline-flex - font-size: $size-normal - height: $control-height - justify-content: flex-start - line-height: $control-line-height - padding-bottom: $control-padding-vertical - padding-left: $control-padding-horizontal - padding-right: $control-padding-horizontal - padding-top: $control-padding-vertical - position: relative - vertical-align: top - // States - &:focus, - &.is-focused, - &:active, - &.is-active - outline: none - &[disabled], - fieldset[disabled] & - cursor: not-allowed - -%control - +control - -// The controls sizes use mixins so they can be used at different breakpoints -=control-small - border-radius: $control-radius-small - font-size: $size-small -=control-medium - font-size: $size-medium -=control-large - font-size: $size-large diff --git a/shared/static/src/bulma/sass/utilities/derived-variables.scss b/shared/static/src/bulma/sass/utilities/derived-variables.scss deleted file mode 100644 index 54a03585..00000000 --- a/shared/static/src/bulma/sass/utilities/derived-variables.scss +++ /dev/null @@ -1,132 +0,0 @@ -$primary: $turquoise !default; - -$info : $cyan !default; -$success: $green !default; -$warning: $yellow !default; -$danger : $red !default; - -$light : $white-ter !default; -$dark : $grey-darker !default; - -// Invert colors - -$orange-invert : findColorInvert($orange) !default; -$yellow-invert : findColorInvert($yellow) !default; -$green-invert : findColorInvert($green) !default; -$turquoise-invert: findColorInvert($turquoise) !default; -$cyan-invert : findColorInvert($cyan) !default; -$blue-invert : findColorInvert($blue) !default; -$purple-invert : findColorInvert($purple) !default; -$red-invert : findColorInvert($red) !default; - -$primary-invert : findColorInvert($primary) !default; -$primary-light : findLightColor($primary) !default; -$primary-dark : findDarkColor($primary) !default; -$info-invert : findColorInvert($info) !default; -$info-light : findLightColor($info) !default; -$info-dark : findDarkColor($info) !default; -$success-invert : findColorInvert($success) !default; -$success-light : findLightColor($success) !default; -$success-dark : findDarkColor($success) !default; -$warning-invert : findColorInvert($warning) !default; -$warning-light : findLightColor($warning) !default; -$warning-dark : findDarkColor($warning) !default; -$danger-invert : findColorInvert($danger) !default; -$danger-light : findLightColor($danger) !default; -$danger-dark : findDarkColor($danger) !default; -$light-invert : findColorInvert($light) !default; -$dark-invert : findColorInvert($dark) !default; - -// General colors - -$scheme-main : $white !default; -$scheme-main-bis : $white-bis !default; -$scheme-main-ter : $white-ter !default; -$scheme-invert : $black !default; -$scheme-invert-bis : $black-bis !default; -$scheme-invert-ter : $black-ter !default; - -$background : $white-ter !default; - -$border : $grey-lighter !default; -$border-hover : $grey-light !default; -$border-light : $grey-lightest !default; -$border-light-hover: $grey-light !default; - -// Text colors - -$text : $grey-dark !default; -$text-invert: findColorInvert($text) !default; -$text-light : $grey !default; -$text-strong: $grey-darker !default; - -// Code colors - -$code : $red !default; -$code-background: $background !default; - -$pre : $text !default; -$pre-background : $background !default; - -// Link colors - -$link : $blue !default; -$link-invert : findColorInvert($link) !default; -$link-light : findLightColor($link) !default; -$link-dark : findDarkColor($link) !default; -$link-visited : $purple !default; - -$link-hover : $grey-darker !default; -$link-hover-border : $grey-light !default; - -$link-focus : $grey-darker !default; -$link-focus-border : $blue !default; - -$link-active : $grey-darker !default; -$link-active-border: $grey-dark !default; - -// Typography - -$family-primary : $family-sans-serif !default; -$family-secondary: $family-sans-serif !default; -$family-code : $family-monospace !default; - -$size-small : $size-7 !default; -$size-normal: $size-6 !default; -$size-medium: $size-5 !default; -$size-large : $size-4 !default; - -// Lists and maps -$custom-colors: null !default; -$custom-shades: null !default; - -$colors: mergeColorMaps( -( - "white" : ($white, $black), - "black" : ($black, $white), - "light" : ($light, $light-invert), - "dark" : ($dark, $dark-invert), - "primary": ($primary, $primary-invert, $primary-light, $primary-dark), - "link" : ($link, $link-invert, $link-light, $link-dark), - "info" : ($info, $info-invert, $info-light, $info-dark), - "success": ($success, $success-invert, $success-light, $success-dark), - "warning": ($warning, $warning-invert, $warning-light, $warning-dark), - "danger" : ($danger, $danger-invert, $danger-light, $danger-dark)), - $custom-colors -) !default; - -$shades: mergeColorMaps( -( - "black-bis" : $black-bis, - "black-ter" : $black-ter, - "grey-darker" : $grey-darker, - "grey-dark" : $grey-dark, - "grey" : $grey, - "grey-light" : $grey-light, - "grey-lighter": $grey-lighter, - "white-ter" : $white-ter, - "white-bis" : $white-bis), - $custom-shades -) !default; - -$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6 $size-7 !default; diff --git a/shared/static/src/bulma/sass/utilities/functions.sass b/shared/static/src/bulma/sass/utilities/functions.sass deleted file mode 100644 index 270121f6..00000000 --- a/shared/static/src/bulma/sass/utilities/functions.sass +++ /dev/null @@ -1,115 +0,0 @@ -@function mergeColorMaps($bulma-colors, $custom-colors) - // We return at least Bulma's hard-coded colors - $merged-colors: $bulma-colors - - // We want a map as input - @if type-of($custom-colors) == 'map' - @each $name, $components in $custom-colors - // The color name should be a string - // and the components either a single color - // or a colors list with at least one element - @if type-of($name) == 'string' and (type-of($components) == 'list' or type-of($components) == 'color') and length($components) >= 1 - $color-base: null - $color-invert: null - $color-light: null - $color-dark: null - $value: null - - // The param can either be a single color - // or a list of 2 colors - @if type-of($components) == 'color' - $color-base: $components - $color-invert: findColorInvert($color-base) - $color-light: findLightColor($color-base) - $color-dark: findDarkColor($color-base) - @else if type-of($components) == 'list' - $color-base: nth($components, 1) - // If Invert, Light and Dark are provided - @if length($components) > 3 - $color-invert: nth($components, 2) - $color-light: nth($components, 3) - $color-dark: nth($components, 4) - // If only Invert and Light are provided - @else if length($components) > 2 - $color-invert: nth($components, 2) - $color-light: nth($components, 3) - $color-dark: findDarkColor($color-base) - // If only Invert is provided - @else - $color-invert: nth($components, 2) - $color-light: findLightColor($color-base) - $color-dark: findDarkColor($color-base) - - $value: ($color-base, $color-invert, $color-light, $color-dark) - - // We only want to merge the map if the color base is an actual color - @if type-of($color-base) == 'color' - // We merge this colors elements as map with Bulma's colors map - // (we can override them this way, no multiple definition for the same name) - // $merged-colors: map_merge($merged-colors, ($name: ($color-base, $color-invert, $color-light, $color-dark))) - $merged-colors: map_merge($merged-colors, ($name: $value)) - - @return $merged-colors - -@function powerNumber($number, $exp) - $value: 1 - @if $exp > 0 - @for $i from 1 through $exp - $value: $value * $number - @else if $exp < 0 - @for $i from 1 through -$exp - $value: $value / $number - @return $value - -@function colorLuminance($color) - @if type-of($color) != 'color' - @return 0.55 - $color-rgb: ('red': red($color),'green': green($color),'blue': blue($color)) - @each $name, $value in $color-rgb - $adjusted: 0 - $value: $value / 255 - @if $value < 0.03928 - $value: $value / 12.92 - @else - $value: ($value + .055) / 1.055 - $value: powerNumber($value, 2) - $color-rgb: map-merge($color-rgb, ($name: $value)) - @return (map-get($color-rgb, 'red') * .2126) + (map-get($color-rgb, 'green') * .7152) + (map-get($color-rgb, 'blue') * .0722) - -@function findColorInvert($color) - @if (colorLuminance($color) > 0.55) - @return rgba(#000, 0.7) - @else - @return #fff - -@function findLightColor($color) - @if type-of($color) == 'color' - $l: 96% - @if lightness($color) > 96% - $l: lightness($color) - @return change-color($color, $lightness: $l) - @return $background - -@function findDarkColor($color) - @if type-of($color) == 'color' - $base-l: 29% - $luminance: colorLuminance($color) - $luminance-delta: (0.53 - $luminance) - $target-l: round($base-l + ($luminance-delta * 53)) - @return change-color($color, $lightness: max($base-l, $target-l)) - @return $text-strong - -@function bulmaRgba($color, $alpha) - @if type-of($color) != 'color' - @return $color - @return rgba($color, $alpha) - -@function bulmaDarken($color, $amount) - @if type-of($color) != 'color' - @return $color - @return darken($color, $amount) - -@function bulmaLighten($color, $amount) - @if type-of($color) != 'color' - @return $color - @return lighten($color, $amount) diff --git a/shared/static/src/bulma/sass/utilities/initial-variables.sass b/shared/static/src/bulma/sass/utilities/initial-variables.sass deleted file mode 100644 index a1d688b6..00000000 --- a/shared/static/src/bulma/sass/utilities/initial-variables.sass +++ /dev/null @@ -1,78 +0,0 @@ -// Colors - -$black: hsl(0, 0%, 4%) !default -$black-bis: hsl(0, 0%, 7%) !default -$black-ter: hsl(0, 0%, 14%) !default - -$grey-darker: hsl(0, 0%, 21%) !default -$grey-dark: hsl(0, 0%, 29%) !default -$grey: hsl(0, 0%, 48%) !default -$grey-light: hsl(0, 0%, 71%) !default -$grey-lighter: hsl(0, 0%, 86%) !default -$grey-lightest: hsl(0, 0%, 93%) !default - -$white-ter: hsl(0, 0%, 96%) !default -$white-bis: hsl(0, 0%, 98%) !default -$white: hsl(0, 0%, 100%) !default - -$orange: hsl(14, 100%, 53%) !default -$yellow: hsl(48, 100%, 67%) !default -$green: hsl(141, 53%, 53%) !default -$turquoise: hsl(171, 100%, 41%) !default -$cyan: hsl(204, 71%, 53%) !default -$blue: hsl(217, 71%, 53%) !default -$purple: hsl(271, 100%, 71%) !default -$red: hsl(348, 86%, 61%) !default - -// Typography - -$family-sans-serif: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif !default -$family-monospace: monospace !default -$render-mode: optimizeLegibility !default - -$size-1: 3rem !default -$size-2: 2.5rem !default -$size-3: 2rem !default -$size-4: 1.5rem !default -$size-5: 1.25rem !default -$size-6: 1rem !default -$size-7: 0.75rem !default - -$weight-light: 300 !default -$weight-normal: 400 !default -$weight-medium: 500 !default -$weight-semibold: 600 !default -$weight-bold: 700 !default - -// Spacing - -$block-spacing: 1.5rem !default - -// Responsiveness - -// The container horizontal gap, which acts as the offset for breakpoints -$gap: 32px !default -// 960, 1152, and 1344 have been chosen because they are divisible by both 12 and 16 -$tablet: 769px !default -// 960px container + 4rem -$desktop: 960px + (2 * $gap) !default -// 1152px container + 4rem -$widescreen: 1152px + (2 * $gap) !default -$widescreen-enabled: true !default -// 1344px container + 4rem -$fullhd: 1344px + (2 * $gap) !default -$fullhd-enabled: true !default - -// Miscellaneous - -$easing: ease-out !default -$radius-small: 2px !default -$radius: 4px !default -$radius-large: 6px !default -$radius-rounded: 290486px !default -$speed: 86ms !default - -// Flags - -$variable-columns: true !default -$rtl: false !default diff --git a/shared/static/src/bulma/sass/utilities/mixins.sass b/shared/static/src/bulma/sass/utilities/mixins.sass deleted file mode 100644 index 0ed78c15..00000000 --- a/shared/static/src/bulma/sass/utilities/mixins.sass +++ /dev/null @@ -1,285 +0,0 @@ -@import "initial-variables" - -=clearfix - &::after - clear: both - content: " " - display: table - -=center($width, $height: 0) - position: absolute - @if $height != 0 - left: calc(50% - (#{$width} / 2)) - top: calc(50% - (#{$height} / 2)) - @else - left: calc(50% - (#{$width} / 2)) - top: calc(50% - (#{$width} / 2)) - -=fa($size, $dimensions) - display: inline-block - font-size: $size - height: $dimensions - line-height: $dimensions - text-align: center - vertical-align: top - width: $dimensions - -=hamburger($dimensions) - cursor: pointer - display: block - height: $dimensions - position: relative - width: $dimensions - span - background-color: currentColor - display: block - height: 1px - left: calc(50% - 8px) - position: absolute - transform-origin: center - transition-duration: $speed - transition-property: background-color, opacity, transform - transition-timing-function: $easing - width: 16px - &:nth-child(1) - top: calc(50% - 6px) - &:nth-child(2) - top: calc(50% - 1px) - &:nth-child(3) - top: calc(50% + 4px) - &:hover - background-color: bulmaRgba(black, 0.05) - // Modifers - &.is-active - span - &:nth-child(1) - transform: translateY(5px) rotate(45deg) - &:nth-child(2) - opacity: 0 - &:nth-child(3) - transform: translateY(-5px) rotate(-45deg) - -=overflow-touch - -webkit-overflow-scrolling: touch - -=placeholder - $placeholders: ':-moz' ':-webkit-input' '-moz' '-ms-input' - @each $placeholder in $placeholders - &:#{$placeholder}-placeholder - @content - -// Responsiveness - -=from($device) - @media screen and (min-width: $device) - @content - -=until($device) - @media screen and (max-width: $device - 1px) - @content - -=mobile - @media screen and (max-width: $tablet - 1px) - @content - -=tablet - @media screen and (min-width: $tablet), print - @content - -=tablet-only - @media screen and (min-width: $tablet) and (max-width: $desktop - 1px) - @content - -=touch - @media screen and (max-width: $desktop - 1px) - @content - -=desktop - @media screen and (min-width: $desktop) - @content - -=desktop-only - @if $widescreen-enabled - @media screen and (min-width: $desktop) and (max-width: $widescreen - 1px) - @content - -=until-widescreen - @if $widescreen-enabled - @media screen and (max-width: $widescreen - 1px) - @content - -=widescreen - @if $widescreen-enabled - @media screen and (min-width: $widescreen) - @content - -=widescreen-only - @if $widescreen-enabled and $fullhd-enabled - @media screen and (min-width: $widescreen) and (max-width: $fullhd - 1px) - @content - -=until-fullhd - @if $fullhd-enabled - @media screen and (max-width: $fullhd - 1px) - @content - -=fullhd - @if $fullhd-enabled - @media screen and (min-width: $fullhd) - @content - -=ltr - @if not $rtl - @content - -=rtl - @if $rtl - @content - -=ltr-property($property, $spacing, $right: true) - $normal: if($right, "right", "left") - $opposite: if($right, "left", "right") - @if $rtl - #{$property}-#{$opposite}: $spacing - @else - #{$property}-#{$normal}: $spacing - -=ltr-position($spacing, $right: true) - $normal: if($right, "right", "left") - $opposite: if($right, "left", "right") - @if $rtl - #{$opposite}: $spacing - @else - #{$normal}: $spacing - -// Placeholders - -=unselectable - -webkit-touch-callout: none - -webkit-user-select: none - -moz-user-select: none - -ms-user-select: none - user-select: none - -%unselectable - +unselectable - -=arrow($color: transparent) - border: 3px solid $color - border-radius: 2px - border-right: 0 - border-top: 0 - content: " " - display: block - height: 0.625em - margin-top: -0.4375em - pointer-events: none - position: absolute - top: 50% - transform: rotate(-45deg) - transform-origin: center - width: 0.625em - -%arrow - +arrow - -=block($spacing: $block-spacing) - &:not(:last-child) - margin-bottom: $spacing - -%block - +block - -=delete - @extend %unselectable - -moz-appearance: none - -webkit-appearance: none - background-color: bulmaRgba($scheme-invert, 0.2) - border: none - border-radius: $radius-rounded - cursor: pointer - pointer-events: auto - display: inline-block - flex-grow: 0 - flex-shrink: 0 - font-size: 0 - height: 20px - max-height: 20px - max-width: 20px - min-height: 20px - min-width: 20px - outline: none - position: relative - vertical-align: top - width: 20px - &::before, - &::after - background-color: $scheme-main - content: "" - display: block - left: 50% - position: absolute - top: 50% - transform: translateX(-50%) translateY(-50%) rotate(45deg) - transform-origin: center center - &::before - height: 2px - width: 50% - &::after - height: 50% - width: 2px - &:hover, - &:focus - background-color: bulmaRgba($scheme-invert, 0.3) - &:active - background-color: bulmaRgba($scheme-invert, 0.4) - // Sizes - &.is-small - height: 16px - max-height: 16px - max-width: 16px - min-height: 16px - min-width: 16px - width: 16px - &.is-medium - height: 24px - max-height: 24px - max-width: 24px - min-height: 24px - min-width: 24px - width: 24px - &.is-large - height: 32px - max-height: 32px - max-width: 32px - min-height: 32px - min-width: 32px - width: 32px - -%delete - +delete - -=loader - animation: spinAround 500ms infinite linear - border: 2px solid $grey-lighter - border-radius: $radius-rounded - border-right-color: transparent - border-top-color: transparent - content: "" - display: block - height: 1em - position: relative - width: 1em - -%loader - +loader - -=overlay($offset: 0) - bottom: $offset - left: $offset - position: absolute - right: $offset - top: $offset - -%overlay - +overlay diff --git a/shared/static/src/jquery/jquery-3.3.1.js b/shared/static/src/jquery/jquery-3.3.1.js deleted file mode 100644 index 9b5206bc..00000000 --- a/shared/static/src/jquery/jquery-3.3.1.js +++ /dev/null @@ -1,10364 +0,0 @@ -/*! - * jQuery JavaScript Library v3.3.1 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2018-01-20T17:24Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var document = window.document; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var concat = arr.concat; - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - - - - var preservedScriptAttributes = { - type: true, - src: true, - noModule: true - }; - - function DOMEval( code, doc, node ) { - doc = doc || document; - - var i, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - if ( node[ i ] ) { - script[ i ] = node[ i ]; - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.3.1", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - - // Support: Android <=4.0 only - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - - if ( copyIsArray ) { - copyIsArray = false; - clone = src && Array.isArray( src ) ? src : []; - - } else { - clone = src && jQuery.isPlainObject( src ) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - - /* eslint-disable no-unused-vars */ - // See https://github.com/eslint/eslint/issues/6125 - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a global context - globalEval: function( code ) { - DOMEval( code ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // Support: Android <=4.0 only - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.3 - * https://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2016-08-08 - */ -(function( window ) { - -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - disabledAncestor = addCombinator( - function( elem ) { - return elem.disabled === true && ("form" in elem || "label" in elem); - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { - - // ID selector - if ( (m = match[1]) ) { - - // Document context - if ( nodeType === 9 ) { - if ( (elem = context.getElementById( m )) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && (elem = newContext.getElementById( m )) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( (m = match[3]) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !compilerCache[ selector + " " ] && - (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - - if ( nodeType !== 1 ) { - newContext = context; - newSelector = selector; - - // qSA looks outside Element context, which is not what we want - // Thanks to Andrew Dupont for this workaround technique - // Support: IE <=8 - // Exclude object elements - } else if ( context.nodeName.toLowerCase() !== "object" ) { - - // Capture the context ID, setting it first if necessary - if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", (nid = expando) ); - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[i] = "#" + nid + " " + toSelector( groups[i] ); - } - newSelector = groups.join( "," ); - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement("fieldset"); - - try { - return !!fn( el ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - disabledAncestor( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9-11, Edge - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - if ( preferredDoc !== document && - (subWindow = document.defaultView) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert(function( el ) { - el.className = "i"; - return !el.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( el ) { - el.appendChild( document.createComment("") ); - return !el.getElementsByTagName("*").length; - }); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - }); - - // ID filter and find - if ( support.getById ) { - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( (elem = elems[i++]) ) { - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( el ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll("[msallowcapture^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push("~="); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push(".#.+[+~]"); - } - }); - - assert(function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement("input"); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll(":enabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll(":disabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( el ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - return a === document ? -1 : - b === document ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - !compilerCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch (e) {} - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return (sel + "").replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - while ( (node = elem[i++]) ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[6] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] ) { - match[2] = match[4] || match[5] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - // Use previously-cached element index if available - if ( useCache ) { - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - // Don't keep the element (issue #299) - input[0] = null; - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( (oldCache = uniqueCache[ key ]) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context === document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - if ( !context && elem.ownerDocument !== document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context || document, xml) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( (selector = compiled.selector || selector) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( el ) { - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( el ) { - return el.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - null; - } - }); -} - -return Sizzle; - -})( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -}; -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( nodeName( elem, "iframe" ) ) { - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the master Deferred - master = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return master.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); - } - - return master.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - jQuery.contains( elem.ownerDocument, elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - -var swap = function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // Support: IE <=9 only - option: [ 1, "" ], - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
    " ], - col: [ 2, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - - _default: [ 0, "", "" ] -}; - -// Support: IE <=9 only -wrapMap.optgroup = wrapMap.option; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, contains, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; -} )(); -var documentElement = document.documentElement; - - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 only -// See #13393 for more info -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = {}; - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - // Make a writable jQuery.Event from the native event object - var event = jQuery.event.fix( nativeEvent ); - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or 2) have namespace(s) - // a subset or equal to those in the bound event (both can have no namespace). - if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - this.focus(); - return false; - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - /* eslint-disable max-len */ - - // See https://github.com/eslint/eslint/issues/3229 - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, - - /* eslint-enable */ - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.access( src ); - pdataCur = dataPriv.set( dest, pdataOld ); - events = pdataOld.events; - - if ( events ) { - delete pdataCur.handle; - pdataCur.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html.replace( rxhtmlTag, "<$1>" ); - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - div.style.position = "absolute"; - scrollboxSizeVal = div.offsetWidth === 36 || "absolute"; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }, - - cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style; - -// Return a css property mapped to a potentially vendor prefixed property -function vendorPropName( name ) { - - // Shortcut for names that are not vendor prefixed - if ( name in emptyStyle ) { - return name; - } - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a property mapped along what jQuery.cssProps suggests or to -// a vendor prefixed property. -function finalPropName( name ) { - var ret = jQuery.cssProps[ name ]; - if ( !ret ) { - ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; - } - return ret; -} - -function setPositiveNumber( elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - ) ); - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - val = curCSS( elem, dimension, styles ), - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox; - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - // Check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = valueIsBorderBox && - ( support.boxSizingReliable() || val === elem.style[ dimension ] ); - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - if ( val === "auto" || - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { - - val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; - - // offsetWidth/offsetHeight provide border-box values - valueIsBorderBox = true; - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - if ( type === "number" ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra && boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ); - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && support.scrollboxSize() === styles.position ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && - ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || - jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - var doc = this.ownerDocument || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = Date.now(); - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match == null ? null : match; - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - - -jQuery._evalUrl = function( url ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - "throws": true - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( "