1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge branch 'beta'

This commit is contained in:
Luke Pulverenti 2016-04-09 22:32:27 -04:00
commit 55d74a8e10
310 changed files with 23941 additions and 9553 deletions

View file

@ -3,12 +3,6 @@
<div data-role="content">
<div class="content-primary">
<div class="readOnlyContent">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="support.html" data-role="button">${TabGeneral}</a>
<a href="log.html" data-role="button">${TabLogs}</a>
<a href="supporterkey.html" data-role="button" class="tabSupporterMembership">${TabEmbyPremiere}</a>
<a href="about.html" data-role="button" class="ui-btn-active">${TabAbout}</a>
</div>
<h1>
<img class="imgLogoIcon" src="css/images/mblogoicon.png" /><span class="logoLibraryMenuButtonText">EMBY</span>
</h1>
@ -44,7 +38,17 @@
<a href="http://thetvdb.com" target="_blank">TheTVDB.com</a>
</p>
</div>
<br/>
<p>${ProjectHasCommunity}</p>
<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="http://emby.media/community" target="_blank">${VisitTheCommunity}</a>
<br />
<p>
${CheckoutKnowledgeBase}
</p>
<a data-role="button" data-icon="search" data-iconpos="right" href="http://emby.media/community/index.php?/forum/23-knowledge-base/" target="_blank">${SearchKnowledgeBase}</a>
<br />
<p>${VisitProjectWebsiteLong}</p>
<a data-role="button" data-icon="home" data-iconpos="right" href="http://emby.media" target="_blank">${VisitProjectWebsite}</a>
</div>
</div>
</div>

View file

@ -2,22 +2,6 @@
<div data-role="content">
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav pluginTabs" data-mini="true" style="display:none;">
<a href="plugins.html" data-role="button">${TabMyPlugins}</a>
<a href="plugincatalog.html" data-role="button" class="ui-btn-active">${TabCatalog}</a>
<a href="channelsettings.html" data-role="button">${TabChannels}</a>
</div>
<div data-role="controlgroup" data-type="horizontal" class="localnav syncTabs" data-mini="true" style="display:none;">
<a href="syncactivity.html" data-role="button">${TabActivity}</a>
<a href="appservices.html?context=sync" data-role="button" class="ui-btn-active">${TabServices}</a>
<a href="syncsettings.html" data-role="button">${TabSettings}</a>
</div>
<div data-role="controlgroup" data-type="horizontal" class="localnav livetvTabs" data-mini="true" style="display:none;">
<a href="livetvstatus.html" data-role="button">${TabTuners}</a>
<a href="livetvsettings.html" data-role="button">${TabSettings}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabExternalServices}</a>
</div>
<div data-role="controlgroup" data-type="horizontal" class="localnav notificationsTabs" data-mini="true" style="display:none;">
<a href="notificationsettings.html" data-role="button">${TabNotifications}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabServices}</a>

View file

@ -1,97 +0,0 @@
<div id="advancedConfigurationPage" data-role="page" class="page type-interior advancedConfigurationPage" data-require="emby-collapsible,scripts/advancedconfigurationpage,paper-input,paper-checkbox">
<div data-role="content">
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" class="ui-btn-active">${TabGeneral}</a>
<a href="dashboardhosting.html" data-role="button">${TabHosting}</a>
<a href="serversecurity.html" data-role="button">${TabSecurity}</a>
</div>
<form class="advancedConfigurationForm">
<ul data-role="listview" class="ulForm">
<li id="fldRunAtStartup" style="display: none;">
<paper-checkbox id="chkRunAtStartup">${LabelRunServerAtStartup}</paper-checkbox>
<div id="windowsStartupDescription" class="fieldDescription paperCheckboxFieldDescription" style="display: none;">
${LabelRunServerAtStartupHelp}
</div>
</li>
<li>
<paper-checkbox id="chkDebugLog">${LabelEnableDebugLogging}</paper-checkbox>
</li>
<li>
<paper-checkbox id="chkUsageData">${OptionEnableAnonymousUsageReporting}</paper-checkbox>
<div class="fieldDescription paperCheckboxFieldDescription">
${OptionEnableAnonymousUsageReportingHelp}
<div style="margin-top:.5em;">
<a target="_blank" href="https://emby.media/privacy">${ButtonLearnMore}</a>
</div>
</div>
</li>
</ul>
<emby-collapsible title="${HeaderAutomaticUpdates}">
<br />
<ul data-role="listview" class="ulForm">
<li class="fldAutomaticUpdates">
<div data-role="controlgroup">
<input type="checkbox" id="chkEnableAutomaticServerUpdates" data-mini="true" />
<label for="chkEnableAutomaticServerUpdates">${OptionEnableAutomaticServerUpdates}</label>
</div>
</li>
<li>
<label class="lnlAutomaticUpdateLevel selectLabel" for="selectAutomaticUpdateLevel"></label>
<select name="selectAutomaticUpdateLevel" id="selectAutomaticUpdateLevel">
<option value="Release">${OptionRelease}</option>
<option value="Beta">${OptionBeta}</option>
<option value="Dev">${OptionDev}</option>
</select>
<div id="devBuildWarning" class="fieldDescription warningFieldDescription" style="display: none;">
${DevBuildWarning}
</div>
</li>
<li id="fldEnableAutomaticRestart" style="display: none;">
<paper-checkbox id="chkEnableAutomaticRestart">${LabelAllowServerAutoRestart}</paper-checkbox>
<div class="fieldDescription paperCheckboxFieldDescription">
${LabelAllowServerAutoRestartHelp}
</div>
</li>
</ul>
</emby-collapsible>
<emby-collapsible title="${HeaderDeveloperOptions}">
<br />
<div>
<paper-checkbox id="chkEnableDashboardResponseCache">${OptionEnableWebClientResponseCache}</paper-checkbox>
</div>
<br />
<div>
<paper-checkbox id="chkEnableMinification">${OptionEnableWebClientResourceMinification}</paper-checkbox>
</div>
<div class="fieldDescription paperCheckboxFieldDescription">
${OptionDisableForDevelopmentHelp}
</div>
<br /><br />
<ul data-role="listview" class="ulForm">
<li>
<paper-input type="text" id="txtDashboardSourcePath" label="${LabelDashboardSourcePath}" style="display: inline-block; width: 80%;"></paper-input>
<paper-icon-button id="btnSelectDashboardSourcePath" icon="search" title="${ButtonSelectDirectory}"></paper-icon-button>
<div class="fieldDescription">${LabelDashboardSourcePathHelp}</div>
</li>
</ul>
</emby-collapsible>
<br />
<ul data-role="listview" class="ulForm">
<li>
<button type="submit" data-role="none" class="clearButton">
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
</button>
</li>
</ul>
</form>
</div>
</div>
</div>

View file

@ -3,29 +3,6 @@
<div data-role="content">
<div class="content-primary">
<div class="sectionTabs syncSectionTabs" style="display:none;">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="syncactivity.html" data-role="button">${TabActivity}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabServices}</a>
<a href="syncsettings.html" data-role="button">${TabSettings}</a>
</div>
</div>
<div class="sectionTabs livetvSectionTabs" style="display:none;">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="livetvstatus.html" data-role="button">${TabTuners}</a>
<a href="livetvsettings.html" data-role="button">${TabSettings}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabExternalServices}</a>
</div>
</div>
<div class="sectionTabs notificationsSectionTabs" style="display:none;">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="notificationsettings.html" data-role="button">${TabNotifications}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabServices}</a>
</div>
</div>
<div class="detailSectionHeader">${HeaderInstalledServices}</div>
<div class="installedPlugins"></div>
<br />

View file

@ -0,0 +1,34 @@
{
"name": "alameda",
"version": "1.0.0",
"ignore": [
".gitignore",
".npmignore",
"node_modules",
"package.json",
"README.md",
"tests",
"tests-requirejs",
"copyrequirejstests.sh",
"testBaseUrl.js"
],
"homepage": "https://github.com/requirejs/alameda",
"authors": [
"jrburke.com"
],
"description": "AMD loader, like requirejs, but with promises and for modern browsers",
"main": "alameda.js",
"license": [
"MIT"
],
"_release": "1.0.0",
"_resolution": {
"type": "version",
"tag": "1.0.0",
"commit": "f09e80862f0e40b4018531f360f5336c5ca8eaa2"
},
"_source": "git://github.com/requirejs/alameda.git",
"_target": "^1.0.0",
"_originalSource": "alameda",
"_direct": true
}

View file

@ -0,0 +1,45 @@
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/requirejs/alameda
The following license applies to all parts of this software except as
documented below:
====
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.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
Files located in the node_modules directory, and certain utilities used
to build or test the software in the tests and tests-requirejs directories, are
externally maintained libraries used by this software which have their own
licenses; we recommend you read them, as their terms may differ from the
terms above.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
{
"name": "alameda",
"version": "1.0.0",
"ignore": [
".gitignore",
".npmignore",
"node_modules",
"package.json",
"README.md",
"tests",
"tests-requirejs",
"copyrequirejstests.sh",
"testBaseUrl.js"
],
"homepage": "https://github.com/requirejs/alameda",
"authors": [
"jrburke.com"
],
"description": "AMD loader, like requirejs, but with promises and for modern browsers",
"main": "alameda.js",
"license": [
"MIT"
]
}

View file

@ -0,0 +1,8 @@
#!/bin/sh
rm alameda.min.js.gz
ls -la alameda.js
uglifyjs -c -m -o alameda.min.js alameda.js
ls -la alameda.min.js
gzip alameda.min.js
ls -la alameda.min.js.gz

View file

@ -16,14 +16,14 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.0.48",
"_release": "1.0.48",
"version": "1.0.50",
"_release": "1.0.50",
"_resolution": {
"type": "version",
"tag": "1.0.48",
"commit": "f9732e1b9084dad2f84a351dbae5a4772afab8b5"
"tag": "1.0.50",
"commit": "7988bb63ffe48f61c7a1b69fb5f7ab73a8d30fdd"
},
"_source": "git://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
"_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
"_target": "~1.0.3",
"_originalSource": "emby-apiclient"
}

View file

@ -1,339 +1,22 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
The MIT License
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Copyright (c) Emby https://emby.media
Preamble
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 licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
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.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{{description}}
Copyright (C) {{year}} {{fullname}}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View file

