working somewhat on thinkpad - doesn't pass tests
This commit is contained in:
@@ -6,6 +6,8 @@ argcomplete==1.0.0
|
||||
arrow==0.12.1
|
||||
asn1crypto==0.23.0
|
||||
astropy==1.1.2
|
||||
atomicwrites==1.3.0
|
||||
attrs==18.2.0
|
||||
awscli==1.14.57
|
||||
Babel==2.2.0
|
||||
backports-abc==0.4
|
||||
@@ -34,7 +36,7 @@ click==6.6
|
||||
cloudpickle==0.1.1
|
||||
clyent==1.2.1
|
||||
colorama==0.3.7
|
||||
comtypes==1.1.3
|
||||
comtypes==1.1.7
|
||||
configobj==5.0.6
|
||||
coreapi==2.0.9
|
||||
cryptography==2.1.3
|
||||
@@ -85,6 +87,7 @@ docopt==0.6.2
|
||||
docutils==0.12
|
||||
enum34==1.1.2
|
||||
et-xmlfile==1.0.1
|
||||
Factory==1.2
|
||||
fastcache==1.0.2
|
||||
filemagic==1.6
|
||||
fitparse==1.0.1
|
||||
@@ -94,7 +97,7 @@ Flask-Login==0.3.2
|
||||
Flask-OpenID==1.2.5
|
||||
Flask-Uploads==0.2.0
|
||||
flower==0.9.1
|
||||
funcsigs==0.4
|
||||
funcsigs==1.0.2
|
||||
functools32==3.2.3.post2
|
||||
future==0.16.0
|
||||
futures==3.0.5
|
||||
@@ -127,12 +130,14 @@ Markdown==2.6.7
|
||||
MarkupSafe==0.23
|
||||
matplotlib==2.2.2
|
||||
mechanize==0.3.6
|
||||
MiniMockTest==0.5
|
||||
mock==2.0.0
|
||||
more-itertools==5.0.0
|
||||
mpld3==0.2
|
||||
mpmath==0.19
|
||||
multipledispatch==0.4.8
|
||||
MySQL-python==1.2.5
|
||||
mysqlclient==1.3.7
|
||||
networkx==1.11
|
||||
nose==1.3.7
|
||||
nose-parameterized==0.6.0
|
||||
numpy==1.14.2
|
||||
oauth2==1.9.0.post1
|
||||
@@ -141,20 +146,25 @@ odo==0.4.2
|
||||
openapi-codec==1.1.7
|
||||
packaging==16.8
|
||||
pandas==0.22.0
|
||||
pathlib2==2.1.0
|
||||
pathlib2==2.3.3
|
||||
pathspec==0.5.5
|
||||
pbr==5.1.2
|
||||
pexpect==4.0.1
|
||||
pickleshare==0.7.2
|
||||
Pillow==3.2.0
|
||||
pluggy==0.8.1
|
||||
polib==1.0.7
|
||||
psutil==4.1.0
|
||||
ptyprocess==0.5.1
|
||||
py==1.7.0
|
||||
pyasn1==0.1.9
|
||||
pycparser==2.14
|
||||
pycrypto==2.6.1
|
||||
PyMySQL==0.7.4
|
||||
pync==1.6.1
|
||||
pyparsing==2.2.0
|
||||
pytest==4.2.0
|
||||
pytest-sugar==0.9.2
|
||||
python-dateutil==2.7.2
|
||||
python-memcached==1.58
|
||||
python-metar==1.4.0
|
||||
@@ -165,6 +175,7 @@ PyYAML==3.12
|
||||
pyzmq==15.2.0
|
||||
ratelim==0.1.6
|
||||
redis==2.10.5
|
||||
req==1.0.0
|
||||
requests==2.12.3
|
||||
requests-oauthlib==0.7.0
|
||||
rowingdata==2.0.0
|
||||
@@ -186,10 +197,10 @@ singledispatch==3.4.0.3
|
||||
six==1.11.0
|
||||
SQLAlchemy==1.0.12
|
||||
sqlparse==0.1.19
|
||||
# Editable install with no version control (stravalib==0.6.6)
|
||||
-e /srv/venv/lib/python2.7/site-packages
|
||||
-e git+git@bitbucket.org:sanderroosendaal/rowsandall.git@c9695a9f8f5ee0e459de066007a5ef4cef58255b#egg=stravalib
|
||||
subprocess32==3.2.7
|
||||
sympy==1.0
|
||||
termcolor==1.1.0
|
||||
timestring==1.6.2
|
||||
timezonefinder==2.1.2
|
||||
toolz==0.7.4
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
try:
|
||||
WindowsError
|
||||
except NameError:
|
||||
WindowsError = None
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
@@ -146,7 +146,7 @@ from rowsandall_app.settings import (
|
||||
PAYMENT_PROCESSING_ON
|
||||
)
|
||||
|
||||
from rowers.tasks_standalone import addcomment2
|
||||
#from rowers.tasks_standalone import addcomment2
|
||||
from django.contrib import messages
|
||||
from async_messages import messages as a_messages
|
||||
|
||||
|
||||
104
rowsandall_app/settings_thinkpad.py
Normal file
104
rowsandall_app/settings_thinkpad.py
Normal file
@@ -0,0 +1,104 @@
|
||||
"""
|
||||
Django settings for rowsandall_app project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 1.9.5.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/1.9/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/1.9/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from settings import *
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
# 'HOST': 'localhost',
|
||||
},
|
||||
# 'TEST': {
|
||||
# 'CHARSET': 'utf8',
|
||||
# 'COLLATION': 'utf8_general_ci',
|
||||
# },
|
||||
|
||||
# 'slave': {
|
||||
# 'ENGINE': 'django.db.backends.mysql',
|
||||
# 'NAME': 'rowsanda_107501',
|
||||
# 'USER': 'rowsanda_107501',
|
||||
# 'PASSWORD': 'roeidata',
|
||||
# 'HOST': 'store3.rosti.cz',
|
||||
# 'PORT': '3306',
|
||||
# }
|
||||
}
|
||||
|
||||
#BROKER_URL = 'redis://localhost:6379/0'
|
||||
#CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
|
||||
#CELERY_IGNORE_RESULT = False
|
||||
|
||||
#CELERY_ACCEPT_CONTENT = ['json']
|
||||
#CELERY_TASK_SERIALIZER = 'json'
|
||||
#CELERY_RESULT_SERIALIZER = 'json'
|
||||
#CELERY_TRACK_STARTED = True
|
||||
#CELERY_SEND_TASK_SENT_EVENT = True
|
||||
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
#INSTALLED_APPS += ['debug_toolbar',]
|
||||
|
||||
MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||
'LOCATION': os.path.join(BASE_DIR, 'django_cache'),
|
||||
}
|
||||
}
|
||||
|
||||
# Application definition
|
||||
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = BASE_DIR
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR,'static/plots'),os.path.join(BASE_DIR,'static'),]
|
||||
|
||||
# INTERNAL_IPS = ['127.0.0.1']
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
|
||||
|
||||
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
|
||||
|
||||
SITE_URL = "http://localhost:8000"
|
||||
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
|
||||
#EMAIL_BACKEND = 'django_ses.SESBackend'
|
||||
|
||||
AWS_SES_REGION_NAME = 'eu-west-1'
|
||||
AWS_SES_REGION_ENDPOINT = 'email.eu-west-1.amazonaws.com'
|
||||
|
||||
EMAIL_HOST = CFG['aws_smtp']
|
||||
EMAIL_PORT = CFG['aws_port']
|
||||
EMAIL_HOST_USER = CFG['aws_smtp_username']
|
||||
EMAIL_HOST_PASSWORD = CFG['aws_smtp_password']
|
||||
EMAIL_USE_TLS = CFG['email_use_tls']
|
||||
DEFAULT_FROM_EMAIL = 'info@rowsandall.com'
|
||||
|
||||
SETTINGS_NAME = 'rowsandall_app.settings_thinkpad'
|
||||
|
||||
|
||||
@@ -82,4 +82,9 @@ if settings.DEBUG:
|
||||
import debug_toolbar
|
||||
urlpatterns += [
|
||||
url(r'^__debug__/',include(debug_toolbar.urls)),
|
||||
]
|
||||
url(
|
||||
regex=r'^static/(?P<path>.*)$',
|
||||
view='django.views.static.serve',
|
||||
kwargs={'document_root': settings.STATIC_ROOT,}
|
||||
)
|
||||
]
|
||||
|
||||
24
rqsettings.txt
Normal file
24
rqsettings.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
[program:myworker]
|
||||
; Point the command to the specific rq command you want to run.
|
||||
; If you use virtualenv, be sure to point it to
|
||||
; /home/sander/python/rowsandall/py2/bin/rq
|
||||
; Also, you probably want to include a settings module to configure this
|
||||
; worker. For more info on that, see http://python-rq.org/docs/workers/
|
||||
command=/path/to/rq worker -c workersettings high normal low
|
||||
; process_num is required if you specify >1 numprocs
|
||||
process_name=%(program_name)s-%(process_num)s
|
||||
|
||||
; If you want to run more than one worker instance, increase this
|
||||
numprocs=3
|
||||
|
||||
; This is the directory from which RQ is ran. Be sure to point this to the
|
||||
; directory where your source code is importable from
|
||||
directory=/path/to
|
||||
|
||||
; RQ requires the TERM signal to perform a warm shutdown. If RQ does not die
|
||||
; within 10 seconds, supervisor will forcefully kill it
|
||||
stopsignal=TERM
|
||||
|
||||
; These are up to you
|
||||
autostart=true
|
||||
autorestart=true
|
||||
@@ -1,202 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
#CookielawBanner #CookielawCross {
|
||||
background: url('/static/img/close.png') no-repeat 0 0;
|
||||
background: url('../img/close.png') no-repeat 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
position: absolute;
|
||||
|
||||
@@ -38,14 +38,13 @@
|
||||
font-family:sans-serif;
|
||||
text-align:left;
|
||||
text-shadow: none;
|
||||
white-space: normal;
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
#djDebug button, #djDebug a.button {
|
||||
#djDebug button {
|
||||
background-color: #eee;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eee), color-stop(100%, #cccccc));
|
||||
background-image: -webkit-linear-gradient(top, #eee, #cccccc);
|
||||
@@ -65,7 +64,7 @@
|
||||
text-shadow: 0 1px 0 #eee;
|
||||
}
|
||||
|
||||
#djDebug button:hover, #djDebug a.button:hover {
|
||||
#djDebug button:hover {
|
||||
background-color: #ddd;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ddd), color-stop(100%, #bbb));
|
||||
background-image: -webkit-linear-gradient(top, #ddd, #bbb);
|
||||
@@ -79,7 +78,7 @@
|
||||
text-shadow: 0 1px 0 #ddd;
|
||||
}
|
||||
|
||||
#djDebug button:active, #djDebug a.button:active {
|
||||
#djDebug button:active {
|
||||
border: 1px solid #aaa;
|
||||
border-bottom: 1px solid #888;
|
||||
-webkit-box-shadow: inset 0 0 5px 2px #aaa, 0 1px 0 0 #eee;
|
||||
@@ -287,7 +286,7 @@
|
||||
border-collapse:collapse;
|
||||
width:100%;
|
||||
background-color:#fff;
|
||||
display:table;
|
||||
display:block;
|
||||
margin-top:0.8em;
|
||||
overflow: auto;
|
||||
}
|
||||
@@ -657,6 +656,3 @@
|
||||
#djDebug .djdt-highlighted {
|
||||
background-color: lightgrey;
|
||||
}
|
||||
.djdt-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
5
static/debug_toolbar/js/jquery_post.js
vendored
5
static/debug_toolbar/js/jquery_post.js
vendored
@@ -1,4 +1 @@
|
||||
var djdt = {jQuery: jQuery.noConflict(true)};
|
||||
if (window.define) {
|
||||
window.define.amd = _djdt_define_amd_backup;
|
||||
}
|
||||
var djdt = {jQuery: jQuery.noConflict(true)}; window.define = _djdt_define_backup;
|
||||
|
||||
6
static/debug_toolbar/js/jquery_pre.js
vendored
6
static/debug_toolbar/js/jquery_pre.js
vendored
@@ -1,5 +1 @@
|
||||
var _djdt_define_amd_backup;
|
||||
if (window.define) {
|
||||
_djdt_define_amd_backup = window.define.amd;
|
||||
window.define.amd = undefined;
|
||||
}
|
||||
var _djdt_define_backup = window.define; window.define = undefined;
|
||||
|
||||
@@ -64,16 +64,16 @@
|
||||
|
||||
if (name == 'button') {
|
||||
var form = self.parents('form:eq(0)');
|
||||
ajax_data.url = self.attr('formaction');
|
||||
ajax_data['url'] = self.attr('formaction');
|
||||
|
||||
if (form.length) {
|
||||
ajax_data.data = form.serialize();
|
||||
ajax_data.type = form.attr('method') || 'POST';
|
||||
ajax_data['data'] = form.serialize();
|
||||
ajax_data['type'] = form.attr('method') || 'POST';
|
||||
}
|
||||
}
|
||||
|
||||
if (name == 'a') {
|
||||
ajax_data.url = self.attr('href');
|
||||
ajax_data['url'] = self.attr('href');
|
||||
}
|
||||
|
||||
$.ajax(ajax_data).done(function(data){
|
||||
@@ -141,13 +141,13 @@
|
||||
// due to djdt.handleDragged being set to true.
|
||||
if (djdt.handleDragged || event.pageY != startPageY) {
|
||||
var top = baseY + event.clientY;
|
||||
|
||||
|
||||
if (top < 0) {
|
||||
top = 0;
|
||||
} else if (top + handle.height() > windowHeight) {
|
||||
top = windowHeight - handle.height();
|
||||
}
|
||||
|
||||
|
||||
handle.css({top: top});
|
||||
djdt.handleDragged = true;
|
||||
}
|
||||
@@ -213,13 +213,11 @@
|
||||
$('#djDebugToolbar li').removeClass('djdt-active');
|
||||
// finally close toolbar
|
||||
$('#djDebugToolbar').hide('fast');
|
||||
handle = $('#djDebugToolbarHandle');
|
||||
handle.show();
|
||||
$('#djDebugToolbarHandle').show();
|
||||
// set handle position
|
||||
var handleTop = djdt.cookie.get('djdttop');
|
||||
if (handleTop) {
|
||||
handleTop = Math.min(handleTop, window.innerHeight - handle.outerHeight() - 10);
|
||||
handle.css({top: handleTop + 'px'});
|
||||
$('#djDebugToolbarHandle').css({top: handleTop + 'px'});
|
||||
}
|
||||
// Unbind keydown
|
||||
$(document).unbind('keydown.djDebug');
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
var $row = $('<tr class="' + ((rowCount % 2) ? 'djDebugOdd' : 'djDebugEven') + '"></tr>');
|
||||
if (endStat) {
|
||||
// Render a start through end bar
|
||||
$row.html('<td>' + stat.replace('Start', '') + '</td>' +
|
||||
'<td class="timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong></div></div></td>' +
|
||||
$row.html('<td>' + stat.replace('Start', '') + '</td>' +
|
||||
'<td class="timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong></div></div></td>' +
|
||||
'<td>' + (perf.timing[stat] - timingOffset) + ' (+' + (perf.timing[endStat] - perf.timing[stat]) + ')</td>');
|
||||
$row.find('strong').css({width: getCSSWidth(stat, endStat)});
|
||||
} else {
|
||||
// Render a point in time
|
||||
$row.html('<td>' + stat + '</td>' +
|
||||
'<td class="timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong></div></div></td>' +
|
||||
'<td>' + (perf.timing[stat] - timingOffset) + '</td>');
|
||||
$row.find('strong').css({width: 2});
|
||||
$row.html('<td>' + stat + '</td>' +
|
||||
'<td class="timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong></div></div></td>' +
|
||||
'<td>' + (perf.timing[stat] - timingOffset) + '</td>');
|
||||
$row.find('strong').css({width: 2});
|
||||
}
|
||||
$row.find('djDebugLineChart').css({left: getLeft(stat) + '%'});
|
||||
$('#djDebugBrowserTimingTableBody').append($row);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,51 +1,51 @@
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.lvml {
|
||||
behavior: url(#default#VML);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.leaflet-control {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.leaflet-popup-tip {
|
||||
width: 21px;
|
||||
_width: 27px;
|
||||
margin: 0 auto;
|
||||
_margin-top: -3px;
|
||||
|
||||
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin-top: -1px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.leaflet-control-zoom,
|
||||
.leaflet-control-layers {
|
||||
border: 3px solid #999;
|
||||
}
|
||||
.leaflet-control-layers-toggle {
|
||||
}
|
||||
.leaflet-control-attribution,
|
||||
.leaflet-control-layers,
|
||||
.leaflet-control-scale-line {
|
||||
background: white;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
.leaflet-control-attribution {
|
||||
border-top: 1px solid #bbb;
|
||||
border-left: 1px solid #bbb;
|
||||
}
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.lvml {
|
||||
behavior: url(#default#VML);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.leaflet-control {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.leaflet-popup-tip {
|
||||
width: 21px;
|
||||
_width: 27px;
|
||||
margin: 0 auto;
|
||||
_margin-top: -3px;
|
||||
|
||||
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin-top: -1px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.leaflet-control-zoom,
|
||||
.leaflet-control-layers {
|
||||
border: 3px solid #999;
|
||||
}
|
||||
.leaflet-control-layers-toggle {
|
||||
}
|
||||
.leaflet-control-attribution,
|
||||
.leaflet-control-layers,
|
||||
.leaflet-control-scale-line {
|
||||
background: white;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
.leaflet-control-attribution {
|
||||
border-top: 1px solid #bbb;
|
||||
border-left: 1px solid #bbb;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
/*
|
||||
proj4js.js -- Javascript reprojection library.
|
||||
|
||||
Authors: Mike Adair madairATdmsolutions.ca
|
||||
Richard Greenwood richATgreenwoodmap.com
|
||||
Didier Richard didier.richardATign.fr
|
||||
Stephen Irons stephen.ironsATclear.net.nz
|
||||
Olivier Terral oterralATgmail.com
|
||||
|
||||
License:
|
||||
Copyright (c) 2012, Mike Adair, Richard Greenwood, Didier Richard,
|
||||
Stephen Irons and Olivier Terral
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Note: This program is an almost direct port of the C library PROJ.4.
|
||||
*/
|
||||
/*
|
||||
proj4js.js -- Javascript reprojection library.
|
||||
|
||||
Authors: Mike Adair madairATdmsolutions.ca
|
||||
Richard Greenwood richATgreenwoodmap.com
|
||||
Didier Richard didier.richardATign.fr
|
||||
Stephen Irons stephen.ironsATclear.net.nz
|
||||
Olivier Terral oterralATgmail.com
|
||||
|
||||
License:
|
||||
Copyright (c) 2012, Mike Adair, Richard Greenwood, Didier Richard,
|
||||
Stephen Irons and Olivier Terral
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Note: This program is an almost direct port of the C library PROJ.4.
|
||||
*/
|
||||
var Proj4js={defaultDatum:"WGS84",transform:function(a,c,b){if(!a.readyToUse)return this.reportError("Proj4js initialization for:"+a.srsCode+" not yet complete"),b;if(!c.readyToUse)return this.reportError("Proj4js initialization for:"+c.srsCode+" not yet complete"),b;if(a.datum&&c.datum&&((a.datum.datum_type==Proj4js.common.PJD_3PARAM||a.datum.datum_type==Proj4js.common.PJD_7PARAM)&&"WGS84"!=c.datumCode||(c.datum.datum_type==Proj4js.common.PJD_3PARAM||c.datum.datum_type==Proj4js.common.PJD_7PARAM)&&
|
||||
"WGS84"!=a.datumCode)){var d=Proj4js.WGS84;this.transform(a,d,b);a=d}"enu"!=a.axis&&this.adjust_axis(a,!1,b);"longlat"==a.projName?(b.x*=Proj4js.common.D2R,b.y*=Proj4js.common.D2R):(a.to_meter&&(b.x*=a.to_meter,b.y*=a.to_meter),a.inverse(b));a.from_greenwich&&(b.x+=a.from_greenwich);b=this.datum_transform(a.datum,c.datum,b);c.from_greenwich&&(b.x-=c.from_greenwich);"longlat"==c.projName?(b.x*=Proj4js.common.R2D,b.y*=Proj4js.common.R2D):(c.forward(b),c.to_meter&&(b.x/=c.to_meter,b.y/=c.to_meter));
|
||||
"enu"!=c.axis&&this.adjust_axis(c,!0,b);return b},datum_transform:function(a,c,b){if(a.compare_datums(c)||a.datum_type==Proj4js.common.PJD_NODATUM||c.datum_type==Proj4js.common.PJD_NODATUM)return b;if(a.es!=c.es||a.a!=c.a||a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM||c.datum_type==Proj4js.common.PJD_3PARAM||c.datum_type==Proj4js.common.PJD_7PARAM)a.geodetic_to_geocentric(b),(a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM)&&a.geocentric_to_wgs84(b),
|
||||
|
||||
@@ -1,263 +1,263 @@
|
||||
(function (factory) {
|
||||
var L, proj4;
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['leaflet', 'proj4'], factory);
|
||||
} else if (typeof module === 'object' && typeof module.exports === "object") {
|
||||
// Node/CommonJS
|
||||
L = require('leaflet');
|
||||
proj4 = require('proj4');
|
||||
module.exports = factory(L, proj4);
|
||||
} else {
|
||||
// Browser globals
|
||||
if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined')
|
||||
throw 'Leaflet and proj4 must be loaded first';
|
||||
factory(window.L, window.proj4);
|
||||
}
|
||||
}(function (L, proj4) {
|
||||
|
||||
L.Proj = {};
|
||||
|
||||
L.Proj._isProj4Obj = function(a) {
|
||||
return (typeof a.inverse !== 'undefined' &&
|
||||
typeof a.forward !== 'undefined');
|
||||
};
|
||||
|
||||
L.Proj.Projection = L.Class.extend({
|
||||
initialize: function(code, def, bounds) {
|
||||
var isP4 = L.Proj._isProj4Obj(code);
|
||||
this._proj = isP4 ? code : this._projFromCodeDef(code, def);
|
||||
this.bounds = isP4 ? def : bounds;
|
||||
},
|
||||
|
||||
project: function (latlng) {
|
||||
var point = this._proj.forward([latlng.lng, latlng.lat]);
|
||||
return new L.Point(point[0], point[1]);
|
||||
},
|
||||
|
||||
unproject: function (point, unbounded) {
|
||||
var point2 = this._proj.inverse([point.x, point.y]);
|
||||
return new L.LatLng(point2[1], point2[0], unbounded);
|
||||
},
|
||||
|
||||
_projFromCodeDef: function(code, def) {
|
||||
if (def) {
|
||||
proj4.defs(code, def);
|
||||
} else if (proj4.defs[code] === undefined) {
|
||||
var urn = code.split(':');
|
||||
if (urn.length > 3) {
|
||||
code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
|
||||
}
|
||||
if (proj4.defs[code] === undefined) {
|
||||
throw 'No projection definition for code ' + code;
|
||||
}
|
||||
}
|
||||
|
||||
return proj4(code);
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.CRS = L.Class.extend({
|
||||
includes: L.CRS,
|
||||
|
||||
options: {
|
||||
transformation: new L.Transformation(1, 0, -1, 0)
|
||||
},
|
||||
|
||||
initialize: function(a, b, c) {
|
||||
var code,
|
||||
proj,
|
||||
def,
|
||||
options;
|
||||
|
||||
if (L.Proj._isProj4Obj(a)) {
|
||||
proj = a;
|
||||
code = proj.srsCode;
|
||||
options = b || {};
|
||||
|
||||
this.projection = new L.Proj.Projection(proj, options.bounds);
|
||||
} else {
|
||||
code = a;
|
||||
def = b;
|
||||
options = c || {};
|
||||
this.projection = new L.Proj.Projection(code, def, options.bounds);
|
||||
}
|
||||
|
||||
L.Util.setOptions(this, options);
|
||||
this.code = code;
|
||||
this.transformation = this.options.transformation;
|
||||
|
||||
if (this.options.origin) {
|
||||
this.transformation =
|
||||
new L.Transformation(1, -this.options.origin[0],
|
||||
-1, this.options.origin[1]);
|
||||
}
|
||||
|
||||
if (this.options.scales) {
|
||||
this._scales = this.options.scales;
|
||||
} else if (this.options.resolutions) {
|
||||
this._scales = [];
|
||||
for (var i = this.options.resolutions.length - 1; i >= 0; i--) {
|
||||
if (this.options.resolutions[i]) {
|
||||
this._scales[i] = 1 / this.options.resolutions[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.infinite = !this.options.bounds;
|
||||
|
||||
},
|
||||
|
||||
scale: function(zoom) {
|
||||
var iZoom = Math.floor(zoom),
|
||||
baseScale,
|
||||
nextScale,
|
||||
scaleDiff,
|
||||
zDiff;
|
||||
if (zoom === iZoom) {
|
||||
return this._scales[zoom];
|
||||
} else {
|
||||
// Non-integer zoom, interpolate
|
||||
baseScale = this._scales[iZoom];
|
||||
nextScale = this._scales[iZoom + 1];
|
||||
scaleDiff = nextScale - baseScale;
|
||||
zDiff = (zoom - iZoom);
|
||||
return baseScale + scaleDiff * zDiff;
|
||||
}
|
||||
},
|
||||
|
||||
zoom: function(scale) {
|
||||
// Find closest number in this._scales, down
|
||||
var downScale = this._closestElement(this._scales, scale),
|
||||
downZoom = this._scales.indexOf(downScale),
|
||||
nextScale,
|
||||
nextZoom,
|
||||
scaleDiff;
|
||||
// Check if scale is downScale => return array index
|
||||
if (scale === downScale) {
|
||||
return downZoom;
|
||||
}
|
||||
// Interpolate
|
||||
nextZoom = downZoom + 1;
|
||||
nextScale = this._scales[nextZoom];
|
||||
if (nextScale === undefined) {
|
||||
return Infinity;
|
||||
}
|
||||
scaleDiff = nextScale - downScale;
|
||||
return (scale - downScale) / scaleDiff + downZoom;
|
||||
},
|
||||
|
||||
distance: L.CRS.Earth.distance,
|
||||
|
||||
R: L.CRS.Earth.R,
|
||||
|
||||
/* Get the closest lowest element in an array */
|
||||
_closestElement: function(array, element) {
|
||||
var low;
|
||||
for (var i = array.length; i--;) {
|
||||
if (array[i] <= element && (low === undefined || low < array[i])) {
|
||||
low = array[i];
|
||||
}
|
||||
}
|
||||
return low;
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.GeoJSON = L.GeoJSON.extend({
|
||||
initialize: function(geojson, options) {
|
||||
this._callLevel = 0;
|
||||
L.GeoJSON.prototype.initialize.call(this, geojson, options);
|
||||
},
|
||||
|
||||
addData: function(geojson) {
|
||||
var crs;
|
||||
|
||||
if (geojson) {
|
||||
if (geojson.crs && geojson.crs.type === 'name') {
|
||||
crs = new L.Proj.CRS(geojson.crs.properties.name);
|
||||
} else if (geojson.crs && geojson.crs.type) {
|
||||
crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code);
|
||||
}
|
||||
|
||||
if (crs !== undefined) {
|
||||
this.options.coordsToLatLng = function(coords) {
|
||||
var point = L.point(coords[0], coords[1]);
|
||||
return crs.projection.unproject(point);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Base class' addData might call us recursively, but
|
||||
// CRS shouldn't be cleared in that case, since CRS applies
|
||||
// to the whole GeoJSON, inluding sub-features.
|
||||
this._callLevel++;
|
||||
try {
|
||||
L.GeoJSON.prototype.addData.call(this, geojson);
|
||||
} finally {
|
||||
this._callLevel--;
|
||||
if (this._callLevel === 0) {
|
||||
delete this.options.coordsToLatLng;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.geoJson = function(geojson, options) {
|
||||
return new L.Proj.GeoJSON(geojson, options);
|
||||
};
|
||||
|
||||
L.Proj.ImageOverlay = L.ImageOverlay.extend({
|
||||
initialize: function (url, bounds, options) {
|
||||
L.ImageOverlay.prototype.initialize.call(this, url, null, options);
|
||||
this._projectedBounds = bounds;
|
||||
},
|
||||
|
||||
// Danger ahead: Overriding internal methods in Leaflet.
|
||||
// Decided to do this rather than making a copy of L.ImageOverlay
|
||||
// and doing very tiny modifications to it.
|
||||
// Future will tell if this was wise or not.
|
||||
_animateZoom: function (event) {
|
||||
var scale = this._map.getZoomScale(event.zoom);
|
||||
var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y);
|
||||
var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center);
|
||||
|
||||
L.DomUtil.setTransform(this._image, offset, scale);
|
||||
},
|
||||
|
||||
_reset: function () {
|
||||
var zoom = this._map.getZoom();
|
||||
var pixelOrigin = this._map.getPixelOrigin();
|
||||
var bounds = L.bounds(
|
||||
this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin),
|
||||
this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin)
|
||||
);
|
||||
var size = bounds.getSize();
|
||||
|
||||
L.DomUtil.setPosition(this._image, bounds.min);
|
||||
this._image.style.width = size.x + 'px';
|
||||
this._image.style.height = size.y + 'px';
|
||||
},
|
||||
|
||||
_projectedToNewLayerPoint: function (point, zoom, center) {
|
||||
var viewHalf = this._map.getSize()._divideBy(2);
|
||||
var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round();
|
||||
var topLeft = newTopLeft.add(this._map._getMapPanePos());
|
||||
|
||||
return this._transform(point, zoom)._subtract(topLeft);
|
||||
},
|
||||
|
||||
_transform: function (point, zoom) {
|
||||
var crs = this._map.options.crs;
|
||||
var transformation = crs.transformation;
|
||||
var scale = crs.scale(zoom);
|
||||
|
||||
return transformation.transform(point, scale);
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.imageOverlay = function (url, bounds, options) {
|
||||
return new L.Proj.ImageOverlay(url, bounds, options);
|
||||
};
|
||||
|
||||
return L.Proj;
|
||||
}));
|
||||
(function (factory) {
|
||||
var L, proj4;
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['leaflet', 'proj4'], factory);
|
||||
} else if (typeof module === 'object' && typeof module.exports === "object") {
|
||||
// Node/CommonJS
|
||||
L = require('leaflet');
|
||||
proj4 = require('proj4');
|
||||
module.exports = factory(L, proj4);
|
||||
} else {
|
||||
// Browser globals
|
||||
if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined')
|
||||
throw 'Leaflet and proj4 must be loaded first';
|
||||
factory(window.L, window.proj4);
|
||||
}
|
||||
}(function (L, proj4) {
|
||||
|
||||
L.Proj = {};
|
||||
|
||||
L.Proj._isProj4Obj = function(a) {
|
||||
return (typeof a.inverse !== 'undefined' &&
|
||||
typeof a.forward !== 'undefined');
|
||||
};
|
||||
|
||||
L.Proj.Projection = L.Class.extend({
|
||||
initialize: function(code, def, bounds) {
|
||||
var isP4 = L.Proj._isProj4Obj(code);
|
||||
this._proj = isP4 ? code : this._projFromCodeDef(code, def);
|
||||
this.bounds = isP4 ? def : bounds;
|
||||
},
|
||||
|
||||
project: function (latlng) {
|
||||
var point = this._proj.forward([latlng.lng, latlng.lat]);
|
||||
return new L.Point(point[0], point[1]);
|
||||
},
|
||||
|
||||
unproject: function (point, unbounded) {
|
||||
var point2 = this._proj.inverse([point.x, point.y]);
|
||||
return new L.LatLng(point2[1], point2[0], unbounded);
|
||||
},
|
||||
|
||||
_projFromCodeDef: function(code, def) {
|
||||
if (def) {
|
||||
proj4.defs(code, def);
|
||||
} else if (proj4.defs[code] === undefined) {
|
||||
var urn = code.split(':');
|
||||
if (urn.length > 3) {
|
||||
code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
|
||||
}
|
||||
if (proj4.defs[code] === undefined) {
|
||||
throw 'No projection definition for code ' + code;
|
||||
}
|
||||
}
|
||||
|
||||
return proj4(code);
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.CRS = L.Class.extend({
|
||||
includes: L.CRS,
|
||||
|
||||
options: {
|
||||
transformation: new L.Transformation(1, 0, -1, 0)
|
||||
},
|
||||
|
||||
initialize: function(a, b, c) {
|
||||
var code,
|
||||
proj,
|
||||
def,
|
||||
options;
|
||||
|
||||
if (L.Proj._isProj4Obj(a)) {
|
||||
proj = a;
|
||||
code = proj.srsCode;
|
||||
options = b || {};
|
||||
|
||||
this.projection = new L.Proj.Projection(proj, options.bounds);
|
||||
} else {
|
||||
code = a;
|
||||
def = b;
|
||||
options = c || {};
|
||||
this.projection = new L.Proj.Projection(code, def, options.bounds);
|
||||
}
|
||||
|
||||
L.Util.setOptions(this, options);
|
||||
this.code = code;
|
||||
this.transformation = this.options.transformation;
|
||||
|
||||
if (this.options.origin) {
|
||||
this.transformation =
|
||||
new L.Transformation(1, -this.options.origin[0],
|
||||
-1, this.options.origin[1]);
|
||||
}
|
||||
|
||||
if (this.options.scales) {
|
||||
this._scales = this.options.scales;
|
||||
} else if (this.options.resolutions) {
|
||||
this._scales = [];
|
||||
for (var i = this.options.resolutions.length - 1; i >= 0; i--) {
|
||||
if (this.options.resolutions[i]) {
|
||||
this._scales[i] = 1 / this.options.resolutions[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.infinite = !this.options.bounds;
|
||||
|
||||
},
|
||||
|
||||
scale: function(zoom) {
|
||||
var iZoom = Math.floor(zoom),
|
||||
baseScale,
|
||||
nextScale,
|
||||
scaleDiff,
|
||||
zDiff;
|
||||
if (zoom === iZoom) {
|
||||
return this._scales[zoom];
|
||||
} else {
|
||||
// Non-integer zoom, interpolate
|
||||
baseScale = this._scales[iZoom];
|
||||
nextScale = this._scales[iZoom + 1];
|
||||
scaleDiff = nextScale - baseScale;
|
||||
zDiff = (zoom - iZoom);
|
||||
return baseScale + scaleDiff * zDiff;
|
||||
}
|
||||
},
|
||||
|
||||
zoom: function(scale) {
|
||||
// Find closest number in this._scales, down
|
||||
var downScale = this._closestElement(this._scales, scale),
|
||||
downZoom = this._scales.indexOf(downScale),
|
||||
nextScale,
|
||||
nextZoom,
|
||||
scaleDiff;
|
||||
// Check if scale is downScale => return array index
|
||||
if (scale === downScale) {
|
||||
return downZoom;
|
||||
}
|
||||
// Interpolate
|
||||
nextZoom = downZoom + 1;
|
||||
nextScale = this._scales[nextZoom];
|
||||
if (nextScale === undefined) {
|
||||
return Infinity;
|
||||
}
|
||||
scaleDiff = nextScale - downScale;
|
||||
return (scale - downScale) / scaleDiff + downZoom;
|
||||
},
|
||||
|
||||
distance: L.CRS.Earth.distance,
|
||||
|
||||
R: L.CRS.Earth.R,
|
||||
|
||||
/* Get the closest lowest element in an array */
|
||||
_closestElement: function(array, element) {
|
||||
var low;
|
||||
for (var i = array.length; i--;) {
|
||||
if (array[i] <= element && (low === undefined || low < array[i])) {
|
||||
low = array[i];
|
||||
}
|
||||
}
|
||||
return low;
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.GeoJSON = L.GeoJSON.extend({
|
||||
initialize: function(geojson, options) {
|
||||
this._callLevel = 0;
|
||||
L.GeoJSON.prototype.initialize.call(this, geojson, options);
|
||||
},
|
||||
|
||||
addData: function(geojson) {
|
||||
var crs;
|
||||
|
||||
if (geojson) {
|
||||
if (geojson.crs && geojson.crs.type === 'name') {
|
||||
crs = new L.Proj.CRS(geojson.crs.properties.name);
|
||||
} else if (geojson.crs && geojson.crs.type) {
|
||||
crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code);
|
||||
}
|
||||
|
||||
if (crs !== undefined) {
|
||||
this.options.coordsToLatLng = function(coords) {
|
||||
var point = L.point(coords[0], coords[1]);
|
||||
return crs.projection.unproject(point);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Base class' addData might call us recursively, but
|
||||
// CRS shouldn't be cleared in that case, since CRS applies
|
||||
// to the whole GeoJSON, inluding sub-features.
|
||||
this._callLevel++;
|
||||
try {
|
||||
L.GeoJSON.prototype.addData.call(this, geojson);
|
||||
} finally {
|
||||
this._callLevel--;
|
||||
if (this._callLevel === 0) {
|
||||
delete this.options.coordsToLatLng;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.geoJson = function(geojson, options) {
|
||||
return new L.Proj.GeoJSON(geojson, options);
|
||||
};
|
||||
|
||||
L.Proj.ImageOverlay = L.ImageOverlay.extend({
|
||||
initialize: function (url, bounds, options) {
|
||||
L.ImageOverlay.prototype.initialize.call(this, url, null, options);
|
||||
this._projectedBounds = bounds;
|
||||
},
|
||||
|
||||
// Danger ahead: Overriding internal methods in Leaflet.
|
||||
// Decided to do this rather than making a copy of L.ImageOverlay
|
||||
// and doing very tiny modifications to it.
|
||||
// Future will tell if this was wise or not.
|
||||
_animateZoom: function (event) {
|
||||
var scale = this._map.getZoomScale(event.zoom);
|
||||
var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y);
|
||||
var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center);
|
||||
|
||||
L.DomUtil.setTransform(this._image, offset, scale);
|
||||
},
|
||||
|
||||
_reset: function () {
|
||||
var zoom = this._map.getZoom();
|
||||
var pixelOrigin = this._map.getPixelOrigin();
|
||||
var bounds = L.bounds(
|
||||
this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin),
|
||||
this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin)
|
||||
);
|
||||
var size = bounds.getSize();
|
||||
|
||||
L.DomUtil.setPosition(this._image, bounds.min);
|
||||
this._image.style.width = size.x + 'px';
|
||||
this._image.style.height = size.y + 'px';
|
||||
},
|
||||
|
||||
_projectedToNewLayerPoint: function (point, zoom, center) {
|
||||
var viewHalf = this._map.getSize()._divideBy(2);
|
||||
var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round();
|
||||
var topLeft = newTopLeft.add(this._map._getMapPanePos());
|
||||
|
||||
return this._transform(point, zoom)._subtract(topLeft);
|
||||
},
|
||||
|
||||
_transform: function (point, zoom) {
|
||||
var crs = this._map.options.crs;
|
||||
var transformation = crs.transformation;
|
||||
var scale = crs.scale(zoom);
|
||||
|
||||
return transformation.transform(point, scale);
|
||||
}
|
||||
});
|
||||
|
||||
L.Proj.imageOverlay = function (url, bounds, options) {
|
||||
return new L.Proj.ImageOverlay(url, bounds, options);
|
||||
};
|
||||
|
||||
return L.Proj;
|
||||
}));
|
||||
|
||||
@@ -18988,169 +18988,169 @@ function request(RequestConstructor, method, url) {
|
||||
module.exports = request;
|
||||
|
||||
},{}],162:[function(require,module,exports){
|
||||
|
||||
/**
|
||||
* Expose `Emitter`.
|
||||
*/
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = Emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new `Emitter`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Emitter(obj) {
|
||||
if (obj) return mixin(obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mixin the emitter properties.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function mixin(obj) {
|
||||
for (var key in Emitter.prototype) {
|
||||
obj[key] = Emitter.prototype[key];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen on the given `event` with `fn`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.on =
|
||||
Emitter.prototype.addEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
|
||||
.push(fn);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an `event` listener that will be invoked a single
|
||||
* time then automatically removed.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.once = function(event, fn){
|
||||
function on() {
|
||||
this.off(event, on);
|
||||
fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
on.fn = fn;
|
||||
this.on(event, on);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the given callback for `event` or all
|
||||
* registered callbacks.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.off =
|
||||
Emitter.prototype.removeListener =
|
||||
Emitter.prototype.removeAllListeners =
|
||||
Emitter.prototype.removeEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
|
||||
// all
|
||||
if (0 == arguments.length) {
|
||||
this._callbacks = {};
|
||||
return this;
|
||||
}
|
||||
|
||||
// specific event
|
||||
var callbacks = this._callbacks['$' + event];
|
||||
if (!callbacks) return this;
|
||||
|
||||
// remove all handlers
|
||||
if (1 == arguments.length) {
|
||||
delete this._callbacks['$' + event];
|
||||
return this;
|
||||
}
|
||||
|
||||
// remove specific handler
|
||||
var cb;
|
||||
for (var i = 0; i < callbacks.length; i++) {
|
||||
cb = callbacks[i];
|
||||
if (cb === fn || cb.fn === fn) {
|
||||
callbacks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit `event` with the given args.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Mixed} ...
|
||||
* @return {Emitter}
|
||||
*/
|
||||
|
||||
Emitter.prototype.emit = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
var args = [].slice.call(arguments, 1)
|
||||
, callbacks = this._callbacks['$' + event];
|
||||
|
||||
if (callbacks) {
|
||||
callbacks = callbacks.slice(0);
|
||||
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
||||
callbacks[i].apply(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return array of callbacks for `event`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.listeners = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
return this._callbacks['$' + event] || [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this emitter has `event` handlers.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.hasListeners = function(event){
|
||||
return !! this.listeners(event).length;
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose `Emitter`.
|
||||
*/
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = Emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new `Emitter`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Emitter(obj) {
|
||||
if (obj) return mixin(obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mixin the emitter properties.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function mixin(obj) {
|
||||
for (var key in Emitter.prototype) {
|
||||
obj[key] = Emitter.prototype[key];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen on the given `event` with `fn`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.on =
|
||||
Emitter.prototype.addEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
|
||||
.push(fn);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an `event` listener that will be invoked a single
|
||||
* time then automatically removed.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.once = function(event, fn){
|
||||
function on() {
|
||||
this.off(event, on);
|
||||
fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
on.fn = fn;
|
||||
this.on(event, on);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the given callback for `event` or all
|
||||
* registered callbacks.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.off =
|
||||
Emitter.prototype.removeListener =
|
||||
Emitter.prototype.removeAllListeners =
|
||||
Emitter.prototype.removeEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
|
||||
// all
|
||||
if (0 == arguments.length) {
|
||||
this._callbacks = {};
|
||||
return this;
|
||||
}
|
||||
|
||||
// specific event
|
||||
var callbacks = this._callbacks['$' + event];
|
||||
if (!callbacks) return this;
|
||||
|
||||
// remove all handlers
|
||||
if (1 == arguments.length) {
|
||||
delete this._callbacks['$' + event];
|
||||
return this;
|
||||
}
|
||||
|
||||
// remove specific handler
|
||||
var cb;
|
||||
for (var i = 0; i < callbacks.length; i++) {
|
||||
cb = callbacks[i];
|
||||
if (cb === fn || cb.fn === fn) {
|
||||
callbacks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit `event` with the given args.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Mixed} ...
|
||||
* @return {Emitter}
|
||||
*/
|
||||
|
||||
Emitter.prototype.emit = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
var args = [].slice.call(arguments, 1)
|
||||
, callbacks = this._callbacks['$' + event];
|
||||
|
||||
if (callbacks) {
|
||||
callbacks = callbacks.slice(0);
|
||||
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
||||
callbacks[i].apply(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return array of callbacks for `event`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.listeners = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
return this._callbacks['$' + event] || [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this emitter has `event` handlers.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.hasListeners = function(event){
|
||||
return !! this.listeners(event).length;
|
||||
};
|
||||
|
||||
},{}],163:[function(require,module,exports){
|
||||
|
||||
|
||||
2
static/rq/jquery.js
vendored
2
static/rq/jquery.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user