├── tellme ├── __init__.py ├── tests │ ├── __init__.py │ ├── testproject │ │ ├── __init__.py │ │ ├── models.py │ │ ├── wsgi.py │ │ ├── urls.py │ │ └── settings.py │ ├── factories.py │ ├── test_models.py │ ├── test_admin.py │ └── test_views.py ├── migrations │ ├── __init__.py │ ├── 0003_feedback_email.py │ ├── 0004_auto.py │ ├── 0001_initial.py │ └── 0002_auto_20160411_2232.py ├── templates │ └── tellme │ │ ├── initButtonText.txt │ │ ├── tpl-button.html │ │ ├── css_inc.html │ │ ├── tpl-submit-error.html │ │ ├── tpl-submit-success.html │ │ ├── tpl-description.html │ │ ├── tpl-highlighter.html │ │ ├── tpl-overview.html │ │ └── js_inc.html ├── locale │ ├── en │ │ └── LC_MESSAGES │ │ │ ├── django.mo │ │ │ └── django.po │ ├── fr │ │ └── LC_MESSAGES │ │ │ ├── django.mo │ │ │ └── django.po │ ├── ja │ │ └── LC_MESSAGES │ │ │ ├── django.mo │ │ │ └── django.po │ └── pt_BR │ │ └── LC_MESSAGES │ │ ├── django.mo │ │ └── django.po ├── static │ └── tellme │ │ └── vendor │ │ ├── feedback │ │ ├── icons.png │ │ ├── feedback.css │ │ └── feedback.js │ │ ├── es6-promise │ │ └── es6-promise.auto.js │ │ └── html2canvas │ │ └── html2canvas.min.js ├── forms.py ├── urls.py ├── mail.py ├── models.py ├── views.py └── admin.py ├── requirements-tests.txt ├── MANIFEST.in ├── images ├── snapshot-admin-view.png ├── snapshot-feedback-form.png ├── snapshot-feedback-button.png └── snapshot-highlight-blackout.png ├── pyproject.toml ├── .gitignore ├── SECURITY.md ├── runtests.py ├── .coveragerc ├── setup.cfg ├── .github └── workflows │ ├── python-publish.yml │ └── sdist.yml ├── tox.ini ├── setup.py ├── LICENSE └── README.rst /tellme/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tellme/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tellme/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tellme/tests/testproject/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements-tests.txt: -------------------------------------------------------------------------------- 1 | factory-boy 2 | Pillow 3 | coverage 4 | -------------------------------------------------------------------------------- /tellme/tests/testproject/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | graft tellme 4 | -------------------------------------------------------------------------------- /tellme/templates/tellme/initButtonText.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% trans 'Send feedback' %} -------------------------------------------------------------------------------- /images/snapshot-admin-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/images/snapshot-admin-view.png -------------------------------------------------------------------------------- /images/snapshot-feedback-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/images/snapshot-feedback-form.png -------------------------------------------------------------------------------- /images/snapshot-feedback-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/images/snapshot-feedback-button.png -------------------------------------------------------------------------------- /images/snapshot-highlight-blackout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/images/snapshot-highlight-blackout.png -------------------------------------------------------------------------------- /tellme/locale/en/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/tellme/locale/en/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /tellme/locale/fr/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/tellme/locale/fr/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /tellme/locale/ja/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/tellme/locale/ja/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /tellme/templates/tellme/tpl-button.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | -------------------------------------------------------------------------------- /tellme/locale/pt_BR/LC_MESSAGES/django.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/tellme/locale/pt_BR/LC_MESSAGES/django.mo -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" 7 | -------------------------------------------------------------------------------- /tellme/static/tellme/vendor/feedback/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludrao/django-tellme/HEAD/tellme/static/tellme/vendor/feedback/icons.png -------------------------------------------------------------------------------- /tellme/templates/tellme/css_inc.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | build/ 3 | django-tellme-*/ 4 | django_tellme.egg-info/ 5 | .DS_Store 6 | .idea/ 7 | __pycache__/ 8 | *.pyc 9 | venv 10 | *.sw[pon] 11 | .coverage 12 | .tox/ 13 | tellme/screenshots/ 14 | -------------------------------------------------------------------------------- /tellme/forms.py: -------------------------------------------------------------------------------- 1 | from django.forms import ModelForm 2 | from .models import Feedback 3 | 4 | 5 | class FeedbackForm(ModelForm): 6 | 7 | class Meta: 8 | model = Feedback 9 | fields = "__all__" 10 | -------------------------------------------------------------------------------- /tellme/tests/testproject/wsgi.py: -------------------------------------------------------------------------------- 1 | import os 2 | from django.core.wsgi import get_wsgi_application 3 | 4 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tellme.tests.testproject.settings") 5 | application = get_wsgi_application() 6 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Support is minimal, pleae provide pull request if you need a new fature or fix. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Please create an issue to report a vulnerability, and ideally an associate pull request so that the fix can be merged and released asap. 10 | -------------------------------------------------------------------------------- /tellme/tests/testproject/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | try: 3 | from django.conf.urls import url, include 4 | except ImportError: 5 | from django.urls import re_path as url, include 6 | from tellme import urls 7 | 8 | 9 | urlpatterns = [ 10 | url('admin/', admin.site.urls), 11 | url('tellme/', include('tellme.urls')), 12 | ] 13 | -------------------------------------------------------------------------------- /tellme/templates/tellme/tpl-submit-error.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |
3 | 4 |

{% trans 'Sadly an error occurred while sending your feedback. Please try again.' %}

5 | 6 |
7 |
-------------------------------------------------------------------------------- /tellme/templates/tellme/tpl-submit-success.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |
3 | 4 |

{% trans 'Thank you for your feedback. We value every piece of feedback we receive.'%}

5 |

{% trans 'We cannot respond individually to every one, but we will use your comments as we strive to improve your experience.' %}