@ -526,6 +526,14 @@
}
};
self.ensureWebSocket = function() {
if (self.isWebSocketOpenOrConnecting() || !self.isWebSocketSupported()) {
return;
}
self.openWebSocket();
};
self.openWebSocket = function () {
var accessToken = self.accessToken();
@ -555,9 +563,7 @@
}, 0);
};
webSocket.onerror = function () {
setTimeout(function () {
Events.trigger(self, 'websocketerror');
}, 0);
};
webSocket.onclose = function () {
setTimeout(function () {

View file

@ -557,11 +557,9 @@
function validateAuthentication(server, connectionMode) {
return new Promise(function (resolve, reject) {
var url = ServerInfo.getServerAddress(server, connectionMode);
ajax({
return ajax({
type: "GET",
url: getEmbyServerUrl(url, "System/Info"),
@ -576,8 +574,7 @@
if (server.UserId) {
ajax({
return ajax({
type: "GET",
url: getEmbyServerUrl(url, "users/" + server.UserId),
dataType: "json",
@ -588,22 +585,23 @@
}).then(function(user) {
onLocalUserSignIn(server, connectionMode, user);
resolve();
return Promise.resolve();
}, function() {
server.UserId = null;
server.AccessToken = null;
resolve();
return Promise.resolve();
});
} else {
return Promise.resolve();
}
}, function () {
server.UserId = null;
server.AccessToken = null;
resolve();
});
return Promise.resolve();
});
}
@ -1522,7 +1520,7 @@
}
updateDevicePromise = ajax({
url: 'http://mb3admin.com/admin/service/registration/updateDevice?' + paramsToString({
url: 'https://mb3admin.com/admin/service/registration/updateDevice?' + paramsToString({
serverId: params.serverId,
oldDeviceId: regInfo.deviceId,
newDeviceId: params.deviceId
@ -1541,7 +1539,7 @@
params.embyUserName = user.Name;
return ajax({
url: 'http://mb3admin.com/admin/service/registration/validateDevice?' + paramsToString(params),
url: 'https://mb3admin.com/admin/service/registration/validateDevice?' + paramsToString(params),
type: 'POST'
}).then(function (response) {

View file

@ -21,9 +21,24 @@
padding-left: 16px;
padding-right: 16px;
}
:host:not([icon]) #titleIcon {
display: none !important;
}
:host #titleIcon {
margin-right: 1em;
}
:host #expandButton {
margin: 0;
display: flex;
align-items: center;
}
</style>
<div>
<paper-button on-tap="toggleExpand" id="expandButton" class="emby-collapsible-button" style="margin:0;display: flex; align-items: center;">
<paper-button on-tap="toggleExpand" id="expandButton" class="emby-collapsible-button">
<iron-icon id="titleIcon" icon="[[icon]]" style="[[iconstyle]]"></iron-icon>
<h3 class="emby-collapsible-title" title="[[title]]">[[title]]</h3>
<iron-icon id="expandIcon" style="margin-left: auto; margin-right: .5em;"></iron-icon>
</paper-button>

View file

@ -16,14 +16,14 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.1.96",
"_release": "1.1.96",
"version": "1.2.8",
"_release": "1.2.8",
"_resolution": {
"type": "version",
"tag": "1.1.96",
"commit": "81f0ec7b5bca701668dd1e643d0a4381b414d771"
"tag": "1.2.8",
"commit": "ab69b1f6c75888a55b4baa100f2d3c527633bf49"
},
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "~1.1.5",
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",
"_originalSource": "emby-webcomponents"
}

View file

@ -1,4 +1,4 @@
define(['appStorage'], function (appStorage) {
define(['appStorage', 'events'], function (appStorage, events) {
function getKey(name, userId) {
@ -9,74 +9,86 @@ define(['appStorage'], function (appStorage) {
return name;
}
function get(name, userId) {
return new function () {
return appStorage.getItem(getKey(name, userId));
}
var self = this;
function set(name, value, userId) {
appStorage.setItem(getKey(name, userId), value);
}
return {
enableAutomaticBitrateDetection: function (val) {
self.enableAutomaticBitrateDetection = function (val) {
if (val != null) {
set('enableAutomaticBitrateDetection', val.toString());
self.set('enableAutomaticBitrateDetection', val.toString());
}
return get('enableAutomaticBitrateDetection') != 'false';
},
maxStreamingBitrate: function (val) {
return self.get('enableAutomaticBitrateDetection') != 'false';
};
self.maxStreamingBitrate = function (val) {
if (val != null) {
set('preferredVideoBitrate', val);
self.set('preferredVideoBitrate', val);
}
return parseInt(get('preferredVideoBitrate') || '') || 1500000;
},
maxChromecastBitrate: function (val) {
return parseInt(self.get('preferredVideoBitrate') || '') || 1500000;
};
self.maxChromecastBitrate = function (val) {
if (val != null) {
set('chromecastBitrate1', val);
self.set('chromecastBitrate1', val);
}
val = get('chromecastBitrate1');
val = self.get('chromecastBitrate1');
return val ? parseInt(val) : null;
},
syncOnlyOnWifi: function (val) {
};
self.syncOnlyOnWifi = function (val) {
if (val != null) {
set('syncOnlyOnWifi', val.toString());
self.set('syncOnlyOnWifi', val.toString());
}
return get('syncOnlyOnWifi') != 'false';
},
syncPath: function (val) {
return self.get('syncOnlyOnWifi') != 'false';
};
self.syncPath = function (val) {
if (val != null) {
set('syncPath', val);
self.set('syncPath', val);
}
return get('syncPath');
},
return self.get('syncPath');
};
cameraUploadServers: function (val) {
self.cameraUploadServers = function (val) {
if (val != null) {
set('cameraUploadServers', val.join(','));
self.set('cameraUploadServers', val.join(','));
}
val = get('cameraUploadServers');
val = self.get('cameraUploadServers');
if (val) {
return val.split(',');
}
return [];
},
set: set,
get: get
};
self.set = function (name, value, userId) {
var currentValue = self.get(name, userId);
appStorage.setItem(getKey(name, userId), value);
if (currentValue != value) {
events.trigger(self, 'change', [name]);
}
};
self.get = function (name, userId) {
return appStorage.getItem(getKey(name, userId));
};
}();
});

View file

@ -160,8 +160,9 @@ define(['browser'], function (browser) {
return 100000000;
}
return function () {
return function (options) {
options = options || {};
var bitrateSetting = getMaxBitrate();
var videoTestElement = document.createElement('video');
@ -288,7 +289,7 @@ define(['browser'], function (browser) {
});
// Can't use mkv on mobile because we have to use the native player controls and they won't be able to seek it
if (canPlayMkv && !browser.mobile) {
if (canPlayMkv && options.supportsCustomSeeking) {
profile.TranscodingProfiles.push({
Container: 'mkv',
Type: 'Video',
@ -317,7 +318,9 @@ define(['browser'], function (browser) {
AudioCodec: hlsVideoAudioCodecs.join(','),
VideoCodec: 'h264',
Context: 'Streaming',
Protocol: 'hls'
Protocol: 'hls',
// Can't use this when autoplay is not supported
ForceLiveStream: options.supportsCustomSeeking ? true : false
});
}
@ -468,5 +471,5 @@ define(['browser'], function (browser) {
});
return profile;
}();
};
});

View file

@ -25,6 +25,12 @@
width: auto;
}
.dialog.centeredDialog {
top: 50%;
left: 50%;
max-width: 70%;
}
.dialog.scrollY {
overflow-y: auto;
-webkit-overflow-scrolling: touch;

View file

@ -71,8 +71,7 @@
var center = !dlg.classList.contains('fixedSize');
if (center) {
dlg.style.left = '50%';
dlg.style.top = '50%';
dlg.classList.add('centeredDialog');
}
dlg.classList.remove('hide');
@ -216,22 +215,22 @@
}
}
function scaleUp(elem) {
function scaleUp(elem, onFinish) {
var keyframes = [
{ transform: 'scale(0)', offset: 0 },
{ transform: 'scale(1,1)', offset: 1 }];
var timing = elem.animationConfig.entry.timing;
return elem.animate(keyframes, timing);
return elem.animate(keyframes, timing).onfinish = onFinish;
}
function fadeIn(elem) {
function fadeIn(elem, onFinish) {
var keyframes = [
{ opacity: '0', offset: 0 },
{ opacity: '1', offset: 1 }];
var timing = elem.animationConfig.entry.timing;
return elem.animate(keyframes, timing);
return elem.animate(keyframes, timing).onfinish = onFinish;
}
function fadeOut(elem) {
@ -269,13 +268,17 @@
function animateDialogOpen(dlg) {
var onAnimationFinish = function() {
};
if (!dlg.animationConfig || !dlg.animate) {
onAnimationFinish();
return;
}
if (dlg.animationConfig.entry.name == 'fade-in-animation') {
fadeIn(dlg);
fadeIn(dlg, onAnimationFinish);
} else if (dlg.animationConfig.entry.name == 'scale-up-animation') {
scaleUp(dlg);
scaleUp(dlg, onAnimationFinish);
}
}

View file

@ -457,6 +457,12 @@ define([], function () {
return result;
}
function sendText(text) {
var elem = document.activeElement;
elem.value = text;
}
return {
autoFocus: autoFocus,
focus: focus,
@ -473,6 +479,7 @@ define([], function () {
},
moveDown: function (sourceElement) {
nav(sourceElement, 3);
}
},
sendText: sendText
};
});

View file

@ -54,12 +54,95 @@ define(['cryptojs-md5'], function () {
imageCacheDirectoryEntry = dirEntry;
// TODO: find a better time to schedule this
setTimeout(cleanCache, 60000);
});
});
});
function toArray(list) {
return Array.prototype.slice.call(list || [], 0);
}
function cleanCache() {
var dirReader = imageCacheDirectoryEntry.createReader();
var entries = [];
var onReadFail = function () {
console.log('dirReader.readEntries failed');
};
// Keep calling readEntries() until no more results are returned.
var readEntries = function () {
dirReader.readEntries(function (results) {
if (!results.length) {
entries.forEach(cleanFile);
} else {
entries = entries.concat(toArray(results));
readEntries();
}
}, onReadFail);
};
// Start reading the directory.
readEntries();
}
function cleanFile(fileEntry) {
if (!fileEntry.isFile) {
return;
}
fileEntry.file(function (file) {
getLastModified(file, fileEntry).then(function (lastModifiedDate) {
var elapsed = new Date().getTime() - lastModifiedDate;
// 40 days
var maxElapsed = 3456000000;
if (elapsed >= maxElapsed) {
var fullPath = fileEntry.fullPath;
console.log('deleting file: ' + fullPath);
fileEntry.remove(function () {
console.log('File deleted: ' + fullPath);
}, function () {
console.log('Failed to delete file: ' + fullPath);
});
}
});
});
}
function getLastModified(file, fileEntry) {
var lastModifiedDate = file.lastModified || file.lastModifiedDate || file.modificationTime;
if (lastModifiedDate) {
if (lastModifiedDate.getTime) {
lastModifiedDate = lastModifiedDate.getTime();
}
return Promise.resolve(lastModifiedDate);
}
return new Promise(function (resolve, reject) {
fileEntry.getMetadata(function (metadata) {
var lastModifiedDate = metadata.lastModified || metadata.lastModifiedDate || metadata.modificationTime;
if (lastModifiedDate) {
if (lastModifiedDate.getTime) {
lastModifiedDate = lastModifiedDate.getTime();
}
}
resolve(lastModifiedDate);
});
});
}
function getCacheKey(url) {
// Try to strip off the domain to share the cache between local and remote connections

View file

@ -0,0 +1,195 @@
define(['connectionManager', 'playbackManager', 'events', 'inputManager', 'focusManager'], function (connectionManager, playbackManager, events, inputManager, focusManager) {
function displayMessage(cmd) {
var args = cmd.Arguments;
if (args.TimeoutMs) {
require(['toast'], function (toast) {
toast({ title: args.Header, text: args.Text });
});
}
else {
require(['alert'], function (alert) {
alert({ title: args.Header, text: args.Text });
});
}
}
function processGeneralCommand(cmd) {
// Full list
// https://github.com/MediaBrowser/MediaBrowser/blob/master/MediaBrowser.Model/Session/GeneralCommand.cs#L23
console.log('Received command: ' + cmd.Name);
switch (cmd.Name) {
case 'Select':
inputManager.trigger('select');
break;
case 'Back':
inputManager.trigger('back');
break;
case 'MoveUp':
inputManager.trigger('up');
break;
case 'MoveDown':
inputManager.trigger('down');
break;
case 'MoveLeft':
inputManager.trigger('left');
break;
case 'MoveRight':
inputManager.trigger('right');
break;
case 'PageUp':
inputManager.trigger('pageup');
break;
case 'PageDown':
inputManager.trigger('pagedown');
break;
case 'SetRepeatMode':
playbackManager.setRepeatMode(cmd.Arguments.RepeatMode);
break;
case 'VolumeUp':
inputManager.trigger('volumeup');
break;
case 'VolumeDown':
inputManager.trigger('volumedown');
break;
case 'ChannelUp':
inputManager.trigger('channelup');
break;
case 'ChannelDown':
inputManager.trigger('channeldown');
break;
case 'Mute':
inputManager.trigger('mute');
break;
case 'Unmute':
inputManager.trigger('unmute');
break;
case 'ToggleMute':
inputManager.trigger('togglemute');
break;
case 'SetVolume':
playbackManager.volume(cmd.Arguments.Volume);
break;
case 'SetAudioStreamIndex':
playbackManager.setAudioStreamIndex(parseInt(cmd.Arguments.Index));
break;
case 'SetSubtitleStreamIndex':
playbackManager.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index));
break;
case 'ToggleFullscreen':
inputManager.trigger('togglefullscreen');
break;
case 'GoHome':
inputManager.trigger('home');
break;
case 'GoToSettings':
inputManager.trigger('settings');
break;
case 'DisplayContent':
//Dashboard.onBrowseCommand(cmd.Arguments);
break;
case 'GoToSearch':
inputManager.trigger('search');
break;
case 'DisplayMessage':
displayMessage(cmd);
break;
case 'ToggleOsd':
// todo
break;
case 'ToggleContextMenu':
// todo
break;
case 'TakeScreenShot':
// todo
break;
case 'SendKey':
// todo
break;
case 'SendString':
// todo
focusManager.sendText(cmd.Arguments.String);
break;
default:
console.log('processGeneralCommand does not recognize: ' + cmd.Name);
break;
}
}
function onWebSocketMessageReceived(e, msg) {
var apiClient = this;
if (msg.MessageType === "LibraryChanged") {
}
else if (msg.MessageType === "Play") {
var serverId = apiClient.serverInfo().Id;
if (msg.Data.PlayCommand == "PlayNext") {
playbackManager.queueNext({ ids: msg.Data.ItemIds, serverId: serverId });
}
else if (msg.Data.PlayCommand == "PlayLast") {
playbackManager.queue({ ids: msg.Data.ItemIds, serverId: serverId });
}
else {
playbackManager.play({ ids: msg.Data.ItemIds, startPositionTicks: msg.Data.StartPositionTicks, serverId: serverId });
}
}
else if (msg.MessageType === "ServerShuttingDown") {
}
else if (msg.MessageType === "ServerRestarting") {
}
else if (msg.MessageType === "Playstate") {
if (msg.Data.Command === 'Stop') {
inputManager.trigger('stop');
}
else if (msg.Data.Command === 'Pause') {
inputManager.trigger('pause');
}
else if (msg.Data.Command === 'Unpause') {
inputManager.trigger('play');
}
else if (msg.Data.Command === 'Seek') {
playbackManager.seek(msg.Data.SeekPositionTicks);
}
else if (msg.Data.Command === 'NextTrack') {
inputManager.trigger('next');
}
else if (msg.Data.Command === 'PreviousTrack') {
inputManager.trigger('previous');
}
}
else if (msg.MessageType === "GeneralCommand") {
var cmd = msg.Data;
processGeneralCommand(cmd);
}
else if (msg.MessageType === "RestartRequired") {
}
}
function bindEvents(apiClient) {
events.off(apiClient, "websocketmessage", onWebSocketMessageReceived);
events.on(apiClient, "websocketmessage", onWebSocketMessageReceived);
}
//var current = connectionManager.currentApiClient();
//if (current) {
// bindEvents(current);
//}
events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
bindEvents(newApiClient);
});
});

View file

@ -15,6 +15,9 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b
},
showSettings: function () {
show('/settings/settings.html');
},
showSearch: function () {
skinManager.getCurrentSkin().search();
}
};
@ -285,7 +288,12 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b
skinManager.loadUserSkin();
return;
} else if (route.roles) {
validateRoles(apiClient, route.roles, callback).then(callback, beginConnectionWizard);
validateRoles(apiClient, route.roles).then(function () {
apiClient.ensureWebSocket();
callback();
}, beginConnectionWizard);
return;
}
}

View file

@ -11,7 +11,7 @@ define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, ap
return null;
}
var obj = function () {
return new function () {
var self = this;
@ -94,7 +94,5 @@ define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, ap
});
}
};
};
return new obj();
}();
});

View file

@ -1,6 +1,6 @@
{
"name": "hls.js",
"version": "0.5.16",
"version": "0.5.19",
"license": "Apache-2.0",
"description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js",
@ -16,11 +16,11 @@
"test",
"tests"
],
"_release": "0.5.16",
"_release": "0.5.19",
"_resolution": {
"type": "version",
"tag": "v0.5.16",
"commit": "a7df764cb21cf306bf4fe7c54ae68c8e4cd30f51"
"tag": "v0.5.19",
"commit": "ad5665b216b04d1dd5a44dbf9242664e2da323e0"
},
"_source": "git://github.com/dailymotion/hls.js.git",
"_target": "~0.5.7",

View file