6 | 7 |
8 |
-------------------------------------------------------------------------------- /tellme/migrations/0003_feedback_email.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11.5 on 2017-10-27 17:39 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('tellme', '0002_auto_20160411_2232'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='feedback', 17 | name='email', 18 | field=models.EmailField(blank=True, max_length=254, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /runtests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | import django 6 | from django.conf import settings 7 | from django.test.utils import get_runner 8 | 9 | 10 | def main(): 11 | from django.core.management import execute_from_command_line 12 | execute_from_command_line(sys.argv) 13 | 14 | if __name__ == "__main__": 15 | os.environ['DJANGO_SETTINGS_MODULE'] = 'tellme.tests.testproject.settings' 16 | if len(sys.argv) == 1: 17 | django.setup() 18 | TestRunner = get_runner(settings) 19 | test_runner = TestRunner(verbosity=2) 20 | failures = test_runner.run_tests(["tellme.tests"]) 21 | sys.exit(bool(failures)) 22 | main() 23 | -------------------------------------------------------------------------------- /tellme/tests/factories.py: -------------------------------------------------------------------------------- 1 | import factory 2 | from factory import fuzzy 3 | 4 | 5 | class UserFactory(factory.django.DjangoModelFactory): 6 | class Meta: 7 | model = 'auth.User' 8 | django_get_or_create = ('username',) 9 | 10 | username = factory.Faker('user_name') 11 | email = factory.Faker('email') 12 | 13 | 14 | class FeedbackFactory(factory.django.DjangoModelFactory): 15 | class Meta: 16 | model = 'tellme.Feedback' 17 | 18 | url = factory.Faker('url') 19 | browser = factory.Faker('user_agent') 20 | comment = factory.Faker('sentence') 21 | screenshot = factory.django.ImageField(color='green') 22 | 23 | user = factory.SubFactory(UserFactory) 24 | email = factory.Faker('email') 25 | created = factory.Faker('date_time') 26 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = tellme 4 | omit = 5 | tellme/tests/* 6 | tellme/migrations* 7 | 8 | [report] 9 | # Regexes for lines to exclude from consideration 10 | exclude_lines = 11 | # Have to re-enable the standard pragma 12 | pragma: no cover 13 | noqa: 14 | 15 | # Don't complain about missing debug-only code: 16 | def __repr__ 17 | def __str__ 18 | if self\.debug 19 | 20 | # Don't complain if tests don't hit defensive assertion code: 21 | raise AssertionError 22 | raise NotImplementedError 23 | 24 | # Don't complain if non-runnable code isn't run: 25 | if 0: 26 | if __name__ == .__main__.: 27 | __all__ 28 | import 29 | deprecated_warning 30 | in_development_warning 31 | 32 | ignore_errors = True 33 | 34 | [html] 35 | directory = coverage_html_report 36 | -------------------------------------------------------------------------------- /tellme/migrations/0004_auto.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.8 on 2019-02-12 14:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | dependencies = [ 8 | ('tellme', '0003_feedback_email'), 9 | ] 10 | 11 | operations = [ 12 | migrations.AlterField( 13 | model_name='feedback', 14 | name='created', 15 | field=models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Creation date'), 16 | ), 17 | migrations.AlterModelOptions( 18 | name='feedback', 19 | options={'verbose_name': 'feedback', 'verbose_name_plural': 'feedbacks'}, 20 | ), 21 | migrations.AddField( 22 | model_name='feedback', 23 | name='ack', 24 | field=models.BooleanField(default=False, verbose_name='Acknowledgement'), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = django-tellme 3 | version = 0.7.3 4 | url = https://github.com/ludrao/django-tellme 5 | author = Ludrao 6 | author_email = ludrao@ludrao.net 7 | classifiers = 8 | Development Status :: 4 - Beta 9 | Environment :: Web Environment 10 | Framework :: Django 11 | Intended Audience :: Developers 12 | License :: OSI Approved :: BSD License 13 | Operating System :: OS Independent 14 | Programming Language :: Python 15 | Programming Language :: Python :: 3 16 | Programming Language :: Python :: 3.2 17 | Programming Language :: Python :: 3.3 18 | Programming Language :: Python :: 3.5 19 | Topic :: Internet :: WWW/HTTP 20 | Topic :: Internet :: WWW/HTTP :: Dynamic Content 21 | description = A simple Django app that enables user feedback. 22 | long_description = file: README.rst 23 | 24 | [options] 25 | python_requires = >=2.7 26 | install_requires = 27 | Pillow>=8.4.0 28 | -------------------------------------------------------------------------------- /tellme/urls.py: -------------------------------------------------------------------------------- 1 | import django 2 | 3 | try: 4 | from django.urls import path, include 5 | except ImportError: 6 | from django.conf.urls import url, include 7 | 8 | 9 | from .views import get_feedback_screenshot, post_feedback 10 | 11 | 12 | if django.VERSION[0] < 2: 13 | tellme_urlpatterns = [ 14 | url(r'^post_feedback/$', post_feedback, name='post_feedback'), 15 | url(r'^get_feedback_screenshot/(?P\d+)/$', get_feedback_screenshot, name='get_feedback_screenshot'), 16 | ] 17 | 18 | urlpatterns = [ 19 | url(r'^', include(tellme_urlpatterns, 20 | namespace='tellme')), 21 | ] 22 | else: 23 | tellme_urlpatterns = [ 24 | path('post_feedback/', post_feedback, name='post_feedback'), 25 | path('get_feedback_screenshot//', get_feedback_screenshot, name='get_feedback_screenshot'), 26 | ] 27 | 28 | app_name = 'tellme' 29 | 30 | urlpatterns = [ 31 | path('', include(tellme_urlpatterns,)), 32 | ] 33 | -------------------------------------------------------------------------------- /tellme/templates/tellme/tpl-description.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |
3 | 4 |

{% trans 'Feedback lets you send us suggestions about this site. We welcome problem reports, feature ideas and general comments.' %}

5 | {% if not user.is_authenticated %} 6 |

{% trans 'If you wish to be contacted please leave us your email:' %}

7 | 8 | {% endif %} 9 |

{% trans 'Start by writing a brief description:' %}

10 | 11 |

{% trans "Next we'll let you identify areas of the page related to your description." %}

12 | 13 |
{% trans 'Please enter a description.' %}
14 | 15 |
16 | -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries 3 | 4 | name: Upload Python Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | deploy: 12 | if: startsWith(github.ref, 'refs/tags/v') 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up Python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: '3.x' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install setuptools wheel twine build 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: __token__ 27 | TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} 28 | run: | 29 | python -m build --sdist 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /tellme/mail.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.core.mail import send_mail as django_send_mail 3 | from django.utils.translation import gettext_lazy as _ 4 | try: 5 | from django.core.urlresolvers import reverse 6 | except ImportError: 7 | from django.urls import reverse 8 | 9 | 10 | def send_mail(request, feedback, fail_silently=True): 11 | message = _("Your site %(host)s received feedback from %(user)s.\n" 12 | "The comments were:\n" 13 | "%(note)s.\n\n" 14 | "See the full feedback content here: %(url)s")\ 15 | % {'host': request.get_host(), 'user': str(request.user), 'note': feedback.comment, 16 | 'url': request.build_absolute_uri( 17 | reverse('admin:tellme_feedback_change', args=(feedback.id,)))} 18 | django_send_mail( 19 | _('[%(host)s] Received feedback') % {'host': request.get_host()}, 20 | message, 21 | settings.SERVER_EMAIL, 22 | [settings.TELLME_FEEDBACK_EMAIL], 23 | fail_silently=fail_silently) 24 | -------------------------------------------------------------------------------- /tellme/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | from django.conf import settings 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Feedback', 18 | fields=[ 19 | ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), 20 | ('url', models.CharField(max_length=255)), 21 | ('browser', models.TextField()), 22 | ('comment', models.TextField()), 23 | ('screenshot', models.ImageField(upload_to='tellme/screenshots/', null=True, blank=True)), 24 | ('created', models.DateTimeField(auto_now_add=True)), 25 | ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, blank=True)), 26 | ], 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /tellme/templates/tellme/tpl-highlighter.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |
3 | 4 |

{% trans "Click and drag on the page to help us better understand your feedback. You can move this dialog if it's in the way." %}

5 | 8 | 9 | 12 | 13 | 21 | 22 |
-------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts=--tb=short 3 | 4 | [tox] 5 | requires = tox-gh-actions 6 | 7 | toxworkdir = {homedir}/.toxworkdir 8 | 9 | envlist = 10 | py36-django{111,22,30,31} 11 | py37-django{111,22,30,31} 12 | py38-django{22,30,31} 13 | py39-django{22,30,31,master} 14 | lint 15 | 16 | [gh-actions] 17 | python = 18 | 3.6: py36 19 | 3.7: py37 20 | 3.8: py38 21 | 3.9: py39 22 | 23 | [gh-actions:env] 24 | DJANGO = 25 | 111: django111 26 | 22: django22 27 | 30: django30 28 | 31: django31 29 | master: djangomaster 30 | 31 | [testenv] 32 | commands = ./runtests.py 33 | 34 | skip_missing_interpreters=true 35 | basepython = 36 | py39: python3.9 37 | py38: python3.8 38 | py37: python3.7 39 | py36: python3.6 40 | 41 | deps = 42 | -rrequirements-tests.txt 43 | Pillow 44 | django111: Django>=1.11,<2.0 45 | django22: Django>=2.2,<2.3 46 | django30: Django>=3.0,<3.1 47 | django31: Django>=3.1,<3.2 48 | djangomaster: https://github.com/django/django/archive/master.tar.gz 49 | 50 | [testenv:lint] 51 | deps = 52 | -rrequirements.txt 53 | prospector 54 | commands = prospector faker_cloud -0 -------------------------------------------------------------------------------- /tellme/tests/test_models.py: -------------------------------------------------------------------------------- 1 | from unittest import mock 2 | from django.test import TestCase 3 | from tellme.models import Feedback 4 | from tellme.tests.factories import FeedbackFactory 5 | 6 | try: 7 | from django.core.urlresolvers import reverse 8 | except ImportError: 9 | from django.urls import reverse 10 | 11 | 12 | class FeedbackScreenshotMethodsTest(TestCase): 13 | @mock.patch('tellme.models.reverse', wraps=reverse) 14 | def test_get_screenshot_url(self, mocked_reverse): 15 | feedback = FeedbackFactory() 16 | url = feedback.get_screenshot_url() 17 | self.assertEqual(url, '/tellme/get_feedback_screenshot/%s/' % feedback.pk) 18 | mocked_reverse.assert_called_once_with('tellme:get_feedback_screenshot', kwargs={'pk': feedback.pk}) 19 | 20 | 21 | class FeedbackScreenshotDeleteTest(TestCase): 22 | def test_delete_screenshot(self): 23 | feedback = FeedbackFactory() 24 | self.assertTrue(feedback.screenshot) 25 | feedback.delete() 26 | self.assertFalse(feedback.screenshot) 27 | 28 | def test_no_screenshot(self): 29 | feedback = FeedbackFactory(screenshot=None) 30 | feedback.delete() 31 | self.assertFalse(feedback.screenshot) -------------------------------------------------------------------------------- /tellme/templates/tellme/tpl-overview.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 |
3 | 4 |
5 |

{% trans 'Description' %}

6 | 7 |
{% trans 'None' %}
8 |
{% trans 'Browser Info' %}
9 |
{% trans 'Page Info' %}
10 |
{% trans 'Page Structure' %}
11 |
12 |
13 |

{% trans 'Screenshot' %}

14 | 18 |
{% trans 'Please enter a description.' %}
19 | 20 |
-------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | from setuptools import setup 3 | 4 | with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: 5 | README = readme.read() 6 | 7 | # allow setup.py to be run from any path 8 | os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) 9 | 10 | setup( 11 | name='django-tellme', 12 | version='0.7.3', 13 | packages=['tellme'], 14 | include_package_data=True, 15 | license='BSD License', 16 | description='A simple Django app that enables user feedback.', 17 | long_description=README, 18 | url='https://github.com/ludrao/django-tellme', 19 | author='Ludrao', 20 | author_email='ludrao@ludrao.net', 21 | classifiers=[ 22 | 'Development Status :: 4 - Beta', 23 | 'Environment :: Web Environment', 24 | 'Framework :: Django', 25 | 'Intended Audience :: Developers', 26 | 'License :: OSI Approved :: BSD License', 27 | 'Operating System :: OS Independent', 28 | 'Programming Language :: Python', 29 | 'Programming Language :: Python :: 3', 30 | 'Programming Language :: Python :: 3.2', 31 | 'Programming Language :: Python :: 3.3', 32 | 'Programming Language :: Python :: 3.5', 33 | 'Topic :: Internet :: WWW/HTTP', 34 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 35 | ], 36 | ) 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 1998, Ludrao 2 | All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the University of California, Berkeley nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /tellme/tests/test_admin.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | try: 3 | from django.core.urlresolvers import reverse_lazy as reverse 4 | except ImportError: 5 | from django.urls import reverse_lazy as reverse 6 | 7 | from tellme.models import Feedback 8 | from tellme.tests import factories 9 | 10 | 11 | class AdminAcknowledgeActionTest(TestCase): 12 | url = reverse('admin:tellme_feedback_changelist') 13 | 14 | def test_action(self): 15 | user = factories.UserFactory(is_staff=True, is_superuser=True) 16 | feedback = factories.FeedbackFactory(ack=False) 17 | self.client.force_login(user) 18 | data = { 19 | 'action': 'acknowledge', 20 | '_selected_action': [feedback.id], 21 | } 22 | response = self.client.post(self.url, data, follow=True) 23 | self.assertEqual(response.status_code, 200) 24 | feedback.refresh_from_db() 25 | self.assertTrue(feedback.ack) 26 | 27 | 28 | class AdminUnacknowledgeActionTest(TestCase): 29 | url = reverse('admin:tellme_feedback_changelist') 30 | 31 | def test_action(self): 32 | user = factories.UserFactory(is_staff=True, is_superuser=True) 33 | feedback = factories.FeedbackFactory(ack=True) 34 | self.client.force_login(user) 35 | data = { 36 | 'action': 'unacknowledge', 37 | '_selected_action': [feedback.id], 38 | } 39 | response = self.client.post(self.url, data, follow=True) 40 | self.assertEqual(response.status_code, 200) 41 | feedback.refresh_from_db() 42 | self.assertFalse(feedback.ack) 43 | -------------------------------------------------------------------------------- /tellme/tests/testproject/settings.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 4 | SECRET_KEY = "Shuuut... It's a secret" 5 | 6 | DEBUG = False 7 | ALLOWED_HOSTS = ['*'] 8 | INSTALLED_APPS = [ 9 | 'django.contrib.contenttypes', 10 | 'django.contrib.auth', 11 | 'django.contrib.messages', 12 | 'django.contrib.sessions', 13 | 'django.contrib.admin', 14 | 'tellme', 15 | ] 16 | 17 | MIDDLEWARE = [ 18 | 'django.contrib.sessions.middleware.SessionMiddleware', 19 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 20 | 'django.contrib.messages.middleware.MessageMiddleware', 21 | ] 22 | 23 | ROOT_URLCONF = 'tellme.tests.testproject.urls' 24 | 25 | TEMPLATES = [ 26 | { 27 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 28 | 'DIRS': [], 29 | 'APP_DIRS': True, 30 | 'OPTIONS': { 31 | 'context_processors': [ 32 | 'django.contrib.auth.context_processors.auth', 33 | 'django.contrib.messages.context_processors.messages', 34 | ], 35 | }, 36 | }, 37 | ] 38 | 39 | WSGI_APPLICATION = 'tellme.tests.testproject.wsgi.application' 40 | 41 | DATABASES = { 42 | 'default': { 43 | 'ENGINE': 'django.db.backends.sqlite3', 44 | 'NAME': os.environ.get('DATABASE_PATH', ':memory:'), 45 | } 46 | } 47 | 48 | AUTH_PASSWORD_VALIDATORS = [] 49 | 50 | LANGUAGE_CODE = 'en-us' 51 | TIME_ZONE = 'UTC' 52 | USE_I18N = True 53 | USE_L10N = True 54 | USE_TZ = True 55 | STATIC_URL = '/static/' 56 | 57 | TELLME_FEEDBACK_EMAIL = 'foo@bar.ham' 58 | -------------------------------------------------------------------------------- /tellme/migrations/0002_auto_20160411_2232.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | from django.conf import settings 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('tellme', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='feedback', 18 | name='browser', 19 | field=models.TextField(verbose_name='Browser'), 20 | ), 21 | migrations.AlterField( 22 | model_name='feedback', 23 | name='comment', 24 | field=models.TextField(verbose_name='Comment'), 25 | ), 26 | migrations.AlterField( 27 | model_name='feedback', 28 | name='created', 29 | field=models.DateTimeField(auto_now_add=True, verbose_name='Creation date'), 30 | ), 31 | migrations.AlterField( 32 | model_name='feedback', 33 | name='screenshot', 34 | field=models.ImageField(upload_to='tellme/screenshots/', verbose_name='Screenshot', blank=True, null=True), 35 | ), 36 | migrations.AlterField( 37 | model_name='feedback', 38 | name='url', 39 | field=models.CharField(max_length=255, verbose_name='Url'), 40 | ), 41 | migrations.AlterField( 42 | model_name='feedback', 43 | name='user', 44 | field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, verbose_name='User', to=settings.AUTH_USER_MODEL, null=True), 45 | ), 46 | ] 47 | -------------------------------------------------------------------------------- /tellme/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | from django.db.models.signals import post_delete 4 | from django.dispatch.dispatcher import receiver 5 | from django.utils.translation import gettext_lazy as _ 6 | from six import python_2_unicode_compatible 7 | 8 | try: 9 | from django.core.urlresolvers import reverse 10 | except ImportError: 11 | from django.urls import reverse 12 | 13 | 14 | @python_2_unicode_compatible 15 | class Feedback(models.Model): 16 | url = models.CharField(_('Url'), max_length=255) 17 | browser = models.TextField(_('Browser')) 18 | comment = models.TextField(_('Comment')) 19 | screenshot = models.ImageField(_('Screenshot'), blank=True, null=True, upload_to="tellme/screenshots/") 20 | 21 | user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_("User"), on_delete=models.SET_NULL, blank=True, null=True) 22 | email = models.EmailField(max_length=254, blank=True, null=True) 23 | created = models.DateTimeField(_('Creation date'), auto_now_add=True, db_index=True) 24 | 25 | ack = models.BooleanField(_('Acknowledgement'), default=False) 26 | 27 | class Meta: 28 | verbose_name = _("feedback") 29 | verbose_name_plural = _("feedbacks") 30 | 31 | def __str__(self): 32 | return '%s: %s' % (self.created, self.url) 33 | 34 | def get_screenshot_url(self): 35 | return reverse('tellme:get_feedback_screenshot', kwargs={'pk': self.pk}) 36 | 37 | 38 | @receiver(post_delete, sender=Feedback) 39 | def feedback_screenshot_delete(sender, instance, **kwargs): 40 | """ 41 | Delete feedback's screenshot. 42 | """ 43 | if instance.screenshot: 44 | instance.screenshot.delete(save=False) 45 | -------------------------------------------------------------------------------- /tellme/views.py: -------------------------------------------------------------------------------- 1 | import json 2 | from base64 import b64decode 3 | import importlib 4 | 5 | from django.conf import settings 6 | from django.http import JsonResponse, HttpResponseBadRequest 7 | from django.core.files.base import ContentFile 8 | from django.shortcuts import redirect, get_object_or_404 9 | from django.utils.crypto import get_random_string 10 | 11 | from tellme.forms import FeedbackForm 12 | from tellme.models import Feedback 13 | from tellme import mail 14 | 15 | 16 | def get_notification_function(path=None): 17 | path = path or getattr(settings, 'TELLME_NOTIFICATION_FUNCTION', 18 | 'tellme.mail.send_mail') 19 | module_path = '.'.join(path.split('.')[:-1]) 20 | func_name = path.split('.')[-1] 21 | module = importlib.import_module(module_path) 22 | func = getattr(module, func_name) 23 | return func 24 | 25 | 26 | def post_feedback(request): 27 | if request.method == 'POST' and request.is_ajax(): 28 | 29 | # Copy Post data names into names used into the model in order to automatically create the model/form 30 | # from the request dicts 31 | feedback = json.loads(request.POST["feedback"]) 32 | if request.user.id: 33 | data = {'url': feedback['url'], 'browser': json.dumps(feedback['browser']), 'comment': feedback['note'], 34 | 'user': request.user.id} 35 | else: 36 | data = {'url': feedback['url'], 'browser': json.dumps(feedback['browser']), 'comment': feedback['note'], 37 | 'email': feedback.get('email')} 38 | imgstr = feedback['img'].split(';base64,')[1] 39 | file = {'screenshot': ContentFile(b64decode(imgstr), name="screenshot_" + get_random_string(6) + ".png")} 40 | form = FeedbackForm(data, file) 41 | # check whether it's valid: 42 | if form.is_valid(): 43 | f = form.save() 44 | 45 | if hasattr(settings, 'TELLME_FEEDBACK_EMAIL'): 46 | send_notif = get_notification_function() 47 | send_notif(request, f) 48 | return JsonResponse({}) 49 | else: 50 | return JsonResponse({'error': dict(form.errors)}) 51 | 52 | else: 53 | return HttpResponseBadRequest() 54 | 55 | 56 | def get_feedback_screenshot(request, pk): 57 | instance = get_object_or_404(Feedback, pk=pk) 58 | return redirect(instance.screenshot.url) 59 | -------------------------------------------------------------------------------- /tellme/admin.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import django 4 | from django.contrib import admin 5 | from django.contrib import messages 6 | from django.utils.html import escape 7 | from django.utils.translation import gettext_lazy as _, pgettext_lazy 8 | from django.utils.safestring import mark_safe 9 | 10 | from .models import Feedback 11 | 12 | 13 | # Display an html table from a dict 14 | # Credit: original author Rogerio Hilbert 15 | def pretty_items(r, d, nametag="%s: ", itemtag='
  • %s
  • \n', 16 | valuetag="%s", blocktag=('\n')): 17 | if isinstance(d, dict): 18 | r.append(blocktag[0]) 19 | for k, v in d.items(): 20 | name = nametag % escape(k) 21 | if isinstance(v, dict) or isinstance(v, list): 22 | r.append(itemtag % name) 23 | pretty_items(r, v, nametag, itemtag, valuetag, blocktag) 24 | else: 25 | value = valuetag % escape(v) 26 | r.append(itemtag % (name + value)) 27 | r.append(blocktag[1]) 28 | elif isinstance(d, list): 29 | r.append(blocktag[0]) 30 | for i in d: 31 | if isinstance(i, dict) or isinstance(i, list): 32 | r.append(itemtag % " - ") 33 | pretty_items(r, i, nametag, itemtag, valuetag, blocktag) 34 | else: 35 | r.append(itemtag % escape(i)) 36 | r.append(blocktag[1]) 37 | 38 | 39 | class FeedbackAdmin(admin.ModelAdmin): 40 | list_display = ("comment", "url", "screenshot_thumb", "user", "email", "created", "ack") 41 | list_filter = ("created", "ack", "user", "url") 42 | search_fields = ("comment", "user__email", "user__name") 43 | readonly_fields = ("comment", "url", "user", "browser_html", "screenshot_thumb") 44 | exclude = ('browser', 'screenshot') 45 | ordering = ("-created",) 46 | date_hierarchy = 'created' 47 | 48 | actions = ('acknowledge', 'unacknowledge') 49 | 50 | def acknowledge(self, request, queryset): 51 | queryset.update(ack=True) 52 | messages.info(request, _("Feedback(s) has been acknowledged."), 53 | fail_silently=True) 54 | acknowledge.short_description = _("Acknowledge selected feedbacks") 55 | 56 | def unacknowledge(self, request, queryset): 57 | queryset.update(ack=False) 58 | messages.info(request, _("Feedback(s) has been unacknowledged."), 59 | fail_silently=True) 60 | unacknowledge.short_description = _("Unacknowledge selected feedbacks") 61 | 62 | def screenshot_thumb(self, feedback): 63 | if feedback.screenshot: 64 | if django.VERSION[0] < 2: 65 | return u'' % (feedback.get_screenshot_url(), feedback.get_screenshot_url()) 66 | else: 67 | return mark_safe(u'' % (feedback.get_screenshot_url(), feedback.get_screenshot_url())) 68 | 69 | screenshot_thumb.allow_tags = True 70 | screenshot_thumb.short_description = _("Screenshot") 71 | 72 | def browser_html(self, feedback): 73 | if feedback.browser: 74 | r = [] 75 | pretty_items(r, json.loads(feedback.browser)) 76 | if django.VERSION[0] < 2: 77 | return u''.join(r) 78 | else: 79 | return mark_safe(u''.join(r)) 80 | browser_html.allow_tags = True 81 | browser_html.short_description = pgettext_lazy("Admin model", "Browser Info") 82 | 83 | 84 | admin.site.register(Feedback, FeedbackAdmin) 85 | -------------------------------------------------------------------------------- /tellme/templates/tellme/js_inc.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | {#Extend with an empty block or replace with your version of jquery#} 4 | {% block jquery %} 5 | 6 | {% endblock %} 7 | 8 | {% block es6promise %} 9 | 10 | {% endblock %} 11 | 12 | 13 | {# Extend with an empty block if you other mean to deal with AJAX post request in Django #} 14 | {% block ajax_csrf %} 15 | 45 | {% endblock %} 46 | 47 | {% block feedback %} 48 | 49 | {% endblock %} 50 | 51 | {#This is the actual code that enables the tellme plugin#} 52 | {% block enable_tellme %} 53 | 79 | {% endblock %} 80 | -------------------------------------------------------------------------------- /tellme/tests/test_views.py: -------------------------------------------------------------------------------- 1 | import json 2 | import base64 3 | 4 | import faker 5 | from factory.django import ImageField 6 | 7 | from django.test import TestCase 8 | try: 9 | from django.core.urlresolvers import reverse_lazy as reverse 10 | except ImportError: 11 | from django.urls import reverse_lazy as reverse 12 | from django.core import mail 13 | 14 | from tellme.tests import factories 15 | from tellme.models import Feedback 16 | 17 | fake = faker.Faker() 18 | 19 | 20 | def make_base64_img(): 21 | params = {'format': 'PNG'} 22 | img = ImageField()._make_data(params) 23 | base64_img = base64.b64encode(img).decode() 24 | return 'image/png;base64,%s' % base64_img 25 | 26 | 27 | class PostFeedbackViewTest(TestCase): 28 | url = reverse('tellme:post_feedback') 29 | 30 | def test_non_ajax(self): 31 | response = self.client.post(self.url) 32 | self.assertEqual(response.status_code, 400) 33 | 34 | def test_non_post(self): 35 | for method in ('get', 'patch', 'put', 'delete'): 36 | response = self.client.generic(method, self.url, 37 | HTTP_X_REQUESTED_WITH='XMLHttpRequest') 38 | self.assertEqual(response.status_code, 400) 39 | 40 | def test_authenticated_user(self): 41 | user = factories.UserFactory() 42 | self.client.force_login(user) 43 | data = { 44 | 'feedback': json.dumps({ 45 | 'url': fake.url(), 46 | 'browser': fake.user_agent(), 47 | 'note': fake.sentence(), 48 | 'img': make_base64_img(), 49 | }) 50 | } 51 | response = self.client.post(self.url, data=data, 52 | HTTP_X_REQUESTED_WITH='XMLHttpRequest') 53 | self.assertEqual(response.status_code, 200) 54 | feedback = Feedback.objects.last() 55 | self.assertIsNotNone(feedback, response.content) 56 | self.assertEqual(feedback.user, user) 57 | self.assertEqual(len(mail.outbox), 1) 58 | 59 | def test_with_email_user(self): 60 | email = fake.email() 61 | data = { 62 | 'feedback': json.dumps({ 63 | 'url': fake.url(), 64 | 'browser': fake.user_agent(), 65 | 'note': fake.sentence(), 66 | 'img': make_base64_img(), 67 | 'email': email, 68 | }) 69 | } 70 | response = self.client.post(self.url, data=data, 71 | HTTP_X_REQUESTED_WITH='XMLHttpRequest') 72 | self.assertEqual(response.status_code, 200) 73 | feedback = Feedback.objects.last() 74 | self.assertIsNotNone(feedback, response.content) 75 | self.assertIsNone(feedback.user) 76 | self.assertEqual(feedback.email, email) 77 | self.assertEqual(len(mail.outbox), 1) 78 | 79 | def test_with_invalid_form(self): 80 | email = fake.email() 81 | data = { 82 | 'feedback': json.dumps({ 83 | 'url': fake.url(), 84 | 'browser': fake.user_agent(), 85 | 'note': fake.sentence(), 86 | 'img': make_base64_img(), 87 | 'email': 'foo', 88 | }) 89 | } 90 | response = self.client.post(self.url, data=data, 91 | HTTP_X_REQUESTED_WITH='XMLHttpRequest') 92 | errors = response.json() 93 | self.assertEqual(response.status_code, 200) 94 | self.assertIn('error', errors) 95 | exists = Feedback.objects.exists() 96 | self.assertFalse(exists) 97 | self.assertEqual(len(mail.outbox), 0) 98 | 99 | 100 | class GetFeedbackScreenshotViewTest(TestCase): 101 | def test_screenshot_view(self): 102 | feedback = Feedback.objects.create( 103 | url=fake.url(), 104 | browser=fake.user_agent(), 105 | comment=fake.sentence(), 106 | screenshot=make_base64_img(), 107 | email=fake.email(), 108 | ) 109 | response = self.client.get(feedback.get_screenshot_url()) 110 | self.assertEqual(response.status_code, 302) 111 | self.assertEqual(response['Location'], feedback.screenshot.url) -------------------------------------------------------------------------------- /tellme/locale/en/LC_MESSAGES/django.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2016-06-16 21:04+0000\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: admin.py:46 models.py:11 templates/tellme/tpl-overview.html:13 21 | msgid "Screenshot" 22 | msgstr "" 23 | 24 | #: admin.py:54 25 | msgctxt "Admin model" 26 | msgid "Browser Info" 27 | msgstr "" 28 | 29 | #: models.py:8 30 | msgid "Url" 31 | msgstr "" 32 | 33 | #: models.py:9 34 | msgid "Browser" 35 | msgstr "" 36 | 37 | #: models.py:10 38 | msgid "Comment" 39 | msgstr "" 40 | 41 | #: models.py:13 42 | msgid "User" 43 | msgstr "" 44 | 45 | #: models.py:14 46 | msgid "Creation date" 47 | msgstr "" 48 | 49 | #: templates/tellme/initButtonText.txt:2 50 | msgid "Send feedback" 51 | msgstr "" 52 | 53 | #: templates/tellme/tpl-description.html:3 54 | #: templates/tellme/tpl-highlighter.html:3 templates/tellme/tpl-overview.html:3 55 | #: templates/tellme/tpl-submit-error.html:3 56 | #: templates/tellme/tpl-submit-success.html:3 57 | msgid "Feedback" 58 | msgstr "" 59 | 60 | #: templates/tellme/tpl-description.html:4 61 | msgid "" 62 | "Feedback lets you send us suggestions about this site. We welcome problem " 63 | "reports, feature ideas and general comments." 64 | msgstr "" 65 | 66 | #: templates/tellme/tpl-description.html:5 67 | msgid "Start by writing a brief description:" 68 | msgstr "" 69 | 70 | #: templates/tellme/tpl-description.html:6 71 | msgid "" 72 | "Next we'll let you identify areas of the page related to your description." 73 | msgstr "" 74 | 75 | #: templates/tellme/tpl-description.html:7 76 | #: templates/tellme/tpl-highlighter.html:15 77 | msgid "Next" 78 | msgstr "" 79 | 80 | #: templates/tellme/tpl-description.html:8 81 | #: templates/tellme/tpl-overview.html:18 82 | msgid "Please enter a description." 83 | msgstr "" 84 | 85 | #: templates/tellme/tpl-highlighter.html:4 86 | msgid "" 87 | "Click and drag on the page to help us better understand your feedback. You " 88 | "can move this dialog if it's in the way." 89 | msgstr "" 90 | 91 | #: templates/tellme/tpl-highlighter.html:7 92 | msgid "Highlight" 93 | msgstr "" 94 | 95 | #: templates/tellme/tpl-highlighter.html:8 96 | msgid "Highlight areas relevant to your feedback." 97 | msgstr "" 98 | 99 | #: templates/tellme/tpl-highlighter.html:11 100 | msgid "Black out" 101 | msgstr "" 102 | 103 | #: templates/tellme/tpl-highlighter.html:12 104 | msgid "Black out any personal information." 105 | msgstr "" 106 | 107 | #: templates/tellme/tpl-highlighter.html:18 108 | #: templates/tellme/tpl-overview.html:16 109 | msgid "Back" 110 | msgstr "" 111 | 112 | #: templates/tellme/tpl-overview.html:5 113 | msgid "Description" 114 | msgstr "" 115 | 116 | #: templates/tellme/tpl-overview.html:6 117 | msgid "Additional info" 118 | msgstr "" 119 | 120 | #: templates/tellme/tpl-overview.html:7 121 | msgid "None" 122 | msgstr "" 123 | 124 | #: templates/tellme/tpl-overview.html:8 125 | msgid "Browser Info" 126 | msgstr "" 127 | 128 | #: templates/tellme/tpl-overview.html:9 129 | msgid "Page Info" 130 | msgstr "" 131 | 132 | #: templates/tellme/tpl-overview.html:10 133 | msgid "Page Structure" 134 | msgstr "" 135 | 136 | #: templates/tellme/tpl-overview.html:15 137 | msgid "Submit" 138 | msgstr "" 139 | 140 | #: templates/tellme/tpl-submit-error.html:4 141 | msgid "Sadly an error occurred while sending your feedback. Please try again." 142 | msgstr "" 143 | 144 | #: templates/tellme/tpl-submit-error.html:5 145 | #: templates/tellme/tpl-submit-success.html:6 146 | msgid "OK" 147 | msgstr "" 148 | 149 | #: templates/tellme/tpl-submit-success.html:4 150 | msgid "" 151 | "Thank you for your feedback. We value every piece of feedback we receive." 152 | msgstr "" 153 | 154 | #: templates/tellme/tpl-submit-success.html:5 155 | msgid "" 156 | "We cannot respond individually to every one, but we will use your comments " 157 | "as we strive to improve your experience." 158 | msgstr "" 159 | 160 | #: views.py:29 161 | #, python-format 162 | msgid "" 163 | "Your site %(host)s received feedback from %(user)s.\n" 164 | "The comments were:\n" 165 | "%(note)s.\n" 166 | "\n" 167 | "See the full feedback content here: %(url)s" 168 | msgstr "" 169 | 170 | #: views.py:37 171 | #, python-format 172 | msgid "[%(host)s] Received feedback" 173 | msgstr "" 174 | -------------------------------------------------------------------------------- /tellme/locale/ja/LC_MESSAGES/django.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # salexkidd , 2016 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Django tellme\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2016-06-16 21:04+0000\n" 12 | "PO-Revision-Date: 2016-12-22 08:58+0000\n" 13 | "Last-Translator: salexkidd \n" 14 | "Language-Team: Japanese (http://www.transifex.com/django-tellme/django-tellme/language/ja/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: ja\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | 21 | #: admin.py:46 models.py:11 templates/tellme/tpl-overview.html:13 22 | msgid "Screenshot" 23 | msgstr "スクリーンショット" 24 | 25 | #: admin.py:54 26 | msgctxt "Admin model" 27 | msgid "Browser Info" 28 | msgstr "ブラウザの情報" 29 | 30 | #: models.py:8 31 | msgid "Url" 32 | msgstr "Url" 33 | 34 | #: models.py:9 35 | msgid "Browser" 36 | msgstr "ブラウザ" 37 | 38 | #: models.py:10 39 | msgid "Comment" 40 | msgstr "コメント" 41 | 42 | #: models.py:13 43 | msgid "User" 44 | msgstr "ユーザー" 45 | 46 | #: models.py:14 47 | msgid "Creation date" 48 | msgstr "作成日" 49 | 50 | #: templates/tellme/initButtonText.txt:2 51 | msgid "Send feedback" 52 | msgstr "フィードバックを送る" 53 | 54 | #: templates/tellme/tpl-description.html:3 55 | #: templates/tellme/tpl-highlighter.html:3 56 | #: templates/tellme/tpl-overview.html:3 57 | #: templates/tellme/tpl-submit-error.html:3 58 | #: templates/tellme/tpl-submit-success.html:3 59 | msgid "Feedback" 60 | msgstr "Feedback" 61 | 62 | #: templates/tellme/tpl-description.html:4 63 | msgid "" 64 | "Feedback lets you send us suggestions about this site. We welcome problem " 65 | "reports, feature ideas and general comments." 66 | msgstr "このサイトに関するフィードバックを送信します。ぜひ、問題点・アイデア・気づいた点などをお送りください。" 67 | 68 | #: templates/tellme/tpl-description.html:5 69 | msgid "Start by writing a brief description:" 70 | msgstr "まずは問題点・アイデア・気づいた点を入力してください:" 71 | 72 | #: templates/tellme/tpl-description.html:6 73 | msgid "" 74 | "Next we'll let you identify areas of the page related to your description." 75 | msgstr "次に、上で入力した内容に該当する範囲を画面内から指定してください" 76 | 77 | #: templates/tellme/tpl-description.html:7 78 | #: templates/tellme/tpl-highlighter.html:15 79 | msgid "Next" 80 | msgstr "次へ" 81 | 82 | #: templates/tellme/tpl-description.html:8 83 | #: templates/tellme/tpl-overview.html:18 84 | msgid "Please enter a description." 85 | msgstr "問題点・アイデア・気づいた点を入力してください" 86 | 87 | #: templates/tellme/tpl-highlighter.html:4 88 | msgid "" 89 | "Click and drag on the page to help us better understand your feedback. You " 90 | "can move this dialog if it's in the way." 91 | msgstr "画面内をクリックまたはドラッグして、該当する範囲を指定してください。このボックスを移動することもできます。" 92 | 93 | #: templates/tellme/tpl-highlighter.html:7 94 | msgid "Highlight" 95 | msgstr "ハイライト" 96 | 97 | #: templates/tellme/tpl-highlighter.html:8 98 | msgid "Highlight areas relevant to your feedback." 99 | msgstr "フィードバックしたい範囲をハイライトします" 100 | 101 | #: templates/tellme/tpl-highlighter.html:11 102 | msgid "Black out" 103 | msgstr "塗りつぶし" 104 | 105 | #: templates/tellme/tpl-highlighter.html:12 106 | msgid "Black out any personal information." 107 | msgstr "個人情報をなどを塗りつぶすことができます。" 108 | 109 | #: templates/tellme/tpl-highlighter.html:18 110 | #: templates/tellme/tpl-overview.html:16 111 | msgid "Back" 112 | msgstr "戻る" 113 | 114 | #: templates/tellme/tpl-overview.html:5 115 | msgid "Description" 116 | msgstr "説明" 117 | 118 | #: templates/tellme/tpl-overview.html:6 119 | msgid "Additional info" 120 | msgstr "追加情報" 121 | 122 | #: templates/tellme/tpl-overview.html:7 123 | msgid "None" 124 | msgstr "なし" 125 | 126 | #: templates/tellme/tpl-overview.html:8 127 | msgid "Browser Info" 128 | msgstr "ブラウザの情報" 129 | 130 | #: templates/tellme/tpl-overview.html:9 131 | msgid "Page Info" 132 | msgstr "ページの情報" 133 | 134 | #: templates/tellme/tpl-overview.html:10 135 | msgid "Page Structure" 136 | msgstr "ページの構造" 137 | 138 | #: templates/tellme/tpl-overview.html:15 139 | msgid "Submit" 140 | msgstr "送る" 141 | 142 | #: templates/tellme/tpl-submit-error.html:4 143 | msgid "Sadly an error occurred while sending your feedback. Please try again." 144 | msgstr "フィードバック送信中にエラーが発生しました。お手数ですが、もう一度送信してください。" 145 | 146 | #: templates/tellme/tpl-submit-error.html:5 147 | #: templates/tellme/tpl-submit-success.html:6 148 | msgid "OK" 149 | msgstr "OK" 150 | 151 | #: templates/tellme/tpl-submit-success.html:4 152 | msgid "" 153 | "Thank you for your feedback. We value every piece of feedback we receive." 154 | msgstr "ご意見ありがとうございます。 受け取ったすべてのフィードバックを大切にします。" 155 | 156 | #: templates/tellme/tpl-submit-success.html:5 157 | msgid "" 158 | "We cannot respond individually to every one, but we will use your comments " 159 | "as we strive to improve your experience." 160 | msgstr "すべてのご意見に対応することはできませんが、改善するために努力致します。" 161 | 162 | #: views.py:29 163 | #, python-format 164 | msgid "" 165 | "Your site %(host)s received feedback from %(user)s.\n" 166 | "The comments were:\n" 167 | "%(note)s.\n" 168 | "\n" 169 | "See the full feedback content here: %(url)s" 170 | msgstr "あなたのサイト %(host)s が %(user)s からフィードバックを受け付けました。\nコメントは以下のとおりです:\n%(note)s.\n\nフィードバックの全文についてはこちらをご覧ください: %(url)s" 171 | 172 | #: views.py:37 173 | #, python-format 174 | msgid "[%(host)s] Received feedback" 175 | msgstr "[%(host)s] フィードバックを受け付けました" 176 | -------------------------------------------------------------------------------- /tellme/locale/pt_BR/LC_MESSAGES/django.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: \n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2017-10-26 15:58+0000\n" 11 | "PO-Revision-Date: 2017-10-26 14:47-0200\n" 12 | "Language: pt_BR\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Last-Translator: \n" 17 | "Language-Team: \n" 18 | "X-Generator: Poedit 2.0.3\n" 19 | 20 | #: admin.py:46 models.py:11 templates/tellme/tpl-overview.html:13 21 | msgid "Screenshot" 22 | msgstr "Captura de Tela" 23 | 24 | #: admin.py:54 25 | msgctxt "Admin model" 26 | msgid "Browser Info" 27 | msgstr "Informações do Navegador" 28 | 29 | #: models.py:8 30 | msgid "Url" 31 | msgstr "Url" 32 | 33 | #: models.py:9 34 | msgid "Browser" 35 | msgstr "Navegador" 36 | 37 | #: models.py:10 38 | msgid "Comment" 39 | msgstr "Comentário" 40 | 41 | #: models.py:13 42 | msgid "User" 43 | msgstr "Usuário" 44 | 45 | #: models.py:14 46 | msgid "Creation date" 47 | msgstr "Data de criação" 48 | 49 | #: templates/tellme/initButtonText.txt:2 50 | msgid "Send feedback" 51 | msgstr "Enviar feedback" 52 | 53 | #: templates/tellme/tpl-description.html:3 54 | #: templates/tellme/tpl-highlighter.html:3 55 | #: templates/tellme/tpl-overview.html:3 56 | #: templates/tellme/tpl-submit-error.html:3 57 | #: templates/tellme/tpl-submit-success.html:3 58 | msgid "Feedback" 59 | msgstr "Feedback" 60 | 61 | #: templates/tellme/tpl-description.html:4 62 | msgid "" 63 | "Feedback lets you send us suggestions about this site. We welcome problem " 64 | "reports, feature ideas and general comments." 65 | msgstr "" 66 | "Feedback permite a você nos enviar sugestões sobre esse site. Nós temos a " 67 | "imensa satisfação de receber de você relatórios de problemas, ideias de " 68 | "novos recursos e comentários em geral." 69 | 70 | #: templates/tellme/tpl-description.html:5 71 | msgid "Start by writing a brief description:" 72 | msgstr "Inicie escrevendo uma breve descrição:" 73 | 74 | #: templates/tellme/tpl-description.html:6 75 | msgid "" 76 | "Next we'll let you identify areas of the page related to your description." 77 | msgstr "" 78 | "Em seguida, vamos deixar você identificar áreas da página relacionadas à " 79 | "sua descrição." 80 | 81 | #: templates/tellme/tpl-description.html:7 82 | #: templates/tellme/tpl-highlighter.html:15 83 | msgid "Next" 84 | msgstr "Próximo" 85 | 86 | #: templates/tellme/tpl-description.html:8 87 | #: templates/tellme/tpl-overview.html:18 88 | msgid "Please enter a description." 89 | msgstr "Por favor, informe uma descrição." 90 | 91 | #: templates/tellme/tpl-highlighter.html:4 92 | msgid "" 93 | "Click and drag on the page to help us better understand your feedback. You " 94 | "can move this dialog if it's in the way." 95 | msgstr "" 96 | "Clique e arraste na página para nos ajudar a entender melhor seu feedback. " 97 | "Você pode mover essa janela se ela estiver no seu caminho." 98 | 99 | #: templates/tellme/tpl-highlighter.html:7 100 | msgid "Highlight" 101 | msgstr "Realçar" 102 | 103 | #: templates/tellme/tpl-highlighter.html:8 104 | msgid "Highlight areas relevant to your feedback." 105 | msgstr "Realçar áreas relevantes para seu feedback." 106 | 107 | #: templates/tellme/tpl-highlighter.html:11 108 | msgid "Black out" 109 | msgstr "Escurecer" 110 | 111 | #: templates/tellme/tpl-highlighter.html:12 112 | msgid "Black out any personal information." 113 | msgstr "Escurecer qualquer informação pessoal." 114 | 115 | #: templates/tellme/tpl-highlighter.html:18 116 | #: templates/tellme/tpl-overview.html:16 117 | msgid "Back" 118 | msgstr "Voltar" 119 | 120 | #: templates/tellme/tpl-overview.html:5 121 | msgid "Description" 122 | msgstr "Descrição" 123 | 124 | #: templates/tellme/tpl-overview.html:6 125 | msgid "Additional info" 126 | msgstr "Informações Adicionais" 127 | 128 | #: templates/tellme/tpl-overview.html:7 129 | msgid "None" 130 | msgstr "Nenhum" 131 | 132 | #: templates/tellme/tpl-overview.html:8 133 | msgid "Browser Info" 134 | msgstr "Informações do Navegador" 135 | 136 | #: templates/tellme/tpl-overview.html:9 137 | msgid "Page Info" 138 | msgstr "Informações da Página" 139 | 140 | #: templates/tellme/tpl-overview.html:10 141 | msgid "Page Structure" 142 | msgstr "Estrutura da Página" 143 | 144 | #: templates/tellme/tpl-overview.html:15 145 | msgid "Submit" 146 | msgstr "Enviar" 147 | 148 | #: templates/tellme/tpl-submit-error.html:4 149 | msgid "Sadly an error occurred while sending your feedback. Please try again." 150 | msgstr "" 151 | "Infelizmente ocorreu um erro ao enviar seu feedback. Por favor, tente " 152 | "novamente." 153 | 154 | #: templates/tellme/tpl-submit-error.html:5 155 | #: templates/tellme/tpl-submit-success.html:6 156 | msgid "OK" 157 | msgstr "OK" 158 | 159 | #: templates/tellme/tpl-submit-success.html:4 160 | msgid "" 161 | "Thank you for your feedback. We value every piece of feedback we receive." 162 | msgstr "" 163 | "Obrigado por seu feedback. Nós valorizamos todos os feedbacks recebidos." 164 | 165 | #: templates/tellme/tpl-submit-success.html:5 166 | msgid "" 167 | "We cannot respond individually to every one, but we will use your comments " 168 | "as we strive to improve your experience." 169 | msgstr "" 170 | "Não podemos responder individualmente a cada um, mas usaremos seus " 171 | "comentários à medida que nos esforçamos para melhorar sua experiência." 172 | 173 | #: views.py:30 174 | #, python-format 175 | msgid "" 176 | "Your site %(host)s received feedback from %(user)s.\n" 177 | "The comments were:\n" 178 | "%(note)s.\n" 179 | "\n" 180 | "See the full feedback content here: %(url)s" 181 | msgstr "" 182 | "Seu site %(host)s recebeu um feedback de %(user)s.\n" 183 | "Os comentários são:\n" 184 | "%(note)s.\n" 185 | "\n" 186 | "Veja o conteúdo completo do feedback aqui: %(url)s" 187 | 188 | #: views.py:38 189 | #, python-format 190 | msgid "[%(host)s] Received feedback" 191 | msgstr "[%(host)s] Feedback recebido" 192 | -------------------------------------------------------------------------------- /tellme/locale/fr/LC_MESSAGES/django.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 2 | # This file is distributed under the same license as the PACKAGE package. 3 | # 4 | # Translators: 5 | # Yann Beaud, 2016. 6 | # Ludrao , 2016. 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Django tellme\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2016-06-16 21:04+0000\n" 12 | "PO-Revision-Date: 2016-06-16 23:13+0100\n" 13 | "Last-Translator: Ludrao \n" 14 | "Language-Team: French (http://www.transifex.com/django-tellme/django-tellme/" 15 | "Language: fr\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 20 | 21 | #: admin.py:46 models.py:11 templates/tellme/tpl-overview.html:13 22 | msgid "Screenshot" 23 | msgstr "Capture d'écran" 24 | 25 | #: admin.py:54 26 | msgctxt "Admin model" 27 | msgid "Browser Info" 28 | msgstr "Informations navigateur" 29 | 30 | #: models.py:8 31 | msgid "Url" 32 | msgstr "Url" 33 | 34 | #: models.py:9 35 | msgid "Browser" 36 | msgstr "Navigateur" 37 | 38 | #: models.py:10 39 | msgid "Comment" 40 | msgstr "Commentaire" 41 | 42 | #: models.py:13 43 | msgid "User" 44 | msgstr "Utilisateur" 45 | 46 | #: models.py:14 47 | msgid "Creation date" 48 | msgstr "Date de création" 49 | 50 | #: templates/tellme/initButtonText.txt:2 51 | msgid "Send feedback" 52 | msgstr "Envoyer un feedback" 53 | 54 | #: templates/tellme/tpl-description.html:3 55 | #: templates/tellme/tpl-highlighter.html:3 templates/tellme/tpl-overview.html:3 56 | #: templates/tellme/tpl-submit-error.html:3 57 | #: templates/tellme/tpl-submit-success.html:3 58 | msgid "Feedback" 59 | msgstr "Feedback" 60 | 61 | #: templates/tellme/tpl-description.html:4 62 | msgid "" 63 | "Feedback lets you send us suggestions about this site. We welcome problem " 64 | "reports, feature ideas and general comments." 65 | msgstr "" 66 | "Le système de feedback vous permet de nous envoyer des suggestions à propos " 67 | "de ce site. Vos retours peuvent être des problèmes, des idées de" 68 | " fonctionnalités ou des commentaires généraux." 69 | 70 | #: templates/tellme/tpl-description.html:5 71 | msgid "Start by writing a brief description:" 72 | msgstr "Commencez par écrire une brève description:" 73 | 74 | #: templates/tellme/tpl-description.html:6 75 | msgid "" 76 | "Next we'll let you identify areas of the page related to your description." 77 | msgstr "" 78 | "Ensuite, vous pourrez identifier des zones dans la page liées " 79 | "à votre description." 80 | 81 | #: templates/tellme/tpl-description.html:7 82 | #: templates/tellme/tpl-highlighter.html:15 83 | msgid "Next" 84 | msgstr "Suivant" 85 | 86 | #: templates/tellme/tpl-description.html:8 87 | #: templates/tellme/tpl-overview.html:18 88 | msgid "Please enter a description." 89 | msgstr "Merci d'entrer une description." 90 | 91 | #: templates/tellme/tpl-highlighter.html:4 92 | msgid "" 93 | "Click and drag on the page to help us better understand your feedback. You " 94 | "can move this dialog if it's in the way." 95 | msgstr "" 96 | "Cliquez et dessinez sur la page pour nous aider à mieux comprendre votre " 97 | "feedback. Vous pouvez déplacer cette boîte de dialogue si elle vous gène." 98 | 99 | #: templates/tellme/tpl-highlighter.html:7 100 | msgid "Highlight" 101 | msgstr "Surligner" 102 | 103 | #: templates/tellme/tpl-highlighter.html:8 104 | msgid "Highlight areas relevant to your feedback." 105 | msgstr "Mettre en surbrillance les zones pertinentes pour votre feedback." 106 | 107 | #: templates/tellme/tpl-highlighter.html:11 108 | msgid "Black out" 109 | msgstr "Occulter" 110 | 111 | #: templates/tellme/tpl-highlighter.html:12 112 | msgid "Black out any personal information." 113 | msgstr "Occultez toute information personnelle." 114 | 115 | #: templates/tellme/tpl-highlighter.html:18 116 | #: templates/tellme/tpl-overview.html:16 117 | msgid "Back" 118 | msgstr "Retour" 119 | 120 | #: templates/tellme/tpl-overview.html:5 121 | msgid "Description" 122 | msgstr "Description" 123 | 124 | #: templates/tellme/tpl-overview.html:6 125 | msgid "Additional info" 126 | msgstr "Informations additionnelles" 127 | 128 | #: templates/tellme/tpl-overview.html:7 129 | msgid "None" 130 | msgstr "Aucune" 131 | 132 | #: templates/tellme/tpl-overview.html:8 133 | msgid "Browser Info" 134 | msgstr "Informations sur le navigateur" 135 | 136 | #: templates/tellme/tpl-overview.html:9 137 | msgid "Page Info" 138 | msgstr "Informations sur la page" 139 | 140 | #: templates/tellme/tpl-overview.html:10 141 | msgid "Page Structure" 142 | msgstr "Structure de la page" 143 | 144 | #: templates/tellme/tpl-overview.html:15 145 | msgid "Submit" 146 | msgstr "Envoyer" 147 | 148 | #: templates/tellme/tpl-submit-error.html:4 149 | msgid "Sadly an error occurred while sending your feedback. Please try again." 150 | msgstr "" 151 | "Malheureusement une erreur est survenue pendant l'envoi de votre feedback. " 152 | "Veuillez réessayer." 153 | 154 | #: templates/tellme/tpl-submit-error.html:5 155 | #: templates/tellme/tpl-submit-success.html:6 156 | msgid "OK" 157 | msgstr "OK" 158 | 159 | #: templates/tellme/tpl-submit-success.html:4 160 | msgid "" 161 | "Thank you for your feedback. We value every piece of feedback we receive." 162 | msgstr "" 163 | "Merci pour votre feedback. Nous apprécions chaque commentaire que nous" 164 | " recevons." 165 | 166 | #: templates/tellme/tpl-submit-success.html:5 167 | msgid "" 168 | "We cannot respond individually to every one, but we will use your comments " 169 | "as we strive to improve your experience." 170 | msgstr "" 171 | "Nous ne pouvons pas toujours répondre individuellement à tout le monde, mais " 172 | "nous nous efforcerons de prendre en compte votre commentaire." 173 | 174 | #: views.py:29 175 | #, python-format 176 | msgid "" 177 | "Your site %(host)s received feedback from %(user)s.\n" 178 | "The comments were:\n" 179 | "%(note)s.\n" 180 | "\n" 181 | "See the full feedback content here: %(url)s" 182 | msgstr "" 183 | "Votre site %(host)s a reçu un feedback de %(user)s.\n" 184 | "Les commentaires sont:\n" 185 | "%(note)s.\n" 186 | "\n" 187 | "Consultez le contenu complet du feedback ici : %(url)s" 188 | 189 | #: views.py:37 190 | #, python-format 191 | msgid "[%(host)s] Received feedback" 192 | msgstr "[%(host)s] A reçu un feedback" 193 | 194 | -------------------------------------------------------------------------------- /.github/workflows/sdist.yml: -------------------------------------------------------------------------------- 1 | name: Build, Test, and Release sdist 2 | 3 | # reference: 4 | # - https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts 5 | # - https://docs.github.com/en/actions/reference/environment-variables 6 | 7 | on: [push] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Setup Python ${{ matrix.python-version }} 15 | uses: actions/setup-python@v2 16 | with: 17 | python-version: '3.x' 18 | - name: Install Tox and any other packages 19 | run: python -m pip install tox tox-gh-actions 20 | - name: Display file tree 21 | run: ls -laR tellme 22 | - name: Build sdist 23 | run: python -m tox -vv --sdistonly 24 | - name: Archive sdist 25 | uses: actions/upload-artifact@v2 26 | with: 27 | name: sdist 28 | retention-days: 5 29 | path: ~/.tox/distshare/* 30 | 31 | test: 32 | needs: build 33 | runs-on: ubuntu-latest 34 | strategy: 35 | fail-fast: false 36 | matrix: 37 | python-version: [3.6,3.7,3.8,3.9] 38 | django: [111,22,30,31] 39 | steps: 40 | - uses: actions/checkout@v2 41 | - name: Setup Python ${{ matrix.python-version }} 42 | uses: actions/setup-python@v2 43 | with: 44 | python-version: ${{ matrix.python-version }} 45 | # Remove tellme source folder so we operate on the installed sdist 46 | - name: Remove source folder 47 | run: rm -Rf tellme 48 | - name: Install Tox and any other packages 49 | run: python -m pip install tox tox-gh-actions 50 | - name: Download sdist 51 | uses: actions/download-artifact@v2 52 | with: 53 | name: sdist 54 | path: ~/.toxsdistsrc/ 55 | - name: Display structure of downloaded files 56 | run: ls -aR ~/.toxsdistsrc/ 57 | - name: Rename file 58 | run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 59 | - name: Display tmp files 60 | run: ls /tmp 61 | - name: Run Tox 62 | # Run tox using the version of Python in `PATH` 63 | run: python -m tox -vv --installpkg "/tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip" 64 | env: 65 | DJANGO: ${{ matrix.django }} 66 | 67 | pre-release: 68 | if: startsWith(github.ref, 'refs/tags/p') 69 | needs: test 70 | runs-on: ubuntu-latest 71 | steps: 72 | - name: Download sdist 73 | uses: actions/download-artifact@v2 74 | with: 75 | name: sdist 76 | path: ~/.toxsdistsrc/ 77 | - name: Display structure of downloaded files 78 | run: ls -aR ~/.toxsdistsrc/ 79 | - name: Rename file 80 | run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 81 | - name: Display tmp files 82 | run: ls /tmp 83 | - name: Create Release 84 | id: create_release 85 | uses: actions/create-release@v1 86 | env: 87 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 88 | with: 89 | tag_name: ${{ github.ref }} 90 | release_name: Pre-release ${{ github.ref }} 91 | draft: false 92 | prerelease: true 93 | - name: Upload Release Asset 94 | id: upload-release-asset 95 | uses: actions/upload-release-asset@v1 96 | env: 97 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 98 | with: 99 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 100 | asset_path: /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 101 | asset_name: django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 102 | asset_content_type: application/zip 103 | 104 | release: 105 | if: startsWith(github.ref, 'refs/tags/v') 106 | needs: test 107 | runs-on: ubuntu-latest 108 | steps: 109 | - name: Download sdist 110 | uses: actions/download-artifact@v2 111 | with: 112 | name: sdist 113 | path: ~/.toxsdistsrc/ 114 | - name: Display structure of downloaded files 115 | run: ls -aR ~/.toxsdistsrc/ 116 | - name: Rename file 117 | run: mv ~/.toxsdistsrc/django-tellme-*.zip /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 118 | - name: Display tmp files 119 | run: ls /tmp 120 | - name: Create Release 121 | id: create_release 122 | uses: actions/create-release@v1 123 | env: 124 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 125 | with: 126 | tag_name: ${{ github.ref }} 127 | release_name: Release ${{ github.ref }} 128 | draft: false 129 | prerelease: false 130 | - name: Upload Release Asset 131 | id: upload-release-asset 132 | uses: actions/upload-release-asset@v1 133 | env: 134 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 135 | with: 136 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 137 | asset_path: /tmp/django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 138 | asset_name: django-tellme-sdist-${{ github.run_number }}-${{ github.sha }}.zip 139 | asset_content_type: application/zip 140 | 141 | pypi: 142 | needs: release 143 | runs-on: ubuntu-latest 144 | steps: 145 | - name: Setup Python ${{ matrix.python-version }} 146 | uses: actions/setup-python@v2 147 | with: 148 | python-version: '3.x' 149 | - name: Install twine 150 | run: python -m pip install twine 151 | - name: Download sdist 152 | uses: actions/download-artifact@v2 153 | with: 154 | name: sdist 155 | path: dist 156 | - name: Display structure of downloaded files 157 | run: ls -aR dist 158 | - name: Publish 159 | env: 160 | TWINE_USERNAME: __token__ 161 | TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} 162 | run: twine upload dist/* 163 | -------------------------------------------------------------------------------- /tellme/static/tellme/vendor/feedback/feedback.css: -------------------------------------------------------------------------------- 1 | .feedback-btn { 2 | font-size: 14px; 3 | position: fixed; 4 | bottom: -3px; 5 | right: 60px; 6 | width: auto; 7 | } 8 | #feedback-module p { font-size: 13px } 9 | #feedback-note-tmp { 10 | width: 444px; 11 | height: auto; 12 | min-height: 90px; 13 | outline: none; 14 | padding: 4px; 15 | } 16 | #feedback-note-tmp:focus, 17 | #feedback-overview-note:focus { border: 1px solid #64b7cc } 18 | #feedback-canvas { 19 | position: absolute; 20 | top: 0; 21 | left: 0; 22 | } 23 | #feedback-welcome { 24 | top: 30%; 25 | left: 50%; 26 | margin-left: -270px; 27 | display: block; 28 | position: fixed; 29 | } 30 | .feedback-logo { 31 | background: url(icons.png) -0px -0px no-repeat; 32 | width: 34px; 33 | margin-bottom: 16px; 34 | font-size: 16px; 35 | font-weight: normal; 36 | line-height: 32px; 37 | padding-left: 40px; 38 | height: 32px; 39 | } 40 | .feedback-next-btn { 41 | width: 72px; 42 | height: 29px; 43 | line-height: 27px; 44 | float: right; 45 | font-size: 13px; 46 | padding: 0 8px; 47 | } 48 | .feedback-back-btn { 49 | width: 72px; 50 | height: 29px; 51 | line-height: 27px; 52 | float: right; 53 | font-size: 13px; 54 | padding: 0 8px; 55 | margin-right: 20px; 56 | } 57 | .feedback-submit-btn { 58 | width: 72px; 59 | height: 29px; 60 | line-height: 27px; 61 | float: right; 62 | font-size: 13px; 63 | padding: 0 8px; 64 | } 65 | .feedback-close-btn { 66 | width: 72px; 67 | height: 29px; 68 | line-height: 27px; 69 | float: right; 70 | font-size: 13px; 71 | padding: 0 8px; 72 | } 73 | .feedback-helper { 74 | background: rgba(0,0,0,0); 75 | cursor: default; 76 | } 77 | .feedback-helper[data-type="highlight"]>.feedback-helper-inner { background: rgba(0,68,255,0.1) } 78 | #feedback-close { 79 | cursor: pointer; 80 | position: absolute; 81 | background: url(icons.png) -0px -64px; 82 | width: 30px; 83 | height: 30px; 84 | } 85 | .feedback-wizard-close { 86 | cursor: pointer; 87 | position: absolute; 88 | top: 2px; 89 | right: 2px; 90 | background: url(icons.png) -0px -34px; 91 | width: 30px; 92 | height: 30px; 93 | opacity: 0.65; 94 | } 95 | .feedback-wizard-close:hover { opacity: 1 } 96 | #feedback-welcome-error, 97 | #feedback-overview-error { 98 | display: none; 99 | color: #f13e3e; 100 | float: right; 101 | margin-right: 30px; 102 | font-size: 13px; 103 | line-height: 29px; 104 | } 105 | #feedback-overview-error { margin-top: 20px } 106 | #feedback-highlighter { 107 | display: none; 108 | bottom: 100px; 109 | right: 100px; 110 | position: fixed; 111 | width: 540px; 112 | height: 275px; 113 | } 114 | #feedback-overview { 115 | display: none; 116 | top: 10%; 117 | left: 50%; 118 | margin-left: -420px; 119 | position: fixed; 120 | width: 840px!important; 121 | height: auto; 122 | } 123 | #feedback-submit-loading, 124 | #feedback-submit-error, 125 | #feedback-submit-success { 126 | top: 30%; 127 | left: 50%; 128 | margin-left: -300px; 129 | display: block; 130 | position: fixed; 131 | width: 600px; 132 | height: auto; 133 | } 134 | .feedback-btn { 135 | padding: 10px; 136 | outline: 0; 137 | background-clip: padding-box; 138 | -webkit-box-shadow: 0 4px 16px rgba(0,0,0,.2); 139 | -moz-box-shadow: 0 4px 16px rgba(0,0,0,.2); 140 | box-shadow: 0 4px 16px rgba(0,0,0,.2); 141 | z-index: 40000; 142 | } 143 | .feedback-btn-gray { 144 | text-align: center; 145 | cursor: pointer; 146 | border: 1px solid #dcdcdc; 147 | border: 1px solid rgba(0,0,0,0.1); 148 | color: #444; 149 | border-radius: 2px; 150 | background-color: #f5f5f5; 151 | background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1); 152 | background-image: -moz-linear-gradient(top,#f5f5f5,#f1f1f1); 153 | background-image: -ms-linear-gradient(top,#f5f5f5,#f1f1f1); 154 | background-image: -o-linear-gradient(top,#f5f5f5,#f1f1f1); 155 | background-image: linear-gradient(top,#f5f5f5,#f1f1f1); 156 | } 157 | .feedback-btn-gray:hover { 158 | color: #333; 159 | border: 1px solid #c6c6c6; 160 | background-color: #f8f8f8; 161 | background-image: -webkit-linear-gradient(top,#f8f8f8,#f1f1f1); 162 | background-image: -moz-linear-gradient(top,#f8f8f8,#f1f1f1); 163 | background-image: -ms-linear-gradient(top,#f8f8f8,#f1f1f1); 164 | background-image: -o-linear-gradient(top,#f8f8f8,#f1f1f1); 165 | background-image: linear-gradient(top,#f8f8f8,#f1f1f1); 166 | } 167 | .feedback-btn-blue { 168 | text-align: center; 169 | cursor: pointer; 170 | border-radius: 2px; 171 | background-color: #357ae8; 172 | background-image: -webkit-linear-gradient(top,#4d90fe,#357ae8); 173 | background-image: -moz-linear-gradient(top,#4d90fe,#357ae8); 174 | background-image: -ms-linear-gradient(top,#4d90fe,#357ae8); 175 | background-image: -o-linear-gradient(top,#4d90fe,#357ae8); 176 | background-image: linear-gradient(top,#4d90fe,#357ae8); 177 | border: 1px solid #2f5bb7; 178 | color: #fff; 179 | } 180 | #feedback-note-tmp, 181 | #feedback-overview-note { resize: none } 182 | #feedback-welcome, 183 | #feedback-highlighter, 184 | #feedback-overview, 185 | #feedback-submit-loading, 186 | #feedback-submit-success, 187 | #feedback-submit-error { 188 | z-index: 40000; 189 | background: #fff; 190 | border: 1px solid rgba(0,0,0,.333); 191 | padding: 30px 42px; 192 | width: 540px; 193 | border: 1px solid rgba(0,0,0,.333); 194 | outline: 0; 195 | -webkit-box-shadow: 0 4px 16px rgba(0,0,0,.2); 196 | -moz-box-shadow: 0 4px 16px rgba(0,0,0,.2); 197 | box-shadow: 0 4px 16px rgba(0,0,0,.2); 198 | background: #fff; 199 | background-clip: padding-box; 200 | box-sizing: border-box; 201 | -moz-box-sizing: border-box; 202 | -webkit-box-sizing: border-box; 203 | -webkit-transform: translateZ(); 204 | } 205 | .feedback-sethighlight, 206 | .feedback-setblackout { 207 | -webkit-box-shadow: none; 208 | -moz-box-shadow: none; 209 | box-shadow: none; 210 | background-color: #f5f5f5; 211 | background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1); 212 | background-image: -moz-linear-gradient(top,#f5f5f5,#f1f1f1); 213 | background-image: -ms-linear-gradient(top,#f5f5f5,#f1f1f1); 214 | background-image: -o-linear-gradient(top,#f5f5f5,#f1f1f1); 215 | background-image: linear-gradient(top,#f5f5f5,#f1f1f1); 216 | color: #444; 217 | border: 1px solid #dcdcdc; 218 | border: 1px solid rgba(0,0,0,0.1); 219 | -webkit-border-radius: 2px; 220 | -moz-border-radius: 2px; 221 | border-radius: 2px; 222 | cursor: default; 223 | font-size: 11px; 224 | font-weight: bold; 225 | text-align: center; 226 | white-space: nowrap; 227 | margin-right: 16px; 228 | height: 30px; 229 | line-height: 28px; 230 | min-width: 90px; 231 | outline: 0; 232 | padding: 0 8px; 233 | display: inline-block; 234 | float: left; 235 | } 236 | .feedback-setblackout { 237 | margin-top: 10px; 238 | clear: both; 239 | } 240 | .feedback-sethighlight div { 241 | background: url(icons.png) 0px -94px; 242 | width: 16px; 243 | height: 16px; 244 | margin-top: 7px; 245 | float: left; 246 | } 247 | .feedback-setblackout div { 248 | background: url(icons.png) -16px -94px; 249 | width: 16px; 250 | height: 16px; 251 | margin-top: 7px; 252 | float: left; 253 | } 254 | .feedback-sethighlight:hover, 255 | .feedback-setblackout:hover { 256 | -webkit-box-shadow: none; 257 | -moz-box-shadow: none; 258 | box-shadow: none; 259 | background-color: #f8f8f8; 260 | background-image: -webkit-linear-gradient(top,#f8f8f8,#f1f1f1); 261 | background-image: -moz-linear-gradient(top,#f8f8f8,#f1f1f1); 262 | background-image: -ms-linear-gradient(top,#f8f8f8,#f1f1f1); 263 | background-image: -o-linear-gradient(top,#f8f8f8,#f1f1f1); 264 | background-image: linear-gradient(top,#f8f8f8,#f1f1f1); 265 | border: 1px solid #c6c6c6; 266 | color: #333; 267 | } 268 | .feedback-active { 269 | -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1); 270 | -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.1); 271 | box-shadow: inset 0 1px 2px rgba(0,0,0,.1); 272 | background-color: #eee; 273 | background-image: -webkit-linear-gradient(top,#eee,#e0e0e0); 274 | background-image: -moz-linear-gradient(top,#eee,#e0e0e0); 275 | background-image: -ms-linear-gradient(top,#eee,#e0e0e0); 276 | background-image: -o-linear-gradient(top,#eee,#e0e0e0); 277 | background-image: linear-gradient(top,#eee,#e0e0e0); 278 | border: 1px solid #ccc; 279 | color: #333; 280 | } 281 | #feedback-highlighter label { 282 | float: left; 283 | margin: 0 0 0 10px; 284 | line-height: 30px; 285 | font-size: 13px; 286 | font-weight: normal; 287 | } 288 | #feedback-highlighter label.lower { margin-top: 10px } 289 | .feedback-buttons { 290 | float: right; 291 | margin-top: 20px; 292 | clear: both; 293 | } 294 | #feedback-module h3 { 295 | font-weight: bold; 296 | font-size: 15px; 297 | margin: 8px 0; 298 | } 299 | .feedback-additional { margin-bottom: 20px!important } 300 | #feedback-overview-description { float: left } 301 | #feedback-overview-note { 302 | width: 314px; 303 | padding: 4px; 304 | height: 90px; 305 | outline: none; 306 | } 307 | #feedback-overview-screenshot { float: right } 308 | .feedback-screenshot { 309 | max-width: 396px; 310 | padding: 1px; 311 | border: 1px solid #adadad; 312 | } 313 | #feedback-overview-description-text span { 314 | font-size: 14px; 315 | margin: 8px 0; 316 | color: #666; 317 | padding-left: 10px; 318 | background: url(icons.png) -30px -34px no-repeat; 319 | margin-left: 26px; 320 | } 321 | #feedback-browser-info, 322 | #feedback-page-info, 323 | #feedback-page-structure, 324 | #feedback-additional-none { 325 | margin-top: 16px; 326 | display: none; 327 | } 328 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | 2 | .. image:: https://img.shields.io/pypi/v/django-tellme.svg 3 | :target: https://pypi.python.org/pypi/django-tellme/ 4 | 5 | .. image:: https://img.shields.io/github/license/ludrao/django-tellme.svg 6 | :target: https://en.wikipedia.org/wiki/BSD_licenses 7 | 8 | ====== 9 | tellme 10 | ====== 11 | 12 | tellme is a simple Django app that provides an easy and simple feedback button, form and admin view. 13 | 14 | Features 15 | -------- 16 | 17 | * Take a screenshot of the current page. 18 | * The user can then highlight or black out portions of that screenshot 19 | * The user have to provide textual comments, (effectively giving his feedback) 20 | * Some additional information collected with the feedback 21 | * various browser information (versions, user agent, etc.) 22 | * user information if the user is logged in (and your site uses Django auth system) 23 | * the url the user provides feedback on 24 | * Optionally, send an email to the site admin when a feedback is posted 25 | * Supports localization (currently supported languages are English and French, translation contrib are welcomed!) 26 | * Customizable UI by redefining templates 27 | 28 | The javascript part of this app is using feedback.js from https://github.com/ivoviz/feedback. 29 | feedback.js itself use html2canvas.js (https://github.com/niklasvh/html2canvas) to make page screenshot that is sent 30 | with the feedback comments. 31 | 32 | Dependencies 33 | ------------ 34 | 35 | This application depends on 36 | - python 3 (might work on python 2, but untested) 37 | - django >= 1.8 (also compatible with django >= 2.0) 38 | - jquery must be enabled in your pages 39 | - Promises polyfill for IE (including IE11!) (can use that: https://github.com/stefanpenner/es6-promise) 40 | 41 | 42 | Quick start 43 | ----------- 44 | 45 | 0. Install the app in your environment: 46 | 47 | .. code:: bash 48 | 49 | pip install django-tellme 50 | 51 | 52 | 1. Add "tellme" to your INSTALLED_APPS setting like this: 53 | 54 | .. code:: python 55 | 56 | INSTALLED_APPS = [ 57 | ... 58 | 'tellme', 59 | ] 60 | 61 | 2. Include the tellme URLconf in your project urls.py like this: 62 | 63 | .. code:: python 64 | 65 | url(r'^tellme/', include("tellme.urls")), 66 | 67 | Note: to not set a namespace here, django-tellme does it itself in its urls file. 68 | 69 | 70 | 3. Run ``python manage.py migrate`` to create the tellme model in the database. 71 | 72 | 4. Add a feedback button in your pages so that user can provide feedback 73 | 74 | For example using bootstrap CSS this code would overlay a button, vertically aligned on the middle of the 75 | page, right-aligned. 76 | 77 | In your html/template file, import the form CSS: 78 | 79 | .. code:: html 80 | 81 | 82 | 83 | In your html/template file, inside the section: 84 | 85 | .. code:: html 86 | 87 | 90 | 91 | Note: the CSS class vertical-right-aligned is not from bootstrap, it is defined as: 92 | 93 | .. code:: css 94 | 95 | .vertical-right-aligned { 96 | transform: rotate(-90deg); 97 | transform-origin: 100% 100%; 98 | position: fixed; 99 | right: 0; 100 | top: 50%; 101 | z-index: 100; 102 | } 103 | 104 | In your html/template file, in the page footer, connect that button to the feedback plugin: 105 | 106 | .. code:: html 107 | 108 | {% include 'tellme/js_inc.html' %} 109 | 110 | Look into this template file, it includes a few things that can be overridden (using the Django template {% extend %} mechanism), or simply redefined it in your page. What js_inc.html contains by default: 111 | 112 | - Load jquery plugin 113 | - Add CSRF automatically to all AJAX post request 114 | - Enable the JS feedback plugin using customizable template for each feedback step 115 | 116 | This js_inc.html template usage is totally optional. The important part of that template is the javascript call that enables the plugin on a button: 117 | 118 | .. code:: javascript 119 | 120 | 121 | 140 | 141 | 142 | 143 | 5. Start your site, and click the feedback button. This will pop up the feedback form. Follow the instruction, and click on **Send** when finished. 144 | 145 | 146 | 6. Visit http://127.0.0.1:8000/admin/ to review user feedback. 147 | 148 | Some screenshots of the plugin in action 149 | ---------------------------------------- 150 | 151 | You define the feedback button that you like. In that example it is using the page theme, and is located on the middle left-side of the screen. 152 | 153 | .. image:: images/snapshot-feedback-button.png 154 | :align: right 155 | :scale: 50 % 156 | 157 | If a user click on it he will be able to highlight the reason of his feedback on a screenshot of the current page. He can also black out 158 | sensitive information, if any. 159 | 160 | .. image:: images/snapshot-highlight-blackout.png 161 | :align: right 162 | :scale: 50 % 163 | 164 | Once finished and can review his feedback, add a comment and finalize the feedback. 165 | 166 | .. image:: images/snapshot-feedback-form.png 167 | :align: right 168 | :scale: 50 % 169 | 170 | When the feedback is sent, the site admin will receive an email with a link to the backoffice site that will allow him to learn about this feedback. 171 | Of course, he can always go to the backoffice site in order to review the different feedback later on. 172 | 173 | .. image:: images/snapshot-admin-view.png 174 | :align: right 175 | :scale: 50 % 176 | 177 | 178 | How to customize the JS feedback popup UI 179 | ----------------------------------------- 180 | 181 | Each step of the feedback popup is an HTML UI element that can be redefined. In order to define your custom UI, you simply 182 | have to 'overload' the template by creating, in your own app template directory, a file with the same name as the original tellme template. 183 | The feedback popup contains 4 steps + an error screen, that can be redefined. Look for the following files: 184 | 185 | - tellme/tpl-description.html 186 | - tellme/tpl-highlighter.html 187 | - tellme/tpl-overview.html 188 | - tellme/tpl-submit-error.html 189 | - tellme/tpl-submit-success.html 190 | 191 | As an easy way to start you can copy one of the above file in your template directory and modify it incrementally. Please note that you need to keep the same directory structure (i.e. tellme/tpl-xxx.html), and that your app has to be listed first in the ``INSTALLED_APPS`` list so that it takes this modified template file instead of the original tellme template file. 192 | 193 | 194 | How to restrict access to submitted screenshots 195 | ----------------------------------------------- 196 | By default, we redirect to the url provided by the file storage backend. 197 | However, you can replace the view used to serve the screen shots to enforce 198 | viewer permission checks. You would also be responsible to ensure screenshot 199 | images are not publicly accessible via the file storage backend. 200 | 201 | Modify the following code in your `urls.py` to override the default view: 202 | 203 | .. code:: python 204 | 205 | from tellme.urls import tellme_urlpatterns 206 | 207 | from .views import feedback_screenshot_view 208 | 209 | tellme_overrides = (tellme_urlpatterns + [ 210 | url( 211 | r'^screenshot/(?P\d+)/$', 212 | feedback_screenshot_view, 213 | name='get_feedback_screenshot', 214 | ), 215 | ], 'tellme') 216 | 217 | urlpatterns = [ 218 | ... 219 | url(r'^tellme/', include(tellme_overrides)), 220 | ... 221 | ] 222 | 223 | 224 | Email notifications 225 | ------------------- 226 | 227 | This app can send you an email every time a feedback is posted. Currently the email is plaintext and does not contain 228 | the screenshot. However it does contain a link to the admin site with the full details of that feedback. 229 | 230 | To enable email notification, just add this line in your site ``settings.py``: 231 | 232 | .. code:: python 233 | 234 | TELLME_FEEDBACK_EMAIL = 'admin@tellme.com' 235 | 236 | 237 | 238 | Important Notes 239 | --------------- 240 | 241 | .. note:: 242 | 243 | This app is based on feedback.js that send the feedback content using an HTTP POST method. Django uses a CSRF protection 244 | mechanism, that block POST request that do not contain a specific token. 245 | If you have not setup your page to transparently support AJAX POST here is an explanation on how to do it: 246 | https://docs.djangoproject.com/en/1.8/ref/csrf/#ajax 247 | 248 | .. note:: 249 | 250 | This app stores screenshot as part of the feedback. Those are stored as PNG image files into your MEDIA 251 | directory/backend. 252 | For this reason you need to have MEDIA_URL and MEDIA_ROOT settings available. See here for more details: 253 | https://docs.djangoproject.com/en/1.8/howto/static-files/ 254 | 255 | .. note:: 256 | 257 | If using the email notification feature, make sure to setup your Email backend in django. More details here: 258 | https://docs.djangoproject.com/en/1.8/topics/email/ 259 | 260 | Version History 261 | --------------- 262 | 263 | version NEXT 264 | - 265 | 266 | version 0.7.3 267 | - Saving emails (thx @agusmakmun) 268 | - Update dependencies (thx @justinmerrell) 269 | - Update doc (thx @Michael1142) 270 | 271 | version 0.7.2 272 | - Adjusted released version number 273 | 274 | version 0.7.0 275 | - Updated and Fixed the tox test suite (thx @thenewguy) 276 | - Added GitHub action to run test and deploy to PiPy 277 | - Updated all upstream project javascript code 278 | 279 | version 0.6.7 280 | - Fixed missing migration files (thx @thenewguy) 281 | 282 | version 0.6.6 283 | - Added automatic feedback button insert (thx @thenewguy) 284 | - Added a settable notification function (thx @ZuluPro) 285 | - Added automatic test and code coverage system (thx @ZuluPro) 286 | 287 | version 0.6.5 288 | - Added support for Django 2+ (thx @hebertjulio and @llann) 289 | 290 | version 0.6.4 291 | - Added Brazilian Portuguese translation (thx @hebertjulio) 292 | - Added Optional email user input, when the user is not authenticated (thx @Basiczombie) 293 | 294 | version 0.6.3 295 | - Added Japanese translation (thx @salexkidd) 296 | 297 | version 0.6.2 298 | - Worked around an issue with scrolled page in html2canvas 299 | 300 | version 0.6.1 301 | - Minor translation fixes 302 | 303 | version 0.6 304 | - Minors distribution fixes 305 | - Updated migrations scripts 306 | 307 | version 0.5 308 | *special thanks to @llann for i18n initial support* 309 | 310 | - Added internationalization support, defaulting to English localization. 311 | - Added French localization 312 | - Added an "include" template to simplify usage 313 | - Used minified version of js libraries 314 | - Provided a template structure so that the UI can be customized 315 | 316 | 317 | Improving this app - TODO 318 | ------------------------- 319 | 320 | This app was developed in rush for a simple yet complete, non intrusive, feedback tool. It does lack a lot of cool 321 | features. If you like to contribute, please do not hesitate! 322 | 323 | - Provide a customization mechanism for the email body, make it text+html. 324 | - Add continuous integration testing 325 | 326 | Translations 327 | ------------ 328 | `Transifex `_ is used to manage translations. 329 | 330 | Feel free to improve translations. 331 | 332 | Currently supported languages are: 333 | - English 334 | - French 335 | - Japanese 336 | - Spanish (Initiated but need help, see on transifex site above) 337 | - Russian (Partial, need help see on transifex site above) 338 | - Brazilian Portuguese 339 | 340 | You can request to add your own language directly on Transifex. 341 | -------------------------------------------------------------------------------- /tellme/static/tellme/vendor/feedback/feedback.js: -------------------------------------------------------------------------------- 1 | // feedback.js 2 | // 2013, Kázmér Rapavi, https://github.com/ivoviz/feedback 3 | // Licensed under the MIT license. 4 | // Version 2.0 5 | 6 | (function($){ 7 | 8 | $.feedback = function(options) { 9 | 10 | var settings = $.extend({ 11 | ajaxURL: '', 12 | headers: {}, 13 | postBrowserInfo: true, 14 | postHTML: true, 15 | postURL: true, 16 | proxy: undefined, 17 | letterRendering: false, 18 | initButtonText: 'Send feedback', 19 | strokeStyle: 'black', 20 | shadowColor: 'black', 21 | shadowOffsetX: 1, 22 | shadowOffsetY: 1, 23 | shadowBlur: 10, 24 | lineJoin: 'bevel', 25 | lineWidth: 3, 26 | html2canvasURL: 'html2canvas.js', 27 | feedbackButton: '.feedback-btn', 28 | showDescriptionModal: true, 29 | isDraggable: true, 30 | onScreenshotTaken: function(){}, 31 | tpl: { 32 | description: '

    Feedback lets you send us suggestions about our products. We welcome problem reports, feature ideas and general comments.

    Start by writing a brief description:

    Next we\'ll let you identify areas of the page related to your description.

    Please enter a description.
    ', 33 | highlighter: '

    Click and drag on the page to help us better understand your feedback. You can move this dialog if it\'s in the way.

    ', 34 | overview: '

    Description

    None
    Browser Info
    Page Info
    Page Structure

    Screenshot

    Please enter a description.
    ', 35 | submitLoading: '

    Loading...

    ', 36 | submitSuccess: '

    Thank you for your feedback. We value every piece of feedback we receive.

    We cannot respond individually to every one, but we will use your comments as we strive to improve your experience.

    ', 37 | submitError: '

    Sadly an error occured while sending your feedback. Please try again.

    ' 38 | }, 39 | onClose: function() {}, 40 | screenshotStroke: true, 41 | highlightElement: true, 42 | initialBox: false 43 | }, options); 44 | var supportedBrowser = !!window.HTMLCanvasElement; 45 | var isFeedbackButtonNative = settings.feedbackButton == '.feedback-btn'; 46 | var _html2canvas = false; 47 | if (supportedBrowser) { 48 | if(isFeedbackButtonNative) { 49 | $('body').append(''); 50 | } 51 | $(document).on('click.feedback', settings.feedbackButton, function(){ 52 | if(isFeedbackButtonNative) { 53 | $(this).hide(); 54 | } 55 | if (!_html2canvas) { 56 | $.getScript(settings.html2canvasURL, function() { 57 | _html2canvas = true; 58 | }); 59 | } 60 | var canDraw = false, 61 | img = '', 62 | h = $(document).height(), 63 | w = $(document).width(), 64 | tpl = '
    '; 65 | 66 | if (settings.initialBox) { 67 | tpl += settings.tpl.description; 68 | } 69 | 70 | tpl += settings.tpl.highlighter + settings.tpl.overview + '
    '; 71 | 72 | $('body').append(tpl); 73 | 74 | moduleStyle = { 75 | 'position': 'absolute', 76 | 'left': '0px', 77 | 'top': '0px' 78 | }; 79 | canvasAttr = { 80 | 'width': w, 81 | 'height': h 82 | }; 83 | 84 | $('#feedback-module').css(moduleStyle); 85 | $('#feedback-canvas').attr(canvasAttr).css('z-index', '30000'); 86 | 87 | if (!settings.initialBox) { 88 | $('#feedback-highlighter-back').remove(); 89 | canDraw = true; 90 | $('#feedback-canvas').css('cursor', 'crosshair'); 91 | $('#feedback-helpers').show(); 92 | $('#feedback-welcome').hide(); 93 | $('#feedback-highlighter').show(); 94 | } 95 | 96 | if(settings.isDraggable) { 97 | $('#feedback-highlighter').on('mousedown.feedback', function(e) { 98 | var $d = $(this).addClass('feedback-draggable'), 99 | drag_h = $d.outerHeight(), 100 | drag_w = $d.outerWidth(), 101 | pos_y = $d.offset().top + drag_h - e.pageY, 102 | pos_x = $d.offset().left + drag_w - e.pageX; 103 | $d.css('z-index', 40000).parents().on('mousemove.feedback', function(e) { 104 | _top = e.pageY + pos_y - drag_h; 105 | _left = e.pageX + pos_x - drag_w; 106 | _bottom = drag_h - e.pageY; 107 | _right = drag_w - e.pageX; 108 | 109 | if (_left < 0) _left = 0; 110 | if (_top < 0) _top = 0; 111 | if (_right > $(window).width()) 112 | _left = $(window).width() - drag_w; 113 | if (_left > $(window).width() - drag_w) 114 | _left = $(window).width() - drag_w; 115 | if (_bottom > $(document).height()) 116 | _top = $(document).height() - drag_h; 117 | if (_top > $(document).height() - drag_h) 118 | _top = $(document).height() - drag_h; 119 | 120 | $('.feedback-draggable').offset({ 121 | top: _top, 122 | left: _left 123 | }).on("mouseup", function() { 124 | $(this).removeClass('feedback-draggable'); 125 | }); 126 | }); 127 | e.preventDefault(); 128 | }).on('mouseup.feedback', function(){ 129 | $(this).removeClass('feedback-draggable'); 130 | $(this).parents().off('mousemove mousedown'); 131 | }); 132 | } 133 | 134 | var ctx = $('#feedback-canvas')[0].getContext('2d'); 135 | 136 | ctx.fillStyle = 'rgba(102,102,102,0.5)'; 137 | ctx.fillRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 138 | 139 | rect = {}; 140 | drag = false; 141 | highlight = 1, 142 | post = {}; 143 | 144 | if (settings.postBrowserInfo) { 145 | post.browser = {}; 146 | post.browser.appCodeName = navigator.appCodeName; 147 | post.browser.appName = navigator.appName; 148 | post.browser.appVersion = navigator.appVersion; 149 | post.browser.cookieEnabled = navigator.cookieEnabled; 150 | post.browser.onLine = navigator.onLine; 151 | post.browser.platform = navigator.platform; 152 | post.browser.userAgent = navigator.userAgent; 153 | post.browser.plugins = []; 154 | 155 | $.each(navigator.plugins, function(i) { 156 | post.browser.plugins.push(navigator.plugins[i].name); 157 | }); 158 | $('#feedback-browser-info').show(); 159 | } 160 | 161 | if (settings.postURL) { 162 | post.url = document.URL; 163 | $('#feedback-page-info').show(); 164 | } 165 | 166 | if (settings.postHTML) { 167 | post.html = $('html').html(); 168 | $('#feedback-page-structure').show(); 169 | } 170 | 171 | if (!settings.postBrowserInfo && !settings.postURL && !settings.postHTML) 172 | $('#feedback-additional-none').show(); 173 | 174 | $(document).on('mousedown.feedback', '#feedback-canvas', function(e) { 175 | if (canDraw) { 176 | 177 | rect.startX = e.pageX - $(this).offset().left; 178 | rect.startY = e.pageY - $(this).offset().top; 179 | rect.w = 0; 180 | rect.h = 0; 181 | drag = true; 182 | } 183 | }); 184 | 185 | $(document).on('mouseup.feedback', function(){ 186 | if (canDraw) { 187 | drag = false; 188 | 189 | var dtop = rect.startY, 190 | dleft = rect.startX, 191 | dwidth = rect.w, 192 | dheight = rect.h; 193 | dtype = 'highlight'; 194 | 195 | if (dwidth == 0 || dheight == 0) return; 196 | 197 | if (dwidth < 0) { 198 | dleft += dwidth; 199 | dwidth *= -1; 200 | } 201 | if (dheight < 0) { 202 | dtop += dheight; 203 | dheight *= -1; 204 | } 205 | 206 | if (dtop + dheight > $(document).height()) 207 | dheight = $(document).height() - dtop; 208 | if (dleft + dwidth > $(document).width()) 209 | dwidth = $(document).width() - dleft; 210 | 211 | if (highlight == 0) 212 | dtype = 'blackout'; 213 | 214 | $('#feedback-helpers').append(''); 215 | 216 | redraw(ctx); 217 | rect.w = 0; 218 | } 219 | 220 | }); 221 | 222 | $(document).on('mousemove.feedback', function(e) { 223 | if (canDraw && drag) { 224 | $('#feedback-highlighter').css('cursor', 'default'); 225 | 226 | rect.w = (e.pageX - $('#feedback-canvas').offset().left) - rect.startX; 227 | rect.h = (e.pageY - $('#feedback-canvas').offset().top) - rect.startY; 228 | 229 | ctx.clearRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 230 | ctx.fillStyle = 'rgba(102,102,102,0.5)'; 231 | ctx.fillRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 232 | $('.feedback-helper').each(function() { 233 | if ($(this).attr('data-type') == 'highlight') 234 | drawlines(ctx, parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 235 | }); 236 | if (highlight==1) { 237 | drawlines(ctx, rect.startX, rect.startY, rect.w, rect.h); 238 | ctx.clearRect(rect.startX, rect.startY, rect.w, rect.h); 239 | } 240 | $('.feedback-helper').each(function() { 241 | if ($(this).attr('data-type') == 'highlight') 242 | ctx.clearRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 243 | }); 244 | $('.feedback-helper').each(function() { 245 | if ($(this).attr('data-type') == 'blackout') { 246 | ctx.fillStyle = 'rgba(0,0,0,1)'; 247 | ctx.fillRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()) 248 | } 249 | }); 250 | if (highlight == 0) { 251 | ctx.fillStyle = 'rgba(0,0,0,0.5)'; 252 | ctx.fillRect(rect.startX, rect.startY, rect.w, rect.h); 253 | } 254 | } 255 | }); 256 | 257 | if (settings.highlightElement) { 258 | var highlighted = [], 259 | tmpHighlighted = [], 260 | hidx = 0; 261 | 262 | $(document).on('mousemove.feedback click.feedback', '#feedback-canvas',function(e) { 263 | if (canDraw) { 264 | redraw(ctx); 265 | tmpHighlighted = []; 266 | 267 | $('#feedback-canvas').css('cursor', 'crosshair'); 268 | 269 | $('* :not(body,script,iframe,div,section,.feedback-btn,#feedback-module *)').each(function(){ 270 | if ($(this).attr('data-highlighted') === 'true') 271 | return; 272 | 273 | if (e.pageX > $(this).offset().left && e.pageX < $(this).offset().left + $(this).width() && e.pageY > $(this).offset().top + parseInt($(this).css('padding-top'), 10) && e.pageY < $(this).offset().top + $(this).height() + parseInt($(this).css('padding-top'), 10)) { 274 | tmpHighlighted.push($(this)); 275 | } 276 | }); 277 | 278 | var $toHighlight = tmpHighlighted[tmpHighlighted.length - 1]; 279 | 280 | if ($toHighlight && !drag) { 281 | $('#feedback-canvas').css('cursor', 'pointer'); 282 | 283 | var _x = $toHighlight.offset().left - 2, 284 | _y = $toHighlight.offset().top - 2, 285 | _w = $toHighlight.width() + parseInt($toHighlight.css('padding-left'), 10) + parseInt($toHighlight.css('padding-right'), 10) + 6, 286 | _h = $toHighlight.height() + parseInt($toHighlight.css('padding-top'), 10) + parseInt($toHighlight.css('padding-bottom'), 10) + 6; 287 | 288 | if (highlight == 1) { 289 | drawlines(ctx, _x, _y, _w, _h); 290 | ctx.clearRect(_x, _y, _w, _h); 291 | dtype = 'highlight'; 292 | } 293 | 294 | $('.feedback-helper').each(function() { 295 | if ($(this).attr('data-type') == 'highlight') 296 | ctx.clearRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 297 | }); 298 | 299 | if (highlight == 0) { 300 | dtype = 'blackout'; 301 | ctx.fillStyle = 'rgba(0,0,0,0.5)'; 302 | ctx.fillRect(_x, _y, _w, _h); 303 | } 304 | 305 | $('.feedback-helper').each(function() { 306 | if ($(this).attr('data-type') == 'blackout') { 307 | ctx.fillStyle = 'rgba(0,0,0,1)'; 308 | ctx.fillRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 309 | } 310 | }); 311 | 312 | if (e.type == 'click' && e.pageX == rect.startX && e.pageY == rect.startY) { 313 | $('#feedback-helpers').append(''); 314 | highlighted.push(hidx); 315 | ++hidx; 316 | redraw(ctx); 317 | } 318 | } 319 | } 320 | }); 321 | } 322 | 323 | $(document).on('mouseleave.feedback', 'body,#feedback-canvas', function() { 324 | redraw(ctx); 325 | }); 326 | 327 | $(document).on('mouseenter.feedback', '.feedback-helper', function() { 328 | redraw(ctx); 329 | }); 330 | 331 | $(document).on('click.feedback', '#feedback-welcome-next', function() { 332 | if ($('#feedback-note').val().length > 0) { 333 | canDraw = true; 334 | $('#feedback-canvas').css('cursor', 'crosshair'); 335 | $('#feedback-helpers').show(); 336 | $('#feedback-welcome').hide(); 337 | $('#feedback-highlighter').show(); 338 | } 339 | else { 340 | $('#feedback-welcome-error').show(); 341 | } 342 | }); 343 | 344 | $(document).on('mouseenter.feedback mouseleave.feedback', '.feedback-helper', function(e) { 345 | if (drag) 346 | return; 347 | 348 | rect.w = 0; 349 | rect.h = 0; 350 | 351 | if (e.type === 'mouseenter') { 352 | $(this).css('z-index', '30001'); 353 | $(this).append(''); 354 | $(this).append('
    '); 355 | $(this).find('#feedback-close').css({ 356 | 'top' : -1 * ($(this).find('#feedback-close').height() / 2) + 'px', 357 | 'left' : $(this).width() - ($(this).find('#feedback-close').width() / 2) + 'px' 358 | }); 359 | 360 | if ($(this).attr('data-type') == 'blackout') { 361 | /* redraw white */ 362 | ctx.clearRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 363 | ctx.fillStyle = 'rgba(102,102,102,0.5)'; 364 | ctx.fillRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 365 | $('.feedback-helper').each(function() { 366 | if ($(this).attr('data-type') == 'highlight') 367 | drawlines(ctx, parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 368 | }); 369 | $('.feedback-helper').each(function() { 370 | if ($(this).attr('data-type') == 'highlight') 371 | ctx.clearRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 372 | }); 373 | 374 | ctx.clearRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()) 375 | ctx.fillStyle = 'rgba(0,0,0,0.75)'; 376 | ctx.fillRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 377 | 378 | ignore = $(this).attr('data-time'); 379 | 380 | /* redraw black */ 381 | $('.feedback-helper').each(function() { 382 | if ($(this).attr('data-time') == ignore) 383 | return true; 384 | if ($(this).attr('data-type') == 'blackout') { 385 | ctx.fillStyle = 'rgba(0,0,0,1)'; 386 | ctx.fillRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()) 387 | } 388 | }); 389 | } 390 | } 391 | else { 392 | $(this).css('z-index','30000'); 393 | $(this).children().remove(); 394 | if ($(this).attr('data-type') == 'blackout') { 395 | redraw(ctx); 396 | } 397 | } 398 | }); 399 | 400 | $(document).on('click.feedback', '#feedback-close', function() { 401 | if (settings.highlightElement && $(this).parent().attr('data-highlight-id')) 402 | var _hidx = $(this).parent().attr('data-highlight-id'); 403 | 404 | $(this).parent().remove(); 405 | 406 | if (settings.highlightElement && _hidx) 407 | $('[data-highlight-id="' + _hidx + '"]').removeAttr('data-highlighted').removeAttr('data-highlight-id'); 408 | 409 | redraw(ctx); 410 | }); 411 | 412 | $('#feedback-module').on('click.feedback', '.feedback-wizard-close,.feedback-close-btn', function() { 413 | close(); 414 | }); 415 | 416 | $(document).on('keyup.feedback', function(e) { 417 | if (e.keyCode == 27) 418 | close(); 419 | }); 420 | 421 | $(document).on('selectstart.feedback dragstart.feedback', function(e) { 422 | e.preventDefault(); 423 | }); 424 | 425 | $(document).on('click.feedback', '#feedback-highlighter-back', function() { 426 | canDraw = false; 427 | $('#feedback-canvas').css('cursor', 'default'); 428 | $('#feedback-helpers').hide(); 429 | $('#feedback-highlighter').hide(); 430 | $('#feedback-welcome-error').hide(); 431 | $('#feedback-welcome').show(); 432 | }); 433 | 434 | $(document).on('mousedown.feedback', '.feedback-sethighlight', function() { 435 | highlight = 1; 436 | $(this).addClass('feedback-active'); 437 | $('.feedback-setblackout').removeClass('feedback-active'); 438 | }); 439 | 440 | $(document).on('mousedown.feedback', '.feedback-setblackout', function() { 441 | highlight = 0; 442 | $(this).addClass('feedback-active'); 443 | $('.feedback-sethighlight').removeClass('feedback-active'); 444 | }); 445 | 446 | $(document).on('click.feedback', '#feedback-highlighter-next', function() { 447 | canDraw = false; 448 | $('#feedback-canvas').css('cursor', 'default'); 449 | var sy = $(document).scrollTop(), 450 | dh = $(window).height(); 451 | $('#feedback-helpers').hide(); 452 | $('#feedback-highlighter').hide(); 453 | if (!settings.screenshotStroke) { 454 | redraw(ctx, false); 455 | } 456 | html2canvas($('body'), { 457 | onrendered: function(canvas) { 458 | if (!settings.screenshotStroke) { 459 | redraw(ctx); 460 | } 461 | _canvas = $('').hide().appendTo('body'); 462 | _ctx = _canvas.get(0).getContext('2d'); 463 | _ctx.drawImage(canvas, 0, sy, w, dh, 0, 0, w, dh); 464 | img = _canvas.get(0).toDataURL(); 465 | $(document).scrollTop(sy); 466 | post.img = img; 467 | settings.onScreenshotTaken(post.img); 468 | if(settings.showDescriptionModal) { 469 | $('#feedback-canvas-tmp').remove(); 470 | $('#feedback-overview').show(); 471 | $('#feedback-overview-description-text>textarea').remove(); 472 | $('#feedback-overview-screenshot>img').remove(); 473 | $('').insertAfter('#feedback-overview-description-text h3:eq(0)'); 474 | $('#feedback-overview-screenshot').append(''); 475 | } 476 | else { 477 | $('#feedback-module').remove(); 478 | close(); 479 | _canvas.remove(); 480 | } 481 | }, 482 | proxy: settings.proxy, 483 | letterRendering: settings.letterRendering 484 | }); 485 | }); 486 | 487 | $(document).on('click.feedback', '#feedback-overview-back', function(e) { 488 | canDraw = true; 489 | $('#feedback-canvas').css('cursor', 'crosshair'); 490 | $('#feedback-overview').hide(); 491 | $('#feedback-helpers').show(); 492 | $('#feedback-highlighter').show(); 493 | $('#feedback-overview-error').hide(); 494 | }); 495 | 496 | $(document).on('keyup.feedback', '#feedback-note-tmp,#feedback-overview-note', function(e) { 497 | var tx; 498 | if (e.target.id === 'feedback-note-tmp') 499 | tx = $('#feedback-note-tmp').val(); 500 | else { 501 | tx = $('#feedback-overview-note').val(); 502 | $('#feedback-note-tmp').val(tx); 503 | } 504 | 505 | $('#feedback-note').val(tx); 506 | }); 507 | 508 | $(document).on('click.feedback', '#feedback-submit', function() { 509 | canDraw = false; 510 | 511 | if ($('#feedback-note').val().length > 0) { 512 | $('#feedback-submit-success,#feedback-submit-error').remove(); 513 | $('#feedback-overview').hide(); 514 | $("#feedback-module").append(settings.tpl.submitLoading); 515 | 516 | post.img = img; 517 | post.note = $('#feedback-note')?.val() || $("input[name=feedback-note]")?.val(); 518 | post.email = $("#feedback-user-email")?.val() || $("input[name=email]")?.val(); 519 | var data = {feedback: JSON.stringify(post)}; 520 | $.ajax({ 521 | url: settings.ajaxURL, 522 | dataType: 'json', 523 | type: 'POST', 524 | data: data, 525 | headers: settings.headers, 526 | success: function() { 527 | $('#feedback-module').append(settings.tpl.submitSuccess); 528 | }, 529 | error: function(){ 530 | $('#feedback-module').append(settings.tpl.submitError); 531 | } 532 | }); 533 | } 534 | else { 535 | $('#feedback-overview-error').show(); 536 | } 537 | }); 538 | }); 539 | } 540 | 541 | function close() { 542 | canDraw = false; 543 | $(document).off('mouseenter.feedback mouseleave.feedback', '.feedback-helper'); 544 | $(document).off('mouseup.feedback keyup.feedback'); 545 | $(document).off('mousedown.feedback', '.feedback-setblackout'); 546 | $(document).off('mousedown.feedback', '.feedback-sethighlight'); 547 | $(document).off('mousedown.feedback click.feedback', '#feedback-close'); 548 | $(document).off('mousedown.feedback', '#feedback-canvas'); 549 | $(document).off('click.feedback', '#feedback-highlighter-next'); 550 | $(document).off('click.feedback', '#feedback-highlighter-back'); 551 | $(document).off('click.feedback', '#feedback-welcome-next'); 552 | $(document).off('click.feedback', '#feedback-overview-back'); 553 | $(document).off('mouseleave.feedback', 'body'); 554 | $(document).off('mouseenter.feedback', '.feedback-helper'); 555 | $(document).off('selectstart.feedback dragstart.feedback'); 556 | $('#feedback-module').off('click.feedback', '.feedback-wizard-close,.feedback-close-btn'); 557 | $(document).off('click.feedback', '#feedback-submit'); 558 | 559 | if (settings.highlightElement) { 560 | $(document).off('click.feedback', '#feedback-canvas'); 561 | $(document).off('mousemove.feedback', '#feedback-canvas'); 562 | } 563 | $('[data-highlighted="true"]').removeAttr('data-highlight-id').removeAttr('data-highlighted'); 564 | $('#feedback-module').remove(); 565 | $('.feedback-btn').show(); 566 | 567 | settings.onClose.call(this); 568 | } 569 | 570 | function redraw(ctx, border) { 571 | border = typeof border !== 'undefined' ? border : true; 572 | ctx.clearRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 573 | ctx.fillStyle = 'rgba(102,102,102,0.5)'; 574 | ctx.fillRect(0, 0, $('#feedback-canvas').width(), $('#feedback-canvas').height()); 575 | $('.feedback-helper').each(function() { 576 | if ($(this).attr('data-type') == 'highlight') 577 | if (border) 578 | drawlines(ctx, parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 579 | }); 580 | $('.feedback-helper').each(function() { 581 | if ($(this).attr('data-type') == 'highlight') 582 | ctx.clearRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 583 | }); 584 | $('.feedback-helper').each(function() { 585 | if ($(this).attr('data-type') == 'blackout') { 586 | ctx.fillStyle = 'rgba(0,0,0,1)'; 587 | ctx.fillRect(parseInt($(this).css('left'), 10), parseInt($(this).css('top'), 10), $(this).width(), $(this).height()); 588 | } 589 | }); 590 | } 591 | 592 | function drawlines(ctx, x, y, w, h) { 593 | ctx.strokeStyle = settings.strokeStyle; 594 | ctx.shadowColor = settings.shadowColor; 595 | ctx.shadowOffsetX = settings.shadowOffsetX; 596 | ctx.shadowOffsetY = settings.shadowOffsetY; 597 | ctx.shadowBlur = settings.shadowBlur; 598 | ctx.lineJoin = settings.lineJoin; 599 | ctx.lineWidth = settings.lineWidth; 600 | 601 | ctx.strokeRect(x,y,w,h); 602 | 603 | ctx.shadowOffsetX = 0; 604 | ctx.shadowOffsetY = 0; 605 | ctx.shadowBlur = 0; 606 | ctx.lineWidth = 1; 607 | } 608 | 609 | }; 610 | 611 | }(jQuery)); 612 | -------------------------------------------------------------------------------- /tellme/static/tellme/vendor/es6-promise/es6-promise.auto.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * @overview es6-promise - a tiny implementation of Promises/A+. 3 | * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 4 | * @license Licensed under MIT license 5 | * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE 6 | * @version v4.2.8+1e68dce6 7 | */ 8 | 9 | (function (global, factory) { 10 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 11 | typeof define === 'function' && define.amd ? define(factory) : 12 | (global.ES6Promise = factory()); 13 | }(this, (function () { 'use strict'; 14 | 15 | function objectOrFunction(x) { 16 | var type = typeof x; 17 | return x !== null && (type === 'object' || type === 'function'); 18 | } 19 | 20 | function isFunction(x) { 21 | return typeof x === 'function'; 22 | } 23 | 24 | 25 | 26 | var _isArray = void 0; 27 | if (Array.isArray) { 28 | _isArray = Array.isArray; 29 | } else { 30 | _isArray = function (x) { 31 | return Object.prototype.toString.call(x) === '[object Array]'; 32 | }; 33 | } 34 | 35 | var isArray = _isArray; 36 | 37 | var len = 0; 38 | var vertxNext = void 0; 39 | var customSchedulerFn = void 0; 40 | 41 | var asap = function asap(callback, arg) { 42 | queue[len] = callback; 43 | queue[len + 1] = arg; 44 | len += 2; 45 | if (len === 2) { 46 | // If len is 2, that means that we need to schedule an async flush. 47 | // If additional callbacks are queued before the queue is flushed, they 48 | // will be processed by this flush that we are scheduling. 49 | if (customSchedulerFn) { 50 | customSchedulerFn(flush); 51 | } else { 52 | scheduleFlush(); 53 | } 54 | } 55 | }; 56 | 57 | function setScheduler(scheduleFn) { 58 | customSchedulerFn = scheduleFn; 59 | } 60 | 61 | function setAsap(asapFn) { 62 | asap = asapFn; 63 | } 64 | 65 | var browserWindow = typeof window !== 'undefined' ? window : undefined; 66 | var browserGlobal = browserWindow || {}; 67 | var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; 68 | var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; 69 | 70 | // test for web worker but not in IE10 71 | var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; 72 | 73 | // node 74 | function useNextTick() { 75 | // node version 0.10.x displays a deprecation warning when nextTick is used recursively 76 | // see https://github.com/cujojs/when/issues/410 for details 77 | return function () { 78 | return process.nextTick(flush); 79 | }; 80 | } 81 | 82 | // vertx 83 | function useVertxTimer() { 84 | if (typeof vertxNext !== 'undefined') { 85 | return function () { 86 | vertxNext(flush); 87 | }; 88 | } 89 | 90 | return useSetTimeout(); 91 | } 92 | 93 | function useMutationObserver() { 94 | var iterations = 0; 95 | var observer = new BrowserMutationObserver(flush); 96 | var node = document.createTextNode(''); 97 | observer.observe(node, { characterData: true }); 98 | 99 | return function () { 100 | node.data = iterations = ++iterations % 2; 101 | }; 102 | } 103 | 104 | // web worker 105 | function useMessageChannel() { 106 | var channel = new MessageChannel(); 107 | channel.port1.onmessage = flush; 108 | return function () { 109 | return channel.port2.postMessage(0); 110 | }; 111 | } 112 | 113 | function useSetTimeout() { 114 | // Store setTimeout reference so es6-promise will be unaffected by 115 | // other code modifying setTimeout (like sinon.useFakeTimers()) 116 | var globalSetTimeout = setTimeout; 117 | return function () { 118 | return globalSetTimeout(flush, 1); 119 | }; 120 | } 121 | 122 | var queue = new Array(1000); 123 | function flush() { 124 | for (var i = 0; i < len; i += 2) { 125 | var callback = queue[i]; 126 | var arg = queue[i + 1]; 127 | 128 | callback(arg); 129 | 130 | queue[i] = undefined; 131 | queue[i + 1] = undefined; 132 | } 133 | 134 | len = 0; 135 | } 136 | 137 | function attemptVertx() { 138 | try { 139 | var vertx = Function('return this')().require('vertx'); 140 | vertxNext = vertx.runOnLoop || vertx.runOnContext; 141 | return useVertxTimer(); 142 | } catch (e) { 143 | return useSetTimeout(); 144 | } 145 | } 146 | 147 | var scheduleFlush = void 0; 148 | // Decide what async method to use to triggering processing of queued callbacks: 149 | if (isNode) { 150 | scheduleFlush = useNextTick(); 151 | } else if (BrowserMutationObserver) { 152 | scheduleFlush = useMutationObserver(); 153 | } else if (isWorker) { 154 | scheduleFlush = useMessageChannel(); 155 | } else if (browserWindow === undefined && typeof require === 'function') { 156 | scheduleFlush = attemptVertx(); 157 | } else { 158 | scheduleFlush = useSetTimeout(); 159 | } 160 | 161 | function then(onFulfillment, onRejection) { 162 | var parent = this; 163 | 164 | var child = new this.constructor(noop); 165 | 166 | if (child[PROMISE_ID] === undefined) { 167 | makePromise(child); 168 | } 169 | 170 | var _state = parent._state; 171 | 172 | 173 | if (_state) { 174 | var callback = arguments[_state - 1]; 175 | asap(function () { 176 | return invokeCallback(_state, child, callback, parent._result); 177 | }); 178 | } else { 179 | subscribe(parent, child, onFulfillment, onRejection); 180 | } 181 | 182 | return child; 183 | } 184 | 185 | /** 186 | `Promise.resolve` returns a promise that will become resolved with the 187 | passed `value`. It is shorthand for the following: 188 | 189 | ```javascript 190 | let promise = new Promise(function(resolve, reject){ 191 | resolve(1); 192 | }); 193 | 194 | promise.then(function(value){ 195 | // value === 1 196 | }); 197 | ``` 198 | 199 | Instead of writing the above, your code now simply becomes the following: 200 | 201 | ```javascript 202 | let promise = Promise.resolve(1); 203 | 204 | promise.then(function(value){ 205 | // value === 1 206 | }); 207 | ``` 208 | 209 | @method resolve 210 | @static 211 | @param {Any} value value that the returned promise will be resolved with 212 | Useful for tooling. 213 | @return {Promise} a promise that will become fulfilled with the given 214 | `value` 215 | */ 216 | function resolve$1(object) { 217 | /*jshint validthis:true */ 218 | var Constructor = this; 219 | 220 | if (object && typeof object === 'object' && object.constructor === Constructor) { 221 | return object; 222 | } 223 | 224 | var promise = new Constructor(noop); 225 | resolve(promise, object); 226 | return promise; 227 | } 228 | 229 | var PROMISE_ID = Math.random().toString(36).substring(2); 230 | 231 | function noop() {} 232 | 233 | var PENDING = void 0; 234 | var FULFILLED = 1; 235 | var REJECTED = 2; 236 | 237 | function selfFulfillment() { 238 | return new TypeError("You cannot resolve a promise with itself"); 239 | } 240 | 241 | function cannotReturnOwn() { 242 | return new TypeError('A promises callback cannot return that same promise.'); 243 | } 244 | 245 | function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { 246 | try { 247 | then$$1.call(value, fulfillmentHandler, rejectionHandler); 248 | } catch (e) { 249 | return e; 250 | } 251 | } 252 | 253 | function handleForeignThenable(promise, thenable, then$$1) { 254 | asap(function (promise) { 255 | var sealed = false; 256 | var error = tryThen(then$$1, thenable, function (value) { 257 | if (sealed) { 258 | return; 259 | } 260 | sealed = true; 261 | if (thenable !== value) { 262 | resolve(promise, value); 263 | } else { 264 | fulfill(promise, value); 265 | } 266 | }, function (reason) { 267 | if (sealed) { 268 | return; 269 | } 270 | sealed = true; 271 | 272 | reject(promise, reason); 273 | }, 'Settle: ' + (promise._label || ' unknown promise')); 274 | 275 | if (!sealed && error) { 276 | sealed = true; 277 | reject(promise, error); 278 | } 279 | }, promise); 280 | } 281 | 282 | function handleOwnThenable(promise, thenable) { 283 | if (thenable._state === FULFILLED) { 284 | fulfill(promise, thenable._result); 285 | } else if (thenable._state === REJECTED) { 286 | reject(promise, thenable._result); 287 | } else { 288 | subscribe(thenable, undefined, function (value) { 289 | return resolve(promise, value); 290 | }, function (reason) { 291 | return reject(promise, reason); 292 | }); 293 | } 294 | } 295 | 296 | function handleMaybeThenable(promise, maybeThenable, then$$1) { 297 | if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { 298 | handleOwnThenable(promise, maybeThenable); 299 | } else { 300 | if (then$$1 === undefined) { 301 | fulfill(promise, maybeThenable); 302 | } else if (isFunction(then$$1)) { 303 | handleForeignThenable(promise, maybeThenable, then$$1); 304 | } else { 305 | fulfill(promise, maybeThenable); 306 | } 307 | } 308 | } 309 | 310 | function resolve(promise, value) { 311 | if (promise === value) { 312 | reject(promise, selfFulfillment()); 313 | } else if (objectOrFunction(value)) { 314 | var then$$1 = void 0; 315 | try { 316 | then$$1 = value.then; 317 | } catch (error) { 318 | reject(promise, error); 319 | return; 320 | } 321 | handleMaybeThenable(promise, value, then$$1); 322 | } else { 323 | fulfill(promise, value); 324 | } 325 | } 326 | 327 | function publishRejection(promise) { 328 | if (promise._onerror) { 329 | promise._onerror(promise._result); 330 | } 331 | 332 | publish(promise); 333 | } 334 | 335 | function fulfill(promise, value) { 336 | if (promise._state !== PENDING) { 337 | return; 338 | } 339 | 340 | promise._result = value; 341 | promise._state = FULFILLED; 342 | 343 | if (promise._subscribers.length !== 0) { 344 | asap(publish, promise); 345 | } 346 | } 347 | 348 | function reject(promise, reason) { 349 | if (promise._state !== PENDING) { 350 | return; 351 | } 352 | promise._state = REJECTED; 353 | promise._result = reason; 354 | 355 | asap(publishRejection, promise); 356 | } 357 | 358 | function subscribe(parent, child, onFulfillment, onRejection) { 359 | var _subscribers = parent._subscribers; 360 | var length = _subscribers.length; 361 | 362 | 363 | parent._onerror = null; 364 | 365 | _subscribers[length] = child; 366 | _subscribers[length + FULFILLED] = onFulfillment; 367 | _subscribers[length + REJECTED] = onRejection; 368 | 369 | if (length === 0 && parent._state) { 370 | asap(publish, parent); 371 | } 372 | } 373 | 374 | function publish(promise) { 375 | var subscribers = promise._subscribers; 376 | var settled = promise._state; 377 | 378 | if (subscribers.length === 0) { 379 | return; 380 | } 381 | 382 | var child = void 0, 383 | callback = void 0, 384 | detail = promise._result; 385 | 386 | for (var i = 0; i < subscribers.length; i += 3) { 387 | child = subscribers[i]; 388 | callback = subscribers[i + settled]; 389 | 390 | if (child) { 391 | invokeCallback(settled, child, callback, detail); 392 | } else { 393 | callback(detail); 394 | } 395 | } 396 | 397 | promise._subscribers.length = 0; 398 | } 399 | 400 | function invokeCallback(settled, promise, callback, detail) { 401 | var hasCallback = isFunction(callback), 402 | value = void 0, 403 | error = void 0, 404 | succeeded = true; 405 | 406 | if (hasCallback) { 407 | try { 408 | value = callback(detail); 409 | } catch (e) { 410 | succeeded = false; 411 | error = e; 412 | } 413 | 414 | if (promise === value) { 415 | reject(promise, cannotReturnOwn()); 416 | return; 417 | } 418 | } else { 419 | value = detail; 420 | } 421 | 422 | if (promise._state !== PENDING) { 423 | // noop 424 | } else if (hasCallback && succeeded) { 425 | resolve(promise, value); 426 | } else if (succeeded === false) { 427 | reject(promise, error); 428 | } else if (settled === FULFILLED) { 429 | fulfill(promise, value); 430 | } else if (settled === REJECTED) { 431 | reject(promise, value); 432 | } 433 | } 434 | 435 | function initializePromise(promise, resolver) { 436 | try { 437 | resolver(function resolvePromise(value) { 438 | resolve(promise, value); 439 | }, function rejectPromise(reason) { 440 | reject(promise, reason); 441 | }); 442 | } catch (e) { 443 | reject(promise, e); 444 | } 445 | } 446 | 447 | var id = 0; 448 | function nextId() { 449 | return id++; 450 | } 451 | 452 | function makePromise(promise) { 453 | promise[PROMISE_ID] = id++; 454 | promise._state = undefined; 455 | promise._result = undefined; 456 | promise._subscribers = []; 457 | } 458 | 459 | function validationError() { 460 | return new Error('Array Methods must be provided an Array'); 461 | } 462 | 463 | var Enumerator = function () { 464 | function Enumerator(Constructor, input) { 465 | this._instanceConstructor = Constructor; 466 | this.promise = new Constructor(noop); 467 | 468 | if (!this.promise[PROMISE_ID]) { 469 | makePromise(this.promise); 470 | } 471 | 472 | if (isArray(input)) { 473 | this.length = input.length; 474 | this._remaining = input.length; 475 | 476 | this._result = new Array(this.length); 477 | 478 | if (this.length === 0) { 479 | fulfill(this.promise, this._result); 480 | } else { 481 | this.length = this.length || 0; 482 | this._enumerate(input); 483 | if (this._remaining === 0) { 484 | fulfill(this.promise, this._result); 485 | } 486 | } 487 | } else { 488 | reject(this.promise, validationError()); 489 | } 490 | } 491 | 492 | Enumerator.prototype._enumerate = function _enumerate(input) { 493 | for (var i = 0; this._state === PENDING && i < input.length; i++) { 494 | this._eachEntry(input[i], i); 495 | } 496 | }; 497 | 498 | Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { 499 | var c = this._instanceConstructor; 500 | var resolve$$1 = c.resolve; 501 | 502 | 503 | if (resolve$$1 === resolve$1) { 504 | var _then = void 0; 505 | var error = void 0; 506 | var didError = false; 507 | try { 508 | _then = entry.then; 509 | } catch (e) { 510 | didError = true; 511 | error = e; 512 | } 513 | 514 | if (_then === then && entry._state !== PENDING) { 515 | this._settledAt(entry._state, i, entry._result); 516 | } else if (typeof _then !== 'function') { 517 | this._remaining--; 518 | this._result[i] = entry; 519 | } else if (c === Promise$2) { 520 | var promise = new c(noop); 521 | if (didError) { 522 | reject(promise, error); 523 | } else { 524 | handleMaybeThenable(promise, entry, _then); 525 | } 526 | this._willSettleAt(promise, i); 527 | } else { 528 | this._willSettleAt(new c(function (resolve$$1) { 529 | return resolve$$1(entry); 530 | }), i); 531 | } 532 | } else { 533 | this._willSettleAt(resolve$$1(entry), i); 534 | } 535 | }; 536 | 537 | Enumerator.prototype._settledAt = function _settledAt(state, i, value) { 538 | var promise = this.promise; 539 | 540 | 541 | if (promise._state === PENDING) { 542 | this._remaining--; 543 | 544 | if (state === REJECTED) { 545 | reject(promise, value); 546 | } else { 547 | this._result[i] = value; 548 | } 549 | } 550 | 551 | if (this._remaining === 0) { 552 | fulfill(promise, this._result); 553 | } 554 | }; 555 | 556 | Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { 557 | var enumerator = this; 558 | 559 | subscribe(promise, undefined, function (value) { 560 | return enumerator._settledAt(FULFILLED, i, value); 561 | }, function (reason) { 562 | return enumerator._settledAt(REJECTED, i, reason); 563 | }); 564 | }; 565 | 566 | return Enumerator; 567 | }(); 568 | 569 | /** 570 | `Promise.all` accepts an array of promises, and returns a new promise which 571 | is fulfilled with an array of fulfillment values for the passed promises, or 572 | rejected with the reason of the first passed promise to be rejected. It casts all 573 | elements of the passed iterable to promises as it runs this algorithm. 574 | 575 | Example: 576 | 577 | ```javascript 578 | let promise1 = resolve(1); 579 | let promise2 = resolve(2); 580 | let promise3 = resolve(3); 581 | let promises = [ promise1, promise2, promise3 ]; 582 | 583 | Promise.all(promises).then(function(array){ 584 | // The array here would be [ 1, 2, 3 ]; 585 | }); 586 | ``` 587 | 588 | If any of the `promises` given to `all` are rejected, the first promise 589 | that is rejected will be given as an argument to the returned promises's 590 | rejection handler. For example: 591 | 592 | Example: 593 | 594 | ```javascript 595 | let promise1 = resolve(1); 596 | let promise2 = reject(new Error("2")); 597 | let promise3 = reject(new Error("3")); 598 | let promises = [ promise1, promise2, promise3 ]; 599 | 600 | Promise.all(promises).then(function(array){ 601 | // Code here never runs because there are rejected promises! 602 | }, function(error) { 603 | // error.message === "2" 604 | }); 605 | ``` 606 | 607 | @method all 608 | @static 609 | @param {Array} entries array of promises 610 | @param {String} label optional string for labeling the promise. 611 | Useful for tooling. 612 | @return {Promise} promise that is fulfilled when all `promises` have been 613 | fulfilled, or rejected if any of them become rejected. 614 | @static 615 | */ 616 | function all(entries) { 617 | return new Enumerator(this, entries).promise; 618 | } 619 | 620 | /** 621 | `Promise.race` returns a new promise which is settled in the same way as the 622 | first passed promise to settle. 623 | 624 | Example: 625 | 626 | ```javascript 627 | let promise1 = new Promise(function(resolve, reject){ 628 | setTimeout(function(){ 629 | resolve('promise 1'); 630 | }, 200); 631 | }); 632 | 633 | let promise2 = new Promise(function(resolve, reject){ 634 | setTimeout(function(){ 635 | resolve('promise 2'); 636 | }, 100); 637 | }); 638 | 639 | Promise.race([promise1, promise2]).then(function(result){ 640 | // result === 'promise 2' because it was resolved before promise1 641 | // was resolved. 642 | }); 643 | ``` 644 | 645 | `Promise.race` is deterministic in that only the state of the first 646 | settled promise matters. For example, even if other promises given to the 647 | `promises` array argument are resolved, but the first settled promise has 648 | become rejected before the other promises became fulfilled, the returned 649 | promise will become rejected: 650 | 651 | ```javascript 652 | let promise1 = new Promise(function(resolve, reject){ 653 | setTimeout(function(){ 654 | resolve('promise 1'); 655 | }, 200); 656 | }); 657 | 658 | let promise2 = new Promise(function(resolve, reject){ 659 | setTimeout(function(){ 660 | reject(new Error('promise 2')); 661 | }, 100); 662 | }); 663 | 664 | Promise.race([promise1, promise2]).then(function(result){ 665 | // Code here never runs 666 | }, function(reason){ 667 | // reason.message === 'promise 2' because promise 2 became rejected before 668 | // promise 1 became fulfilled 669 | }); 670 | ``` 671 | 672 | An example real-world use case is implementing timeouts: 673 | 674 | ```javascript 675 | Promise.race([ajax('foo.json'), timeout(5000)]) 676 | ``` 677 | 678 | @method race 679 | @static 680 | @param {Array} promises array of promises to observe 681 | Useful for tooling. 682 | @return {Promise} a promise which settles in the same way as the first passed 683 | promise to settle. 684 | */ 685 | function race(entries) { 686 | /*jshint validthis:true */ 687 | var Constructor = this; 688 | 689 | if (!isArray(entries)) { 690 | return new Constructor(function (_, reject) { 691 | return reject(new TypeError('You must pass an array to race.')); 692 | }); 693 | } else { 694 | return new Constructor(function (resolve, reject) { 695 | var length = entries.length; 696 | for (var i = 0; i < length; i++) { 697 | Constructor.resolve(entries[i]).then(resolve, reject); 698 | } 699 | }); 700 | } 701 | } 702 | 703 | /** 704 | `Promise.reject` returns a promise rejected with the passed `reason`. 705 | It is shorthand for the following: 706 | 707 | ```javascript 708 | let promise = new Promise(function(resolve, reject){ 709 | reject(new Error('WHOOPS')); 710 | }); 711 | 712 | promise.then(function(value){ 713 | // Code here doesn't run because the promise is rejected! 714 | }, function(reason){ 715 | // reason.message === 'WHOOPS' 716 | }); 717 | ``` 718 | 719 | Instead of writing the above, your code now simply becomes the following: 720 | 721 | ```javascript 722 | let promise = Promise.reject(new Error('WHOOPS')); 723 | 724 | promise.then(function(value){ 725 | // Code here doesn't run because the promise is rejected! 726 | }, function(reason){ 727 | // reason.message === 'WHOOPS' 728 | }); 729 | ``` 730 | 731 | @method reject 732 | @static 733 | @param {Any} reason value that the returned promise will be rejected with. 734 | Useful for tooling. 735 | @return {Promise} a promise rejected with the given `reason`. 736 | */ 737 | function reject$1(reason) { 738 | /*jshint validthis:true */ 739 | var Constructor = this; 740 | var promise = new Constructor(noop); 741 | reject(promise, reason); 742 | return promise; 743 | } 744 | 745 | function needsResolver() { 746 | throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); 747 | } 748 | 749 | function needsNew() { 750 | throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); 751 | } 752 | 753 | /** 754 | Promise objects represent the eventual result of an asynchronous operation. The 755 | primary way of interacting with a promise is through its `then` method, which 756 | registers callbacks to receive either a promise's eventual value or the reason 757 | why the promise cannot be fulfilled. 758 | 759 | Terminology 760 | ----------- 761 | 762 | - `promise` is an object or function with a `then` method whose behavior conforms to this specification. 763 | - `thenable` is an object or function that defines a `then` method. 764 | - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). 765 | - `exception` is a value that is thrown using the throw statement. 766 | - `reason` is a value that indicates why a promise was rejected. 767 | - `settled` the final resting state of a promise, fulfilled or rejected. 768 | 769 | A promise can be in one of three states: pending, fulfilled, or rejected. 770 | 771 | Promises that are fulfilled have a fulfillment value and are in the fulfilled 772 | state. Promises that are rejected have a rejection reason and are in the 773 | rejected state. A fulfillment value is never a thenable. 774 | 775 | Promises can also be said to *resolve* a value. If this value is also a 776 | promise, then the original promise's settled state will match the value's 777 | settled state. So a promise that *resolves* a promise that rejects will 778 | itself reject, and a promise that *resolves* a promise that fulfills will 779 | itself fulfill. 780 | 781 | 782 | Basic Usage: 783 | ------------ 784 | 785 | ```js 786 | let promise = new Promise(function(resolve, reject) { 787 | // on success 788 | resolve(value); 789 | 790 | // on failure 791 | reject(reason); 792 | }); 793 | 794 | promise.then(function(value) { 795 | // on fulfillment 796 | }, function(reason) { 797 | // on rejection 798 | }); 799 | ``` 800 | 801 | Advanced Usage: 802 | --------------- 803 | 804 | Promises shine when abstracting away asynchronous interactions such as 805 | `XMLHttpRequest`s. 806 | 807 | ```js 808 | function getJSON(url) { 809 | return new Promise(function(resolve, reject){ 810 | let xhr = new XMLHttpRequest(); 811 | 812 | xhr.open('GET', url); 813 | xhr.onreadystatechange = handler; 814 | xhr.responseType = 'json'; 815 | xhr.setRequestHeader('Accept', 'application/json'); 816 | xhr.send(); 817 | 818 | function handler() { 819 | if (this.readyState === this.DONE) { 820 | if (this.status === 200) { 821 | resolve(this.response); 822 | } else { 823 | reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); 824 | } 825 | } 826 | }; 827 | }); 828 | } 829 | 830 | getJSON('/posts.json').then(function(json) { 831 | // on fulfillment 832 | }, function(reason) { 833 | // on rejection 834 | }); 835 | ``` 836 | 837 | Unlike callbacks, promises are great composable primitives. 838 | 839 | ```js 840 | Promise.all([ 841 | getJSON('/posts'), 842 | getJSON('/comments') 843 | ]).then(function(values){ 844 | values[0] // => postsJSON 845 | values[1] // => commentsJSON 846 | 847 | return values; 848 | }); 849 | ``` 850 | 851 | @class Promise 852 | @param {Function} resolver 853 | Useful for tooling. 854 | @constructor 855 | */ 856 | 857 | var Promise$2 = function () { 858 | function Promise(resolver) { 859 | this[PROMISE_ID] = nextId(); 860 | this._result = this._state = undefined; 861 | this._subscribers = []; 862 | 863 | if (noop !== resolver) { 864 | typeof resolver !== 'function' && needsResolver(); 865 | this instanceof Promise ? initializePromise(this, resolver) : needsNew(); 866 | } 867 | } 868 | 869 | /** 870 | The primary way of interacting with a promise is through its `then` method, 871 | which registers callbacks to receive either a promise's eventual value or the 872 | reason why the promise cannot be fulfilled. 873 | ```js 874 | findUser().then(function(user){ 875 | // user is available 876 | }, function(reason){ 877 | // user is unavailable, and you are given the reason why 878 | }); 879 | ``` 880 | Chaining 881 | -------- 882 | The return value of `then` is itself a promise. This second, 'downstream' 883 | promise is resolved with the return value of the first promise's fulfillment 884 | or rejection handler, or rejected if the handler throws an exception. 885 | ```js 886 | findUser().then(function (user) { 887 | return user.name; 888 | }, function (reason) { 889 | return 'default name'; 890 | }).then(function (userName) { 891 | // If `findUser` fulfilled, `userName` will be the user's name, otherwise it 892 | // will be `'default name'` 893 | }); 894 | findUser().then(function (user) { 895 | throw new Error('Found user, but still unhappy'); 896 | }, function (reason) { 897 | throw new Error('`findUser` rejected and we're unhappy'); 898 | }).then(function (value) { 899 | // never reached 900 | }, function (reason) { 901 | // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. 902 | // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. 903 | }); 904 | ``` 905 | If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. 906 | ```js 907 | findUser().then(function (user) { 908 | throw new PedagogicalException('Upstream error'); 909 | }).then(function (value) { 910 | // never reached 911 | }).then(function (value) { 912 | // never reached 913 | }, function (reason) { 914 | // The `PedgagocialException` is propagated all the way down to here 915 | }); 916 | ``` 917 | Assimilation 918 | ------------ 919 | Sometimes the value you want to propagate to a downstream promise can only be 920 | retrieved asynchronously. This can be achieved by returning a promise in the 921 | fulfillment or rejection handler. The downstream promise will then be pending 922 | until the returned promise is settled. This is called *assimilation*. 923 | ```js 924 | findUser().then(function (user) { 925 | return findCommentsByAuthor(user); 926 | }).then(function (comments) { 927 | // The user's comments are now available 928 | }); 929 | ``` 930 | If the assimliated promise rejects, then the downstream promise will also reject. 931 | ```js 932 | findUser().then(function (user) { 933 | return findCommentsByAuthor(user); 934 | }).then(function (comments) { 935 | // If `findCommentsByAuthor` fulfills, we'll have the value here 936 | }, function (reason) { 937 | // If `findCommentsByAuthor` rejects, we'll have the reason here 938 | }); 939 | ``` 940 | Simple Example 941 | -------------- 942 | Synchronous Example 943 | ```javascript 944 | let result; 945 | try { 946 | result = findResult(); 947 | // success 948 | } catch(reason) { 949 | // failure 950 | } 951 | ``` 952 | Errback Example 953 | ```js 954 | findResult(function(result, err){ 955 | if (err) { 956 | // failure 957 | } else { 958 | // success 959 | } 960 | }); 961 | ``` 962 | Promise Example; 963 | ```javascript 964 | findResult().then(function(result){ 965 | // success 966 | }, function(reason){ 967 | // failure 968 | }); 969 | ``` 970 | Advanced Example 971 | -------------- 972 | Synchronous Example 973 | ```javascript 974 | let author, books; 975 | try { 976 | author = findAuthor(); 977 | books = findBooksByAuthor(author); 978 | // success 979 | } catch(reason) { 980 | // failure 981 | } 982 | ``` 983 | Errback Example 984 | ```js 985 | function foundBooks(books) { 986 | } 987 | function failure(reason) { 988 | } 989 | findAuthor(function(author, err){ 990 | if (err) { 991 | failure(err); 992 | // failure 993 | } else { 994 | try { 995 | findBoooksByAuthor(author, function(books, err) { 996 | if (err) { 997 | failure(err); 998 | } else { 999 | try { 1000 | foundBooks(books); 1001 | } catch(reason) { 1002 | failure(reason); 1003 | } 1004 | } 1005 | }); 1006 | } catch(error) { 1007 | failure(err); 1008 | } 1009 | // success 1010 | } 1011 | }); 1012 | ``` 1013 | Promise Example; 1014 | ```javascript 1015 | findAuthor(). 1016 | then(findBooksByAuthor). 1017 | then(function(books){ 1018 | // found books 1019 | }).catch(function(reason){ 1020 | // something went wrong 1021 | }); 1022 | ``` 1023 | @method then 1024 | @param {Function} onFulfilled 1025 | @param {Function} onRejected 1026 | Useful for tooling. 1027 | @return {Promise} 1028 | */ 1029 | 1030 | /** 1031 | `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same 1032 | as the catch block of a try/catch statement. 1033 | ```js 1034 | function findAuthor(){ 1035 | throw new Error('couldn't find that author'); 1036 | } 1037 | // synchronous 1038 | try { 1039 | findAuthor(); 1040 | } catch(reason) { 1041 | // something went wrong 1042 | } 1043 | // async with promises 1044 | findAuthor().catch(function(reason){ 1045 | // something went wrong 1046 | }); 1047 | ``` 1048 | @method catch 1049 | @param {Function} onRejection 1050 | Useful for tooling. 1051 | @return {Promise} 1052 | */ 1053 | 1054 | 1055 | Promise.prototype.catch = function _catch(onRejection) { 1056 | return this.then(null, onRejection); 1057 | }; 1058 | 1059 | /** 1060 | `finally` will be invoked regardless of the promise's fate just as native 1061 | try/catch/finally behaves 1062 | 1063 | Synchronous example: 1064 | 1065 | ```js 1066 | findAuthor() { 1067 | if (Math.random() > 0.5) { 1068 | throw new Error(); 1069 | } 1070 | return new Author(); 1071 | } 1072 | 1073 | try { 1074 | return findAuthor(); // succeed or fail 1075 | } catch(error) { 1076 | return findOtherAuther(); 1077 | } finally { 1078 | // always runs 1079 | // doesn't affect the return value 1080 | } 1081 | ``` 1082 | 1083 | Asynchronous example: 1084 | 1085 | ```js 1086 | findAuthor().catch(function(reason){ 1087 | return findOtherAuther(); 1088 | }).finally(function(){ 1089 | // author was either found, or not 1090 | }); 1091 | ``` 1092 | 1093 | @method finally 1094 | @param {Function} callback 1095 | @return {Promise} 1096 | */ 1097 | 1098 | 1099 | Promise.prototype.finally = function _finally(callback) { 1100 | var promise = this; 1101 | var constructor = promise.constructor; 1102 | 1103 | if (isFunction(callback)) { 1104 | return promise.then(function (value) { 1105 | return constructor.resolve(callback()).then(function () { 1106 | return value; 1107 | }); 1108 | }, function (reason) { 1109 | return constructor.resolve(callback()).then(function () { 1110 | throw reason; 1111 | }); 1112 | }); 1113 | } 1114 | 1115 | return promise.then(callback, callback); 1116 | }; 1117 | 1118 | return Promise; 1119 | }(); 1120 | 1121 | Promise$2.prototype.then = then; 1122 | Promise$2.all = all; 1123 | Promise$2.race = race; 1124 | Promise$2.resolve = resolve$1; 1125 | Promise$2.reject = reject$1; 1126 | Promise$2._setScheduler = setScheduler; 1127 | Promise$2._setAsap = setAsap; 1128 | Promise$2._asap = asap; 1129 | 1130 | /*global self*/ 1131 | function polyfill() { 1132 | var local = void 0; 1133 | 1134 | if (typeof global !== 'undefined') { 1135 | local = global; 1136 | } else if (typeof self !== 'undefined') { 1137 | local = self; 1138 | } else { 1139 | try { 1140 | local = Function('return this')(); 1141 | } catch (e) { 1142 | throw new Error('polyfill failed because global object is unavailable in this environment'); 1143 | } 1144 | } 1145 | 1146 | var P = local.Promise; 1147 | 1148 | if (P) { 1149 | var promiseToString = null; 1150 | try { 1151 | promiseToString = Object.prototype.toString.call(P.resolve()); 1152 | } catch (e) { 1153 | // silently ignored 1154 | } 1155 | 1156 | if (promiseToString === '[object Promise]' && !P.cast) { 1157 | return; 1158 | } 1159 | } 1160 | 1161 | local.Promise = Promise$2; 1162 | } 1163 | 1164 | // Strange compat.. 1165 | Promise$2.polyfill = polyfill; 1166 | Promise$2.Promise = Promise$2; 1167 | 1168 | Promise$2.polyfill(); 1169 | 1170 | return Promise$2; 1171 | 1172 | }))); 1173 | 1174 | 1175 | 1176 | //# sourceMappingURL=es6-promise.auto.map 1177 | -------------------------------------------------------------------------------- /tellme/static/tellme/vendor/html2canvas/html2canvas.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | html2canvas 0.5.0-beta3 3 | Copyright (c) 2016 Niklas von Hertzen 4 | 5 | Released under License 6 | */ 7 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.html2canvas=e()}}(function(){var e;return function n(e,f,o){function d(t,l){if(!f[t]){if(!e[t]){var s="function"==typeof require&&require;if(!l&&s)return s(t,!0);if(i)return i(t,!0);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}var a=f[t]={exports:{}};e[t][0].call(a.exports,function(n){var f=e[t][1][n];return d(f?f:n)},a,a.exports,n,e,f,o)}return f[t].exports}for(var i="function"==typeof require&&require,t=0;td;)n=e.charCodeAt(d++),n>=55296&&56319>=n&&i>d?(f=e.charCodeAt(d++),56320==(64512&f)?o.push(((1023&n)<<10)+(1023&f)+65536):(o.push(n),d--)):o.push(n);return o}function u(e){return t(e,function(e){var n="";return e>65535&&(e-=65536,n+=L(e>>>10&1023|55296),e=56320|1023&e),n+=L(e)}).join("")}function a(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:k}function p(e,n){return e+22+75*(26>e)-((0!=n)<<5)}function c(e,n,f){var o=0;for(e=f?K(e/B):e>>1,e+=K(e/n);e>J*z>>1;o+=k)e=K(e/J);return K(o+(J+1)*e/(e+A))}function y(e){var n,f,o,d,t,l,s,p,y,m,r=[],v=e.length,w=0,b=D,g=C;for(f=e.lastIndexOf(E),0>f&&(f=0),o=0;f>o;++o)e.charCodeAt(o)>=128&&i("not-basic"),r.push(e.charCodeAt(o));for(d=f>0?f+1:0;v>d;){for(t=w,l=1,s=k;d>=v&&i("invalid-input"),p=a(e.charCodeAt(d++)),(p>=k||p>K((j-w)/l))&&i("overflow"),w+=p*l,y=g>=s?q:s>=g+z?z:s-g,!(y>p);s+=k)m=k-y,l>K(j/m)&&i("overflow"),l*=m;n=r.length+1,g=c(w-t,n,0==t),K(w/n)>j-b&&i("overflow"),b+=K(w/n),w%=n,r.splice(w++,0,b)}return u(r)}function m(e){var n,f,o,d,t,l,u,a,y,m,r,v,w,b,g,h=[];for(e=s(e),v=e.length,n=D,f=0,t=C,l=0;v>l;++l)r=e[l],128>r&&h.push(L(r));for(o=d=h.length,d&&h.push(E);v>o;){for(u=j,l=0;v>l;++l)r=e[l],r>=n&&u>r&&(u=r);for(w=o+1,u-n>K((j-f)/w)&&i("overflow"),f+=(u-n)*w,n=u,l=0;v>l;++l)if(r=e[l],n>r&&++f>j&&i("overflow"),r==n){for(a=f,y=k;m=t>=y?q:y>=t+z?z:y-t,!(m>a);y+=k)g=a-m,b=k-m,h.push(L(p(m+g%b,0))),a=K(g/b);h.push(L(p(a,0))),t=c(f,w,o==d),f=0,++o}++f,++n}return h.join("")}function r(e){return l(e,function(e){return F.test(e)?y(e.slice(4).toLowerCase()):e})}function v(e){return l(e,function(e){return G.test(e)?"xn--"+m(e):e})}var w="object"==typeof o&&o,b="object"==typeof f&&f&&f.exports==w&&f,g="object"==typeof n&&n;(g.global===g||g.window===g)&&(d=g);var h,x,j=2147483647,k=36,q=1,z=26,A=38,B=700,C=72,D=128,E="-",F=/^xn--/,G=/[^ -~]/,H=/\x2E|\u3002|\uFF0E|\uFF61/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=k-q,K=Math.floor,L=String.fromCharCode;if(h={version:"1.2.4",ucs2:{decode:s,encode:u},decode:y,encode:m,toASCII:v,toUnicode:r},"function"==typeof e&&"object"==typeof e.amd&&e.amd)e("punycode",function(){return h});else if(w&&!w.nodeType)if(b)b.exports=h;else for(x in h)h.hasOwnProperty(x)&&(w[x]=h[x]);else d.punycode=h}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,n){function f(e,n,f){!e.defaultView||n===e.defaultView.pageXOffset&&f===e.defaultView.pageYOffset||e.defaultView.scrollTo(n,f)}function o(e,n){try{n&&(n.width=e.width,n.height=e.height,n.getContext("2d").putImageData(e.getContext("2d").getImageData(0,0,e.width,e.height),0,0))}catch(f){t("Unable to copy canvas content from",e,f)}}function d(e,n){for(var f=3===e.nodeType?document.createTextNode(e.nodeValue):e.cloneNode(!1),i=e.firstChild;i;)(n===!0||1!==i.nodeType||"SCRIPT"!==i.nodeName)&&f.appendChild(d(i,n)),i=i.nextSibling;return 1===e.nodeType&&(f._scrollTop=e.scrollTop,f._scrollLeft=e.scrollLeft,"CANVAS"===e.nodeName?o(e,f):("TEXTAREA"===e.nodeName||"SELECT"===e.nodeName)&&(f.value=e.value)),f}function i(e){if(1===e.nodeType){e.scrollTop=e._scrollTop,e.scrollLeft=e._scrollLeft;for(var n=e.firstChild;n;)i(n),n=n.nextSibling}}var t=e("./log");n.exports=function(e,n,o,t,l,s,u){var a=d(e.documentElement,l.javascriptEnabled),p=n.createElement("iframe");return p.className="html2canvas-container",p.style.visibility="hidden",p.style.position="fixed",p.style.left="-10000px",p.style.top="0px",p.style.border="0",p.width=o,p.height=t,p.scrolling="no",n.body.appendChild(p),new Promise(function(n){var o=p.contentWindow.document;p.contentWindow.onload=p.onload=function(){var e=setInterval(function(){o.body.childNodes.length>0&&(i(o.documentElement),clearInterval(e),"view"===l.type&&(p.contentWindow.scrollTo(s,u),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||p.contentWindow.scrollY===u&&p.contentWindow.scrollX===s||(o.documentElement.style.top=-u+"px",o.documentElement.style.left=-s+"px",o.documentElement.style.position="absolute")),n(p))},50)},o.open(),o.write(""),f(e,s,u),o.replaceChild(o.adoptNode(a),o.documentElement),o.close()})}},{"./log":13}],3:[function(e,n){function f(e){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(e)||this.namedColor(e)||this.rgb(e)||this.rgba(e)||this.hex6(e)||this.hex3(e)}f.prototype.darken=function(e){var n=1-e;return new f([Math.round(this.r*n),Math.round(this.g*n),Math.round(this.b*n),this.a])},f.prototype.isTransparent=function(){return 0===this.a},f.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},f.prototype.fromArray=function(e){return Array.isArray(e)&&(this.r=Math.min(e[0],255),this.g=Math.min(e[1],255),this.b=Math.min(e[2],255),e.length>3&&(this.a=e[3])),Array.isArray(e)};var o=/^#([a-f0-9]{3})$/i;f.prototype.hex3=function(e){var n=null;return null!==(n=e.match(o))&&(this.r=parseInt(n[1][0]+n[1][0],16),this.g=parseInt(n[1][1]+n[1][1],16),this.b=parseInt(n[1][2]+n[1][2],16)),null!==n};var d=/^#([a-f0-9]{6})$/i;f.prototype.hex6=function(e){var n=null;return null!==(n=e.match(d))&&(this.r=parseInt(n[1].substring(0,2),16),this.g=parseInt(n[1].substring(2,4),16),this.b=parseInt(n[1].substring(4,6),16)),null!==n};var i=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;f.prototype.rgb=function(e){var n=null;return null!==(n=e.match(i))&&(this.r=Number(n[1]),this.g=Number(n[2]),this.b=Number(n[3])),null!==n};var t=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;f.prototype.rgba=function(e){var n=null;return null!==(n=e.match(t))&&(this.r=Number(n[1]),this.g=Number(n[2]),this.b=Number(n[3]),this.a=Number(n[4])),null!==n},f.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},f.prototype.namedColor=function(e){e=e.toLowerCase();var n=l[e];if(n)this.r=n[0],this.g=n[1],this.b=n[2];else if("transparent"===e)return this.r=this.g=this.b=this.a=0,!0;return!!n},f.prototype.isColor=!0;var l={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};n.exports=f},{}],4:[function(n,f){function o(e,n){var f=j++;if(n=n||{},n.logging&&(v.options.logging=!0,v.options.start=Date.now()),n.async="undefined"==typeof n.async?!0:n.async,n.allowTaint="undefined"==typeof n.allowTaint?!1:n.allowTaint,n.removeContainer="undefined"==typeof n.removeContainer?!0:n.removeContainer,n.javascriptEnabled="undefined"==typeof n.javascriptEnabled?!1:n.javascriptEnabled,n.imageTimeout="undefined"==typeof n.imageTimeout?1e4:n.imageTimeout,n.renderer="function"==typeof n.renderer?n.renderer:c,n.strict=!!n.strict,"string"==typeof e){if("string"!=typeof n.proxy)return Promise.reject("Proxy must be used when rendering url");var o=null!=n.width?n.width:window.innerWidth,t=null!=n.height?n.height:window.innerHeight;return g(a(e),n.proxy,document,o,t,n).then(function(e){return i(e.contentWindow.document.documentElement,e,n,o,t)})}var l=(void 0===e?[document.documentElement]:e.length?e:[e])[0];return l.setAttribute(x+f,f),d(l.ownerDocument,n,l.ownerDocument.defaultView.innerWidth,l.ownerDocument.defaultView.innerHeight,f).then(function(e){return"function"==typeof n.onrendered&&(v("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),n.onrendered(e)),e})}function d(e,n,f,o,d){return b(e,e,f,o,n,e.defaultView.pageXOffset,e.defaultView.pageYOffset).then(function(t){v("Document cloned");var l=x+d,s="["+l+"='"+d+"']";e.querySelector(s).removeAttribute(l);var u=t.contentWindow,a=u.document.querySelector(s),p=Promise.resolve("function"==typeof n.onclone?n.onclone(u.document):!0);return p.then(function(){return i(a,t,n,f,o)})})}function i(e,n,f,o,d){var i=n.contentWindow,a=new p(i.document),c=new y(f,a),r=h(e),w="view"===f.type?o:s(i.document),b="view"===f.type?d:u(i.document),g=new f.renderer(w,b,c,f,document),x=new m(e,g,a,c,f);return x.ready.then(function(){v("Finished rendering");var o;return o="view"===f.type?l(g.canvas,{width:g.canvas.width,height:g.canvas.height,top:0,left:0,x:0,y:0}):e===i.document.body||e===i.document.documentElement||null!=f.canvas?g.canvas:l(g.canvas,{width:null!=f.width?f.width:r.width,height:null!=f.height?f.height:r.height,top:r.top,left:r.left,x:0,y:0}),t(n,f),o})}function t(e,n){n.removeContainer&&(e.parentNode.removeChild(e),v("Cleaned up container"))}function l(e,n){var f=document.createElement("canvas"),o=Math.min(e.width-1,Math.max(0,n.left)),d=Math.min(e.width,Math.max(1,n.left+n.width)),i=Math.min(e.height-1,Math.max(0,n.top)),t=Math.min(e.height,Math.max(1,n.top+n.height));f.width=n.width,f.height=n.height;var l=d-o,s=t-i;return v("Cropping canvas at:","left:",n.left,"top:",n.top,"width:",l,"height:",s),v("Resulting crop with width",n.width,"and height",n.height,"with x",o,"and y",i),f.getContext("2d").drawImage(e,o,i,l,s,n.x,n.y,l,s),f}function s(e){return Math.max(Math.max(e.body.scrollWidth,e.documentElement.scrollWidth),Math.max(e.body.offsetWidth,e.documentElement.offsetWidth),Math.max(e.body.clientWidth,e.documentElement.clientWidth))}function u(e){return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}function a(e){var n=document.createElement("a");return n.href=e,n.href=n.href,n}var p=n("./support"),c=n("./renderers/canvas"),y=n("./imageloader"),m=n("./nodeparser"),r=n("./nodecontainer"),v=n("./log"),w=n("./utils"),b=n("./clone"),g=n("./proxy").loadUrlDocument,h=w.getBounds,x="data-html2canvas-node",j=0;o.CanvasRenderer=c,o.NodeContainer=r,o.log=v,o.utils=w;var k="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return Promise.reject("No canvas support")}:o;f.exports=k,"function"==typeof e&&e.amd&&e("html2canvas",[],function(){return k})},{"./clone":2,"./imageloader":11,"./log":13,"./nodecontainer":14,"./nodeparser":15,"./proxy":16,"./renderers/canvas":20,"./support":22,"./utils":26}],5:[function(e,n){function f(e){if(this.src=e,o("DummyImageContainer for",e),!this.promise||!this.image){o("Initiating DummyImageContainer"),f.prototype.image=new Image;var n=this.image;f.prototype.promise=new Promise(function(e,f){n.onload=e,n.onerror=f,n.src=d(),n.complete===!0&&e(n)})}}var o=e("./log"),d=e("./utils").smallImage;n.exports=f},{"./log":13,"./utils":26}],6:[function(e,n){function f(e,n){var f,d,i=document.createElement("div"),t=document.createElement("img"),l=document.createElement("span"),s="Hidden Text";i.style.visibility="hidden",i.style.fontFamily=e,i.style.fontSize=n,i.style.margin=0,i.style.padding=0,document.body.appendChild(i),t.src=o(),t.width=1,t.height=1,t.style.margin=0,t.style.padding=0,t.style.verticalAlign="baseline",l.style.fontFamily=e,l.style.fontSize=n,l.style.margin=0,l.style.padding=0,l.appendChild(document.createTextNode(s)),i.appendChild(l),i.appendChild(t),f=t.offsetTop-l.offsetTop+1,i.removeChild(l),i.appendChild(document.createTextNode(s)),i.style.lineHeight="normal",t.style.verticalAlign="super",d=t.offsetTop-i.offsetTop+1,document.body.removeChild(i),this.baseline=f,this.lineWidth=1,this.middle=d}var o=e("./utils").smallImage;n.exports=f},{"./utils":26}],7:[function(e,n){function f(){this.data={}}var o=e("./font");f.prototype.getMetrics=function(e,n){return void 0===this.data[e+"-"+n]&&(this.data[e+"-"+n]=new o(e,n)),this.data[e+"-"+n]},n.exports=f},{"./font":6}],8:[function(e,n){function f(n,f,o){this.image=null,this.src=n;var i=this,t=d(n);this.promise=(f?new Promise(function(e){"about:blank"===n.contentWindow.document.URL||null==n.contentWindow.document.documentElement?n.contentWindow.onload=n.onload=function(){e(n)}:e(n)}):this.proxyLoad(o.proxy,t,o)).then(function(n){var f=e("./core");return f(n.contentWindow.document.documentElement,{type:"view",width:n.width,height:n.height,proxy:o.proxy,javascriptEnabled:o.javascriptEnabled,removeContainer:o.removeContainer,allowTaint:o.allowTaint,imageTimeout:o.imageTimeout/2})}).then(function(e){return i.image=e})}var o=e("./utils"),d=o.getBounds,i=e("./proxy").loadUrlDocument;f.prototype.proxyLoad=function(e,n,f){var o=this.src;return i(o.src,e,o.ownerDocument,n.width,n.height,f)},n.exports=f},{"./core":4,"./proxy":16,"./utils":26}],9:[function(e,n){function f(e){this.src=e.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=Promise.resolve(!0)}f.TYPES={LINEAR:1,RADIAL:2},f.REGEXP_COLORSTOP=/^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i,n.exports=f},{}],10:[function(e,n){function f(e,n){this.src=e,this.image=new Image;var f=this;this.tainted=null,this.promise=new Promise(function(o,d){f.image.onload=o,f.image.onerror=d,n&&(f.image.crossOrigin="anonymous"),f.image.src=e,f.image.complete===!0&&o(f.image)})}n.exports=f},{}],11:[function(e,n){function f(e,n){this.link=null,this.options=e,this.support=n,this.origin=this.getOrigin(window.location.href)}var o=e("./log"),d=e("./imagecontainer"),i=e("./dummyimagecontainer"),t=e("./proxyimagecontainer"),l=e("./framecontainer"),s=e("./svgcontainer"),u=e("./svgnodecontainer"),a=e("./lineargradientcontainer"),p=e("./webkitgradientcontainer"),c=e("./utils").bind;f.prototype.findImages=function(e){var n=[];return e.reduce(function(e,n){switch(n.node.nodeName){case"IMG":return e.concat([{args:[n.node.src],method:"url"}]);case"svg":case"IFRAME":return e.concat([{args:[n.node],method:n.node.nodeName}])}return e},[]).forEach(this.addImage(n,this.loadImage),this),n},f.prototype.findBackgroundImage=function(e,n){return n.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(e,this.loadImage),this),e},f.prototype.addImage=function(e,n){return function(f){f.args.forEach(function(d){this.imageExists(e,d)||(e.splice(0,0,n.call(this,f)),o("Added image #"+e.length,"string"==typeof d?d.substring(0,100):d))},this)}},f.prototype.hasImageBackground=function(e){return"none"!==e.method},f.prototype.loadImage=function(e){if("url"===e.method){var n=e.args[0];return!this.isSVG(n)||this.support.svg||this.options.allowTaint?n.match(/data:image\/.*;base64,/i)?new d(n.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(n)||this.options.allowTaint===!0||this.isSVG(n)?new d(n,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new d(n,!0):this.options.proxy?new t(n,this.options.proxy):new i(n):new s(n)}return"linear-gradient"===e.method?new a(e):"gradient"===e.method?new p(e):"svg"===e.method?new u(e.args[0],this.support.svg):"IFRAME"===e.method?new l(e.args[0],this.isSameOrigin(e.args[0].src),this.options):new i(e)},f.prototype.isSVG=function(e){return"svg"===e.substring(e.length-3).toLowerCase()||s.prototype.isInline(e)},f.prototype.imageExists=function(e,n){return e.some(function(e){return e.src===n})},f.prototype.isSameOrigin=function(e){return this.getOrigin(e)===this.origin},f.prototype.getOrigin=function(e){var n=this.link||(this.link=document.createElement("a"));return n.href=e,n.href=n.href,n.protocol+n.hostname+n.port},f.prototype.getPromise=function(e){return this.timeout(e,this.options.imageTimeout)["catch"](function(){var n=new i(e.src);return n.promise.then(function(n){e.image=n})})},f.prototype.get=function(e){var n=null;return this.images.some(function(f){return(n=f).src===e})?n:null},f.prototype.fetch=function(e){return this.images=e.reduce(c(this.findBackgroundImage,this),this.findImages(e)),this.images.forEach(function(e,n){e.promise.then(function(){o("Succesfully loaded image #"+(n+1),e)},function(f){o("Failed loading image #"+(n+1),e,f)})}),this.ready=Promise.all(this.images.map(this.getPromise,this)),o("Finished searching images"),this},f.prototype.timeout=function(e,n){var f,d=Promise.race([e.promise,new Promise(function(d,i){f=setTimeout(function(){o("Timed out loading image",e),i(e)},n)})]).then(function(e){return clearTimeout(f),e});return d["catch"](function(){clearTimeout(f)}),d},n.exports=f},{"./dummyimagecontainer":5,"./framecontainer":8,"./imagecontainer":10,"./lineargradientcontainer":12,"./log":13,"./proxyimagecontainer":17,"./svgcontainer":23,"./svgnodecontainer":24,"./utils":26,"./webkitgradientcontainer":27}],12:[function(e,n){function f(e){o.apply(this,arguments),this.type=o.TYPES.LINEAR;var n=f.REGEXP_DIRECTION.test(e.args[0])||!o.REGEXP_COLORSTOP.test(e.args[0]);n?e.args[0].split(/\s+/).reverse().forEach(function(e,n){switch(e){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var f=this.y0,o=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=o,this.y1=f;break;case"center":break;default:var d=.01*parseFloat(e,10);if(isNaN(d))break;0===n?(this.y0=d,this.y1=1-this.y0):(this.x0=d,this.x1=1-this.x0)}},this):(this.y0=0,this.y1=1),this.colorStops=e.args.slice(n?1:0).map(function(e){var n=e.match(o.REGEXP_COLORSTOP),f=+n[2],i=0===f?"%":n[3];return{color:new d(n[1]),stop:"%"===i?f/100:null}}),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(e,n){null===e.stop&&this.colorStops.slice(n).some(function(f,o){return null!==f.stop?(e.stop=(f.stop-this.colorStops[n-1].stop)/(o+1)+this.colorStops[n-1].stop,!0):!1},this)},this)}var o=e("./gradientcontainer"),d=e("./color");f.prototype=Object.create(o.prototype),f.REGEXP_DIRECTION=/^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i,n.exports=f},{"./color":3,"./gradientcontainer":9}],13:[function(e,n){var f=function(){f.options.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-f.options.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))};f.options={logging:!1},n.exports=f},{}],14:[function(e,n){function f(e,n){this.node=e,this.parent=n,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function o(e){var n=e.options[e.selectedIndex||0];return n?n.text||"":""}function d(e){if(e&&"matrix"===e[1])return e[2].split(",").map(function(e){return parseFloat(e.trim())});if(e&&"matrix3d"===e[1]){var n=e[2].split(",").map(function(e){return parseFloat(e.trim())});return[n[0],n[1],n[4],n[5],n[12],n[13]]}}function i(e){return-1!==e.toString().indexOf("%")}function t(e){return e.replace("px","")}function l(e){return parseFloat(e)}var s=e("./color"),u=e("./utils"),a=u.getBounds,p=u.parseBackgrounds,c=u.offsetBounds;f.prototype.cloneTo=function(e){e.visible=this.visible,e.borders=this.borders,e.bounds=this.bounds,e.clip=this.clip,e.backgroundClip=this.backgroundClip,e.computedStyles=this.computedStyles,e.styles=this.styles,e.backgroundImages=this.backgroundImages,e.opacity=this.opacity},f.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},f.prototype.assignStack=function(e){this.stack=e,e.children.push(this)},f.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},f.prototype.css=function(e){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[e]||(this.styles[e]=this.computedStyles[e])},f.prototype.prefixedCss=function(e){var n=["webkit","moz","ms","o"],f=this.css(e);return void 0===f&&n.some(function(n){return f=this.css(n+e.substr(0,1).toUpperCase()+e.substr(1)),void 0!==f},this),void 0===f?null:f},f.prototype.computedStyle=function(e){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,e)},f.prototype.cssInt=function(e){var n=parseInt(this.css(e),10);return isNaN(n)?0:n},f.prototype.color=function(e){return this.colors[e]||(this.colors[e]=new s(this.css(e)))},f.prototype.cssFloat=function(e){var n=parseFloat(this.css(e));return isNaN(n)?0:n},f.prototype.fontWeight=function(){var e=this.css("fontWeight");switch(parseInt(e,10)){case 401:e="bold";break;case 400:e="normal"}return e},f.prototype.parseClip=function(){var e=this.css("clip").match(this.CLIP);return e?{top:parseInt(e[1],10),right:parseInt(e[2],10),bottom:parseInt(e[3],10),left:parseInt(e[4],10)}:null},f.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=p(this.css("backgroundImage")))},f.prototype.cssList=function(e,n){var f=(this.css(e)||"").split(",");return f=f[n||0]||f[0]||"auto",f=f.trim().split(" "),1===f.length&&(f=[f[0],i(f[0])?"auto":f[0]]),f},f.prototype.parseBackgroundSize=function(e,n,f){var o,d,t=this.cssList("backgroundSize",f);if(i(t[0]))o=e.width*parseFloat(t[0])/100;else{if(/contain|cover/.test(t[0])){var l=e.width/e.height,s=n.width/n.height;return s>l^"contain"===t[0]?{width:e.height*s,height:e.height}:{width:e.width,height:e.width/s}}o=parseInt(t[0],10)}return d="auto"===t[0]&&"auto"===t[1]?n.height:"auto"===t[1]?o/n.width*n.height:i(t[1])?e.height*parseFloat(t[1])/100:parseInt(t[1],10),"auto"===t[0]&&(o=d/n.height*n.width),{width:o,height:d}},f.prototype.parseBackgroundPosition=function(e,n,f,o){var d,t,l=this.cssList("backgroundPosition",f);return d=i(l[0])?(e.width-(o||n).width)*(parseFloat(l[0])/100):parseInt(l[0],10),t="auto"===l[1]?d/n.width*n.height:i(l[1])?(e.height-(o||n).height)*parseFloat(l[1])/100:parseInt(l[1],10),"auto"===l[0]&&(d=t/n.height*n.width),{left:d,top:t}},f.prototype.parseBackgroundRepeat=function(e){return this.cssList("backgroundRepeat",e)[0]},f.prototype.parseTextShadows=function(){var e=this.css("textShadow"),n=[];if(e&&"none"!==e)for(var f=e.match(this.TEXT_SHADOW_PROPERTY),o=0;f&&o0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,e)):e():(this.renderQueue.forEach(this.paint,this),e())},this))},this))}function o(e){return e.parent&&e.parent.clip.length}function d(e){return e.replace(/(\-[a-z])/g,function(e){return e.toUpperCase().replace("-","")})}function i(){}function t(e,n,f,o){return e.map(function(d,i){if(d.width>0){var t=n.left,l=n.top,s=n.width,u=n.height-e[2].width;switch(i){case 0:u=e[0].width,d.args=a({c1:[t,l],c2:[t+s,l],c3:[t+s-e[1].width,l+u],c4:[t+e[3].width,l+u]},o[0],o[1],f.topLeftOuter,f.topLeftInner,f.topRightOuter,f.topRightInner);break;case 1:t=n.left+n.width-e[1].width,s=e[1].width,d.args=a({c1:[t+s,l],c2:[t+s,l+u+e[2].width],c3:[t,l+u],c4:[t,l+e[0].width]},o[1],o[2],f.topRightOuter,f.topRightInner,f.bottomRightOuter,f.bottomRightInner);break;case 2:l=l+n.height-e[2].width,u=e[2].width,d.args=a({c1:[t+s,l+u],c2:[t,l+u],c3:[t+e[3].width,l],c4:[t+s-e[3].width,l]},o[2],o[3],f.bottomRightOuter,f.bottomRightInner,f.bottomLeftOuter,f.bottomLeftInner);break;case 3:s=e[3].width,d.args=a({c1:[t,l+u+e[2].width],c2:[t,l],c3:[t+s,l+e[0].width],c4:[t+s,l+u]},o[3],o[0],f.bottomLeftOuter,f.bottomLeftInner,f.topLeftOuter,f.topLeftInner)}}return d})}function l(e,n,f,o){var d=4*((Math.sqrt(2)-1)/3),i=f*d,t=o*d,l=e+f,s=n+o;return{topLeft:u({x:e,y:s},{x:e,y:s-t},{x:l-i,y:n},{x:l,y:n}),topRight:u({x:e,y:n},{x:e+i,y:n},{x:l,y:s-t},{x:l,y:s}),bottomRight:u({x:l,y:n},{x:l,y:n+t},{x:e+i,y:s},{x:e,y:s}),bottomLeft:u({x:l,y:s},{x:l-i,y:s},{x:e,y:n+t},{x:e,y:n})}}function s(e,n,f){var o=e.left,d=e.top,i=e.width,t=e.height,s=n[0][0]i+f[3].width?0:a-f[3].width,p-f[0].width).topRight.subdivide(.5),bottomRightOuter:l(o+b,d+w,c,y).bottomRight.subdivide(.5),bottomRightInner:l(o+Math.min(b,i-f[3].width),d+Math.min(w,t+f[0].width),Math.max(0,c-f[1].width),y-f[2].width).bottomRight.subdivide(.5),bottomLeftOuter:l(o,d+g,m,r).bottomLeft.subdivide(.5),bottomLeftInner:l(o+f[3].width,d+g,Math.max(0,m-f[3].width),r-f[2].width).bottomLeft.subdivide(.5)} 8 | }function u(e,n,f,o){var d=function(e,n,f){return{x:e.x+(n.x-e.x)*f,y:e.y+(n.y-e.y)*f}};return{start:e,startControl:n,endControl:f,end:o,subdivide:function(i){var t=d(e,n,i),l=d(n,f,i),s=d(f,o,i),a=d(t,l,i),p=d(l,s,i),c=d(a,p,i);return[u(e,t,a,c),u(c,p,s,o)]},curveTo:function(e){e.push(["bezierCurve",n.x,n.y,f.x,f.y,o.x,o.y])},curveToReversed:function(o){o.push(["bezierCurve",f.x,f.y,n.x,n.y,e.x,e.y])}}}function a(e,n,f,o,d,i,t){var l=[];return n[0]>0||n[1]>0?(l.push(["line",o[1].start.x,o[1].start.y]),o[1].curveTo(l)):l.push(["line",e.c1[0],e.c1[1]]),f[0]>0||f[1]>0?(l.push(["line",i[0].start.x,i[0].start.y]),i[0].curveTo(l),l.push(["line",t[0].end.x,t[0].end.y]),t[0].curveToReversed(l)):(l.push(["line",e.c2[0],e.c2[1]]),l.push(["line",e.c3[0],e.c3[1]])),n[0]>0||n[1]>0?(l.push(["line",d[1].end.x,d[1].end.y]),d[1].curveToReversed(l)):l.push(["line",e.c4[0],e.c4[1]]),l}function p(e,n,f,o,d,i,t){n[0]>0||n[1]>0?(e.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(e),o[1].curveTo(e)):e.push(["line",i,t]),(f[0]>0||f[1]>0)&&e.push(["line",d[0].start.x,d[0].start.y])}function c(e){return e.cssInt("zIndex")<0}function y(e){return e.cssInt("zIndex")>0}function m(e){return 0===e.cssInt("zIndex")}function r(e){return-1!==["inline","inline-block","inline-table"].indexOf(e.css("display"))}function v(e){return e instanceof U}function w(e){return e.node.data.trim().length>0}function b(e){return/^(normal|none|0px)$/.test(e.parent.css("letterSpacing"))}function g(e){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(n){var f=e.css("border"+n+"Radius"),o=f.split(" ");return o.length<=1&&(o[1]=o[0]),o.map(F)})}function h(e){return e.nodeType===Node.TEXT_NODE||e.nodeType===Node.ELEMENT_NODE}function x(e){var n=e.css("position"),f=-1!==["absolute","relative","fixed"].indexOf(n)?e.css("zIndex"):"auto";return"auto"!==f}function j(e){return"static"!==e.css("position")}function k(e){return"none"!==e.css("float")}function q(e){return-1!==["inline-block","inline-table"].indexOf(e.css("display"))}function z(e){var n=this;return function(){return!e.apply(n,arguments)}}function A(e){return e.node.nodeType===Node.ELEMENT_NODE}function B(e){return e.isPseudoElement===!0}function C(e){return e.node.nodeType===Node.TEXT_NODE}function D(e){return function(n,f){return n.cssInt("zIndex")+e.indexOf(n)/e.length-(f.cssInt("zIndex")+e.indexOf(f)/e.length)}}function E(e){return e.getOpacity()<1}function F(e){return parseInt(e,10)}function G(e){return e.width}function H(e){return e.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(e.node.nodeName)}function I(e){return[].concat.apply([],e)}function J(e){var n=e.substr(0,1);return n===e.substr(e.length-1)&&n.match(/'|"/)?e.substr(1,e.length-2):e}function K(e){for(var n,f=[],o=0,d=!1;e.length;)L(e[o])===d?(n=e.splice(0,o),n.length&&f.push(O.ucs2.encode(n)),d=!d,o=0):o++,o>=e.length&&(n=e.splice(0,o),n.length&&f.push(O.ucs2.encode(n)));return f}function L(e){return-1!==[32,13,10,9,45].indexOf(e)}function M(e){return/[^\u0000-\u00ff]/.test(e)}var N=e("./log"),O=e("punycode"),P=e("./nodecontainer"),Q=e("./textcontainer"),R=e("./pseudoelementcontainer"),S=e("./fontmetrics"),T=e("./color"),U=e("./stackingcontext"),V=e("./utils"),W=V.bind,X=V.getBounds,Y=V.parseBackgrounds,Z=V.offsetBounds;f.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(e){if(A(e)){B(e)&&e.appendToDOM(),e.borders=this.parseBorders(e);var n="hidden"===e.css("overflow")?[e.borders.clip]:[],f=e.parseClip();f&&-1!==["absolute","fixed"].indexOf(e.css("position"))&&n.push([["rect",e.bounds.left+f.left,e.bounds.top+f.top,f.right-f.left,f.bottom-f.top]]),e.clip=o(e)?e.parent.clip.concat(n):n,e.backgroundClip="hidden"!==e.css("overflow")?e.clip.concat([e.borders.clip]):e.clip,B(e)&&e.cleanDOM()}else C(e)&&(e.clip=o(e)?e.parent.clip:[]);B(e)||(e.bounds=null)},this)},f.prototype.asyncRenderer=function(e,n,f){f=f||Date.now(),this.paint(e[this.renderIndex++]),e.length===this.renderIndex?n():f+20>Date.now()?this.asyncRenderer(e,n,f):setTimeout(W(function(){this.asyncRenderer(e,n)},this),0)},f.prototype.createPseudoHideStyles=function(e){this.createStyles(e,"."+R.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+R.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},f.prototype.disableAnimations=function(e){this.createStyles(e,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},f.prototype.createStyles=function(e,n){var f=e.createElement("style");f.innerHTML=n,e.body.appendChild(f)},f.prototype.getPseudoElements=function(e){var n=[[e]];if(e.node.nodeType===Node.ELEMENT_NODE){var f=this.getPseudoElement(e,":before"),o=this.getPseudoElement(e,":after");f&&n.push(f),o&&n.push(o)}return I(n)},f.prototype.getPseudoElement=function(e,n){var f=e.computedStyle(n);if(!f||!f.content||"none"===f.content||"-moz-alt-content"===f.content||"none"===f.display)return null;for(var o=J(f.content),i="url"===o.substr(0,3),t=document.createElement(i?"img":"html2canvaspseudoelement"),l=new R(t,e,n),s=f.length-1;s>=0;s--){var u=d(f.item(s));t.style[u]=f[u]}if(t.className=R.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+R.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,i)return t.src=Y(o)[0].args[0],[l];var a=document.createTextNode(o);return t.appendChild(a),[l,new Q(a,l)]},f.prototype.getChildren=function(e){return I([].filter.call(e.node.childNodes,h).map(function(n){var f=[n.nodeType===Node.TEXT_NODE?new Q(n,e):new P(n,e)].filter(H);return n.nodeType===Node.ELEMENT_NODE&&f.length&&"TEXTAREA"!==n.tagName?f[0].isElementVisible()?f.concat(this.getChildren(f[0])):[]:f},this))},f.prototype.newStackingContext=function(e,n){var f=new U(n,e.getOpacity(),e.node,e.parent);e.cloneTo(f);var o=n?f.getParentStack(this):f.parent.stack;o.contexts.push(f),e.stack=f},f.prototype.createStackingContexts=function(){this.nodes.forEach(function(e){A(e)&&(this.isRootElement(e)||E(e)||x(e)||this.isBodyWithTransparentRoot(e)||e.hasTransform())?this.newStackingContext(e,!0):A(e)&&(j(e)&&m(e)||q(e)||k(e))?this.newStackingContext(e,!1):e.assignStack(e.parent.stack)},this)},f.prototype.isBodyWithTransparentRoot=function(e){return"BODY"===e.node.nodeName&&e.parent.color("backgroundColor").isTransparent()},f.prototype.isRootElement=function(e){return null===e.parent},f.prototype.sortStackingContexts=function(e){e.contexts.sort(D(e.contexts.slice(0))),e.contexts.forEach(this.sortStackingContexts,this)},f.prototype.parseTextBounds=function(e){return function(n,f,o){if("none"!==e.parent.css("textDecoration").substr(0,4)||0!==n.trim().length){if(this.support.rangeBounds&&!e.parent.hasTransform()){var d=o.slice(0,f).join("").length;return this.getRangeBounds(e.node,d,n.length)}if(e.node&&"string"==typeof e.node.data){var i=e.node.splitText(n.length),t=this.getWrapperBounds(e.node,e.parent.hasTransform());return e.node=i,t}}else(!this.support.rangeBounds||e.parent.hasTransform())&&(e.node=e.node.splitText(n.length));return{}}},f.prototype.getWrapperBounds=function(e,n){var f=e.ownerDocument.createElement("html2canvaswrapper"),o=e.parentNode,d=e.cloneNode(!0);f.appendChild(e.cloneNode(!0)),o.replaceChild(f,e);var i=n?Z(f):X(f);return o.replaceChild(d,f),i},f.prototype.getRangeBounds=function(e,n,f){var o=this.range||(this.range=e.ownerDocument.createRange());return o.setStart(e,n),o.setEnd(e,n+f),o.getBoundingClientRect()},f.prototype.parse=function(e){var n=e.contexts.filter(c),f=e.children.filter(A),o=f.filter(z(k)),d=o.filter(z(j)).filter(z(r)),t=f.filter(z(j)).filter(k),l=o.filter(z(j)).filter(r),s=e.contexts.concat(o.filter(j)).filter(m),u=e.children.filter(C).filter(w),a=e.contexts.filter(y);n.concat(d).concat(t).concat(l).concat(s).concat(u).concat(a).forEach(function(e){this.renderQueue.push(e),v(e)&&(this.parse(e),this.renderQueue.push(new i))},this)},f.prototype.paint=function(e){try{e instanceof i?this.renderer.ctx.restore():C(e)?(B(e.parent)&&e.parent.appendToDOM(),this.paintText(e),B(e.parent)&&e.parent.cleanDOM()):this.paintNode(e)}catch(n){if(N(n),this.options.strict)throw n}},f.prototype.paintNode=function(e){v(e)&&(this.renderer.setOpacity(e.opacity),this.renderer.ctx.save(),e.hasTransform()&&this.renderer.setTransform(e.parseTransform())),"INPUT"===e.node.nodeName&&"checkbox"===e.node.type?this.paintCheckbox(e):"INPUT"===e.node.nodeName&&"radio"===e.node.type?this.paintRadio(e):this.paintElement(e)},f.prototype.paintElement=function(e){var n=e.parseBounds();this.renderer.clip(e.backgroundClip,function(){this.renderer.renderBackground(e,n,e.borders.borders.map(G))},this),this.renderer.clip(e.clip,function(){this.renderer.renderBorders(e.borders.borders)},this),this.renderer.clip(e.backgroundClip,function(){switch(e.node.nodeName){case"svg":case"IFRAME":var f=this.images.get(e.node);f?this.renderer.renderImage(e,n,e.borders,f):N("Error loading <"+e.node.nodeName+">",e.node);break;case"IMG":var o=this.images.get(e.node.src);o?this.renderer.renderImage(e,n,e.borders,o):N("Error loading ",e.node.src);break;case"CANVAS":this.renderer.renderImage(e,n,e.borders,{image:e.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(e)}},this)},f.prototype.paintCheckbox=function(e){var n=e.parseBounds(),f=Math.min(n.width,n.height),o={width:f-1,height:f-1,top:n.top,left:n.left},d=[3,3],i=[d,d,d,d],l=[1,1,1,1].map(function(e){return{color:new T("#A5A5A5"),width:e}}),u=s(o,i,l);this.renderer.clip(e.backgroundClip,function(){this.renderer.rectangle(o.left+1,o.top+1,o.width-2,o.height-2,new T("#DEDEDE")),this.renderer.renderBorders(t(l,o,u,i)),e.node.checked&&(this.renderer.font(new T("#424242"),"normal","normal","bold",f-3+"px","arial"),this.renderer.text("✔",o.left+f/6,o.top+f-1))},this)},f.prototype.paintRadio=function(e){var n=e.parseBounds(),f=Math.min(n.width,n.height)-2;this.renderer.clip(e.backgroundClip,function(){this.renderer.circleStroke(n.left+1,n.top+1,f,new T("#DEDEDE"),1,new T("#A5A5A5")),e.node.checked&&this.renderer.circle(Math.ceil(n.left+f/4)+1,Math.ceil(n.top+f/4)+1,Math.floor(f/2),new T("#424242"))},this)},f.prototype.paintFormValue=function(e){var n=e.getValue();if(n.length>0){var f=e.node.ownerDocument,o=f.createElement("html2canvaswrapper"),d=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];d.forEach(function(n){try{o.style[n]=e.css(n)}catch(f){N("html2canvas: Parse: Exception caught in renderFormValue: "+f.message)}});var i=e.parseBounds();o.style.position="fixed",o.style.left=i.left+"px",o.style.top=i.top+"px",o.textContent=n,f.body.appendChild(o),this.paintText(new Q(o.firstChild,e)),f.body.removeChild(o)}},f.prototype.paintText=function(e){e.applyTextTransform();var n=O.ucs2.decode(e.node.data),f=this.options.letterRendering&&!b(e)||M(e.node.data)?n.map(function(e){return O.ucs2.encode([e])}):K(n),o=e.parent.fontWeight(),d=e.parent.css("fontSize"),i=e.parent.css("fontFamily"),t=e.parent.parseTextShadows();this.renderer.font(e.parent.color("color"),e.parent.css("fontStyle"),e.parent.css("fontVariant"),o,d,i),t.length?this.renderer.fontShadow(t[0].color,t[0].offsetX,t[0].offsetY,t[0].blur):this.renderer.clearShadow(),this.renderer.clip(e.parent.clip,function(){f.map(this.parseTextBounds(e),this).forEach(function(n,o){n&&(this.renderer.text(f[o],n.left,n.bottom),this.renderTextDecoration(e.parent,n,this.fontMetrics.getMetrics(i,d)))},this)},this)},f.prototype.renderTextDecoration=function(e,n,f){switch(e.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(n.left,Math.round(n.top+f.baseline+f.lineWidth),n.width,1,e.color("color"));break;case"overline":this.renderer.rectangle(n.left,Math.round(n.top),n.width,1,e.color("color"));break;case"line-through":this.renderer.rectangle(n.left,Math.ceil(n.top+f.middle+f.lineWidth),n.width,1,e.color("color"))}};var $={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};f.prototype.parseBorders=function(e){var n=e.parseBounds(),f=g(e),o=["Top","Right","Bottom","Left"].map(function(n,f){var o=e.css("border"+n+"Style"),d=e.color("border"+n+"Color");"inset"===o&&d.isBlack()&&(d=new T([255,255,255,d.a]));var i=$[o]?$[o][f]:null;return{width:e.cssInt("border"+n+"Width"),color:i?d[i[0]](i[1]):d,args:null}}),d=s(n,f,o);return{clip:this.parseBackgroundClip(e,d,o,f,n),borders:t(o,n,d,f)}},f.prototype.parseBackgroundClip=function(e,n,f,o,d){var i=e.css("backgroundClip"),t=[];switch(i){case"content-box":case"padding-box":p(t,o[0],o[1],n.topLeftInner,n.topRightInner,d.left+f[3].width,d.top+f[0].width),p(t,o[1],o[2],n.topRightInner,n.bottomRightInner,d.left+d.width-f[1].width,d.top+f[0].width),p(t,o[2],o[3],n.bottomRightInner,n.bottomLeftInner,d.left+d.width-f[1].width,d.top+d.height-f[2].width),p(t,o[3],o[0],n.bottomLeftInner,n.topLeftInner,d.left+f[3].width,d.top+d.height-f[2].width);break;default:p(t,o[0],o[1],n.topLeftOuter,n.topRightOuter,d.left,d.top),p(t,o[1],o[2],n.topRightOuter,n.bottomRightOuter,d.left+d.width,d.top),p(t,o[2],o[3],n.bottomRightOuter,n.bottomLeftOuter,d.left+d.width,d.top+d.height),p(t,o[3],o[0],n.bottomLeftOuter,n.topLeftOuter,d.left,d.top+d.height)}return t},n.exports=f},{"./color":3,"./fontmetrics":7,"./log":13,"./nodecontainer":14,"./pseudoelementcontainer":18,"./stackingcontext":21,"./textcontainer":25,"./utils":26,punycode:1}],16:[function(e,n,f){function o(e,n,f){var o="withCredentials"in new XMLHttpRequest;if(!n)return Promise.reject("No proxy configured");var d=t(o),s=l(n,e,d);return o?a(s):i(f,s,d).then(function(e){return m(e.content)})}function d(e,n,f){var o="crossOrigin"in new Image,d=t(o),s=l(n,e,d);return o?Promise.resolve(s):i(f,s,d).then(function(e){return"data:"+e.type+";base64,"+e.content})}function i(e,n,f){return new Promise(function(o,d){var i=e.createElement("script"),t=function(){delete window.html2canvas.proxy[f],e.body.removeChild(i)};window.html2canvas.proxy[f]=function(e){t(),o(e)},i.src=n,i.onerror=function(e){t(),d(e)},e.body.appendChild(i)})}function t(e){return e?"":"html2canvas_"+Date.now()+"_"+ ++r+"_"+Math.round(1e5*Math.random())}function l(e,n,f){return e+"?url="+encodeURIComponent(n)+(f.length?"&callback=html2canvas.proxy."+f:"")}function s(e){return function(n){var f,o=new DOMParser;try{f=o.parseFromString(n,"text/html")}catch(d){c("DOMParser not supported, falling back to createHTMLDocument"),f=document.implementation.createHTMLDocument("");try{f.open(),f.write(n),f.close()}catch(i){c("createHTMLDocument write not supported, falling back to document.body.innerHTML"),f.body.innerHTML=n}}var t=f.querySelector("base");if(!t||!t.href.host){var l=f.createElement("base");l.href=e,f.head.insertBefore(l,f.head.firstChild)}return f}}function u(e,n,f,d,i,t){return new o(e,n,window.document).then(s(e)).then(function(e){return y(e,f,d,i,t,0,0)})}var a=e("./xhr"),p=e("./utils"),c=e("./log"),y=e("./clone"),m=p.decode64,r=0;f.Proxy=o,f.ProxyURL=d,f.loadUrlDocument=u},{"./clone":2,"./log":13,"./utils":26,"./xhr":28}],17:[function(e,n){function f(e,n){var f=document.createElement("a");f.href=e,e=f.href,this.src=e,this.image=new Image;var d=this;this.promise=new Promise(function(f,i){d.image.crossOrigin="Anonymous",d.image.onload=f,d.image.onerror=i,new o(e,n,document).then(function(e){d.image.src=e})["catch"](i)})}var o=e("./proxy").ProxyURL;n.exports=f},{"./proxy":16}],18:[function(e,n){function f(e,n,f){o.call(this,e,n),this.isPseudoElement=!0,this.before=":before"===f}var o=e("./nodecontainer");f.prototype.cloneTo=function(e){f.prototype.cloneTo.call(this,e),e.isPseudoElement=!0,e.before=this.before},f.prototype=Object.create(o.prototype),f.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},f.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},f.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},f.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",f.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",n.exports=f},{"./nodecontainer":14}],19:[function(e,n){function f(e,n,f,o,d){this.width=e,this.height=n,this.images=f,this.options=o,this.document=d}var o=e("./log");f.prototype.renderImage=function(e,n,f,o){var d=e.cssInt("paddingLeft"),i=e.cssInt("paddingTop"),t=e.cssInt("paddingRight"),l=e.cssInt("paddingBottom"),s=f.borders,u=n.width-(s[1].width+s[3].width+d+t),a=n.height-(s[0].width+s[2].width+i+l);this.drawImage(o,0,0,o.image.width||u,o.image.height||a,n.left+d+s[3].width,n.top+i+s[0].width,u,a)},f.prototype.renderBackground=function(e,n,f){n.height>0&&n.width>0&&(this.renderBackgroundColor(e,n),this.renderBackgroundImage(e,n,f))},f.prototype.renderBackgroundColor=function(e,n){var f=e.color("backgroundColor");f.isTransparent()||this.rectangle(n.left,n.top,n.width,n.height,f)},f.prototype.renderBorders=function(e){e.forEach(this.renderBorder,this)},f.prototype.renderBorder=function(e){e.color.isTransparent()||null===e.args||this.drawShape(e.args,e.color)},f.prototype.renderBackgroundImage=function(e,n,f){var d=e.parseBackgroundImages();d.reverse().forEach(function(d,i,t){switch(d.method){case"url":var l=this.images.get(d.args[0]);l?this.renderBackgroundRepeating(e,n,l,t.length-(i+1),f):o("Error loading background-image",d.args[0]);break;case"linear-gradient":case"gradient":var s=this.images.get(d.value);s?this.renderBackgroundGradient(s,n,f):o("Error loading background-image",d.args[0]);break;case"none":break;default:o("Unknown background-image type",d.args[0])}},this)},f.prototype.renderBackgroundRepeating=function(e,n,f,o,d){var i=e.parseBackgroundSize(n,f.image,o),t=e.parseBackgroundPosition(n,f.image,o,i),l=e.parseBackgroundRepeat(o);switch(l){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(f,t,i,n,n.left+d[3],n.top+t.top+d[0],99999,i.height,d);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(f,t,i,n,n.left+t.left+d[3],n.top+d[0],i.width,99999,d);break;case"no-repeat":this.backgroundRepeatShape(f,t,i,n,n.left+t.left+d[3],n.top+t.top+d[0],i.width,i.height,d);break;default:this.renderBackgroundRepeat(f,t,i,{top:n.top,left:n.left},d[3],d[0])}},n.exports=f},{"./log":13}],20:[function(e,n){function f(e,n){d.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=e,this.canvas.height=n),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},t("Initialized CanvasRenderer with size",e,"x",n)}function o(e){return e.length>0}var d=e("../renderer"),i=e("../lineargradientcontainer"),t=e("../log");f.prototype=Object.create(d.prototype),f.prototype.setFillStyle=function(e){return this.ctx.fillStyle="object"==typeof e&&e.isColor?e.toString():e,this.ctx},f.prototype.rectangle=function(e,n,f,o,d){this.setFillStyle(d).fillRect(e,n,f,o)},f.prototype.circle=function(e,n,f,o){this.setFillStyle(o),this.ctx.beginPath(),this.ctx.arc(e+f/2,n+f/2,f/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},f.prototype.circleStroke=function(e,n,f,o,d,i){this.circle(e,n,f,o),this.ctx.strokeStyle=i.toString(),this.ctx.stroke()},f.prototype.drawShape=function(e,n){this.shape(e),this.setFillStyle(n).fill()},f.prototype.taints=function(e){if(null===e.tainted){this.taintCtx.drawImage(e.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),e.tainted=!1}catch(n){this.taintCtx=document.createElement("canvas").getContext("2d"),e.tainted=!0}}return e.tainted},f.prototype.drawImage=function(e,n,f,o,d,i,t,l,s){(!this.taints(e)||this.options.allowTaint)&&this.ctx.drawImage(e.image,n,f,o,d,i,t,l,s)},f.prototype.clip=function(e,n,f){this.ctx.save(),e.filter(o).forEach(function(e){this.shape(e).clip()},this),n.call(f),this.ctx.restore()},f.prototype.shape=function(e){return this.ctx.beginPath(),e.forEach(function(e,n){"rect"===e[0]?this.ctx.rect.apply(this.ctx,e.slice(1)):this.ctx[0===n?"moveTo":e[0]+"To"].apply(this.ctx,e.slice(1))},this),this.ctx.closePath(),this.ctx},f.prototype.font=function(e,n,f,o,d,i){this.setFillStyle(e).font=[n,f,o,d,i].join(" ").split(",")[0]},f.prototype.fontShadow=function(e,n,f,o){this.setVariable("shadowColor",e.toString()).setVariable("shadowOffsetY",n).setVariable("shadowOffsetX",f).setVariable("shadowBlur",o)},f.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},f.prototype.setOpacity=function(e){this.ctx.globalAlpha=e},f.prototype.setTransform=function(e){this.ctx.translate(e.origin[0],e.origin[1]),this.ctx.transform.apply(this.ctx,e.matrix),this.ctx.translate(-e.origin[0],-e.origin[1])},f.prototype.setVariable=function(e,n){return this.variables[e]!==n&&(this.variables[e]=this.ctx[e]=n),this},f.prototype.text=function(e,n,f){this.ctx.fillText(e,n,f)},f.prototype.backgroundRepeatShape=function(e,n,f,o,d,i,t,l,s){var u=[["line",Math.round(d),Math.round(i)],["line",Math.round(d+t),Math.round(i)],["line",Math.round(d+t),Math.round(l+i)],["line",Math.round(d),Math.round(l+i)]];this.clip([u],function(){this.renderBackgroundRepeat(e,n,f,o,s[3],s[0])},this)},f.prototype.renderBackgroundRepeat=function(e,n,f,o,d,i){var t=Math.round(o.left+n.left+d),l=Math.round(o.top+n.top+i);this.setFillStyle(this.ctx.createPattern(this.resizeImage(e,f),"repeat")),this.ctx.translate(t,l),this.ctx.fill(),this.ctx.translate(-t,-l)},f.prototype.renderBackgroundGradient=function(e,n){if(e instanceof i){var f=this.ctx.createLinearGradient(n.left+n.width*e.x0,n.top+n.height*e.y0,n.left+n.width*e.x1,n.top+n.height*e.y1);e.colorStops.forEach(function(e){f.addColorStop(e.stop,e.color.toString())}),this.rectangle(n.left,n.top,n.width,n.height,f)}},f.prototype.resizeImage=function(e,n){var f=e.image;if(f.width===n.width&&f.height===n.height)return f;var o,d=document.createElement("canvas");return d.width=n.width,d.height=n.height,o=d.getContext("2d"),o.drawImage(f,0,0,f.width,f.height,0,0,n.width,n.height),d},n.exports=f},{"../lineargradientcontainer":12,"../log":13,"../renderer":19}],21:[function(e,n){function f(e,n,f,d){o.call(this,f,d),this.ownStacking=e,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*n}var o=e("./nodecontainer");f.prototype=Object.create(o.prototype),f.prototype.getParentStack=function(e){var n=this.parent?this.parent.stack:null;return n?n.ownStacking?n:n.getParentStack(e):e.stack},n.exports=f},{"./nodecontainer":14}],22:[function(e,n){function f(e){this.rangeBounds=this.testRangeBounds(e),this.cors=this.testCORS(),this.svg=this.testSVG()}f.prototype.testRangeBounds=function(e){var n,f,o,d,i=!1;return e.createRange&&(n=e.createRange(),n.getBoundingClientRect&&(f=e.createElement("boundtest"),f.style.height="123px",f.style.display="block",e.body.appendChild(f),n.selectNode(f),o=n.getBoundingClientRect(),d=o.height,123===d&&(i=!0),e.body.removeChild(f))),i},f.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},f.prototype.testSVG=function(){var e=new Image,n=document.createElement("canvas"),f=n.getContext("2d");e.src="data:image/svg+xml,";try{f.drawImage(e,0,0),n.toDataURL()}catch(o){return!1}return!0},n.exports=f},{}],23:[function(e,n){function f(e){this.src=e,this.image=null;var n=this;this.promise=this.hasFabric().then(function(){return n.isInline(e)?Promise.resolve(n.inlineFormatting(e)):o(e)}).then(function(e){return new Promise(function(f){window.html2canvas.svg.fabric.loadSVGFromString(e,n.createCanvas.call(n,f))})})}var o=e("./xhr"),d=e("./utils").decode64;f.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?Promise.resolve():Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},f.prototype.inlineFormatting=function(e){return/^data:image\/svg\+xml;base64,/.test(e)?this.decode64(this.removeContentType(e)):this.removeContentType(e)},f.prototype.removeContentType=function(e){return e.replace(/^data:image\/svg\+xml(;base64)?,/,"")},f.prototype.isInline=function(e){return/^data:image\/svg\+xml/i.test(e)},f.prototype.createCanvas=function(e){var n=this;return function(f,o){var d=new window.html2canvas.svg.fabric.StaticCanvas("c");n.image=d.lowerCanvasEl,d.setWidth(o.width).setHeight(o.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(f,o)).renderAll(),e(d.lowerCanvasEl)}},f.prototype.decode64=function(e){return"function"==typeof window.atob?window.atob(e):d(e)},n.exports=f},{"./utils":26,"./xhr":28}],24:[function(e,n){function f(e,n){this.src=e,this.image=null;var f=this;this.promise=n?new Promise(function(n,o){f.image=new Image,f.image.onload=n,f.image.onerror=o,f.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(e),f.image.complete===!0&&n(f.image)}):this.hasFabric().then(function(){return new Promise(function(n){window.html2canvas.svg.fabric.parseSVGDocument(e,f.createCanvas.call(f,n))})})}var o=e("./svgcontainer");f.prototype=Object.create(o.prototype),n.exports=f},{"./svgcontainer":23}],25:[function(e,n){function f(e,n){d.call(this,e,n)}function o(e,n,f){return e.length>0?n+f.toUpperCase():void 0}var d=e("./nodecontainer");f.prototype=Object.create(d.prototype),f.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},f.prototype.transform=function(e){var n=this.node.data;switch(e){case"lowercase":return n.toLowerCase();case"capitalize":return n.replace(/(^|\s|:|-|\(|\))([a-z])/g,o);case"uppercase":return n.toUpperCase();default:return n}},n.exports=f},{"./nodecontainer":14}],26:[function(e,n,f){f.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},f.bind=function(e,n){return function(){return e.apply(n,arguments)}},f.decode64=function(e){var n,f,o,d,i,t,l,s,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=e.length,p="";for(n=0;a>n;n+=4)f=u.indexOf(e[n]),o=u.indexOf(e[n+1]),d=u.indexOf(e[n+2]),i=u.indexOf(e[n+3]),t=f<<2|o>>4,l=(15&o)<<4|d>>2,s=(3&d)<<6|i,p+=64===d?String.fromCharCode(t):64===i||-1===i?String.fromCharCode(t,l):String.fromCharCode(t,l,s);return p},f.getBounds=function(e){if(e.getBoundingClientRect){var n=e.getBoundingClientRect(),f=null==e.offsetWidth?n.width:e.offsetWidth;return{top:n.top,bottom:n.bottom||n.top+n.height,right:n.left+f,left:n.left,width:f,height:null==e.offsetHeight?n.height:e.offsetHeight}}return{}},f.offsetBounds=function(e){var n=e.offsetParent?f.offsetBounds(e.offsetParent):{top:0,left:0};return{top:e.offsetTop+n.top,bottom:e.offsetTop+e.offsetHeight+n.top,right:e.offsetLeft+n.left+e.offsetWidth,left:e.offsetLeft+n.left,width:e.offsetWidth,height:e.offsetHeight}},f.parseBackgrounds=function(e){var n,f,o,d,i,t,l,s=" \r\n ",u=[],a=0,p=0,c=function(){n&&('"'===f.substr(0,1)&&(f=f.substr(1,f.length-2)),f&&l.push(f),"-"===n.substr(0,1)&&(d=n.indexOf("-",1)+1)>0&&(o=n.substr(0,d),n=n.substr(d)),u.push({prefix:o,method:n.toLowerCase(),value:i,args:l,image:null})),l=[],n=o=f=i=""};return l=[],n=o=f=i="",e.split("").forEach(function(e){if(!(0===a&&s.indexOf(e)>-1)){switch(e){case'"':t?t===e&&(t=null):t=e;break;case"(":if(t)break;if(0===a)return a=1,void(i+=e);p++;break;case")":if(t)break;if(1===a){if(0===p)return a=0,i+=e,void c();p--}break;case",":if(t)break;if(0===a)return void c();if(1===a&&0===p&&!n.match(/^url$/i))return l.push(f),f="",void(i+=e)}i+=e,0===a?n+=e:f+=e}}),c(),u}},{}],27:[function(e,n){function f(e){o.apply(this,arguments),this.type="linear"===e.args[0]?o.TYPES.LINEAR:o.TYPES.RADIAL}var o=e("./gradientcontainer");f.prototype=Object.create(o.prototype),n.exports=f},{"./gradientcontainer":9}],28:[function(e,n){function f(e){return new Promise(function(n,f){var o=new XMLHttpRequest;o.open("GET",e),o.onload=function(){200===o.status?n(o.responseText):f(new Error(o.statusText))},o.onerror=function(){f(new Error("Network Error"))},o.send()})}n.exports=f},{}]},{},[4])(4)}); --------------------------------------------------------------------------------