@ -191,6 +191,7 @@ configuration parameters could be provided to hls.js upon instantiation of Hls O
maxBufferSize : 60*1000*1000,
maxBufferHole : 0.3,
maxSeekHole : 2,
seekHoleNudgeDuration : 0.01,
maxFragLookUpTolerance : 0.2,
liveSyncDurationCount : 3,
liveMaxLatencyDurationCount: 10,
@ -276,6 +277,13 @@ in case playback is stalled, and a buffered range is available upfront, less tha
hls.js will jump over this buffer hole to reach the beginning of this following buffered range.
```maxSeekHole``` allows to configure this jumpable threshold.
#### ```seekHoleNudgeDuration```
(default 0.01s)
in case playback is still stalling although a seek over buffer hole just occured, hls.js will seek to next buffer start + (nb of consecutive stalls * seekHoleNudgeDuration to try to restore playback
#### ```maxFragLookUpTolerance```
(default 0.2s)

View file

@ -1,6 +1,6 @@
{
"name": "hls.js",
"version": "0.5.16",
"version": "0.5.19",
"license": "Apache-2.0",
"description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js",

View file

@ -368,12 +368,12 @@ module.exports = function (fn) {
},{}],3:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -471,8 +471,8 @@ var AbrController = function (_EventHandler) {
// time to finish loading current fragment is bigger than buffer starvation delay
// ie if we risk buffer starvation if bw does not increase quickly
if (bufferStarvationDelay < 2 * frag.duration && fragLoadedDelay > bufferStarvationDelay) {
var fragLevelNextLoadedDelay = undefined,
nextLoadLevel = undefined;
var fragLevelNextLoadedDelay = void 0,
nextLoadLevel = void 0;
// lets iterate through lower level and try to find the biggest one that could avoid rebuffering
// we start from current level - 1 and we step down , until we find a matching level
for (nextLoadLevel = frag.level - 1; nextLoadLevel >= 0; nextLoadLevel--) {
@ -557,7 +557,7 @@ var AbrController = function (_EventHandler) {
adjustedbw,
i,
maxAutoLevel;
if (this._autoLevelCapping === -1) {
if (this._autoLevelCapping === -1 && hls.levels && hls.levels.length) {
maxAutoLevel = hls.levels.length - 1;
} else {
maxAutoLevel = this._autoLevelCapping;
@ -599,12 +599,12 @@ exports.default = AbrController;
},{"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../utils/logger":36}],4:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -992,12 +992,12 @@ exports.default = BufferController;
},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],5:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -1077,9 +1077,9 @@ var CapLevelController = function (_EventHandler) {
}, {
key: 'getMaxLevel',
value: function getMaxLevel(capLevelIndex) {
var result = undefined,
i = undefined,
level = undefined,
var result = void 0,
i = void 0,
level = void 0,
mWidth = this.mediaWidth,
mHeight = this.mediaHeight,
lWidth = 0,
@ -1108,7 +1108,7 @@ var CapLevelController = function (_EventHandler) {
}, {
key: 'mediaWidth',
get: function get() {
var width = undefined;
var width = void 0;
if (this.media) {
width = this.media.width || this.media.clientWidth || this.media.offsetWidth;
width *= this.contentScaleFactor;
@ -1118,7 +1118,7 @@ var CapLevelController = function (_EventHandler) {
}, {
key: 'mediaHeight',
get: function get() {
var height = undefined;
var height = void 0;
if (this.media) {
height = this.media.height || this.media.clientHeight || this.media.offsetHeight;
height *= this.contentScaleFactor;
@ -1135,12 +1135,12 @@ exports.default = CapLevelController;
},{"../event-handler":21,"../events":22}],6:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -1359,7 +1359,7 @@ var LevelController = function (_EventHandler) {
}
// redispatch same error but with fatal set to true
data.fatal = true;
hls.trigger(event, data);
hls.trigger(_events2.default.ERROR, data);
}
}
}
@ -1460,12 +1460,12 @@ exports.default = LevelController;
},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],7:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _demuxer = require('../demux/demuxer');
var _demuxer2 = _interopRequireDefault(_demuxer);
@ -1691,7 +1691,7 @@ var StreamController = function (_EventHandler) {
fragLen = fragments.length,
start = fragments[0].start,
end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,
frag = undefined;
frag = void 0;
// in case of live playlist we need to ensure that requested position is not located before playlist start
if (levelDetails.live) {
@ -1733,7 +1733,7 @@ var StreamController = function (_EventHandler) {
}
if (!frag) {
(function () {
var foundFrag = undefined;
var foundFrag = void 0;
var maxFragLookUpTolerance = config.maxFragLookUpTolerance;
if (bufferEnd < end) {
if (bufferEnd > end - maxFragLookUpTolerance) {
@ -2446,9 +2446,12 @@ var StreamController = function (_EventHandler) {
case _errors.ErrorDetails.LEVEL_LOAD_TIMEOUT:
case _errors.ErrorDetails.KEY_LOAD_ERROR:
case _errors.ErrorDetails.KEY_LOAD_TIMEOUT:
// when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received
if (this.state !== State.ERROR) {
// if fatal error, stop processing, otherwise move to IDLE to retry loading
_logger.logger.warn('mediaController: ' + data.details + ' while loading frag,switch to ' + (data.fatal ? 'ERROR' : 'IDLE') + ' state ...');
this.state = data.fatal ? State.ERROR : State.IDLE;
_logger.logger.warn('mediaController: ' + data.details + ' while loading frag,switch to ' + this.state + ' state ...');
}
break;
case _errors.ErrorDetails.BUFFER_FULL_ERROR:
// trigger a smooth level switch to empty buffers
@ -2512,12 +2515,16 @@ var StreamController = function (_EventHandler) {
if (playheadMoving || !expectedPlaying) {
// playhead moving or media not playing
jumpThreshold = 0;
this.seekHoleNudgeDuration = 0;
} else {
// playhead not moving AND media expected to play
if (!this.stalled) {
this.seekHoleNudgeDuration = 0;
_logger.logger.log('playback seems stuck @' + currentTime);
this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_STALLED_ERROR, fatal: false });
this.stalled = true;
} else {
this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration;
}
}
// if we are below threshold, try to jump if next buffer range is close
@ -2528,8 +2535,8 @@ var StreamController = function (_EventHandler) {
if (nextBufferStart && delta < this.config.maxSeekHole && delta > 0 && !media.seeking) {
// next buffer is close ! adjust currentTime to nextBufferStart
// this will ensure effective video decoding
_logger.logger.log('adjust currentTime from ' + media.currentTime + ' to next buffered @ ' + nextBufferStart);
media.currentTime = nextBufferStart;
_logger.logger.log('adjust currentTime from ' + media.currentTime + ' to next buffered @ ' + nextBufferStart + ' + nudge ' + this.seekHoleNudgeDuration);
media.currentTime = nextBufferStart + this.seekHoleNudgeDuration;
this.hls.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false });
}
}
@ -2631,12 +2638,12 @@ exports.default = StreamController;
},{"../demux/demuxer":16,"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../helper/level-helper":24,"../utils/binary-search":34,"../utils/logger":36}],8:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -2729,12 +2736,12 @@ exports.default = TimelineController;
},{"../event-handler":21,"../events":22,"../utils/cea-708-interpreter":35}],9:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*
@ -2857,6 +2864,7 @@ var AES = function () {
* @private
*/
_createClass(AES, [{
key: '_precompute',
value: function _precompute() {
@ -2938,6 +2946,7 @@ var AES = function () {
kIndex = 4,
table = this._tables[1],
// load up the tables
table0 = table[0],
table1 = table[1],
@ -2971,6 +2980,10 @@ exports.default = AES;
},{}],10:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
*
* This file contains an adaptation of the AES decryption algorithm
@ -3009,10 +3022,6 @@ var _createClass = function () { function defineProperties(target, props) { for
* official policies, either expressed or implied, of the authors.
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _aes = require('./aes');
var _aes2 = _interopRequireDefault(_aes);
@ -3034,6 +3043,7 @@ var AES128Decrypter = function () {
* representation.
*/
_createClass(AES128Decrypter, [{
key: 'ntoh',
value: function ntoh(word) {
@ -3061,10 +3071,12 @@ var AES128Decrypter = function () {
encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2),
decipher = new _aes2.default(Array.prototype.slice.call(key)),
// byte and word-level access for the decrypted output
decrypted = new Uint8Array(encrypted.byteLength),
decrypted32 = new Int32Array(decrypted.buffer),
// temporary variables for working with the IV, encrypted, and
// decrypted data
init0,
@ -3076,6 +3088,7 @@ var AES128Decrypter = function () {
encrypted2,
encrypted3,
// iteration variable
wordIx;
@ -3153,14 +3166,14 @@ exports.default = AES128Decrypter;
},{"./aes":9}],11:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
* AES128 decryption.
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
* AES128 decryption.
*/
var _aes128Decrypter = require('./aes128-decrypter');
var _aes128Decrypter2 = _interopRequireDefault(_aes128Decrypter);
@ -3250,13 +3263,14 @@ exports.default = Decrypter;
},{"../errors":20,"../utils/logger":36,"./aes128-decrypter":10}],12:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* AAC demuxer
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _adts = require('./adts');
@ -3285,6 +3299,7 @@ var AACDemuxer = function () {
_createClass(AACDemuxer, [{
key: 'push',
// feed incoming data to the front of the parsing pipeline
value: function push(data, audioCodec, videoCodec, timeOffset, cc, level, sn, duration) {
var track = this._aacTrack,
@ -3376,13 +3391,14 @@ exports.default = AACDemuxer;
},{"../demux/id3":18,"../utils/logger":36,"./adts":13}],13:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* ADTS parser helper
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _logger = require('../utils/logger');
@ -3522,14 +3538,14 @@ exports.default = ADTS;
},{"../errors":20,"../utils/logger":36}],14:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* inline demuxer.
* probe fragments and instantiate appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* inline demuxer.
* probe fragments and instantiate appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)
*/
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -3694,12 +3710,12 @@ exports.default = DemuxerWorker;
},{"../demux/demuxer-inline":14,"../events":22,"events":1}],16:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -3840,14 +3856,14 @@ exports.default = Demuxer;
},{"../crypt/decrypter":11,"../demux/demuxer-inline":14,"../demux/demuxer-worker":15,"../events":22,"../utils/logger":36,"webworkify":2}],17:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.
*/
var _logger = require('../utils/logger');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -3867,6 +3883,7 @@ var ExpGolomb = function () {
// ():void
_createClass(ExpGolomb, [{
key: 'loadWord',
value: function loadWord() {
@ -4132,7 +4149,7 @@ var ExpGolomb = function () {
// vui_parameters_present_flag
if (this.readBoolean()) {
// aspect_ratio_info_present_flag
var sarRatio = undefined;
var sarRatio = void 0;
var aspectRatioIdc = this.readUByte();
switch (aspectRatioIdc) {
case 1:
@ -4203,13 +4220,14 @@ exports.default = ExpGolomb;
},{"../utils/logger":36}],18:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* ID3 parser
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _logger = require('../utils/logger');
@ -4355,6 +4373,10 @@ exports.default = ID3;
},{"../utils/logger":36}],19:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* highly optimized TS demuxer:
* parse PAT, PMT
@ -4368,9 +4390,6 @@ var _createClass = function () { function defineProperties(target, props) { for
// import Hex from '../utils/hex';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _adts = require('./adts');
@ -5138,14 +5157,14 @@ var ErrorDetails = exports.ErrorDetails = {
},{}],21:[function(require,module,exports){
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*
@ -5312,12 +5331,12 @@ module.exports = {
},{}],23:[function(require,module,exports){
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
@ -5415,14 +5434,14 @@ exports.default = BufferHelper;
},{}],24:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* Level Helper class, providing methods dealing with playlist sliding and drift
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* Level Helper class, providing methods dealing with playlist sliding and drift
*/
var _logger = require('../utils/logger');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -5561,13 +5580,14 @@ exports.default = LevelHelper;
*/
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
//import FPSController from './controller/fps-controller';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
//import FPSController from './controller/fps-controller';
var _events = require('./events');
var _events2 = _interopRequireDefault(_events);
@ -5657,6 +5677,7 @@ var Hls = function () {
maxBufferSize: 60 * 1000 * 1000,
maxBufferHole: 0.5,
maxSeekHole: 2,
seekHoleNudgeDuration: 0.01,
maxFragLookUpTolerance: 0.2,
liveSyncDurationCount: 3,
liveMaxLatencyDurationCount: Infinity,
@ -5984,12 +6005,12 @@ module.exports = require('./hls.js').default;
},{"./hls.js":25}],27:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -6079,12 +6100,12 @@ exports.default = FragmentLoader;
},{"../errors":20,"../event-handler":21,"../events":22}],28:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -6184,12 +6205,12 @@ exports.default = KeyLoader;
},{"../errors":20,"../event-handler":21,"../events":22}],29:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -6280,7 +6301,7 @@ var PlaylistLoader = function (_EventHandler) {
key: 'parseMasterPlaylist',
value: function parseMasterPlaylist(string, baseurl) {
var levels = [],
result = undefined;
result = void 0;
// https://regex101.com is your friend
var re = /#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g;
@ -6295,7 +6316,7 @@ var PlaylistLoader = function (_EventHandler) {
level.width = resolution.width;
level.height = resolution.height;
}
level.bitrate = attrs.decimalInteger('BANDWIDTH');
level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');
level.name = attrs.NAME;
var codecs = attrs.CODECS;
@ -6524,12 +6545,12 @@ exports.default = PlaylistLoader;
},{"../errors":20,"../event-handler":21,"../events":22,"../utils/attr-list":33,"../utils/url":37}],30:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
@ -7033,14 +7054,14 @@ exports.default = MP4;
},{}],31:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* fMP4 remuxer
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* fMP4 remuxer
*/
var _events = require('../events');
var _events2 = _interopRequireDefault(_events);
@ -7088,6 +7109,7 @@ var MP4Remuxer = function () {
if (!this.ISGenerated) {
this.generateIS(audioTrack, videoTrack, timeOffset);
}
if (this.ISGenerated) {
//logger.log('nb AVC samples:' + videoTrack.samples.length);
if (videoTrack.samples.length) {
this.remuxVideo(videoTrack, timeOffset, contiguous);
@ -7096,6 +7118,7 @@ var MP4Remuxer = function () {
if (audioTrack.samples.length) {
this.remuxAudio(audioTrack, timeOffset, contiguous);
}
}
//logger.log('nb ID3 samples:' + audioTrack.samples.length);
if (id3Track.samples.length) {
this.remuxID3(id3Track, timeOffset);
@ -7172,15 +7195,15 @@ var MP4Remuxer = function () {
}
}
if (!Object.keys(tracks)) {
observer.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found' });
} else {
if (Object.keys(tracks).length) {
observer.trigger(_events2.default.FRAG_PARSING_INIT_SEGMENT, data);
this.ISGenerated = true;
if (computePTSDTS) {
this._initPTS = initPTS;
this._initDTS = initDTS;
}
} else {
observer.trigger(_events2.default.ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found' });
}
}
}, {
@ -7240,8 +7263,8 @@ var MP4Remuxer = function () {
}
mp4Sample.duration = sampleDuration;
} else {
var nextAvcDts = undefined,
delta = undefined;
var nextAvcDts = void 0,
delta = void 0;
if (contiguous) {
nextAvcDts = this.nextAvcDts;
} else {
@ -7374,8 +7397,8 @@ var MP4Remuxer = function () {
mp4Sample.duration = expectedSampleDuration;
dtsnorm = expectedSampleDuration * pes2mp4ScaleFactor + lastDTS;
} else {
var nextAacPts = undefined,
delta = undefined;
var nextAacPts = void 0,
delta = void 0;
if (contiguous) {
nextAacPts = this.nextAacPts;
} else {
@ -7545,13 +7568,14 @@ exports.default = MP4Remuxer;
},{"../errors":20,"../events":22,"../remux/mp4-generator":30,"../utils/logger":36}],32:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* passthrough remuxer
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _events = require('../events');
@ -7639,12 +7663,12 @@ exports.default = PassThroughRemuxer;
},{"../events":22}],33:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js
@ -7791,12 +7815,12 @@ module.exports = BinarySearch;
},{}],35:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*
@ -8211,11 +8235,12 @@ exports.default = CEA708Interpreter;
},{}],36:[function(require,module,exports){
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
function noop() {}
var fakeLogger = {
@ -8373,14 +8398,14 @@ module.exports = URLHelper;
},{}],38:[function(require,module,exports){
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* XHR based logger
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* XHR based logger
*/
var _logger = require('../utils/logger');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
#/bin/sh
git checkout gh-pages
git rebase master
git rebase v0.5.x
git push origin gh-pages --force
git checkout master
git checkout v0.5.x

View file

@ -1,6 +1,6 @@
{
"name": "hls.js",
"version": "0.5.16",
"version": "0.5.19",
"license": "Apache-2.0",
"description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js",

View file

@ -143,7 +143,7 @@ class AbrController extends EventHandler {
get nextAutoLevel() {
var lastbw = this.lastbw, hls = this.hls,adjustedbw, i, maxAutoLevel;
if (this._autoLevelCapping === -1) {
if (this._autoLevelCapping === -1 && hls.levels && hls.levels.length) {
maxAutoLevel = hls.levels.length - 1;
} else {
maxAutoLevel = this._autoLevelCapping;

View file

@ -225,7 +225,7 @@ class LevelController extends EventHandler {
}
// redispatch same error but with fatal set to true
data.fatal = true;
hls.trigger(event, data);
hls.trigger(Event.ERROR, data);
}
}
}

View file

@ -943,9 +943,12 @@ class StreamController extends EventHandler {
case ErrorDetails.LEVEL_LOAD_TIMEOUT:
case ErrorDetails.KEY_LOAD_ERROR:
case ErrorDetails.KEY_LOAD_TIMEOUT:
// when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received
if(this.state !== State.ERROR) {
// if fatal error, stop processing, otherwise move to IDLE to retry loading
logger.warn(`mediaController: ${data.details} while loading frag,switch to ${data.fatal ? 'ERROR' : 'IDLE'} state ...`);
this.state = data.fatal ? State.ERROR : State.IDLE;
logger.warn(`mediaController: ${data.details} while loading frag,switch to ${this.state} state ...`);
}
break;
case ErrorDetails.BUFFER_FULL_ERROR:
// trigger a smooth level switch to empty buffers
@ -1007,12 +1010,16 @@ _checkBuffer() {
if(playheadMoving || !expectedPlaying) {
// playhead moving or media not playing
jumpThreshold = 0;
this.seekHoleNudgeDuration = 0;
} else {
// playhead not moving AND media expected to play
if(!this.stalled) {
this.seekHoleNudgeDuration = 0;
logger.log(`playback seems stuck @${currentTime}`);
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_STALLED_ERROR, fatal: false});
this.stalled = true;
} else {
this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration;
}
}
// if we are below threshold, try to jump if next buffer range is close
@ -1025,8 +1032,8 @@ _checkBuffer() {
!media.seeking) {
// next buffer is close ! adjust currentTime to nextBufferStart
// this will ensure effective video decoding
logger.log(`adjust currentTime from ${media.currentTime} to next buffered @ ${nextBufferStart}`);
media.currentTime = nextBufferStart;
logger.log(`adjust currentTime from ${media.currentTime} to next buffered @ ${nextBufferStart} + nudge ${this.seekHoleNudgeDuration}`);
media.currentTime = nextBufferStart + this.seekHoleNudgeDuration;
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: false});
}
}

View file

@ -47,6 +47,7 @@ class Hls {
maxBufferSize: 60 * 1000 * 1000,
maxBufferHole: 0.5,
maxSeekHole: 2,
seekHoleNudgeDuration : 0.01,
maxFragLookUpTolerance : 0.2,
liveSyncDurationCount:3,
liveMaxLatencyDurationCount: Infinity,

View file

@ -75,7 +75,7 @@ class PlaylistLoader extends EventHandler {
level.width = resolution.width;
level.height = resolution.height;
}
level.bitrate = attrs.decimalInteger('BANDWIDTH');
level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');
level.name = attrs.NAME;
var codecs = attrs.CODECS;

View file

@ -37,6 +37,7 @@ class MP4Remuxer {
if (!this.ISGenerated) {
this.generateIS(audioTrack,videoTrack,timeOffset);
}
if (this.ISGenerated) {
//logger.log('nb AVC samples:' + videoTrack.samples.length);
if (videoTrack.samples.length) {
this.remuxVideo(videoTrack,timeOffset,contiguous);
@ -45,6 +46,7 @@ class MP4Remuxer {
if (audioTrack.samples.length) {
this.remuxAudio(audioTrack,timeOffset,contiguous);
}
}
//logger.log('nb ID3 samples:' + audioTrack.samples.length);
if (id3Track.samples.length) {
this.remuxID3(id3Track,timeOffset);
@ -117,15 +119,15 @@ class MP4Remuxer {
}
}
if(!Object.keys(tracks)) {
observer.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found'});
} else {
if(Object.keys(tracks).length) {
observer.trigger(Event.FRAG_PARSING_INIT_SEGMENT,data);
this.ISGenerated = true;
if (computePTSDTS) {
this._initPTS = initPTS;
this._initDTS = initDTS;
}
} else {
observer.trigger(Event.ERROR, {type : ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found'});
}
}

View file

@ -1,6 +1,6 @@
{
"name": "iron-a11y-keys-behavior",
"version": "1.1.1",
"version": "1.1.2",
"description": "A behavior that enables keybindings for greater a11y.",
"keywords": [
"web-components",
@ -23,19 +23,19 @@
},
"devDependencies": {
"paper-styles": "PolymerElements/paper-styles#^1.0.2",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior",
"_release": "1.1.1",
"_release": "1.1.2",
"_resolution": {
"type": "version",
"tag": "v1.1.1",
"commit": "12af7cb19b2c6b3887e37a5ea1501ffe676d1e8a"
"tag": "v1.1.2",
"commit": "0c2330c229a6fd3d200e2b84147ec6f94f17c22d"
},
"_source": "git://github.com/polymerelements/iron-a11y-keys-behavior.git",
"_target": "^1.0.0",

View file

@ -0,0 +1,33 @@
<!-- Instructions: https://github.com/PolymerElements/iron-a11y-keys-behavior/CONTRIBUTING.md#filing-issues -->
### Description
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
### Expected outcome
<!-- Example: The page stays the same color. -->
### Actual outcome
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
### Steps to reproduce
<!-- Example
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
-->
### Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10

View file

@ -1,22 +1,25 @@
language: node_js
sudo: false
before_script:
- npm install web-component-tester
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- npm install -g bower polylint web-component-tester
- bower install
- polylint
env:
global:
- secure: OZhLlPsjjnWU4FyZ+RKq5i/Nv/tElvcjr9+OT04ENGKfh9+fkuij/XdHJQe6EpOCjrNkwt23c+I6V5YWRrSatRX/AxEkViW8EXnF32rX3HV8fWnjD6Vfn+4Qz82y4huc9II8OV5I7jFDln6yzEGZn08zAtbmhj5dSpYtT1spSf/ZuUkqn4mMRJW2wCOnzbjueP56Ry40IwQm0enLXVQLPYB3LC4fBWfT+VFrsE9qH1ZgGKcSD/n2dOD3d6xjts4FSilNp2IZ8Km5RNAFUxYmkcwrY4O2ltNtKUngWwIpeplpz0bNj5k8kOpT5xA/FT630M5sFd1ODVp846kTr/EyYTq/VCiwTaA/vDfZL85DC3O+Zt0vTHAvkxKAaXkg9sMp8gJOJ6gt6cK8rV8z7npeAUVsK1gmuHYXne1Z76SRgWwbE0/z82vyFLNgitmZDLLM1fP3TpzsK1QQg1ikn6iYXdWpHcrzBi6lk8mCafnP7D7B/yFB/Z6Y9AFI6NQI/jWP2FMMJjMWbaJVG9DAU4PWlVTiFnhfVjPI7FUEmW46/QjH1ztSZWpDA9SBozJluIpKRA1qk1EgGX1RBFBHrbFtHG//x0AGyAV6gWOfdKjl/nqcM02xFUSrDb0tkNUnEAS6K7l+X1eDaBbiaAQiakPt9Je2WvvHyc+OiZviSc72Gmc=
- secure: vIs86+z7s1QwihkHtLBRQzlmJRSIWIadq3SlDdZHS4HOivH7fNV0d4hm8QnZYZ9X8yvSvxFCzEFdLuX1TpU0H3oy5wgYky7DnfJtsEhuOfW8dobHHZeCNi/t2FQAXpobqpRwojC3A+1b1lNrY1XNpYRz7aEialO4Yr8e1SQSLex5zw/pqm7g9Vz6PnQwobDQcGXKc6ZWc84+DqOo9qfkSlnEJC/1vQxHYpUa172UnnAnmHJ7gZKdhf9aLWJSZcSpPcoKEnvslRFmeDyRMNRDWVzcg2vHnV+tc1aYzp1wsrRW3P+oqwYlvGlxo+5U92QLXKIcKZhGblVWxe8BtXgiVzgS1sz5D11vKs61Xe46onbguG/XK3UxX9bPRK5uklkC5fwAY2hhvOTGXqimTb2YrlyEWO3BCKGBk6Is3KGyCe7c2nNEmXPUSun9X1JLGRPivJb9iBR4/WSEFvibYHl6/gIke9LdXPOCHuJ3+Iu14lCz+pwi8ADIWVuGpDIxFcorG8a3BCoxQo5VouUbSe0mcNttAvSzBNxhljaaBuFs56DLDpLRr0sGhqvfA1JzdCyzVyrk4WECfZw26pAnYCyTczVXmu5msVdKnjPJKtDqWazvIhHk2G1mk8CKb14lrN58u/Kh6PQ3miJ+61c1stBWhRDlp2QffOkBJiOATKHF+AA=
node_js: 4
- CXX=g++-4.8
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
- ubuntu-toolchain-r-test
packages:
- google-chrome-stable
- g++-4.8
sauce_connect: true
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -5,6 +5,11 @@ https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
You can however override the jsbin link with one that's customized to this
specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output
-->
# Polymer Elements
## Guide for Contributors
@ -41,7 +46,7 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output).
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
@ -51,14 +56,14 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, #40
Fixes #32, fixes #40
```
2. **A succinct description of the design** used to fix any related issues. For example:

View file

@ -1,6 +1,6 @@
{
"name": "iron-a11y-keys-behavior",
"version": "1.1.1",
"version": "1.1.2",
"description": "A behavior that enables keybindings for greater a11y.",
"keywords": [
"web-components",
@ -23,10 +23,10 @@
},
"devDependencies": {
"paper-styles": "PolymerElements/paper-styles#^1.0.2",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "polymer/web-component-tester#^3.4.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": []

View file

@ -2,11 +2,11 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>

View file

@ -90,6 +90,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
var SPACE_KEY = /^space(bar)?/;
/**
* Matches ESC key.
*
* Value from: http://w3c.github.io/uievents-key/#key-Escape
*/
var ESC_KEY = /^escape$/;
/**
* Transforms the key.
* @param {string} key The KeyBoardEvent.key
@ -102,6 +109,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var lKey = key.toLowerCase();
if (lKey === ' ' || SPACE_KEY.test(lKey)) {
validKey = 'space';
} else if (ESC_KEY.test(lKey)) {
validKey = 'esc';
} else if (lKey.length == 1) {
if (!noSpecialChars || KEY_CHAR.test(lKey)) {
validKey = lKey;
@ -145,10 +154,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
validKey = 'f' + (keyCode - 112);
} else if (keyCode >= 48 && keyCode <= 57) {
// top 0-9 keys
validKey = String(48 - keyCode);
validKey = String(keyCode - 48);
} else if (keyCode >= 96 && keyCode <= 105) {
// num pad 0-9
validKey = String(96 - keyCode);
validKey = String(keyCode - 96);
} else {
validKey = KEY_CODE[keyCode];
}
@ -313,6 +322,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this._resetKeyEventListeners();
},
/**
* Returns true if a keyboard event matches `eventString`.
*
* @param {KeyboardEvent} event
* @param {string} eventString
* @return {boolean}
*/
keyboardEventMatchesKeys: function(event, eventString) {
var keyCombos = parseEventString(eventString);
for (var i = 0; i < keyCombos.length; ++i) {

View file

@ -98,7 +98,8 @@ suite('Polymer.IronA11yKeysBehavior', function() {
keyBindings: {
'space': '_keyHandler',
'@': '_keyHandler'
'@': '_keyHandler',
'esc': '_keyHandler'
}
});
@ -170,6 +171,15 @@ suite('Polymer.IronA11yKeysBehavior', function() {
MockInteractions.pressSpace(keys);
expect(keys.keyCount).to.be.equal(1);
MockInteractions.pressAndReleaseKeyOn(keys, 27, [], 'Esc');
expect(keys.keyCount).to.be.equal(2);
MockInteractions.pressAndReleaseKeyOn(keys, 27, [], 'Escape');
expect(keys.keyCount).to.be.equal(3);
MockInteractions.pressAndReleaseKeyOn(keys, 27, []);
expect(keys.keyCount).to.be.equal(4);
});
test('trigger the handler when the specified key is pressed together with a modifier', function() {
@ -273,6 +283,20 @@ suite('Polymer.IronA11yKeysBehavior', function() {
expect(keys.keyboardEventMatchesKeys(event, 'up')).to.be.equal(true);
});
});
suite('matching keyboard events to top row and number pad digit keys', function() {
test('top row can be done imperatively', function() {
var event = new CustomEvent('keydown');
event.keyCode = 49;
expect(keys.keyboardEventMatchesKeys(event, '1')).to.be.equal(true);
});
test('number pad digits can be done imperatively', function() {
var event = new CustomEvent('keydown');
event.keyCode = 97;
expect(keys.keyboardEventMatchesKeys(event, '1')).to.be.equal(true);
});
});
});
suite('combo keys', function() {

View file

@ -1,6 +1,6 @@
{
"name": "iron-demo-helpers",
"version": "1.1.1",
"version": "1.2.3",
"description": "Utility classes to make building demo pages easier",
"authors": [
"The Polymer Authors"
@ -10,7 +10,10 @@
"polymer",
"demo"
],
"main": "demo-snippet.html",
"main": [
"demo-snippet.html",
"url-bar.html"
],
"private": true,
"repository": {
"type": "git",
@ -25,23 +28,24 @@
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"marked-element": "polymerelements/marked-element#^1.0.0",
"prism-element": "PolymerElements/prism-element#^1.0.0"
"prism-element": "PolymerElements/prism-element#^1.0.0",
"iron-location": "PolymerElements/iron-location#^0.8.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0"
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"web-component-tester": "^4.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.1.2",
"paper-styles": "PolymerElements/paper-styles#^1.1.0",
"paper-checkbox": "PolymerElements/paper-checkbox#^1.0.0"
},
"_release": "1.1.1",
"_release": "1.2.3",
"_resolution": {
"type": "version",
"tag": "v1.1.1",
"commit": "49584de566eae4f6c31cd1078ce0407b53c601eb"
"tag": "v1.2.3",
"commit": "8d2c2e6f49b3c414f2998e14330727e5195f2f3b"
},
"_source": "git://github.com/polymerelements/iron-demo-helpers.git",
"_target": "^1.0.0",

View file

@ -0,0 +1,33 @@
<!-- Instructions: https://github.com/PolymerElements/iron-demo-helpers/CONTRIBUTING.md#filing-issues -->
### Description
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
### Expected outcome
<!-- Example: The page stays the same color. -->
### Actual outcome
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
### Steps to reproduce
<!-- Example
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
-->
### Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10

View file

@ -1,6 +1,6 @@
{
"name": "iron-demo-helpers",
"version": "1.1.1",
"version": "1.2.3",
"description": "Utility classes to make building demo pages easier",
"authors": [
"The Polymer Authors"
@ -10,7 +10,10 @@
"polymer",
"demo"
],
"main": "demo-snippet.html",
"main": [
"demo-snippet.html",
"url-bar.html"
],
"private": true,
"repository": {
"type": "git",
@ -25,13 +28,14 @@
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"marked-element": "polymerelements/marked-element#^1.0.0",
"prism-element": "PolymerElements/prism-element#^1.0.0"
"prism-element": "PolymerElements/prism-element#^1.0.0",
"iron-location": "PolymerElements/iron-location#^0.8.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0"
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"web-component-tester": "^4.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.1.2",
"paper-styles": "PolymerElements/paper-styles#^1.1.0",

View file

@ -0,0 +1,47 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html lang="en">
<head>
<title>url-bar demo</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../url-bar.html">
<link rel="import" href="../demo-pages-shared-styles.html">
<style is="custom-style" include="demo-pages-shared-styles">
iframe {
width: 100%;
}
</style>
</head>
<body unresolved>
<url-bar></url-bar>
<div id='message'></div>
<script>
var message;
if (window.top !== window) {
message = 'URL Bar should appear above this text';
} else {
message = 'No URL Bar above this text. iframe below this text with URL bar.';
var iframe = document.createElement('iframe');
iframe.setAttribute('src', window.location.href);
document.body.appendChild(iframe);
}
document.querySelector('#message').innerText = message;
</script>
</body>
</html>

View file

@ -14,7 +14,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>paper-tooltip</title>
<title>iron-demo-helpers</title>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
@ -22,7 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</head>
<body>
<iron-component-page></iron-component-page>
<iron-component-page src="demo-snippet.html"></iron-component-page>
</body>
</html>

View file

@ -0,0 +1,102 @@
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-location/iron-location.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../paper-styles/typography.html">
<!--
`url-bar` is a helper element that displays a simple read-only URL bar if
and only if the page is in an iframe. In this way we can demo elements that
deal with the URL in our iframe-based demo environments.
If the page is not in an iframe, the url-bar element is not displayed.
### Styling
The following custom properties and mixins are available for styling:
Custom property | Description | Default
----------------|-------------|----------
`--url-bar` | Mixin applied to the entire element | `{}`
@element url-bar
@demo demo/url-bar.html
-->
<dom-module id='url-bar'>
<template>
<style include="iron-flex">
:host {
margin: 0px;
padding: 15px 35px;
border-bottom: 2px solid gray;
height: 1.5em;
display: none;
overflow-x: auto;
overflow-y: hidden;
background-color: white;
@apply(--url-bar);
}
:host[in-iframe] {
/* This element only wants to be displayed if it's in an iframe. */
display: block;
}
label {
@apply(--paper-font-common-base);
display: inline-block;
padding-right: 25px;
}
span {
@apply(--paper-font-common-code);
white-space: pre;
}
</style>
<iron-location path="{{path}}" query="{{query}}" hash="{{hash}}">
</iron-location>
<div class="layout horizontal">
<label>URL</label><span>{{url}}</span>
</div>
</template>
<script>
Polymer({
is: 'url-bar',
properties: {
url: {
computed: '__computeUrl(path, query, hash)'
},
inIframe: {
value: function() {
return window.top !== window;
},
reflectToAttribute: true
},
path: {
type: String
},
query: {
type: String
},
hash: {
type: String
}
},
__computeUrl: function(path, query, hash) {
var url = path;
if (query) {
url += '?' + query;
}
if (hash) {
url += '#' + hash;
}
return url;
}
})
</script>
</dom-module>

View file

@ -42,7 +42,7 @@
"tag": "v1.3.0",
"commit": "9d6bb9e7a8150430e61559f5a0827526d2eefaa4"
},
"_source": "git://github.com/polymerelements/iron-dropdown.git",
"_source": "git://github.com/PolymerElements/iron-dropdown.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-dropdown"
"_originalSource": "PolymerElements/iron-dropdown"
}

View file

@ -0,0 +1,45 @@
{
"name": "iron-location",
"version": "0.8.1",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"polymer",
"routing"
],
"main": "iron-location.html",
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-location.git"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/iron-location",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
"paper-input": "polymerelements/paper-input#^1.0.0",
"paper-slider": "polymerelements/paper-slider#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "0.8.1",
"_resolution": {
"type": "version",
"tag": "v0.8.1",
"commit": "fe42515f03ff4b3397dedf1c0810f1667f460172"
},
"_source": "git://github.com/PolymerElements/iron-location.git",
"_target": "^0.8.0",
"_originalSource": "PolymerElements/iron-location"
}

View file

@ -0,0 +1 @@
bower_components

View file

@ -0,0 +1,25 @@
language: node_js
sudo: false
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
- ubuntu-toolchain-r-test
packages:
- google-chrome-stable
- g++-4.8
sauce_connect: true
before_script:
- npm install -g bower polylint web-component-tester
- bower install
- polylint
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
env:
global:
- secure: GQ+cUlta7BWa8Gq4YXrBStPzwRpHT2QG79T4pbDTz2Zs1RvT0GYQaEUksPQnsNCwnTF8ondXhUfMxHcC/r8p7YTCt2hSJSsKkx0lMertsjbKW38ZG28liaAN8msYGb9hnTs4qxhpVEX1pZtOI13RKBU85dw+jKbtxKDX/jVrMn42XCMhEmTeLxM4z8dW5nBu6LW6F3nwABQIUfdc/3OeIYG+2n+84zkXIsX1BFeejq28E6fYJAoMJgqfugLPgPu4IEVCWZJwYl2SgdXwxAcJ2auPph5GJ3DLd0fRRD1TZ94/u0A+eJcQ0OPiPu8hLpQNXOkCgAnO5jkpTCDERNQnB4nY8VfZeZdf1RLAB4VmxzOAbJwJcnqGrh89H6RhKKXyhcuFCgFACYfkzncBCs+co5KwVcwLq88cDOUbnmo3DlwQWpkfusvKy/ZrMrFrX1zycJWN4u8rDsIH4ELasSQh/J3OIa9l2mKfL/OEvqCmpv/ZLGlOVSvNLpr4U7vTVdZBP6C9rtwVXX7VzrClttiidHfoxztAMrNh2GBMjNH9n3FuWMoA/OSoxQGc7RreTsuzdniw3iJYUHIeG08R9bqRtSVA71AlQrbqUaHR+WM7rf7GUx6xG0uDop5vH0RDkE0Nld1W8XuVhHQUg3y3fd4AHJAQVmM7Zsfa3AY1gSr3hV0=
- secure: He0JAbtg9jFzuEBRHQdFWHJ33uueY/9Hxq4NB5PCAI1Z9ebIiTs73ofdNy6e+ftBqlQnBuhoKLfIpuD8Qj2kSdLHQvg1s6ojvNDmAvau1ZINCJRgOSKbGC0TvCVx9rT9Kqc83eqKvKDzr/rcpaIArgMYJzBrSG0D2Kn4luUQnWkKfo1knn17ytJFCvzqQvPWZTIZ6beJ7MRKXRU093a4wYMsKIxQHH65T4Ypj+RBsgv6Xnidjb8qZbNsEwaeOwExfsh30WUo/hSygRi2CP3KSRSc/vsMgSrGpFghZpnhjeDJAGTiDzCTxpJkAkHXereJT4agsWErcgSrRTaxi5G6f18o56pRS+I61BC5DuGGwSL7hOHWSC8pGzkwVFyz31MB2ll0HO3iQHMmcSjY37+G7toEP/vJ/UHm6SZoQq36HGJea7Ycv/2mk4HAHcVEDxhYG42bXXflxevFeqAkVUI7SxSaQpQuZF76/4th4uKFmAHPvRVj5yx8OWil9Lt6cG8DIEZaxXdJVueGgiODmmul7lAd5osO/1UCg4CTy1OnmuSJj7ax9LBa6YY2+3uvnBfE7fNUVKmVmVhlLsF0QAdj0LaFoSU0eQFWdReYqBxEvc4gOT3AtEpaAvfZnL11Q6wVyI7kCHhTHrltA4WENPOSA2u7W//WsQfHX3gRdpIVIVI=
- CXX=g++-4.8

View file

@ -0,0 +1,77 @@
<!--
This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
If you edit that file, it will get updated everywhere else.
If you edit this file, your changes will get overridden :)
You can however override the jsbin link with one that's customized to this
specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output
-->
# Polymer Elements
## Guide for Contributors
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
### Filing Issues
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
1. **Who will use the feature?** _“As someone filling out a form…”_
2. **When will they use the feature?** _“When I enter an invalid value…”_
3. **What is the users goal?** _“I want to be visually notified that the value needs to be corrected…”_
**If you are filing an issue to report a bug**, please provide:
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
```markdown
The `paper-foo` element causes the page to turn pink when clicked.
## Expected outcome
The page stays the same color.
## Actual outcome
The page turns pink.
## Steps to reproduce
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
```
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
### Submitting Pull Requests
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
When submitting pull requests, please provide:
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
```markdown
(For a single issue)
Fixes #20
(For multiple issues)
Fixes #32, fixes #40
```
2. **A succinct description of the design** used to fix any related issues. For example:
```markdown
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
```
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so dont be afraid to ask us if you need help with that!

View file

@ -0,0 +1,36 @@
{
"name": "iron-location",
"version": "0.8.1",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"polymer",
"routing"
],
"main": "iron-location.html",
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-location.git"
},
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/iron-location",
"ignore": [],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
"paper-input": "polymerelements/paper-input#^1.0.0",
"paper-slider": "polymerelements/paper-slider#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
}

View file

@ -0,0 +1,124 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../iron-location.html">
<link rel="import" href="../../paper-styles/typography.html">
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="import" href="../../paper-slider/paper-slider.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
</head>
<body>
<dom-module id="iron-location-demo">
<template>
<style>
div.inputs {
margin-bottom: 15px;
}
label {
display: inline-block;
width: 100px;
}
h3 {
padding: 0;
margin: 0;
}
.inputs, .history_entries {
@apply(--layout-vertical);
@apply(--layout-flex);
padding: 20px;
max-width: 500px;
}
.container {
@apply(--layout-horizontal);
}
</style>
<iron-location path="{{path}}" hash="{{hash}}" query="{{query}}"
dwell-time="{{dwellTime}}">
</iron-location>
<div class="container">
<div class="inputs">
<h3>URL</h3>
<paper-input label="path" value="{{path}}" always-float-label>
</paper-input>
<paper-input label="hash" value="{{hash}}" always-float-label>
</paper-input>
<paper-input label='query' value='{{query}}' always-float-label>
</paper-input>
</div>
<div class="history_entries">
<h3>Dwell Time</h3>
<p>
iron-location won't add extraneous entries to the browser's history
when changes come in quick succession.
</p>
<p>
A new history entry will only be added if iron-location stays in
the same state longer than dwellTime.
</p>
<div>
<label>History added: </label>
{{historyElementsAdded}} entries
</div>
<div>
<label>Dwell time:</label>
{{inSeconds(dwellTime)}}s
</div>
<paper-slider min="-1" max="5000" value="2000" step="100"
immediate-value="{{dwellTime}}">
</paper-slider>
</div>
</div>
</template>
<script>
window.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'iron-location-demo',
properties: {
historyElementsAdded: {
type: Number
}
},
observers: [
'checkHistorySize(path, hash, query, startingHistoryLength)'
],
ready: function() {
this.startingHistoryLength = window.history.length;
},
checkHistorySize: function() {
this.historyElementsAdded =
window.history.length - this.startingHistoryLength;
},
inSeconds: function(dwellTime) {
if (dwellTime === -1) {
return -1;
}
return (Math.round(dwellTime / 100) / 10)
}
});
});
</script>
</dom-module>
<iron-location-demo></iron-location-demo>
</body>
</html>

View file

@ -0,0 +1,119 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-query-params</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-query-params.html">
<link rel="import" href="../../paper-styles/classes/typography.html">
<link rel="import" href="../../iron-flex-layout/classes/iron-flex-layout.html">
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
</head>
<body>
<dom-module id='iron-query-params-demo'>
<template>
<style>
div.inputs {
margin-bottom: 15px;
}
label {
display: inline-block;
width: 100px;
}
span.seconds {
}
[layout] {
@apply(--layout);
}
[layout][horizontal] {
@apply(--layout-horizontal);
}
[layout][horizontal] > div {
padding: 20px;
max-width: 500px;
}
[layout][vertical] {
@apply(--layout-vertical);
}
[layout][flex] {
@apply(--layout-flex);
}
h3 {
padding: 0;
margin: 0;
}
</style>
<iron-query-params
params-string='{{paramString}}' params-object='{{params}}'>
</iron-query-params>
<div layout horizontal>
<div layout vertical flex class='inputs'>
<paper-input label='params as string'
value='{{paramString}}' always-float-label>
</paper-input>
<paper-input label='params as object' value='{{paramsString}}'
invalid='{{paramsInvalid}}'
error-message='Should be legal JSON'
always-float-label>
</paper-input>
</div>
</div>
</template>
<script>
window.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'iron-query-params-demo',
properties: {
paramsString: {
observer: 'paramsStringChanged'
},
params: {
observer: 'paramsChanged'
},
paramsInvalid: {
value: false,
},
},
paramsStringChanged: function() {
if (this.ignore) {
return;
}
this.ignore = true;
try {
this.params = JSON.parse(this.paramsString);
this.paramsInvalid = false;
} catch(_) {
this.paramsInvalid = true;
}
this.ignore = false;
},
paramsChanged: function() {
if (this.ignore) {
return;
}
this.ignore = true;
this.paramsString = JSON.stringify(this.params);
this.paramsInvalid = false;
this.ignore = false;
}
});
});
</script>
</dom-module>
<iron-query-params-demo></iron-query-params-demo>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>

View file

@ -0,0 +1,314 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<!--
The `iron-location` element manages binding to and from the current URL.
iron-location is the first, and lowest level element in the Polymer team's
routing system. This is a beta release of iron-location as we continue work
on higher level elements, and as such iron-location may undergo breaking
changes.
#### Properties
When the URL is: `/search?query=583#details` iron-location's properties will be:
- path: `'/search'`
- query: `'query=583'`
- hash: `'details'`
These bindings are bidirectional. Modifying them will in turn modify the URL.
iron-location is only active while it is attached to the document.
#### Links
While iron-location is active in the document it will intercept clicks on links
within your site, updating the URL pushing the updated URL out through the
databinding system. iron-location only intercepts clicks with the intent to
open in the same window, so middle mouse clicks and ctrl/cmd clicks work fine.
You can customize this behavior with the `urlSpaceRegex`.
#### Dwell Time
iron-location protects against accidental history spamming by only adding
entries to the user's history if the URL stays unchanged for `dwellTime`
milliseconds.
@demo demo/index.html
-->
<script>
'use strict';
Polymer({
is: 'iron-location',
properties: {
/**
* The pathname component of the URL.
*/
path: {
type: String,
notify: true,
value: function() {
return window.location.pathname;
}
},
/**
* The query string portion of the URL.
*/
query: {
type: String,
notify: true,
value: function() {
return window.location.search.slice(1);
}
},
/**
* The hash component of the URL.
*/
hash: {
type: String,
notify: true,
value: function() {
return window.location.hash.slice(1);
}
},
/**
* If the user was on a URL for less than `dwellTime` milliseconds, it
* won't be added to the browser's history, but instead will be replaced
* by the next entry.
*
* This is to prevent large numbers of entries from clogging up the user's
* browser history. Disable by setting to a negative number.
*/
dwellTime: {
type: Number,
value: 2000
},
/**
* A regexp that defines the set of URLs that should be considered part
* of this web app.
*
* Clicking on a link that matches this regex won't result in a full page
* navigation, but will instead just update the URL state in place.
*
* This regexp is given everything after the origin in an absolute
* URL. So to match just URLs that start with /search/ do:
* url-space-regex="^/search/"
*
* @type {string|RegExp}
*/
urlSpaceRegex: {
type: String,
value: ''
},
/**
* urlSpaceRegex, but coerced into a regexp.
*
* @type {RegExp}
*/
_urlSpaceRegExp: {
computed: '_makeRegExp(urlSpaceRegex)'
},
_lastChangedAtAt: {
type: Number,
value: -Infinity
},
_initialized: {
type: Boolean,
value: false
}
},
hostAttributes: {
hidden: true
},
observers: [
'_updateUrl(path, query, hash)'
],
attached: function() {
this.listen(window, 'hashchange', '_hashChanged');
this.listen(window, 'location-changed', '_urlChanged');
this.listen(window, 'popstate', '_urlChanged');
this.listen(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
this._urlChanged();
this._initialized = true;
},
detached: function() {
this.unlisten(window, 'hashchange', '_hashChanged');
this.unlisten(window, 'location-changed', '_urlChanged');
this.unlisten(window, 'popstate', '_urlChanged');
this.unlisten(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
this._initialized = false;
},
/**
* @return {number} the number of milliseconds since some point in the
* past. Only useful for comparing against other results from this
* function.
*/
_now: function() {
if (window.performance && window.performance.now) {
return window.performance.now();
}
return new Date().getTime();
},
_hashChanged: function() {
this.hash = window.location.hash.substring(1);
},
_urlChanged: function() {
// We want to extract all info out of the updated URL before we
// try to write anything back into it.
//
// i.e. without _dontUpdateUrl we'd overwrite the new path with the old
// one when we set this.hash. Likewise for query.
this._dontUpdateUrl = true;
this._hashChanged();
this.path = window.location.pathname;
this.query = window.location.search.substring(1);
this._dontUpdateUrl = false;
this._updateUrl();
},
_getUrl: function() {
var url = this.path;
var query = this.query;
if (query) {
url += '?' + query;
}
if (this.hash) {
url += '#' + this.hash;
}
return url;
},
_updateUrl: function() {
if (this._dontUpdateUrl || !this._initialized) {
return;
}
var newUrl = this._getUrl();
var currentUrl = (
window.location.pathname +
window.location.search +
window.location.hash
);
if (newUrl == currentUrl) {
// nothing to do, the URL didn't change
return;
}
var now = this._now();
var shouldReplace =
this._lastChangedAt + this.dwellTime > now;
this._lastChangedAt = now;
if (shouldReplace) {
window.history.replaceState({}, '', newUrl);
} else {
window.history.pushState({}, '', newUrl);
}
this.fire('location-changed', {}, {node: window});
},
/**
* A necessary evil so that links work as expected. Does its best to
* bail out early if possible.
*
* @param {MouseEvent} event .
*/
_globalOnClick: function(event) {
var href = this._getSameOriginLinkHref(event);
if (!href) {
return;
}
window.history.pushState({}, '', href);
this.fire('location-changed', {}, {node: window});
event.preventDefault();
},
/**
* Returns the absolute URL of the link (if any) that this click event
* is clicking on, if we can and should override the resulting full
* page navigation. Returns null otherwise.
*
* This method is separated away from _globalOnClick for testability,
* as we can't test that a clicked link should have resulted in navigating
* away from the test page.
*
* @param {MouseEvent} event .
* @return {string?} .
*/
_getSameOriginLinkHref: function(event) {
// We only care about left-clicks.
if (event.button !== 0) {
return null;
}
// We don't want modified clicks, where the intent is to open the page
// in a new tab.
if (event.metaKey || event.ctrlKey) {
return null;
}
var eventPath = Polymer.dom(event).path;
var href = null;
for (var i = 0; i < eventPath.length; i++) {
var element = eventPath[i];
if (element.tagName === 'A' && element.href) {
href = element.href;
break;
}
}
// If there's no link there's nothing to do.
if (!href) {
return null;
}
// It only makes sense for us to intercept same-origin navigations.
// pushState/replaceState don't work with cross-origin links.
var url;
if (document.baseURI != null) {
url = new URL(href, /** @type {string} */(document.baseURI));
} else {
url = new URL(href);
}
var origin;
// IE Polyfill
if (window.location.origin) {
origin = window.location.origin;
} else {
origin = window.location.protocol + '//' + window.location.hostname;
if (window.location.port) {
origin += ':' + window.location.port;
}
}
if (url.origin !== origin) {
return null;
}
var normalizedHref = url.pathname + url.search + url.hash;
// If we've been configured not to handle this url... don't handle it!
if (this._urlSpaceRegExp &&
!this._urlSpaceRegExp.test(normalizedHref)) {
return null;
}
return normalizedHref;
},
_makeRegExp: function(urlSpaceRegex) {
return RegExp(urlSpaceRegex);
}
});
</script>

View file

@ -0,0 +1,83 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<script>
'use strict';
Polymer({
is: 'iron-query-params',
properties: {
paramsString: {
type: String,
notify: true,
observer: 'paramsStringChanged',
},
paramsObject: {
type: Object,
notify: true,
value: function() {
return {};
}
},
_dontReact: {
type: Boolean,
value: false
}
},
hostAttributes: {
hidden: true
},
observers: [
'paramsObjectChanged(paramsObject.*)'
],
paramsStringChanged: function() {
this._dontReact = true;
this.paramsObject = this._decodeParams(this.paramsString);
this._dontReact = false;
},
paramsObjectChanged: function() {
if (this._dontReact) {
return;
}
this.paramsString = this._encodeParams(this.paramsObject);
},
_encodeParams: function(params) {
var encodedParams = [];
for (var key in params) {
var value = params[key];
if (value === '') {
encodedParams.push(encodeURIComponent(key));
} else if (value) {
encodedParams.push(
encodeURIComponent(key) +
'=' +
encodeURIComponent(value.toString())
);
}
}
return encodedParams.join('&');
},
_decodeParams: function(paramString) {
var params = {};
var paramList = (paramString || '').split('&');
for (var i = 0; i < paramList.length; i++) {
var param = paramList[i].split('=');
if (param[0]) {
params[decodeURIComponent(param[0])] =
decodeURIComponent(param[1] || '');
}
}
return params;
}
});
</script>

View file

@ -0,0 +1,26 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="utf-8">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'iron-location.html',
'iron-query-params.html',
'initialization-tests.html'
]);
</script>
</body>
</html>

View file

@ -0,0 +1,277 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel='import' href='../iron-location.html'>
<link rel='import' href='../../polymer/polymer.html'>
<script>
Polymer({
is: 'default-value',
properties: {
val: {
type: String,
notify: true,
value: 'default-value'
}
},
});
Polymer({
is: 'on-attached',
properties: {
val: {
type: String,
notify: true,
value: 'on-attached-default-value'
}
},
attached: function() {
if (this.val === 'on-attached-default-value') {
this.val = 'on-attached';
}
}
});
Polymer({
is: 'on-ready',
properties: {
val: {
type: String,
notify: true,
value: 'on-ready-default-value'
}
},
ready: function() {
this.val = 'on-ready';
}
});
Polymer({
is: 'on-timeout',
properties: {
val: {
type: String,
notify: true,
value: 'on-timeout-default-value'
}
},
attached: function() {
setTimeout(function() {
this.val = 'on-timeout';
}.bind(this), 10);
}
})
</script>
<dom-module id='default-before'>
<template>
<default-value value='{{val}}'></default-value>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'default-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-before'>
<template>
<on-attached val='{{val}}'></on-attached>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'attached-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-before'>
<template>
<on-ready val='{{val}}'></on-ready>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'ready-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-before'>
<template>
<on-timeout val='{{val}}'></on-timeout>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({is: 'timeout-before', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<default-value value='{{val}}'></default-value>
</template>
<script>Polymer({is: 'default-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<on-attached val='{{val}}'></on-attached>
</template>
<script>Polymer({is: 'attached-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<on-ready val='{{val}}'></on-ready>
</template>
<script>Polymer({is: 'ready-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-after'>
<template>
<iron-location query='{{val}}'></iron-location>
<on-timeout val='{{val}}'></on-timeout>
</template>
<script>Polymer({is: 'timeout-after', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-below'>
<template>
<iron-location query='{{val}}'>
<default-value value='{{val}}'></default-value>
</iron-location>
</template>
<script>Polymer({is: 'default-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-below'>
<template>
<iron-location query='{{val}}'>
<on-attached val='{{val}}'></on-attached>
</iron-location>
</template>
<script>Polymer({is: 'attached-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-below'>
<template>
<iron-location query='{{val}}'>
<on-ready val='{{val}}'></on-ready>
</iron-location>
</template>
<script>Polymer({is: 'ready-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-below'>
<template>
<iron-location query='{{val}}'>
<on-timeout val='{{val}}'></on-timeout>
</iron-location>
</template>
<script>Polymer({is: 'timeout-below', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-above'>
<template>
<default-value value='{{val}}'>
<iron-location query='{{val}}'></iron-location>
</default-value>
</template>
<script>Polymer({is: 'default-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='attached-above'>
<template>
<on-attached val='{{val}}'>
<iron-location query='{{val}}'>
</iron-location>
</on-attached>
</template>
<script>Polymer({is: 'attached-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='ready-above'>
<template>
<on-ready val='{{val}}'>
<iron-location query='{{val}}'>
</iron-location>
</on-ready>
</template>
<script>Polymer({is: 'ready-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='timeout-above'>
<template>
<on-timeout val='{{val}}'>
<iron-location query='{{val}}'></iron-location>
</on-timeout>
</template>
<script>Polymer({is: 'timeout-above', properties: {val: {type: String}}});</script>
</dom-module>
<dom-module id='default-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>
Polymer({
is: 'default-container',
properties: {val: {type: String, value: 'default-container-val'}}
});
</script>
</dom-module>
<dom-module id='attached-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>
Polymer({
is: 'attached-container',
properties: {val: {type: String, value: 'container-attached-default-val'}},
attached: function() {
if (this.val === 'container-attached-default-val') {
this.val = 'attached-container-val';
}
}
});
</script>
</dom-module>
<dom-module id='ready-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>
Polymer({
is: 'ready-container', properties: {val: {type: String}},
ready: function() {
this.val = 'ready-container-val';
}
});
</script>
</dom-module>
<dom-module id='timeout-container'>
<template>
<iron-location query='{{val}}'></iron-location>
</template>
<script>Polymer({
is: 'timeout-container',
properties: {
val: {
type: String,
notify: true
}
},
attached: function() {
setTimeout(function() {
this.val = 'on-timeout';
}.bind(this), 10);
}
});</script>
</dom-module>

View file

@ -0,0 +1,61 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Base source for injecting into an iframe for tests</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<link rel='import' href='./initialization-cases.html'>
</head>
<body>
<script>
window.addEventListener("message", messageReceived, false);
window.addEventListener('WebComponentsReady', function() {
window.parent.postMessage({
'type': 'ready'
}, '*');
});
var appendBodyReceived = false;
function messageReceived(msg) {
if (!msg.data) {
console.error('got invalid msg?');
}
// the parent can (at any time) ask for our URL.
if (msg.data.type === 'urlQuery') {
msg.source.postMessage({
'type': 'urlQueryResponse',
'href': window.location.href,
'pathname': window.location.pathname,
'hash': window.location.hash,
'search': window.location.search
}, '*');
} else if (msg.data.type === 'appendBody') {
if (appendBodyReceived) {
throw new Error('should only receive at most one appendBody call');
}
var element = document.createElement(msg.data.tagName);
document.body.appendChild(element);
appendBodyReceived = true;
}
}
window.addEventListener('error', function(e) {
window.parent.postMessage({
'type': 'error',
'error': e.message
}, '*');
});
</script>
</body>
</html>

View file

@ -0,0 +1,145 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-location.html">
</head>
<body>
<script>
'use strict';
function getIframe() {
return new Promise(function(resolve, reject) {
var iframe = document.createElement('iframe');
var result = getMessageMatching(iframe, function(message) {
return message.type === 'ready';
});
iframe.src = './initialization-iframe.html';
document.body.appendChild(iframe);
iframe.addEventListener('error', reject);
result.then(function() {resolve(iframe)}, reject);
});
}
function onMessage(iframe, callback) {
var f = function(event) {
if (event.source === iframe.contentWindow) {
callback(event.data);
}
};
window.addEventListener('message', f, false);
return function() {
window.removeEventListener('message', f);
}
}
function getMessageMatching(iframe, predicate) {
var revoke = function() {};
var result = new Promise(function(resolve, reject) {
revoke = onMessage(iframe, function(message) {
if (predicate(message)) {
resolve(message);
}
});
});
result.then(revoke, revoke);
return result;
}
function getUrl(iframe) {
var result = getMessageMatching(iframe, function(message) {
return message.type === 'urlQueryResponse';
})
var revoke = function() {};
var result = new Promise(function(resolve, reject) {
revoke = onMessage(iframe, resolve);
});
result.then(revoke, revoke);
iframe.contentWindow.postMessage({type: 'urlQuery'}, '*');
return result;
}
function timePasses(ms) {
return new Promise(function(resolve) {
window.setTimeout(function() {
resolve();
}, ms);
});
}
suite('<iron-location>\'s initialization', function() {
var iframe;
var error;
setup(function() {
return getIframe().then(function(i) {
iframe = i;
function isError(m) {return m.type === 'error'}
getMessageMatching(iframe, isError).then(function(m) {
error = m.error;
});
});
});
teardown(function() {
if (iframe) {
document.body.removeChild(iframe);
}
var e = error;
iframe = null;
error = null;
if (e) {
throw new Error('Error message from contained iframe: ' + e);
}
});
var cases = [
'default-before', 'attached-before', 'ready-before',
'default-after', 'attached-after', 'ready-after',
'default-below', 'attached-below', 'ready-below',
'default-above', 'attached-above', 'ready-above',
'default-container', 'attached-container', 'ready-container'
];
cases.forEach(function(caseName) {
test('the url takes priority in ' + caseName + ' initialization', function() {
return getUrl(iframe).then(function(url) {
expect(url.search).to.be.eq('');
iframe.contentWindow.postMessage({type: 'appendBody', tagName: caseName}, '*');
return timePasses(10).then(function() {return getUrl(iframe)});
}).then(function(url) {
expect(url.search).to.be.eq('');
});
});
});
var expectedFailureCases = ['timeout-before', 'timeout-after', 'timeout-below', 'timeout-above', 'timeout-container'];
expectedFailureCases.forEach(function(caseName) {
test('the url does not take priority in ' + caseName + ' initialization', function() {
return getUrl(iframe).then(function(url) {
expect(url.search).to.be.eq('');
iframe.contentWindow.postMessage({type: 'appendBody', tagName: caseName}, '*');
return timePasses(60).then(function() {return getUrl(iframe)});
}).then(function(url) {
expect(url.search).to.be.eq('?on-timeout');
});
});
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,140 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../iron-location.html">
</head>
<body>
<test-fixture id='Solo'>
<template>
<iron-location></iron-location>
</template>
</test-fixture>
<test-fixture id='Together'>
<template>
<div>
<iron-location id='one'></iron-location>
<iron-location id='two'></iron-location>
</div>
</template>
</test-fixture>
<script>
'use strict';
function timePasses(ms) {
return new Promise(function(resolve) {
window.setTimeout(function() {
resolve();
}, ms);
});
}
suite('<iron-location>', function () {
var initialUrl;
setup(function() {
initialUrl = window.location.href;
});
teardown(function(){
window.history.replaceState({}, '', initialUrl);
});
suite('when used solo', function() {
var urlElem;
setup(function() {
urlElem = fixture('Solo');
});
test('basic functionality with #hash urls', function() {
// Initialized to the window location's hash.
expect(window.location.hash).to.be.equal(urlElem.hash);
// Changing the urlElem's hash changes the URL
urlElem.hash = '/lol/ok';
expect(window.location.hash).to.be.equal('#/lol/ok');
// Changing the hash via normal means changes the urlElem.
var anchor = document.createElement('a');
anchor.href = '#/wat';
document.body.appendChild(anchor);
anchor.click();
// In IE10 it appears that the hashchange event is asynchronous.
return timePasses(10).then(function() {
expect(urlElem.hash).to.be.equal('/wat');
});
});
test('basic functionality with paths', function() {
// Initialized to the window location's path.
expect(window.location.pathname).to.be.equal(urlElem.path);
// Changing the urlElem's path changes the URL
urlElem.path = '/foo/bar';
expect(window.location.pathname).to.be.equal('/foo/bar');
// Changing the path and sending a custom event on the window changes
// the urlElem.
window.history.replaceState({}, '', '/baz')
window.dispatchEvent(new CustomEvent('location-changed'));
expect(urlElem.path).to.be.equal('/baz');
});
test('basic functionality with ?key=value params', function() {
// Initialized to the window location's params.
expect(urlElem.query).to.be.eq('');
// Changing location.search and sending a custom event on the window
// changes the urlElem.
window.history.replaceState({}, '', '/?greeting=hello&target=world');
window.dispatchEvent(new CustomEvent('location-changed'));
expect(urlElem.query).to.be.equal('greeting=hello&target=world');
// Changing the urlElem's query changes the URL.
urlElem.query = 'greeting=hello&target=world&another=key';
expect(window.location.search).to.be.equal(
'?greeting=hello&target=world&another=key');
});
});
suite('when used with other iron-location elements', function() {
var otherUrlElem;
var urlElem;
setup(function() {
var elems = fixture('Together');
urlElem = elems.querySelector('#one');
otherUrlElem = elems.querySelector('#two');
});
function assertHaveSameUrls(urlElemOne, urlElemTwo) {
expect(urlElemOne.path).to.be.equal(urlElemTwo.path);
expect(urlElemOne.hash).to.be.equal(urlElemTwo.hash);
expect(urlElemOne.query).to.be.equal(urlElemTwo.query);
}
test('coordinate their changes (by firing events on window)', function() {
assertHaveSameUrls(urlElem, otherUrlElem);
urlElem.path = '/a/b/c';
assertHaveSameUrls(urlElem, otherUrlElem);
otherUrlElem.query = 'alsdkjflaksjfd=alksjfdlkajsdfl';
assertHaveSameUrls(urlElem, otherUrlElem);
urlElem.hash = 'lkjljifosjkldfjlksjfldsjf';
assertHaveSameUrls(urlElem, otherUrlElem);
});
});
});
</script>
</body>

View file

@ -0,0 +1,96 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-location</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../iron-query-params.html">
</head>
<body>
<test-fixture id="BasicQueryParams">
<template>
<iron-query-params></iron-query-params>
</template>
</test-fixture>
<script>
'use strict';
suite('<iron-query-params>', function () {
var paramsElem;
setup(function() {
paramsElem = fixture('BasicQueryParams');
});
test('basic functionality with ?key=value params', function() {
// Check initialization
expect(paramsElem.paramsString).to.be.eq('');
expect(paramsElem.paramsObject).to.deep.eq({});
// Check the mapping from paramsString to paramsObject.
paramsElem.paramsString = 'greeting=hello&target=world';
expect(paramsElem.paramsObject).to.deep.equal(
{greeting: 'hello', target: 'world'});
// Check the mapping from paramsObject back to paramsString.
paramsElem.set('paramsObject.another', 'key');
expect(paramsElem.paramsString).to.be.equal(
'greeting=hello&target=world&another=key');
});
test('encoding of params', function() {
var mappings = [
{
string: 'a=b',
object: {'a': 'b'}
},
{
string: 'debug&ok',
object: {'debug': '', 'ok': ''}
},
{
string: 'monster%20kid%3A=%F0%9F%98%BF',
object: {'monster kid:': '😿'}
},
{
string: 'yes%2C%20ok%3F%20what%20is%20up%20with%20%CB%9Athiiis%CB%9A=%E2%98%83',
object: {'yes, ok? what is up with ˚thiiis˚': '☃'}
},
];
mappings.forEach(function(mapping) {
// Clear
paramsElem.paramsObject = {};
expect(paramsElem.paramsString).to.be.equal('');
// Test going from string to object
paramsElem.paramsString = mapping.string;
expect(paramsElem.paramsObject).to.deep.equal(mapping.object);
// Clear again.
paramsElem.paramsObject = {};
expect(paramsElem.paramsString).to.be.equal('');
// Test going from object to string
paramsElem.paramsObject = mapping.object;
expect(paramsElem.paramsString).to.be.equal(mapping.string);
});
});
});
</script>
</body>

View file

@ -1,6 +1,6 @@
{
"name": "iron-overlay-behavior",
"version": "1.5.3",
"version": "1.6.2",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay",
"private": true,
@ -35,11 +35,11 @@
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
"_release": "1.5.3",
"_release": "1.6.2",
"_resolution": {
"type": "version",
"tag": "v1.5.3",
"commit": "49d4c3fb1525aa14911cbda46f0997641c93bbe0"
"tag": "v1.6.2",
"commit": "be4e703b6894af6d4013a8a9f514a384ee91e2db"
},
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "iron-overlay-behavior",
"version": "1.5.3",
"version": "1.6.2",
"license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay",
"private": true,

View file

@ -100,6 +100,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</demo-snippet>
<h3>Use <code>always-on-top</code> to keep the overlay on top of others.</h3>
<demo-snippet>
<template>
<button onclick="onTop.open()">Open always-on-top</button>
<simple-overlay id="onTop" always-on-top tabindex=-1>
<h2>Always on top</h2>
<button onclick="backdrop2.open()">Open with backdrop</button>
<button onclick="onTop.close()">Close this</button>
</simple-overlay>
<simple-overlay id="backdrop2" with-backdrop tabindex=-1>
<h2>With backdrop</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<button onclick="backdrop2.close()">Close</button>
</simple-overlay>
</template>
</demo-snippet>
<h3>An element with <code>IronOverlayBehavior</code> can be scrollable or contain scrollable content.</h3>
<demo-snippet>
<template>

View file

@ -15,6 +15,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="iron-overlay-manager.html">
<script>
// IIFE to help scripts concatenation.
(function() {
'use strict';
/**
Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden or shown, and displays
@ -126,6 +129,13 @@ context. You should place this element as a child of `<body>` whenever possible.
value: false
},
/**
* Set to true to keep overlay always on top.
*/
alwaysOnTop: {
type: Boolean
},
/**
* Shortcut to access to the overlay manager.
* @private
@ -226,6 +236,10 @@ context. You should place this element as a child of `<body>` whenever possible.
this.__shouldRemoveTabIndex = false;
// Used for wrapping the focus on TAB / Shift+TAB.
this.__firstFocusableNode = this.__lastFocusableNode = null;
// Used for requestAnimationFrame when opened changes.
this.__openChangedAsync = null;
// Used for requestAnimationFrame when iron-resize is fired.
this.__onIronResizeAsync = null;
this._ensureSetup();
},
@ -310,26 +324,22 @@ context. You should place this element as a child of `<body>` whenever possible.
this.__isAnimating = true;
// requestAnimationFrame for non-blocking rendering
if (this.__openChangedAsync) {
cancelAnimationFrame(this.__openChangedAsync);
}
if (this.opened) {
if (this.withBackdrop) {
this.backdropElement.prepare();
}
this.__openChangedAsync = requestAnimationFrame(function() {
this.__openChangedAsync = null;
this._prepareRenderOpened();
}
if (this._openChangedAsync) {
this.cancelAsync(this._openChangedAsync);
}
// Async here to allow overlay layer to become visible.
this._openChangedAsync = this.async(function() {
// overlay becomes visible here
this.style.display = '';
// Force layout to ensure transition will go. Set offsetWidth to itself
// so that compilers won't remove it.
this.offsetWidth = this.offsetWidth;
if (this.opened) {
this._renderOpened();
}.bind(this));
} else {
this._renderClosed();
}
this._openChangedAsync = null;
});
},
_canceledChanged: function() {
@ -372,10 +382,6 @@ context. You should place this element as a child of `<body>` whenever possible.
this.refit();
this._finishPositioning();
if (this.withBackdrop) {
this.backdropElement.prepare();
}
// Safari will apply the focus to the autofocus element when displayed for the first time,
// so we blur it. Later, _applyFocus will set the focus if necessary.
if (this.noAutoFocus && document.activeElement === this._focusNode) {
@ -425,6 +431,8 @@ context. You should place this element as a child of `<body>` whenever possible.
_finishRenderClosed: function() {
// Hide the overlay and remove the backdrop.
this.style.display = 'none';
// Reset z-index only at the end of the animation.
this.style.zIndex = '';
this._applyFocus();
@ -440,12 +448,18 @@ context. You should place this element as a child of `<body>` whenever possible.
},
_finishPositioning: function() {
// First, make it invisible & reactivate animations.
this.style.display = 'none';
this.style.transform = this.style.webkitTransform = '';
// Force layout layout to avoid application of transform.
// Set offsetWidth to itself so that compilers won't remove it.
this.offsetWidth = this.offsetWidth;
// Force reflow before re-enabling animations so that they don't start.
// Set scrollTop to itself so that Closure Compiler doesn't remove this.
this.scrollTop = this.scrollTop;
this.style.transition = this.style.webkitTransition = '';
this.style.transform = this.style.webkitTransform = '';
// Now that animations are enabled, make it visible again
this.style.display = '';
// Force reflow, so that following animations are properly started.
// Set scrollTop to itself so that Closure Compiler doesn't remove this.
this.scrollTop = this.scrollTop;
},
/**
@ -528,12 +542,15 @@ context. You should place this element as a child of `<body>` whenever possible.
* @protected
*/
_onIronResize: function() {
if (this.__isAnimating) {
return;
if (this.__onIronResizeAsync) {
cancelAnimationFrame(this.__onIronResizeAsync);
this.__onIronResizeAsync = null;
}
if (this.opened) {
if (this.opened && !this.__isAnimating) {
this.__onIronResizeAsync = requestAnimationFrame(function() {
this.__onIronResizeAsync = null;
this.refit();
}.bind(this));
}
},
@ -576,4 +593,5 @@ context. You should place this element as a child of `<body>` whenever possible.
* @param {{canceled: (boolean|undefined)}} closingReason Contains `canceled` (whether the overlay was canceled).
*/
})();
</script>

View file

@ -38,11 +38,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
this._backdropElement = null;
// Enable document-wide tap recognizer.
Polymer.Gestures.add(document, 'tap', null);
// We should be using only 'tap', but this would be a breaking change.
var tapEvent = ('ontouchstart' in window) ? 'tap' : 'click';
document.addEventListener(tapEvent, this._onCaptureClick.bind(this), true);
// Listen to mousedown or touchstart to be sure to be the first to capture
// clicks outside the overlay.
var clickEvent = ('ontouchstart' in window) ? 'touchstart' : 'mousedown';
document.addEventListener(clickEvent, this._onCaptureClick.bind(this), true);
document.addEventListener('focus', this._onCaptureFocus.bind(this), true);
document.addEventListener('keydown', this._onCaptureKeyDown.bind(this), true);
};
@ -85,8 +84,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_bringOverlayAtIndexToFront: function(i) {
var overlay = this._overlays[i];
var lastI = this._overlays.length - 1;
// Ensure always-on-top overlay stays on top.
if (!overlay.alwaysOnTop && this._overlays[lastI].alwaysOnTop) {
lastI--;
}
// If already the top element, return.
if (!overlay || i === lastI) {
if (!overlay || i >= lastI) {
return;
}
// Update z-index to be on top.
@ -119,6 +122,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Tracks overlays for z-index and focus management.
* Ensures the last added overlay with always-on-top remains on top.
* @param {Element} overlay
*/
addOverlay: function(overlay) {
@ -127,12 +131,28 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this._bringOverlayAtIndexToFront(i);
return;
}
var minimumZ = Math.max(this.currentOverlayZ(), this._minimumZ);
this._overlays.push(overlay);
var newZ = this.currentOverlayZ();
var insertionIndex = this._overlays.length;
var currentOverlay = this._overlays[insertionIndex - 1];
var minimumZ = Math.max(this._getZ(currentOverlay), this._minimumZ);
var newZ = this._getZ(overlay);
// Ensure always-on-top overlay stays on top.
if (currentOverlay && currentOverlay.alwaysOnTop && !overlay.alwaysOnTop) {
// This bumps the z-index of +2.
this._applyOverlayZ(currentOverlay, minimumZ);
insertionIndex--;
// Update minimumZ to match previous overlay's z-index.
var previousOverlay = this._overlays[insertionIndex - 1];
minimumZ = Math.max(this._getZ(previousOverlay), this._minimumZ);
}
// Update z-index and insert overlay.
if (newZ <= minimumZ) {
this._applyOverlayZ(overlay, minimumZ);
}
this._overlays.splice(insertionIndex, 0, overlay);
// Get focused node.
var element = this.deepActiveElement;
overlay.restoreFocusNode = this._overlayParent(element) ? null : element;
},
@ -146,7 +166,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return;
}
this._overlays.splice(i, 1);
this._setZ(overlay, '');
var node = overlay.restoreFocusOnClose ? overlay.restoreFocusNode : null;
overlay.restoreFocusNode = null;
@ -246,7 +265,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_getZ: function(overlay) {
var z = this._minimumZ;
if (overlay) {
var z1 = Number(window.getComputedStyle(overlay).zIndex);
var z1 = Number(overlay.style.zIndex || window.getComputedStyle(overlay).zIndex);
// Check if is a number
// Number.isNaN not supported in IE 10+
if (z1 === z1) {
@ -292,6 +311,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
},
/**
* Returns the deepest overlay in the path.
* @param {Array<Element>=} path
* @return {Element|undefined}
* @private
*/
_overlayInPath: function(path) {
path = path || [];
for (var i = 0; i < path.length; i++) {
if (path[i]._manager === this) {
return path[i];
}
}
},
/**
* Ensures the click event is delegated to the right overlay.
* @param {!Event} event
@ -299,9 +333,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
_onCaptureClick: function(event) {
var overlay = /** @type {?} */ (this.currentOverlay());
// Check if clicked outside of any overlay.
var target = /** @type {Element} */ (Polymer.dom(event).rootTarget);
if (overlay && this._overlayParent(target) !== overlay) {
// Check if clicked outside of top overlay.
if (overlay && this._overlayInPath(Polymer.dom(event).path) !== overlay) {
overlay._onCaptureClick(event);
}
},

View file

@ -25,6 +25,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="test-overlay.html">
<link rel="import" href="test-overlay2.html">
<link rel="import" href="test-buttons.html">
<link rel="import" href="test-menu-button.html">
<style is="custom-style">
iron-overlay-backdrop {
@ -113,14 +114,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="composed">
<template>
<test-menu-button>
Composed overlay
<button>Button</button>
</test-menu-button>
</template>
</test-fixture>
<test-buttons id="buttons"></test-buttons>
<input id="focusInput" placeholder="focus input">
<script>
function runAfterOpen(overlay, callback) {
overlay.addEventListener('iron-overlay-opened', function() {
Polymer.Base.async(callback, 1);
HTMLImports.whenReady(function() {
// Enable document-wide tap recognizer.
Polymer.Gestures.add(document, 'tap', null);
});
function runAfterOpen(overlay, callback) {
overlay.addEventListener('iron-overlay-opened', callback);
overlay.open();
}
@ -158,10 +172,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlay.opened = true;
});
test('closed overlay does not refit on iron-resize', function() {
test('open() refits overlay only once', function(done) {
var spy = sinon.spy(overlay, 'refit');
runAfterOpen(overlay, function() {
assert.equal(spy.callCount, 1, 'overlay did refit only once');
done();
});
});
test('open overlay refits on iron-resize', function(done) {
runAfterOpen(overlay, function() {
var spy = sinon.spy(overlay, 'refit');
overlay.fire('iron-resize');
Polymer.dom.flush();
requestAnimationFrame(function() {
assert.isTrue(spy.called, 'overlay did refit');
done();
});
});
});
test('closed overlay does not refit on iron-resize', function(done) {
var spy = sinon.spy(overlay, 'refit');
overlay.fire('iron-resize');
Polymer.dom.flush();
requestAnimationFrame(function() {
assert.isFalse(spy.called, 'overlay should not refit');
done();
});
});
test('open() triggers iron-resize', function(done) {
@ -196,13 +234,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(callCount, 0, 'iron-resize should not be called');
});
test('open overlay triggers iron-resize when its content changes', function() {
test('open overlay triggers iron-resize when its content changes', function(done) {
runAfterOpen(overlay, function() {
var spy = sinon.stub();
overlay.addEventListener('iron-resize', spy);
Polymer.dom(overlay).appendChild(document.createElement('div'));
Polymer.dom.flush();
assert.equal(spy.callCount, 1, 'iron-resize should be called once');
done();
});
});
@ -231,6 +270,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('open overlay on mousedown does not close it', function(done) {
var btn = document.createElement('button');
btn.addEventListener('mousedown', overlay.open.bind(overlay));
document.body.appendChild(btn);
// It triggers mousedown, mouseup, and click.
MockInteractions.tap(btn);
document.body.removeChild(btn);
assert.isTrue(overlay.opened, 'overlay opened');
overlay.async(function() {
assert.isTrue(overlay.opened, 'overlay is still open');
done();
}, 10);
});
test('clicking outside fires iron-overlay-canceled', function(done) {
runAfterOpen(overlay, function() {
overlay.addEventListener('iron-overlay-canceled', function(event) {
@ -385,18 +439,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
done();
});
});
test('open overlay refits on iron-resize', function(done) {
var spy = sinon.spy(overlay, 'refit');
// At this point, overlay is still opening.
overlay.fire('iron-resize');
assert.isFalse(spy.called, 'overlay did not refit while animating');
overlay.addEventListener('iron-overlay-opened', function() {
overlay.fire('iron-resize');
assert.isTrue(spy.called, 'overlay did refit');
done();
});
});
});
suite('focus handling', function() {
@ -493,17 +535,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlay.withBackdrop = true;
var focusableNodes = overlay._focusableNodes;
runAfterOpen(overlay, function() {
Polymer.Base.async(function() {
// Go to last element.
MockInteractions.focus(focusableNodes[focusableNodes.length-1]);
// Simulate TAB & focus out of overlay.
MockInteractions.pressAndReleaseKeyOn(document, 9);
MockInteractions.focus(document.body);
assert.equal(focusableNodes[0], document.activeElement, 'focus wrapped to first focusable');
// Simulate Shift+TAB & focus out of overlay.
MockInteractions.pressAndReleaseKeyOn(document, 9, ['shift']);
MockInteractions.focus(document.body);
assert.equal(focusableNodes[focusableNodes.length-1], document.activeElement, 'focus wrapped to last focusable');
done();
}, 1);
});
});
@ -511,6 +556,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overlayWithTabIndex.withBackdrop = true;
var focusableNodes = overlayWithTabIndex._focusableNodes;
runAfterOpen(overlayWithTabIndex, function() {
Polymer.Base.async(function() {
// Go to last element.
MockInteractions.focus(focusableNodes[focusableNodes.length-1]);
// Simulate TAB & focus out of overlay.
@ -522,6 +568,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
MockInteractions.focus(document.body);
assert.equal(focusableNodes[focusableNodes.length-1], document.activeElement, 'focus wrapped to last focusable');
done();
}, 1);
});
});
@ -879,7 +926,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
Polymer.Base.async(function() {
assert.lengthOf(document.querySelectorAll('iron-overlay-backdrop'), 0, 'backdrop element removed from the DOM');
done();
}, 1);
}, 100);
});
test('newest overlay appear on top', function(done) {
@ -925,6 +972,90 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
suite('overlay in composed tree', function() {
test('click on overlay content does not close it', function(done) {
var composed = fixture('composed');
// Opens overlay.
MockInteractions.tap(composed.$.trigger);
composed.$.dropdown.addEventListener('iron-overlay-opened', function() {
// Tap on button inside overlay.
MockInteractions.tap(Polymer.dom(composed).querySelector('button'));
Polymer.Base.async(function(){
assert.isTrue(composed.$.dropdown.opened, 'overlay still opened');
done();
}, 1);
});
});
});
suite('always-on-top', function() {
var overlay1, overlay2;
setup(function() {
var f = fixture('multiple');
overlay1 = f[0];
overlay2 = f[1];
overlay1.alwaysOnTop = true;
});
test('stays on top', function(done) {
runAfterOpen(overlay1, function() {
runAfterOpen(overlay2, function() {
var zIndex1 = parseInt(window.getComputedStyle(overlay1).zIndex, 10);
var zIndex2 = parseInt(window.getComputedStyle(overlay2).zIndex, 10);
assert.isAbove(zIndex1, zIndex2, 'overlay1 on top');
assert.equal(Polymer.IronOverlayManager.currentOverlay(), overlay1, 'currentOverlay ok');
done();
});
});
});
test('stays on top also if another overlay is with-backdrop', function(done) {
overlay2.withBackdrop = true;
runAfterOpen(overlay1, function() {
runAfterOpen(overlay2, function() {
var zIndex1 = parseInt(window.getComputedStyle(overlay1).zIndex, 10);
var zIndex2 = parseInt(window.getComputedStyle(overlay2).zIndex, 10);
assert.isAbove(zIndex1, zIndex2, 'overlay1 on top');
assert.equal(Polymer.IronOverlayManager.currentOverlay(), overlay1, 'currentOverlay ok');
done();
});
});
});
test('last overlay with always-on-top wins', function(done) {
overlay2.alwaysOnTop = true;
runAfterOpen(overlay1, function() {
runAfterOpen(overlay2, function() {
var zIndex1 = parseInt(window.getComputedStyle(overlay1).zIndex, 10);
var zIndex2 = parseInt(window.getComputedStyle(overlay2).zIndex, 10);
assert.isAbove(zIndex2, zIndex1, 'overlay2 on top');
assert.equal(Polymer.IronOverlayManager.currentOverlay(), overlay2, 'currentOverlay ok');
done();
});
});
});
});
suite('animations', function() {
test('overlay animations correctly triggered', function(done) {
var overlay = fixture('basic');
overlay.animated = true;
overlay.open();
overlay.addEventListener('simple-overlay-open-animation-start', function() {
// Since animated overlay will transition center + 300px to center,
// we should not find the element at the center when the open animation starts.
var centerElement = document.elementFromPoint(window.innerWidth/2, window.innerHeight/2);
assert.notEqual(centerElement, overlay, 'overlay should not be centered already');
done();
});
});
});
suite('a11y', function() {
test('overlay has aria-hidden=true when opened', function() {
@ -936,7 +1067,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(overlay.getAttribute('aria-hidden'), 'true', 'overlay has aria-hidden="true"');
});
})
});
</script>
</body>

View file

@ -0,0 +1,36 @@
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="test-overlay.html">
<dom-module id="test-menu-button">
<template>
<button id="trigger" on-click="toggle">Open</button>
<test-overlay id="dropdown">
<content></content>
</test-overlay>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'test-menu-button',
toggle: function() {
this.$.dropdown.toggle();
}
});
})();
</script>

View file

@ -15,13 +15,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<dom-module id="test-overlay">
<style>
:host {
background: white;
color: black;
border: 1px solid black;
}
:host([animated]) {
-webkit-transition: -webkit-transform 0.3s;
transition: transform 0.3s;
-webkit-transform: translateY(300px);
transform: translateY(300px);
}
:host(.opened[animated]) {
-webkit-transform: translateY(0px);
transform: translateY(0px);
}
</style>
<template>
@ -31,19 +41,62 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</dom-module>
<script>
(function() {
Polymer({
is: 'test-overlay',
properties: {
animated: {
type: Boolean,
reflectToAttribute: true
}
},
behaviors: [
Polymer.IronOverlayBehavior
]
],
listeners: {
'transitionend': '__onTransitionEnd'
},
_renderOpened: function() {
if (this.animated) {
if (this.withBackdrop) {
this.backdropElement.open();
}
this.classList.add('opened');
this.fire('simple-overlay-open-animation-start');
} else {
Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this, arguments);
}
},
_renderClosed: function() {
if (this.animated) {
if (this.withBackdrop) {
this.backdropElement.close();
}
this.classList.remove('opened');
this.fire('simple-overlay-close-animation-start');
} else {
Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this, arguments);
}
},
__onTransitionEnd: function(e) {
if (e && e.target === this) {
if (this.opened) {
this._finishRenderOpened();
} else {
this._finishRenderClosed();
}
}
},
});
})();
</script>

View file

@ -1,6 +1,6 @@
{
"name": "iron-selector",
"version": "1.3.0",
"version": "1.4.0",
"description": "Manages a set of elements that can be selected",
"private": true,
"license": "http://polymer.github.io/LICENSE.txt",
@ -30,11 +30,11 @@
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.3.0",
"_release": "1.4.0",
"_resolution": {
"type": "version",
"tag": "v1.3.0",
"commit": "1662093611cda3fd29125cdab94a61d3d88093da"
"tag": "v1.4.0",
"commit": "554f7418fdbd97688eb21518b5f8172167d53a95"
},
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0",

View file

@ -0,0 +1,33 @@
<!-- Instructions: https://github.com/PolymerElements/iron-selector/CONTRIBUTING.md#filing-issues -->
### Description
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
### Expected outcome
<!-- Example: The page stays the same color. -->
### Actual outcome
<!-- Example: The page turns pink. -->
### Live Demo
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
### Steps to reproduce
<!-- Example
1. Put a `paper-foo` element in the page.
2. Open the page in a web browser.
3. Click the `paper-foo` element.
-->
### Browsers Affected
<!-- Check all that apply -->
- [ ] Chrome
- [ ] Firefox
- [ ] Safari 9
- [ ] Safari 8
- [ ] Safari 7
- [ ] Edge
- [ ] IE 11
- [ ] IE 10

View file

@ -1,6 +1,6 @@
{
"name": "iron-selector",
"version": "1.3.0",
"version": "1.4.0",
"description": "Manages a set of elements that can be selected",
"private": true,
"license": "http://polymer.github.io/LICENSE.txt",

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@ -69,7 +70,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</div>
<div>
<h3>Example</h3>
<h3>Example with attr-for-selected</h3>
<div class="horizontal-section">
<iron-selector selected="foo" attr-for-selected="name">
<div name="foo">Foo</div>
@ -80,6 +81,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</iron-selector>
</div>
</div>
<div>
<h3>Example with fallback-selection</h3>
<div class="horizontal-section">
<iron-selector selected="non-existing" attr-for-selected="name" fallback-selection="default">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="baz">Baz</div>
<div name="qux">Qux</div>
<div name="quux">Quux</div>
<div name="default">Default</div>
</iron-selector>
</div>
</div>
</div>
</body>

View file

@ -106,6 +106,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
for (var i = 0; i < selectedItems.length; i++) {
this._selection.setItemSelected(selectedItems[i], true);
}
// Check for items, since this array is populated only when attached
if (this.fallbackSelection && this.items.length && !this._selection.get().length) {
var fallback = this._valueToItem(this.fallbackSelection);
if (fallback) {
this.selectedValues = [this.fallbackSelection];
}
}
} else {
this._selection.clear();
}
@ -129,7 +136,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} else {
this.splice('selectedValues',i,1);
}
this._selection.setItemSelected(this._valueToItem(value), unselected);
},
_valuesToItems: function(values) {

View file

@ -1,4 +1,5 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@ -113,6 +114,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
value: null
},
/**
* Default fallback if the selection based on selected with `attrForSelected`
* is not found.
*/
fallbackSelection: {
type: String,
value: null
},
/**
* The list of items from which a selection can be made.
*/
@ -143,7 +153,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
observers: [
'_updateAttrForSelected(attrForSelected)',
'_updateSelected(selected)'
'_updateSelected(selected)',
'_checkFallback(fallbackSelection)'
],
created: function() {
@ -229,6 +240,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return this.selected != null;
},
_checkFallback: function() {
if (this._shouldUpdateSelection) {
this._updateSelected();
}
},
_addListener: function(eventName) {
this.listen(this, eventName, '_activateHandler');
},
@ -260,6 +277,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_selectSelected: function(selected) {
this._selection.select(this._valueToItem(this.selected));
// Check for items, since this array is populated only when attached
// Since Number(0) is falsy, explicitly check for undefined
if (this.fallbackSelection && this.items.length && (this._selection.get() === undefined)) {
this.selected = this.fallbackSelection;
}
},
_filterItem: function(node) {

View file

@ -1,5 +1,6 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,4 +1,5 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@ -37,6 +38,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<div name="zot">Zot</div>
</iron-selector>
If no matching element is found using `attForSelected`, use `fallbackSelection` as fallback.
Example:
<iron-selector attr-for-selected="name" selected="non-existing"
fallback-selection="default">
<div name="foo">Foo</div>
<div name="bar">Bar</div>
<div name="default">Default</div>
</iron-selector>
Note: When the selector is multi, the selection will set to `fallbackSelection` iff
the number of matching elements is zero.
`iron-selector` is not styled. Use the `iron-selected` CSS class to style the selected element.
Example:

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,4 +1,5 @@
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@ -7,7 +8,7 @@ Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../../polymer/polymer.html">
<dom-module id="attr-reflector">
<template>

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@ -71,6 +72,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="defaultAttribute">
<template>
<iron-selector attr-for-selected="some-attr" fallback-selection="default">
<div some-attr="value0">Item 0</div>
<div some-attr="value1">Item 1</div>
<div some-attr="default">Item 2</div>
</iron-selector>
</template>
</test-fixture>
<script>
suite('inline attributes', function() {
var selector;
@ -157,6 +168,61 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
testSelectItem(i);
});
});
suite('default attribute', function() {
var selector;
var items;
setup(function () {
selector = fixture('defaultAttribute');
items = Array.prototype.slice.apply(selector.querySelectorAll('div[some-attr]'));
});
test('setting non-existing value sets default', function() {
selector.select('non-existing-value');
assert.equal(selector.selected, 'default');
assert.equal(selector.selectedItem, items[2]);
});
test('setting non-existing value sets default', function() {
selector.multi = true;
selector.select(['non-existing-value']);
assert.deepEqual(selector.selectedValues, ['default']);
assert.deepEqual(selector.selectedItems, [items[2]]);
});
test('default not used when there was at least one match', function() {
selector.multi = true;
selector.selectedValues = ['non-existing-value', 'value0'];
assert.deepEqual(selector.selectedValues, ['non-existing-value', 'value0']);
assert.deepEqual(selector.selectedItems, [items[0]]);
});
test('default element not found does not result in infinite loop', function() {
selector.fallbackSelection = 'non-existing-fallback';
selector.select('non-existing-value');
assert.equal(selector.selectedItem, undefined);
selector.multi = true;
selector.selectedValues = ['non-existing-value'];
assert.deepEqual(selector.selectedItems, [undefined]);
selector.fallbackSelection = 'default';
assert.deepEqual(selector.selectedItems, [items[2]]);
});
test('selection is updated after fallback is set', function() {
selector.fallbackSolution = undefined;
selector.select('non-existing-value');
selector.fallbackSelection = 'default';
assert.equal(selector.selectedItem, items[2]);
});
test('multi-selection is updated after fallback is set', function() {
selector.fallbackSolution = undefined;
selector.selectedValues = ['non-existing-value'];
selector.fallbackSolution = 'default';
assert.equal(selector.selectedItem, items[2]);
});
});
</script>
</body>

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,4 +1,5 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,4 +1,5 @@
<!DOCTYPE html><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
@ -17,6 +18,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script>
WCT.loadSuites([
'activate-event.html',
'attr-for-selected.html',
'basic.html',
'multi.html',
'next-previous.html',

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

View file

@ -12,12 +12,12 @@
"library"
],
"homepage": "https://github.com/jquery/jquery-dist",
"version": "2.2.2",
"_release": "2.2.2",
"version": "2.2.3",
"_release": "2.2.3",
"_resolution": {
"type": "version",
"tag": "2.2.2",
"commit": "086d381cd2f3b4b8b0af85ecb2c9593a61e5b4bd"
"tag": "2.2.3",
"commit": "af22a351b2ea5801ffb1695abb3bb34d5bed9198"
},
"_source": "git://github.com/jquery/jquery-dist.git",
"_target": ">=1.9.1",

View file

@ -1,5 +1,5 @@
/*!
* jQuery JavaScript Library v2.2.2
* jQuery JavaScript Library v2.2.3
* http://jquery.com/
*
* Includes Sizzle.js
@ -9,7 +9,7 @@
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2016-03-17T17:51Z
* Date: 2016-04-05T19:26Z
*/
(function( global, factory ) {
@ -65,7 +65,7 @@ var support = {};
var
version = "2.2.2",
version = "2.2.3",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@ -9475,7 +9475,7 @@ jQuery.fn.load = function( url, params, callback ) {
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}

Some files were not shown because too many files have changed in this diff Show more