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

update polymer

This commit is contained in:
Luke Pulverenti 2015-07-09 23:00:03 -04:00
parent 568fabb9ca
commit 319d838d6e
48 changed files with 3045 additions and 2348 deletions

View file

@ -98,6 +98,14 @@
return deviceId;
};
self.appName = function () {
return clientName;
};
self.appVersion = function () {
return applicationVersion;
};
self.clearAuthenticationInfo = function () {
self.setAuthenticationInfo(null, null);
};
@ -138,7 +146,7 @@
}]);
}
self.setRequestHeaders = function(headers) {
self.setRequestHeaders = function (headers) {
var currentServerInfo = self.serverInfo();
@ -173,7 +181,7 @@
if (includeAuthorization !== false) {
request.headers = {};
request.headers = request.headers || {};
self.setRequestHeaders(request.headers);
}
@ -500,8 +508,8 @@
self.get(url).done(function () {
var responseTime = new Date().getTime() - now;
responseTime /= 1000;
var bytesPerSecond = byteSize / responseTime;
bytesPerSecond *= 1000;
deferred.resolveWith(null, [bytesPerSecond]);

View file

@ -25,14 +25,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/polymerelements/iron-meta",
"homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
},
"_source": "git://github.com/polymerelements/iron-meta.git",
"_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta"
"_originalSource": "PolymerElements/iron-meta"
}

View file

@ -28,14 +28,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/iron-selector",
"homepage": "https://github.com/polymerelements/iron-selector",
"_release": "1.0.2",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "ea22d91d11ba6f72c01faa952d5e600f9d1773cf"
},
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_source": "git://github.com/polymerelements/iron-selector.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-selector"
"_originalSource": "polymerelements/iron-selector"
}

View file

@ -1,6 +1,6 @@
{
"name": "paper-drawer-panel",
"version": "1.0.2",
"version": "1.0.3",
"description": "A responsive drawer panel",
"authors": [
"The Polymer Authors"
@ -30,14 +30,13 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.2",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "691739c877914f7231eaca16b724bdca295dfe8d"
"tag": "v1.0.3",
"commit": "92713b61eb8eec378db63af61b73341453b8180d"
},
"_source": "git://github.com/PolymerElements/paper-drawer-panel.git",
"_target": "~1.0.2",
"_originalSource": "PolymerElements/paper-drawer-panel",
"_direct": true
"_originalSource": "PolymerElements/paper-drawer-panel"
}

View file

@ -1,6 +1,6 @@
{
"name": "paper-drawer-panel",
"version": "1.0.2",
"version": "1.0.3",
"description": "A responsive drawer panel",
"authors": [
"The Polymer Authors"

View file

@ -17,9 +17,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../paper-styles/paper-styles.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../../paper-button/paper-button.html">
<link rel="import" href="../paper-drawer-panel.html">

View file

@ -74,9 +74,10 @@ To position the drawer to the right, add `right-drawer` attribute.
<div main> Main panel... </div>
</paper-drawer-panel>
Styling paper-drawer-panel:
Styling `paper-drawer-panel`
To change the main container:
paper-drawer-panel {
--paper-drawer-panel-main-container: {
background-color: gray;
@ -84,6 +85,7 @@ To change the main container:
}
To change the drawer container when it's in the left side:
paper-drawer-panel {
--paper-drawer-panel-left-drawer-container: {
background-color: white;
@ -108,12 +110,14 @@ To change the drawer container when it's in the right side:
<link rel="import" type="css" href="paper-drawer-panel.css">
<template>
<iron-media-query id="mq"
<iron-media-query
id="mq"
on-query-matches-changed="_onQueryMatchesChanged"
query="[[_computeMediaQuery(forceNarrow, responsiveWidth)]]">
</iron-media-query>
<iron-selector attr-for-selected="id"
<iron-selector
attr-for-selected="id"
class$="[[_computeIronSelectorClass(narrow, transition, dragging, rightDrawer, peeking)]]"
activate-event=""
selected="[[selected]]">
@ -134,7 +138,7 @@ To change the drawer container when it's in the right side:
<script>
(function () {
(function() {
'use strict';
@ -250,7 +254,7 @@ To change the drawer container when it's in the right side:
*/
hasTransform: {
type: Boolean,
value: function () {
value: function() {
return 'transform' in this.style;
}
},
@ -260,7 +264,7 @@ To change the drawer container when it's in the right side:
*/
hasWillChange: {
type: Boolean,
value: function () {
value: function() {
return 'willChange' in this.style;
}
},
@ -349,7 +353,7 @@ To change the drawer container when it's in the right side:
*
* @method togglePanel
*/
togglePanel: function () {
togglePanel: function() {
if (this._isMainSelected()) {
this.openDrawer();
} else {
@ -362,9 +366,8 @@ To change the drawer container when it's in the right side:
*
* @method openDrawer
*/
openDrawer: function () {
openDrawer: function() {
this.selected = 'drawer';
this.fire('paper-drawer-panel-open');
},
/**
@ -372,18 +375,17 @@ To change the drawer container when it's in the right side:
*
* @method closeDrawer
*/
closeDrawer: function () {
closeDrawer: function() {
this.selected = 'main';
this.fire('paper-drawer-panel-close');
},
ready: function () {
ready: function() {
// Avoid transition at the beginning e.g. page loads and enable
// transitions only after the element is rendered and ready.
this.transition = true;
},
_computeIronSelectorClass: function (narrow, transition, dragging, rightDrawer, peeking) {
_computeIronSelectorClass: function(narrow, transition, dragging, rightDrawer, peeking) {
return classNames({
dragging: dragging,
'narrow-layout': narrow,
@ -394,11 +396,11 @@ To change the drawer container when it's in the right side:
});
},
_computeDrawerStyle: function (drawerWidth) {
_computeDrawerStyle: function(drawerWidth) {
return 'width:' + drawerWidth + ';';
},
_computeMainStyle: function (narrow, rightDrawer, drawerWidth) {
_computeMainStyle: function(narrow, rightDrawer, drawerWidth) {
var style = '';
style += 'left:' + ((narrow || rightDrawer) ? '0' : drawerWidth) + ';';
@ -410,15 +412,15 @@ To change the drawer container when it's in the right side:
return style;
},
_computeMediaQuery: function (forceNarrow, responsiveWidth) {
_computeMediaQuery: function(forceNarrow, responsiveWidth) {
return forceNarrow ? '' : '(max-width: ' + responsiveWidth + ')';
},
_computeSwipeOverlayHidden: function (narrow, disableEdgeSwipe) {
_computeSwipeOverlayHidden: function(narrow, disableEdgeSwipe) {
return !narrow || disableEdgeSwipe;
},
_onTrack: function (event) {
_onTrack: function(event) {
if (sharedPanel && this !== sharedPanel) {
return;
}
@ -436,7 +438,7 @@ To change the drawer container when it's in the right side:
},
_responsiveChange: function (narrow) {
_responsiveChange: function(narrow) {
this._setNarrow(narrow);
if (this.narrow) {
@ -444,41 +446,41 @@ To change the drawer container when it's in the right side:
}
this.setScrollDirection(this._swipeAllowed() ? 'y' : 'all');
this.fire('paper-responsive-change', { narrow: this.narrow });
this.fire('paper-responsive-change', {narrow: this.narrow});
},
_onQueryMatchesChanged: function (event) {
_onQueryMatchesChanged: function(event) {
this._responsiveChange(event.detail.value);
},
_forceNarrowChanged: function () {
_forceNarrowChanged: function() {
// set the narrow mode only if we reached the `responsiveWidth`
this._responsiveChange(this.forceNarrow || this.$.mq.queryMatches);
},
_swipeAllowed: function () {
_swipeAllowed: function() {
return this.narrow && !this.disableSwipe;
},
_isMainSelected: function () {
_isMainSelected: function() {
return this.selected === 'main';
},
_startEdgePeek: function () {
_startEdgePeek: function() {
this.width = this.$.drawer.offsetWidth;
this._moveDrawer(this._translateXForDeltaX(this.rightDrawer ?
-this.edgeSwipeSensitivity : this.edgeSwipeSensitivity));
this._setPeeking(true);
},
_stopEdgePeek: function () {
_stopEdgePeek: function() {
if (this.peeking) {
this._setPeeking(false);
this._moveDrawer(null);
}
},
_downHandler: function (event) {
_downHandler: function(event) {
if (!this.dragging && this._isMainSelected() && this._isEdgeTouch(event) && !sharedPanel) {
this._startEdgePeek();
// cancel selection
@ -488,13 +490,13 @@ To change the drawer container when it's in the right side:
}
},
_upHandler: function () {
_upHandler: function() {
this._stopEdgePeek();
// release the panel
sharedPanel = null;
},
_onTap: function (event) {
_onTap: function(event) {
var targetElement = Polymer.dom(event).localTarget;
var isTargetToggleElement = targetElement &&
this.drawerToggleAttribute &&
@ -505,7 +507,7 @@ To change the drawer container when it's in the right side:
}
},
_isEdgeTouch: function (event) {
_isEdgeTouch: function(event) {
var x = event.detail.x;
return !this.disableEdgeSwipe && this._swipeAllowed() &&
@ -514,7 +516,7 @@ To change the drawer container when it's in the right side:
x <= this.edgeSwipeSensitivity);
},
_trackStart: function (event) {
_trackStart: function(event) {
if (this._swipeAllowed()) {
sharedPanel = this;
this._setDragging(true);
@ -530,7 +532,7 @@ To change the drawer container when it's in the right side:
}
},
_translateXForDeltaX: function (deltaX) {
_translateXForDeltaX: function(deltaX) {
var isMain = this._isMainSelected();
if (this.rightDrawer) {
@ -540,7 +542,7 @@ To change the drawer container when it's in the right side:
}
},
_trackX: function (event) {
_trackX: function(event) {
if (this.dragging) {
var dx = event.detail.dx;
@ -552,18 +554,11 @@ To change the drawer container when it's in the right side:
this._setPeeking(false);
}
var dy = event.detail.dy;
var absDy = Math.abs(dy);
if (absDy >= 70) {
// Ignore trackx until we move past the edge peek.
return;
}
this._moveDrawer(this._translateXForDeltaX(dx));
}
},
_trackEnd: function (event) {
_trackEnd: function(event) {
if (this.dragging) {
var xDirection = event.detail.dx > 0;
@ -572,19 +567,15 @@ To change the drawer container when it's in the right side:
sharedPanel = null;
this._moveDrawer(null);
var dx = event.detail.dx;
var dy = event.detail.dy;
var absDy = Math.abs(dy);
if (this.rightDrawer) {
this[xDirection ? 'closeDrawer' : 'openDrawer']();
} else {
this[xDirection || dx > -80 || absDy >= 70 ? 'openDrawer' : 'closeDrawer']();
this[xDirection ? 'openDrawer' : 'closeDrawer']();
}
}
},
_transformForTranslateX: function (translateX) {
_transformForTranslateX: function(translateX) {
if (translateX === null) {
return '';
}
@ -593,7 +584,7 @@ To change the drawer container when it's in the right side:
'translate3d(' + translateX + 'px, 0, 0)';
},
_moveDrawer: function (translateX) {
_moveDrawer: function(translateX) {
this.transform(this._transformForTranslateX(translateX), this.$.drawer);
}

View file

@ -34,7 +34,7 @@
"tag": "v1.0.7",
"commit": "c65f5ce6b898bb756fca35cedaa53c3e8011abeb"
},
"_source": "git://github.com/polymerelements/paper-styles.git",
"_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/paper-styles"
"_originalSource": "PolymerElements/paper-styles"
}

View file

@ -1,6 +1,6 @@
{
"name": "polymer",
"version": "1.0.5",
"version": "1.0.6",
"main": [
"polymer.html"
],
@ -24,11 +24,11 @@
},
"private": true,
"homepage": "https://github.com/Polymer/polymer",
"_release": "1.0.5",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "b93f076d7b2606733d7166f311b77550deb98a39"
"tag": "v1.0.6",
"commit": "953fcba374812690c279abdacbfaf61e3e3aa347"
},
"_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "polymer",
"version": "1.0.5",
"version": "1.0.6",
"main": [
"polymer.html"
],

View file

@ -506,7 +506,7 @@ debouncer.stop();
}
}
});
Polymer.version = '1.0.5';
Polymer.version = '1.0.6';
Polymer.Base._addFeature({
_registerFeatures: function () {
this._prepIs();

View file

@ -426,6 +426,8 @@ var getInnerHTML = Polymer.domInnerHTML.getInnerHTML;
var nativeInsertBefore = Element.prototype.insertBefore;
var nativeRemoveChild = Element.prototype.removeChild;
var nativeAppendChild = Element.prototype.appendChild;
var nativeCloneNode = Element.prototype.cloneNode;
var nativeImportNode = Document.prototype.importNode;
var dirtyRoots = [];
var DomApi = function (node) {
this.node = node;
@ -554,8 +556,8 @@ return parentNeedsDist || hasContent && !wrappedContent;
},
_tryRemoveUndistributedNode: function (node) {
if (this.node.shadyRoot) {
if (node.parentNode) {
nativeRemoveChild.call(node.parentNode, node);
if (node._composedParent) {
nativeRemoveChild.call(node._composedParent, node);
}
return true;
}
@ -564,7 +566,7 @@ _updateInsertionPoints: function (host) {
host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTENT);
},
_nodeIsInLogicalTree: function (node) {
return Boolean(node._lightParent || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
return Boolean(node._lightParent !== undefined || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
},
_parentNeedsDistribution: function (parent) {
return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
@ -737,6 +739,31 @@ _distributeParent: function () {
if (this._parentNeedsDistribution(this.parentNode)) {
this._lazyDistribute(this.parentNode);
}
},
cloneNode: function (deep) {
var n = nativeCloneNode.call(this.node, false);
if (deep) {
var c$ = this.childNodes;
var d = factory(n);
for (var i = 0, nc; i < c$.length; i++) {
nc = factory(c$[i]).cloneNode(true);
d.appendChild(nc);
}
}
return n;
},
importNode: function (externalNode, deep) {
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
var n = nativeImportNode.call(doc, externalNode, false);
if (deep) {
var c$ = factory(externalNode).childNodes;
var d = factory(n);
for (var i = 0, nc; i < c$.length; i++) {
nc = factory(doc).importNode(c$[i], true);
d.appendChild(nc);
}
}
return n;
}
};
Object.defineProperty(DomApi.prototype, 'classList', {
@ -885,8 +912,9 @@ if (this.node.nodeType !== Node.TEXT_NODE) {
this._clear();
var d = document.createElement('div');
d.innerHTML = text;
for (var e = d.firstChild; e; e = e.nextSibling) {
this.appendChild(e);
var c$ = Array.prototype.slice.call(d.childNodes);
for (var i = 0; i < c$.length; i++) {
this.appendChild(c$[i]);
}
}
},
@ -909,6 +937,13 @@ return n;
n = n.parentNode;
}
};
DomApi.prototype.cloneNode = function (deep) {
return this.node.cloneNode(deep);
};
DomApi.prototype.importNode = function (externalNode, deep) {
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
return doc.importNode(externalNode, deep);
};
DomApi.prototype.getDestinationInsertionPoints = function () {
var n$ = this.node.getDestinationInsertionPoints();
return n$ ? Array.prototype.slice.call(n$) : [];

View file

@ -416,6 +416,7 @@ var MOUSE_EVENTS = [
'mouseup',
'click'
];
var IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
var mouseCanceller = function (mouseEvent) {
mouseEvent[HANDLED_OBJ] = { skip: true };
if (mouseEvent.type === 'click') {
@ -440,6 +441,9 @@ document.removeEventListener(en, mouseCanceller, true);
}
}
function ignoreMouse() {
if (IS_TOUCH_ONLY) {
return;
}
if (!POINTERSTATE.mouse.mouseIgnoreJob) {
setupTeardownMouseCanceller(true);
}
@ -488,6 +492,12 @@ node = next;
}
return node;
},
findOriginalTarget: function (ev) {
if (ev.path) {
return ev.path[0];
}
return ev.target;
},
handleNative: function (ev) {
var handled;
var type = ev.type;
@ -558,8 +568,7 @@ prevent = dy > dx;
prevent = dx > dy;
}
if (prevent) {
//This breaks scrolling in safari
//ev.preventDefault();
ev.preventDefault();
}
}
},
@ -573,12 +582,18 @@ node[GESTURE_KEY] = gobj = {};
}
for (var i = 0, dep, gd; i < deps.length; i++) {
dep = deps[i];
if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1) {
continue;
}
gd = gobj[dep];
if (!gd) {
gobj[dep] = gd = {};
gobj[dep] = gd = { _count: 0 };
}
if (gd._count === 0) {
node.addEventListener(dep, this.handleNative);
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
}
node.addEventListener(evType, handler);
if (recognizer.touchAction) {
@ -596,9 +611,10 @@ dep = deps[i];
gd = gobj[dep];
if (gd && gd[name]) {
gd[name] = (gd[name] || 1) - 1;
if (gd[name] === 0) {
node.removeEventListener(dep, this.handleNative);
gd._count = (gd._count || 1) - 1;
}
if (gd._count === 0) {
node.removeEventListener(dep, this.handleNative);
}
}
}
@ -660,7 +676,7 @@ emits: [
'up'
],
mousedown: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var self = this;
var upfn = function upfn(e) {
self.fire('up', t, e);
@ -670,10 +686,10 @@ document.addEventListener('mouseup', upfn);
this.fire('down', t, e);
},
touchstart: function (e) {
this.fire('down', e.currentTarget, e.changedTouches[0]);
this.fire('down', Gestures.findOriginalTarget(e), e.changedTouches[0]);
},
touchend: function (e) {
this.fire('up', e.currentTarget, e.changedTouches[0]);
this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]);
},
fire: function (type, target, event) {
var self = this;
@ -729,7 +745,7 @@ var dy = Math.abs(this.info.y - y);
return dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE;
},
mousedown: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var self = this;
var movefn = function movefn(e) {
var x = e.clientX, y = e.clientY;
@ -763,7 +779,7 @@ this.info.x = ct.clientX;
this.info.y = ct.clientY;
},
touchmove: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var ct = e.changedTouches[0];
var x = ct.clientX, y = ct.clientY;
if (this.hasMovedEnough(x, y)) {
@ -777,7 +793,7 @@ this.info.started = true;
}
},
touchend: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var ct = e.changedTouches[0];
if (this.info.started) {
Gestures.prevent('tap');
@ -853,9 +869,10 @@ this.forward(e.changedTouches[0]);
forward: function (e) {
var dx = Math.abs(e.clientX - this.info.x);
var dy = Math.abs(e.clientY - this.info.y);
var t = Gestures.findOriginalTarget(e);
if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) {
if (!this.info.prevent) {
Gestures.fire(e.target, 'tap', {
Gestures.fire(t, 'tap', {
x: e.clientX,
y: e.clientY,
sourceEvent: e
@ -1102,15 +1119,15 @@ Polymer.Bind = {
prepareModel: function (model) {
model._propertyEffects = {};
model._bindListeners = [];
var api = this._modelApi;
for (var n in api) {
model[n] = api[n];
}
Polymer.Base.mixin(model, this._modelApi);
},
_modelApi: {
_notifyChange: function (property) {
var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
this.fire(eventName, { value: this[property] }, { bubbles: false });
Polymer.Base.fire(eventName, { value: this[property] }, {
bubbles: false,
node: this
});
},
_propertySetter: function (property, value, effects, fromAbove) {
var old = this.__data__[property];
@ -1201,8 +1218,11 @@ return this.__data__[property];
var setter = function (value) {
this._propertySetter(property, value, effects);
};
if (model.getPropertyInfo && model.getPropertyInfo(property).readOnly) {
var info = model.getPropertyInfo && model.getPropertyInfo(property);
if (info && info.readOnly) {
if (!info.computed) {
model['_set' + this.upper(property)] = setter;
}
} else {
defun.set = setter;
}
@ -1660,6 +1680,7 @@ this._pathEffector(path, value);
if (!fromAbove) {
this._notifyPath(path, value);
}
return true;
}
},
_getPathParts: function (path) {
@ -2001,7 +2022,7 @@ var VAR_START = '--';
var MEDIA_START = '@media';
var AT_START = '@';
var rx = {
comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
port: /@import[^;]*;/gim,
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim,
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
@ -2673,10 +2694,10 @@ props[i] = v;
}
},
rx: {
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?:(?=[;\n])|$)/gim,
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/im,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
IS_VAR: /^--/,
BRACKETED: /\{[^}]*\}/g,
HOST_PREFIX: '(?:^|[^.#[:])',
@ -3015,7 +3036,7 @@ styleTransformer.documentRule(rule);
});
}());
Polymer.Templatizer = {
properties: { _hideTemplateChildren: { observer: '_showHideChildren' } },
properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
_templatizerStatic: {
count: 0,
callbacks: {},
@ -3044,6 +3065,7 @@ this._prepParentProperties(archetype, template);
archetype._notifyPath = this._notifyPathImpl;
archetype._scopeElementClass = this._scopeElementClassImpl;
archetype.listen = this._listenImpl;
archetype._showHideChildren = this._showHideChildrenImpl;
var _constructor = this._constructorImpl;
var ctor = function TemplateInstance(model, host) {
_constructor.call(this, model, host);
@ -3056,7 +3078,15 @@ this.ctor = ctor;
_getRootDataHost: function () {
return this.dataHost && this.dataHost._rootDataHost || this.dataHost;
},
_showHideChildren: function (hidden) {
_showHideChildrenImpl: function (hide) {
var c = this._children;
for (var i = 0; i < c.length; i++) {
var n = c[i];
if (n.style) {
n.style.display = hide ? 'none' : '';
n.__hideTemplateChildren__ = hide;
}
}
},
_debounceTemplate: function (fn) {
this._templatizerStatic.callbacks[this._templatizerId] = fn.bind(this);
@ -3157,6 +3187,8 @@ template._propertySetter(n, val);
}
});
},
_showHideChildren: function (hidden) {
},
_forwardInstancePath: function (inst, path, value) {
},
_forwardInstanceProp: function (inst, prop, value) {
@ -3195,6 +3227,9 @@ children.push(n);
n._templateInstance = this;
}
this._children = children;
if (host.__hideTemplateChildren__) {
this._showHideChildren(true);
}
this._tryReady();
},
_listenImpl: function (node, eventName, methodName) {
@ -3221,6 +3256,20 @@ model[prop] = this['_parent_' + prop];
}
}
return new this.ctor(model, this);
},
modelForElement: function (el) {
var model;
while (el) {
if (model = el._templateInstance) {
if (model.dataHost != this) {
el = model.dataHost;
} else {
return model;
}
} else {
el = el.parentNode;
}
}
}
};
Polymer({
@ -3267,7 +3316,7 @@ this._removeFromMap(this.store[key]);
delete this.store[key];
},
_removeFromMap: function (item) {
if (typeof item == 'object') {
if (item && typeof item == 'object') {
this.omap.delete(item);
} else {
delete this.pmap[item];
@ -3279,7 +3328,7 @@ this.removeKey(key);
return key;
},
getKey: function (item) {
if (typeof item == 'object') {
if (item && typeof item == 'object') {
return this.omap.get(item);
} else {
return this.pmap[item];
@ -3648,14 +3697,7 @@ return row;
_showHideChildren: function (hidden) {
if (this.rows) {
for (var i = 0; i < this.rows.length; i++) {
var c$ = this.rows[i]._children;
for (var j = 0; j < c$.length; j++) {
var c = c$[j];
if (c.style) {
c.style.display = hidden ? 'none' : '';
}
c._hideTemplateChildren = hidden;
}
this.rows[i]._showHideChildren(hidden);
}
}
},
@ -3705,20 +3747,6 @@ row.__setProperty(this.as, value, true);
}
}
},
modelForElement: function (el) {
var model;
while (el) {
if (model = el._templateInstance) {
if (model.dataHost != this) {
el = model.dataHost;
} else {
return model;
}
} else {
el = el.parentNode;
}
}
},
itemForElement: function (el) {
var instance = this.modelForElement(el);
return instance && instance[this.as];
@ -3873,7 +3901,7 @@ this._instance = null;
},
_wrapTextNodes: function (root) {
for (var n = root.firstChild; n; n = n.nextSibling) {
if (n.nodeType === Node.TEXT_NODE) {
if (n.nodeType === Node.TEXT_NODE && n.textContent.trim()) {
var s = document.createElement('span');
root.insertBefore(s, n);
s.appendChild(n);
@ -3882,14 +3910,9 @@ n = s;
}
},
_showHideChildren: function () {
var hidden = this._hideTemplateChildren || !this.if;
var hidden = this.__hideTemplateChildren__ || !this.if;
if (this._instance) {
var c$ = this._instance._children;
for (var i = 0; i < c$.length; i++) {
var c = c$[i];
c.style.display = hidden ? 'none' : '';
c._hideTemplateChildren = hidden;
}
this._instance._showHideChildren(hidden);
}
},
_forwardParentProp: function (prop, value) {

View file

@ -1,7 +1,7 @@
{
"name": "webcomponentsjs",
"main": "webcomponents.js",
"version": "0.7.5",
"version": "0.7.6",
"homepage": "http://webcomponents.org",
"authors": [
"The Polymer Authors"
@ -15,11 +15,11 @@
],
"license": "BSD",
"ignore": [],
"_release": "0.7.5",
"_release": "0.7.6",
"_resolution": {
"type": "version",
"tag": "v0.7.5",
"commit": "6e2fd746392a9fbec95711872e21fa22bff22fae"
"tag": "v0.7.6",
"commit": "401764710ac11f9ed8a175195107752af2f72eb6"
},
"_source": "git://github.com/Polymer/webcomponentsjs.git",
"_target": "^0.7.2",

View file

@ -7,7 +7,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
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;
@ -423,30 +423,24 @@ window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
var forSubtree = scope.forSubtree;
var forDocumentTree = scope.forDocumentTree;
function addedNode(node) {
return added(node) || addedSubtree(node);
function addedNode(node, isAttached) {
return added(node, isAttached) || addedSubtree(node, isAttached);
}
function added(node) {
if (scope.upgrade(node)) {
function added(node, isAttached) {
if (scope.upgrade(node, isAttached)) {
return true;
}
if (isAttached) {
attached(node);
}
function addedSubtree(node) {
}
function addedSubtree(node, isAttached) {
forSubtree(node, function(e) {
if (added(e)) {
if (added(e, isAttached)) {
return true;
}
});
}
function attachedNode(node) {
attached(node);
if (inDocument(node)) {
forSubtree(node, function(e) {
attached(e);
});
}
}
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
scope.hasPolyfillMutations = hasPolyfillMutations;
var isPendingMutations = false;
@ -476,15 +470,13 @@ window.CustomElements.addModule(function(scope) {
}
}
function _attached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (!element.__attached && inDocument(element)) {
if (element.__upgraded__ && !element.__attached) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
}
}
}
function detachedNode(node) {
detached(node);
forSubtree(node, function(e) {
@ -501,18 +493,16 @@ window.CustomElements.addModule(function(scope) {
}
}
function _detached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (element.__attached && !inDocument(element)) {
if (element.__upgraded__ && element.__attached) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
}
}
}
function inDocument(element) {
var p = element;
var doc = wrap(document);
var doc = window.wrap(document);
while (p) {
if (p == doc) {
return true;
@ -530,7 +520,7 @@ window.CustomElements.addModule(function(scope) {
}
}
}
function handler(mutations) {
function handler(root, mutations) {
if (flags.dom) {
var mx = mutations[0];
if (mx && mx.type === "childList" && mx.addedNodes) {
@ -545,13 +535,14 @@ window.CustomElements.addModule(function(scope) {
}
console.group("mutations (%d) [%s]", mutations.length, u || "");
}
var isAttached = inDocument(root);
mutations.forEach(function(mx) {
if (mx.type === "childList") {
forEach(mx.addedNodes, function(n) {
if (!n.localName) {
return;
}
addedNode(n);
addedNode(n, isAttached);
});
forEach(mx.removedNodes, function(n) {
if (!n.localName) {
@ -573,7 +564,7 @@ window.CustomElements.addModule(function(scope) {
}
var observer = node.__observer;
if (observer) {
handler(observer.takeRecords());
handler(node, observer.takeRecords());
takeMutations();
}
}
@ -582,7 +573,7 @@ window.CustomElements.addModule(function(scope) {
if (inRoot.__observer) {
return;
}
var observer = new MutationObserver(handler);
var observer = new MutationObserver(handler.bind(this, inRoot));
observer.observe(inRoot, {
childList: true,
subtree: true
@ -592,7 +583,8 @@ window.CustomElements.addModule(function(scope) {
function upgradeDocument(doc) {
doc = window.wrap(doc);
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
addedNode(doc);
var isMainDocument = doc === window.wrap(document);
addedNode(doc, isMainDocument);
observe(doc);
flags.dom && console.groupEnd();
}
@ -611,26 +603,26 @@ window.CustomElements.addModule(function(scope) {
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attachedNode = attachedNode;
scope.attached = attached;
scope.takeRecords = takeRecords;
});
window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
function upgrade(node) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
}
}
}
}
function upgradeWithDefinition(element, definition) {
function upgradeWithDefinition(element, definition, isAttached) {
flags.upgrade && console.group("upgrade:", element.localName);
if (definition.is) {
element.setAttribute("is", definition.is);
@ -638,8 +630,10 @@ window.CustomElements.addModule(function(scope) {
implementPrototype(element, definition);
element.__upgraded__ = true;
created(element);
scope.attachedNode(element);
scope.upgradeSubtree(element);
if (isAttached) {
scope.attached(element);
}
scope.upgradeSubtree(element, isAttached);
flags.upgrade && console.groupEnd();
return element;
}
@ -921,7 +915,7 @@ window.CustomElements.addModule(function(scope) {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(wrap(elt.import));
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,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
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;
@ -847,7 +847,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
if (script.parentNode) {
script.parentNode.removeChild(script);
}
scope.currentScript = null;
});
this.addElementToDocument(script);

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,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
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,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
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"name": "webcomponentsjs",
"main": "webcomponents.js",
"version": "0.7.5",
"version": "0.7.6",
"homepage": "http://webcomponents.org",
"authors": [
"The Polymer Authors"

View file

@ -1,6 +1,6 @@
{
"name": "webcomponents.js",
"version": "0.7.5",
"version": "0.7.6",
"description": "webcomponents.js",
"main": "webcomponents.js",
"directories": {

View file

@ -7,7 +7,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
*/
// @version 0.7.5
// @version 0.7.6
window.WebComponents = window.WebComponents || {};
(function(scope) {
@ -1415,7 +1415,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
if (script.parentNode) {
script.parentNode.removeChild(script);
}
scope.currentScript = null;
});
this.addElementToDocument(script);
@ -1732,30 +1734,24 @@ window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
var forSubtree = scope.forSubtree;
var forDocumentTree = scope.forDocumentTree;
function addedNode(node) {
return added(node) || addedSubtree(node);
function addedNode(node, isAttached) {
return added(node, isAttached) || addedSubtree(node, isAttached);
}
function added(node) {
if (scope.upgrade(node)) {
function added(node, isAttached) {
if (scope.upgrade(node, isAttached)) {
return true;
}
if (isAttached) {
attached(node);
}
function addedSubtree(node) {
}
function addedSubtree(node, isAttached) {
forSubtree(node, function(e) {
if (added(e)) {
if (added(e, isAttached)) {
return true;
}
});
}
function attachedNode(node) {
attached(node);
if (inDocument(node)) {
forSubtree(node, function(e) {
attached(e);
});
}
}
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
scope.hasPolyfillMutations = hasPolyfillMutations;
var isPendingMutations = false;
@ -1785,15 +1781,13 @@ window.CustomElements.addModule(function(scope) {
}
}
function _attached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (!element.__attached && inDocument(element)) {
if (element.__upgraded__ && !element.__attached) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
}
}
}
function detachedNode(node) {
detached(node);
forSubtree(node, function(e) {
@ -1810,18 +1804,16 @@ window.CustomElements.addModule(function(scope) {
}
}
function _detached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (element.__attached && !inDocument(element)) {
if (element.__upgraded__ && element.__attached) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
}
}
}
function inDocument(element) {
var p = element;
var doc = wrap(document);
var doc = window.wrap(document);
while (p) {
if (p == doc) {
return true;
@ -1839,7 +1831,7 @@ window.CustomElements.addModule(function(scope) {
}
}
}
function handler(mutations) {
function handler(root, mutations) {
if (flags.dom) {
var mx = mutations[0];
if (mx && mx.type === "childList" && mx.addedNodes) {
@ -1854,13 +1846,14 @@ window.CustomElements.addModule(function(scope) {
}
console.group("mutations (%d) [%s]", mutations.length, u || "");
}
var isAttached = inDocument(root);
mutations.forEach(function(mx) {
if (mx.type === "childList") {
forEach(mx.addedNodes, function(n) {
if (!n.localName) {
return;
}
addedNode(n);
addedNode(n, isAttached);
});
forEach(mx.removedNodes, function(n) {
if (!n.localName) {
@ -1882,7 +1875,7 @@ window.CustomElements.addModule(function(scope) {
}
var observer = node.__observer;
if (observer) {
handler(observer.takeRecords());
handler(node, observer.takeRecords());
takeMutations();
}
}
@ -1891,7 +1884,7 @@ window.CustomElements.addModule(function(scope) {
if (inRoot.__observer) {
return;
}
var observer = new MutationObserver(handler);
var observer = new MutationObserver(handler.bind(this, inRoot));
observer.observe(inRoot, {
childList: true,
subtree: true
@ -1901,7 +1894,8 @@ window.CustomElements.addModule(function(scope) {
function upgradeDocument(doc) {
doc = window.wrap(doc);
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
addedNode(doc);
var isMainDocument = doc === window.wrap(document);
addedNode(doc, isMainDocument);
observe(doc);
flags.dom && console.groupEnd();
}
@ -1920,26 +1914,26 @@ window.CustomElements.addModule(function(scope) {
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attachedNode = attachedNode;
scope.attached = attached;
scope.takeRecords = takeRecords;
});
window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
function upgrade(node) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
}
}
}
}
function upgradeWithDefinition(element, definition) {
function upgradeWithDefinition(element, definition, isAttached) {
flags.upgrade && console.group("upgrade:", element.localName);
if (definition.is) {
element.setAttribute("is", definition.is);
@ -1947,8 +1941,10 @@ window.CustomElements.addModule(function(scope) {
implementPrototype(element, definition);
element.__upgraded__ = true;
created(element);
scope.attachedNode(element);
scope.upgradeSubtree(element);
if (isAttached) {
scope.attached(element);
}
scope.upgradeSubtree(element, isAttached);
flags.upgrade && console.groupEnd();
return element;
}
@ -2230,7 +2226,7 @@ window.CustomElements.addModule(function(scope) {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(wrap(elt.import));
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,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
*/
// @version 0.7.5
// @version 0.7.6
window.WebComponents = window.WebComponents || {};
(function(scope) {
@ -6184,7 +6184,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
if (script.parentNode) {
script.parentNode.removeChild(script);
}
scope.currentScript = null;
});
this.addElementToDocument(script);
@ -6501,30 +6503,24 @@ window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
var forSubtree = scope.forSubtree;
var forDocumentTree = scope.forDocumentTree;
function addedNode(node) {
return added(node) || addedSubtree(node);
function addedNode(node, isAttached) {
return added(node, isAttached) || addedSubtree(node, isAttached);
}
function added(node) {
if (scope.upgrade(node)) {
function added(node, isAttached) {
if (scope.upgrade(node, isAttached)) {
return true;
}
if (isAttached) {
attached(node);
}
function addedSubtree(node) {
}
function addedSubtree(node, isAttached) {
forSubtree(node, function(e) {
if (added(e)) {
if (added(e, isAttached)) {
return true;
}
});
}
function attachedNode(node) {
attached(node);
if (inDocument(node)) {
forSubtree(node, function(e) {
attached(e);
});
}
}
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
scope.hasPolyfillMutations = hasPolyfillMutations;
var isPendingMutations = false;
@ -6554,15 +6550,13 @@ window.CustomElements.addModule(function(scope) {
}
}
function _attached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (!element.__attached && inDocument(element)) {
if (element.__upgraded__ && !element.__attached) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
}
}
}
function detachedNode(node) {
detached(node);
forSubtree(node, function(e) {
@ -6579,18 +6573,16 @@ window.CustomElements.addModule(function(scope) {
}
}
function _detached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (element.__attached && !inDocument(element)) {
if (element.__upgraded__ && element.__attached) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
}
}
}
function inDocument(element) {
var p = element;
var doc = wrap(document);
var doc = window.wrap(document);
while (p) {
if (p == doc) {
return true;
@ -6608,7 +6600,7 @@ window.CustomElements.addModule(function(scope) {
}
}
}
function handler(mutations) {
function handler(root, mutations) {
if (flags.dom) {
var mx = mutations[0];
if (mx && mx.type === "childList" && mx.addedNodes) {
@ -6623,13 +6615,14 @@ window.CustomElements.addModule(function(scope) {
}
console.group("mutations (%d) [%s]", mutations.length, u || "");
}
var isAttached = inDocument(root);
mutations.forEach(function(mx) {
if (mx.type === "childList") {
forEach(mx.addedNodes, function(n) {
if (!n.localName) {
return;
}
addedNode(n);
addedNode(n, isAttached);
});
forEach(mx.removedNodes, function(n) {
if (!n.localName) {
@ -6651,7 +6644,7 @@ window.CustomElements.addModule(function(scope) {
}
var observer = node.__observer;
if (observer) {
handler(observer.takeRecords());
handler(node, observer.takeRecords());
takeMutations();
}
}
@ -6660,7 +6653,7 @@ window.CustomElements.addModule(function(scope) {
if (inRoot.__observer) {
return;
}
var observer = new MutationObserver(handler);
var observer = new MutationObserver(handler.bind(this, inRoot));
observer.observe(inRoot, {
childList: true,
subtree: true
@ -6670,7 +6663,8 @@ window.CustomElements.addModule(function(scope) {
function upgradeDocument(doc) {
doc = window.wrap(doc);
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
addedNode(doc);
var isMainDocument = doc === window.wrap(document);
addedNode(doc, isMainDocument);
observe(doc);
flags.dom && console.groupEnd();
}
@ -6689,26 +6683,26 @@ window.CustomElements.addModule(function(scope) {
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attachedNode = attachedNode;
scope.attached = attached;
scope.takeRecords = takeRecords;
});
window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
function upgrade(node) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
}
}
}
}
function upgradeWithDefinition(element, definition) {
function upgradeWithDefinition(element, definition, isAttached) {
flags.upgrade && console.group("upgrade:", element.localName);
if (definition.is) {
element.setAttribute("is", definition.is);
@ -6716,8 +6710,10 @@ window.CustomElements.addModule(function(scope) {
implementPrototype(element, definition);
element.__upgraded__ = true;
created(element);
scope.attachedNode(element);
scope.upgradeSubtree(element);
if (isAttached) {
scope.attached(element);
}
scope.upgradeSubtree(element, isAttached);
flags.upgrade && console.groupEnd();
return element;
}
@ -6999,7 +6995,7 @@ window.CustomElements.addModule(function(scope) {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(wrap(elt.import));
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;

File diff suppressed because one or more lines are too long

View file

@ -4,6 +4,8 @@
var self = this;
self.enableProgressReporting = options.type == 'audio';
function onEnded() {
Events.trigger(self, 'ended');
}
@ -148,10 +150,19 @@
var playbackStartInfo = getPlaybackStartInfoForVideoActivity(val, mediaSource, item);
var serverUrl = ApiClient.serverAddress();
var requestHeaders = {};
ApiClient.setRequestHeaders(requestHeaders);
AndroidVlcPlayer.playVideoVlc(val, startPosMs, item.Name, JSON.stringify(mediaSource), JSON.stringify(playbackStartInfo), serverUrl, JSON.stringify(requestHeaders));
AndroidVlcPlayer.playVideoVlc(val,
startPosMs,
item.Name,
JSON.stringify(mediaSource),
JSON.stringify(playbackStartInfo),
serverUrl,
ApiClient.appName(),
ApiClient.appVersion(),
ApiClient.deviceId(),
ApiClient.deviceName(),
ApiClient.getCurrentUserId(),
ApiClient.accessToken());
playerState.currentSrc = val;
self.report('playing', null, startPosMs, false, 100);

View file

@ -64,7 +64,7 @@
</div>
<p>${MessagePleaseRestartServerToFinishUpdating}</p>
<div class="btnRestartContainer hide">
<paper-button raised class="submit" onclick="DashboardPage.restartServer();"><iron-icon icon="refresh"></iron-icon><span>${ButtonRestartNow}</span></paper-button>
<paper-button raised class="submit" onclick="DashboardPage.restart();"><iron-icon icon="refresh"></iron-icon><span>${ButtonRestartNow}</span></paper-button>
</div>
</div>

View file

@ -5,7 +5,7 @@
</head>
<body>
<div id="indexPage" data-role="page" class="page homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs" data-backdroptype="movie,series,game,book" data-require="scripts/sections,scripts/indexpage,scripts/homenextup,scripts/favorites,scripts/homeupcoming,paperbuttonstyle">
<div id="indexPage" data-role="page" class="page homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs" data-title="${ButtonHome}" data-backdroptype="movie,series,game,book" data-require="scripts/sections,scripts/indexpage,scripts/homenextup,scripts/favorites,scripts/homeupcoming,paperbuttonstyle">
<div class="libraryViewNav libraryViewNavWithMinHeight">
<paper-tabs style="display:none;">

View file

@ -9,12 +9,6 @@
</div>
<div data-role="content" class="itemListContent">
<h1 class="listHeader" style="margin: 0; text-align: center;">
<span id="itemName"></span>
<span id="editButtonContainer" style="display: none; margin-left: .5em;">
<button id="btnEdit" type="button" data-icon="edit" data-inline="true" data-mini="true">${ButtonEdit}</button>
</span>
</h1>
<div class="viewSettings">
<div class="listTopPaging">
</div>

View file

@ -4,14 +4,9 @@
<title>Emby</title>
</head>
<body>
<div id="playlistEditorPage" data-role="page" class="page libraryPage" data-require="scripts/playlistedit">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="playlists.html" class="ui-btn-active"><i class="material-icons">menu</i>${TabPlaylists}</a>
</div>
<div id="playlistEditorPage" data-role="page" class="page libraryPage noSecondaryNavPage" data-require="scripts/playlistedit" data-backbutton="true">
<div data-role="content">
<h2 style="text-align:center;" class="playlistName"></h2>
<div class="viewSettings">
<div class="listTopPaging"></div>
<paper-button raised class="secondary btnPlay hide"><iron-icon icon="play-arrow"></iron-icon><span>${ButtonPlay}</span></paper-button>

View file

@ -4,11 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="playlistsPage" data-role="page" class="page libraryPage" data-require="scripts/playlists">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="#" class="ui-btn-active"><i class="material-icons">menu</i>${TabPlaylists}</a>
</div>
<div id="playlistsPage" data-role="page" class="page libraryPage noSecondaryNavPage" data-require="scripts/playlists" data-title="${HeaderPlaylists}">
<div data-role="content">
<div class="viewSettings">

View file

@ -60,6 +60,42 @@
}
}
var viblastKey = 'N8FjNTQ3NDdhZqZhNGI5NWU5ZTI=';
function requireViblast(callback) {
require(['thirdparty/viblast/viblast.js'], function () {
if (htmlMediaRenderer.customViblastKey) {
callback();
} else {
downloadViblastKey(callback);
}
});
}
function downloadViblastKey(callback) {
var headers = {};
headers['X-Emby-Token'] = 'EMBY_SERVER';
HttpClient.send({
type: 'GET',
url: 'https://mb3admin.com/admin/service/registration/getViBlastKey',
headers: headers
}).done(function (key) {
htmlMediaRenderer.customViblastKey = key;
callback();
}).fail(function () {
callback();
});
}
function getViblastKey() {
return htmlMediaRenderer.customViblastKey || viblastKey;
}
function onOneVideoPlaying() {
var requiresNativeControls = !self.enableCustomVideoControls();
@ -85,7 +121,7 @@
var element = this;
setTimeout(function () {
element.currentTime = startPositionInSeekParam;
}, 3000);
}, 2500);
}
}
}
@ -175,6 +211,8 @@
.on('error', onError)[0];
}
// Save this for when playback stops, because querying the time at that point might return 0
var _currentTime;
self.currentTime = function (val) {
if (mediaElement) {
@ -183,6 +221,10 @@
return;
}
if (_currentTime) {
return _currentTime * 1000;
}
return (mediaElement.currentTime || 0) * 1000;
}
};
@ -201,11 +243,10 @@
mediaElement.pause();
if (isViblastStarted) {
requirejs(['thirdparty/viblast.js'], function () {
_currentTime = mediaElement.currentTime;
viblast(mediaElement).stop();
isViblastStarted = false;
});
}
}
};
@ -270,7 +311,7 @@
setTracks(elem, tracks || []);
viblast(elem).setup({
key: 'N8FjNTQ3NDdhZqZhNGI5NWU5ZTI=',
key: getViblastKey(),
stream: val
});
@ -322,6 +363,7 @@
self.cleanup = function (destroyRenderer) {
self.setCurrentSrc(null);
_currentTime = null;
var elem = mediaElement;
@ -459,7 +501,7 @@
if (options.type == 'video' && enableViblast()) {
requirejs(['thirdparty/viblast.js'], function () {
requireViblast(function () {
deferred.resolve();
});

View file

@ -135,9 +135,7 @@
name = item.ParentIndexNumber + "." + name;
}
$('#itemName', page).html(name);
Dashboard.setPageTitle(name);
LibraryMenu.setTitle(name);
$(page).trigger('displayingitem', [{
@ -147,16 +145,6 @@
LibraryBrowser.setLastRefreshed(page);
Dashboard.hideLoadingMsg();
});
Dashboard.getCurrentUser().done(function (user) {
if (user.Policy.IsAdministrator && query.ParentId && !AppInfo.isNativeApp) {
$('#editButtonContainer', page).show();
} else {
$('#editButtonContainer', page).hide();
}
});
}
function updateFilterControls(page) {
@ -247,11 +235,6 @@
LibraryBrowser.saveViewSetting(getParameterByName('parentId'), view);
});
$('#btnEdit', page).on('click', function () {
Dashboard.navigate("edititemmetadata.html?id=" + currentItem.Id);
});
$('.alphabetPicker', this).on('alphaselect', function (e, character) {
var query = getQuery();

View file

@ -372,7 +372,7 @@
var section = this.getElementsByClassName('sectionName')[0];
var text = section ? section.innerHTML : this.innerHTML;
document.querySelector('.libraryMenuButtonText').innerHTML = text;
LibraryMenu.setTitle(text);
}
function updateLibraryMenu(user) {
@ -495,11 +495,6 @@
});
}
function setLibraryMenuText(text) {
document.querySelector('.libraryMenuButtonText').innerHTML = '<span>' + text + '</span>';
}
function getTopParentId() {
return getParameterByName('topParentId') || null;
@ -508,8 +503,6 @@
window.LibraryMenu = {
getTopParentId: getTopParentId,
setText: setLibraryMenuText,
onLinkClicked: function (event, link) {
if (event.which != 1) {
@ -558,6 +551,10 @@
// There doesn't seem to be a way to detect if the drawer is in the process of opening, so try to handle that here
Dashboard.navigate('dashboard.html');
return false;
},
setTitle: function (title) {
document.querySelector('.libraryMenuButtonText').innerHTML = title;
}
};
@ -647,20 +644,6 @@
}
}
function updateContextText(page) {
var name = page.getAttribute('data-contextname');
if (name) {
document.querySelector('.libraryMenuButtonText').innerHTML = '<span>' + name + '</span>';
}
else if (page.classList.contains('allLibraryPage') || page.classList.contains('type-interior')) {
document.querySelector('.libraryMenuButtonText').innerHTML = Globalize.translate('ButtonHome');
}
}
function onWebSocketMessage(e, data) {
var msg = data;
@ -700,14 +683,12 @@
updateCastIcon();
updateLibraryNavLinks(page);
updateContextText(page);
requiresViewMenuRefresh = false;
ConnectionManager.user(window.ApiClient).done(addUserToHeader);
} else {
viewMenuBar.classList.remove('hide');
updateContextText(page);
updateLibraryNavLinks(page);
updateViewMenuBarHeadroom(page, viewMenuBar);
requiresViewMenuRefresh = false;
@ -743,10 +724,16 @@
var isLibraryPage = page.classList.contains('libraryPage');
var darkDrawer = false;
var title = page.getAttribute('data-title') || page.getAttribute('data-contextname');
if (title) {
LibraryMenu.setTitle(title);
}
var titleKey = getParameterByName('titlekey');
if (titleKey) {
document.querySelector('.libraryMenuButtonText').innerHTML = Globalize.translate(titleKey);
LibraryMenu.setTitle(Globalize.translate(titleKey));
}
if (page.getAttribute('data-menubutton') == 'false') {

View file

@ -1102,14 +1102,6 @@
errorMsg += '</p>';
}
if ($.browser.msie && !$.browser.mobile && !self.canPlayWebm()) {
errorMsg += '<p>';
errorMsg += '<a href="https://tools.google.com/dlpage/webmmf/" target="_blank">';
errorMsg += Globalize.translate('MessageInternetExplorerWebm');
errorMsg += '</a>';
errorMsg += '</p>';
}
Dashboard.alert({
title: Globalize.translate('HeaderVideoError'),
message: errorMsg

View file

@ -545,14 +545,14 @@
// viblast can help us here
//return true;
//return window.MediaSource != null;
return window.MediaSource != null;
}
if ($.browser.msie) {
// viblast can help us here
//return true;
//return window.MediaSource != null;
return window.MediaSource != null;
}
return false;
@ -742,6 +742,8 @@
self.play = function (options) {
Dashboard.showLoadingMsg();
Dashboard.getCurrentUser().done(function (user) {
if (options.items) {
@ -775,6 +777,11 @@
var firstItem = items[0];
if (firstItem.MediaType === "Video") {
Dashboard.showModalLoadingMsg();
}
if (options.startPositionTicks || firstItem.MediaType !== 'Video') {
self.playInternal(firstItem, options.startPositionTicks, function () {
@ -929,6 +936,7 @@
}
if (item.IsPlaceHolder) {
Dashboard.hideModalLoadingMsg();
MediaController.showPlaybackInfoErrorMessage('PlaceHolder');
return;
}
@ -1666,7 +1674,13 @@
function sendProgressUpdate() {
var state = self.getPlayerStateInternal(self.currentMediaRenderer, self.currentItem, self.currentMediaSource);
var mediaRenderer = self.currentMediaRenderer;
if (mediaRenderer.enableProgressReporting === false) {
return;
}
var state = self.getPlayerStateInternal(mediaRenderer, self.currentItem, self.currentMediaSource);
var info = {
QueueableMediaTypes: state.NowPlayingItem.MediaType,

View file

@ -53,7 +53,7 @@
var user = response2[0];
var item = response3[0];
$('.playlistName', page).html(item.Name);
LibraryMenu.setTitle(item.Name);
_childrenItemsFunction = getItemsFunction(query);

View file

@ -72,7 +72,6 @@
items: result.Items,
shape: "backdrop",
preferThumb: true,
context: 'tv',
lazy: true,
overlayText: true
});
@ -84,7 +83,6 @@
items: result.Items,
shape: "backdrop",
preferThumb: true,
context: 'tv',
lazy: true,
cardLayout: true,
showTitle: true,
@ -97,7 +95,6 @@
items: result.Items,
shape: "banner",
preferBanner: true,
context: 'tv',
lazy: true
});
}
@ -105,33 +102,38 @@
html = LibraryBrowser.getListViewHtml({
items: result.Items,
context: 'tv',
sortBy: query.SortBy
});
trigger = true;
}
else if (view == "PosterCard") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "portrait",
context: 'tv',
showTitle: true,
showYear: true,
lazy: true,
cardLayout: true
});
}
else {
// Poster
html = LibraryBrowser.getPosterViewHtml({
var posterOptions = {
items: result.Items,
shape: "portrait",
context: 'tv',
shape: "auto",
centerText: true,
lazy: true,
overlayText: true
});
};
if (query.IncludeItemTypes == "MusicAlbum") {
posterOptions.overlayText = false;
posterOptions.showParentTitle = true;
posterOptions.overlayPlayButton = true;
}
else if (query.IncludeItemTypes == "MusicArtist") {
posterOptions.overlayText = false;
posterOptions.overlayPlayButton = true;
}
else if (query.IncludeItemTypes == "Episode") {
posterOptions.overlayText = false;
posterOptions.showParentTitle = true;
posterOptions.overlayPlayButton = true;
posterOptions.centerText = false;
}
// Poster
html = LibraryBrowser.getPosterViewHtml(posterOptions);
}
var elem = page.querySelector('#items');

View file

@ -332,7 +332,7 @@
var text = textElem.html();
LibraryMenu.setText(text);
LibraryMenu.setTitle(text);
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<body>
<script>
var worker = new Worker(decodeURIComponent(window.location.search.substring(1)));
window.onmessage = function(evt) {
worker.postMessage(evt.data);
}
worker.onmessage = function(evt) {
window.parent.postMessage(evt.data, "*");
}
</script>
</body>
</html>

View file

@ -522,7 +522,7 @@ debouncer.stop();
}
}
});
Polymer.version = '1.0.5';
Polymer.version = '1.0.6';
Polymer.Base._addFeature({
_registerFeatures: function () {
this._prepIs();
@ -961,6 +961,8 @@ var getInnerHTML = Polymer.domInnerHTML.getInnerHTML;
var nativeInsertBefore = Element.prototype.insertBefore;
var nativeRemoveChild = Element.prototype.removeChild;
var nativeAppendChild = Element.prototype.appendChild;
var nativeCloneNode = Element.prototype.cloneNode;
var nativeImportNode = Document.prototype.importNode;
var dirtyRoots = [];
var DomApi = function (node) {
this.node = node;
@ -1089,8 +1091,8 @@ return parentNeedsDist || hasContent && !wrappedContent;
},
_tryRemoveUndistributedNode: function (node) {
if (this.node.shadyRoot) {
if (node.parentNode) {
nativeRemoveChild.call(node.parentNode, node);
if (node._composedParent) {
nativeRemoveChild.call(node._composedParent, node);
}
return true;
}
@ -1099,7 +1101,7 @@ _updateInsertionPoints: function (host) {
host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTENT);
},
_nodeIsInLogicalTree: function (node) {
return Boolean(node._lightParent || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
return Boolean(node._lightParent !== undefined || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
},
_parentNeedsDistribution: function (parent) {
return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
@ -1272,6 +1274,31 @@ _distributeParent: function () {
if (this._parentNeedsDistribution(this.parentNode)) {
this._lazyDistribute(this.parentNode);
}
},
cloneNode: function (deep) {
var n = nativeCloneNode.call(this.node, false);
if (deep) {
var c$ = this.childNodes;
var d = factory(n);
for (var i = 0, nc; i < c$.length; i++) {
nc = factory(c$[i]).cloneNode(true);
d.appendChild(nc);
}
}
return n;
},
importNode: function (externalNode, deep) {
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
var n = nativeImportNode.call(doc, externalNode, false);
if (deep) {
var c$ = factory(externalNode).childNodes;
var d = factory(n);
for (var i = 0, nc; i < c$.length; i++) {
nc = factory(doc).importNode(c$[i], true);
d.appendChild(nc);
}
}
return n;
}
};
Object.defineProperty(DomApi.prototype, 'classList', {
@ -1420,8 +1447,9 @@ if (this.node.nodeType !== Node.TEXT_NODE) {
this._clear();
var d = document.createElement('div');
d.innerHTML = text;
for (var e = d.firstChild; e; e = e.nextSibling) {
this.appendChild(e);
var c$ = Array.prototype.slice.call(d.childNodes);
for (var i = 0; i < c$.length; i++) {
this.appendChild(c$[i]);
}
}
},
@ -1444,6 +1472,13 @@ return n;
n = n.parentNode;
}
};
DomApi.prototype.cloneNode = function (deep) {
return this.node.cloneNode(deep);
};
DomApi.prototype.importNode = function (externalNode, deep) {
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
return doc.importNode(externalNode, deep);
};
DomApi.prototype.getDestinationInsertionPoints = function () {
var n$ = this.node.getDestinationInsertionPoints();
return n$ ? Array.prototype.slice.call(n$) : [];
@ -2329,6 +2364,7 @@ var MOUSE_EVENTS = [
'mouseup',
'click'
];
var IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
var mouseCanceller = function (mouseEvent) {
mouseEvent[HANDLED_OBJ] = { skip: true };
if (mouseEvent.type === 'click') {
@ -2353,6 +2389,9 @@ document.removeEventListener(en, mouseCanceller, true);
}
}
function ignoreMouse() {
if (IS_TOUCH_ONLY) {
return;
}
if (!POINTERSTATE.mouse.mouseIgnoreJob) {
setupTeardownMouseCanceller(true);
}
@ -2401,6 +2440,12 @@ node = next;
}
return node;
},
findOriginalTarget: function (ev) {
if (ev.path) {
return ev.path[0];
}
return ev.target;
},
handleNative: function (ev) {
var handled;
var type = ev.type;
@ -2471,8 +2516,7 @@ prevent = dy > dx;
prevent = dx > dy;
}
if (prevent) {
//This breaks scrolling in safari
//ev.preventDefault();
ev.preventDefault();
}
}
},
@ -2486,12 +2530,18 @@ node[GESTURE_KEY] = gobj = {};
}
for (var i = 0, dep, gd; i < deps.length; i++) {
dep = deps[i];
if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1) {
continue;
}
gd = gobj[dep];
if (!gd) {
gobj[dep] = gd = {};
gobj[dep] = gd = { _count: 0 };
}
if (gd._count === 0) {
node.addEventListener(dep, this.handleNative);
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
}
node.addEventListener(evType, handler);
if (recognizer.touchAction) {
@ -2509,9 +2559,10 @@ dep = deps[i];
gd = gobj[dep];
if (gd && gd[name]) {
gd[name] = (gd[name] || 1) - 1;
if (gd[name] === 0) {
node.removeEventListener(dep, this.handleNative);
gd._count = (gd._count || 1) - 1;
}
if (gd._count === 0) {
node.removeEventListener(dep, this.handleNative);
}
}
}
@ -2573,7 +2624,7 @@ emits: [
'up'
],
mousedown: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var self = this;
var upfn = function upfn(e) {
self.fire('up', t, e);
@ -2583,10 +2634,10 @@ document.addEventListener('mouseup', upfn);
this.fire('down', t, e);
},
touchstart: function (e) {
this.fire('down', e.currentTarget, e.changedTouches[0]);
this.fire('down', Gestures.findOriginalTarget(e), e.changedTouches[0]);
},
touchend: function (e) {
this.fire('up', e.currentTarget, e.changedTouches[0]);
this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]);
},
fire: function (type, target, event) {
var self = this;
@ -2642,7 +2693,7 @@ var dy = Math.abs(this.info.y - y);
return dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE;
},
mousedown: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var self = this;
var movefn = function movefn(e) {
var x = e.clientX, y = e.clientY;
@ -2676,7 +2727,7 @@ this.info.x = ct.clientX;
this.info.y = ct.clientY;
},
touchmove: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var ct = e.changedTouches[0];
var x = ct.clientX, y = ct.clientY;
if (this.hasMovedEnough(x, y)) {
@ -2690,7 +2741,7 @@ this.info.started = true;
}
},
touchend: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var ct = e.changedTouches[0];
if (this.info.started) {
Gestures.prevent('tap');
@ -2766,9 +2817,10 @@ this.forward(e.changedTouches[0]);
forward: function (e) {
var dx = Math.abs(e.clientX - this.info.x);
var dy = Math.abs(e.clientY - this.info.y);
var t = Gestures.findOriginalTarget(e);
if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) {
if (!this.info.prevent) {
Gestures.fire(e.target, 'tap', {
Gestures.fire(t, 'tap', {
x: e.clientX,
y: e.clientY,
sourceEvent: e
@ -3015,15 +3067,15 @@ Polymer.Bind = {
prepareModel: function (model) {
model._propertyEffects = {};
model._bindListeners = [];
var api = this._modelApi;
for (var n in api) {
model[n] = api[n];
}
Polymer.Base.mixin(model, this._modelApi);
},
_modelApi: {
_notifyChange: function (property) {
var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
this.fire(eventName, { value: this[property] }, { bubbles: false });
Polymer.Base.fire(eventName, { value: this[property] }, {
bubbles: false,
node: this
});
},
_propertySetter: function (property, value, effects, fromAbove) {
var old = this.__data__[property];
@ -3114,8 +3166,11 @@ return this.__data__[property];
var setter = function (value) {
this._propertySetter(property, value, effects);
};
if (model.getPropertyInfo && model.getPropertyInfo(property).readOnly) {
var info = model.getPropertyInfo && model.getPropertyInfo(property);
if (info && info.readOnly) {
if (!info.computed) {
model['_set' + this.upper(property)] = setter;
}
} else {
defun.set = setter;
}
@ -3573,6 +3628,7 @@ this._pathEffector(path, value);
if (!fromAbove) {
this._notifyPath(path, value);
}
return true;
}
},
_getPathParts: function (path) {
@ -3914,7 +3970,7 @@ var VAR_START = '--';
var MEDIA_START = '@media';
var AT_START = '@';
var rx = {
comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
port: /@import[^;]*;/gim,
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim,
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
@ -4586,10 +4642,10 @@ props[i] = v;
}
},
rx: {
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?:(?=[;\n])|$)/gim,
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/im,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
IS_VAR: /^--/,
BRACKETED: /\{[^}]*\}/g,
HOST_PREFIX: '(?:^|[^.#[:])',
@ -4928,7 +4984,7 @@ styleTransformer.documentRule(rule);
});
}());
Polymer.Templatizer = {
properties: { _hideTemplateChildren: { observer: '_showHideChildren' } },
properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
_templatizerStatic: {
count: 0,
callbacks: {},
@ -4957,6 +5013,7 @@ this._prepParentProperties(archetype, template);
archetype._notifyPath = this._notifyPathImpl;
archetype._scopeElementClass = this._scopeElementClassImpl;
archetype.listen = this._listenImpl;
archetype._showHideChildren = this._showHideChildrenImpl;
var _constructor = this._constructorImpl;
var ctor = function TemplateInstance(model, host) {
_constructor.call(this, model, host);
@ -4969,7 +5026,15 @@ this.ctor = ctor;
_getRootDataHost: function () {
return this.dataHost && this.dataHost._rootDataHost || this.dataHost;
},
_showHideChildren: function (hidden) {
_showHideChildrenImpl: function (hide) {
var c = this._children;
for (var i = 0; i < c.length; i++) {
var n = c[i];
if (n.style) {
n.style.display = hide ? 'none' : '';
n.__hideTemplateChildren__ = hide;
}
}
},
_debounceTemplate: function (fn) {
this._templatizerStatic.callbacks[this._templatizerId] = fn.bind(this);
@ -5070,6 +5135,8 @@ template._propertySetter(n, val);
}
});
},
_showHideChildren: function (hidden) {
},
_forwardInstancePath: function (inst, path, value) {
},
_forwardInstanceProp: function (inst, prop, value) {
@ -5108,6 +5175,9 @@ children.push(n);
n._templateInstance = this;
}
this._children = children;
if (host.__hideTemplateChildren__) {
this._showHideChildren(true);
}
this._tryReady();
},
_listenImpl: function (node, eventName, methodName) {
@ -5134,6 +5204,20 @@ model[prop] = this['_parent_' + prop];
}
}
return new this.ctor(model, this);
},
modelForElement: function (el) {
var model;
while (el) {
if (model = el._templateInstance) {
if (model.dataHost != this) {
el = model.dataHost;
} else {
return model;
}
} else {
el = el.parentNode;
}
}
}
};
Polymer({
@ -5180,7 +5264,7 @@ this._removeFromMap(this.store[key]);
delete this.store[key];
},
_removeFromMap: function (item) {
if (typeof item == 'object') {
if (item && typeof item == 'object') {
this.omap.delete(item);
} else {
delete this.pmap[item];
@ -5192,7 +5276,7 @@ this.removeKey(key);
return key;
},
getKey: function (item) {
if (typeof item == 'object') {
if (item && typeof item == 'object') {
return this.omap.get(item);
} else {
return this.pmap[item];
@ -5561,14 +5645,7 @@ return row;
_showHideChildren: function (hidden) {
if (this.rows) {
for (var i = 0; i < this.rows.length; i++) {
var c$ = this.rows[i]._children;
for (var j = 0; j < c$.length; j++) {
var c = c$[j];
if (c.style) {
c.style.display = hidden ? 'none' : '';
}
c._hideTemplateChildren = hidden;
}
this.rows[i]._showHideChildren(hidden);
}
}
},
@ -5618,20 +5695,6 @@ row.__setProperty(this.as, value, true);
}
}
},
modelForElement: function (el) {
var model;
while (el) {
if (model = el._templateInstance) {
if (model.dataHost != this) {
el = model.dataHost;
} else {
return model;
}
} else {
el = el.parentNode;
}
}
},
itemForElement: function (el) {
var instance = this.modelForElement(el);
return instance && instance[this.as];
@ -5786,7 +5849,7 @@ this._instance = null;
},
_wrapTextNodes: function (root) {
for (var n = root.firstChild; n; n = n.nextSibling) {
if (n.nodeType === Node.TEXT_NODE) {
if (n.nodeType === Node.TEXT_NODE && n.textContent.trim()) {
var s = document.createElement('span');
root.insertBefore(s, n);
s.appendChild(n);
@ -5795,14 +5858,9 @@ n = s;
}
},
_showHideChildren: function () {
var hidden = this._hideTemplateChildren || !this.if;
var hidden = this.__hideTemplateChildren__ || !this.if;
if (this._instance) {
var c$ = this._instance._children;
for (var i = 0; i < c$.length; i++) {
var c = c$[i];
c.style.display = hidden ? 'none' : '';
c._hideTemplateChildren = hidden;
}
this._instance._showHideChildren(hidden);
}
},
_forwardParentProp: function (prop, value) {
@ -14635,7 +14693,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
<script>
(function () {
(function() {
'use strict';
@ -14751,7 +14809,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
*/
hasTransform: {
type: Boolean,
value: function () {
value: function() {
return 'transform' in this.style;
}
},
@ -14761,7 +14819,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
*/
hasWillChange: {
type: Boolean,
value: function () {
value: function() {
return 'willChange' in this.style;
}
},
@ -14850,7 +14908,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
*
* @method togglePanel
*/
togglePanel: function () {
togglePanel: function() {
if (this._isMainSelected()) {
this.openDrawer();
} else {
@ -14863,9 +14921,8 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
*
* @method openDrawer
*/
openDrawer: function () {
openDrawer: function() {
this.selected = 'drawer';
this.fire('paper-drawer-panel-open');
},
/**
@ -14873,18 +14930,17 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
*
* @method closeDrawer
*/
closeDrawer: function () {
closeDrawer: function() {
this.selected = 'main';
this.fire('paper-drawer-panel-close');
},
ready: function () {
ready: function() {
// Avoid transition at the beginning e.g. page loads and enable
// transitions only after the element is rendered and ready.
this.transition = true;
},
_computeIronSelectorClass: function (narrow, transition, dragging, rightDrawer, peeking) {
_computeIronSelectorClass: function(narrow, transition, dragging, rightDrawer, peeking) {
return classNames({
dragging: dragging,
'narrow-layout': narrow,
@ -14895,11 +14951,11 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
});
},
_computeDrawerStyle: function (drawerWidth) {
_computeDrawerStyle: function(drawerWidth) {
return 'width:' + drawerWidth + ';';
},
_computeMainStyle: function (narrow, rightDrawer, drawerWidth) {
_computeMainStyle: function(narrow, rightDrawer, drawerWidth) {
var style = '';
style += 'left:' + ((narrow || rightDrawer) ? '0' : drawerWidth) + ';';
@ -14911,15 +14967,15 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
return style;
},
_computeMediaQuery: function (forceNarrow, responsiveWidth) {
_computeMediaQuery: function(forceNarrow, responsiveWidth) {
return forceNarrow ? '' : '(max-width: ' + responsiveWidth + ')';
},
_computeSwipeOverlayHidden: function (narrow, disableEdgeSwipe) {
_computeSwipeOverlayHidden: function(narrow, disableEdgeSwipe) {
return !narrow || disableEdgeSwipe;
},
_onTrack: function (event) {
_onTrack: function(event) {
if (sharedPanel && this !== sharedPanel) {
return;
}
@ -14937,7 +14993,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
},
_responsiveChange: function (narrow) {
_responsiveChange: function(narrow) {
this._setNarrow(narrow);
if (this.narrow) {
@ -14945,41 +15001,41 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
}
this.setScrollDirection(this._swipeAllowed() ? 'y' : 'all');
this.fire('paper-responsive-change', { narrow: this.narrow });
this.fire('paper-responsive-change', {narrow: this.narrow});
},
_onQueryMatchesChanged: function (event) {
_onQueryMatchesChanged: function(event) {
this._responsiveChange(event.detail.value);
},
_forceNarrowChanged: function () {
_forceNarrowChanged: function() {
// set the narrow mode only if we reached the `responsiveWidth`
this._responsiveChange(this.forceNarrow || this.$.mq.queryMatches);
},
_swipeAllowed: function () {
_swipeAllowed: function() {
return this.narrow && !this.disableSwipe;
},
_isMainSelected: function () {
_isMainSelected: function() {
return this.selected === 'main';
},
_startEdgePeek: function () {
_startEdgePeek: function() {
this.width = this.$.drawer.offsetWidth;
this._moveDrawer(this._translateXForDeltaX(this.rightDrawer ?
-this.edgeSwipeSensitivity : this.edgeSwipeSensitivity));
this._setPeeking(true);
},
_stopEdgePeek: function () {
_stopEdgePeek: function() {
if (this.peeking) {
this._setPeeking(false);
this._moveDrawer(null);
}
},
_downHandler: function (event) {
_downHandler: function(event) {
if (!this.dragging && this._isMainSelected() && this._isEdgeTouch(event) && !sharedPanel) {
this._startEdgePeek();
// cancel selection
@ -14989,13 +15045,13 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
}
},
_upHandler: function () {
_upHandler: function() {
this._stopEdgePeek();
// release the panel
sharedPanel = null;
},
_onTap: function (event) {
_onTap: function(event) {
var targetElement = Polymer.dom(event).localTarget;
var isTargetToggleElement = targetElement &&
this.drawerToggleAttribute &&
@ -15006,7 +15062,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
}
},
_isEdgeTouch: function (event) {
_isEdgeTouch: function(event) {
var x = event.detail.x;
return !this.disableEdgeSwipe && this._swipeAllowed() &&
@ -15015,7 +15071,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
x <= this.edgeSwipeSensitivity);
},
_trackStart: function (event) {
_trackStart: function(event) {
if (this._swipeAllowed()) {
sharedPanel = this;
this._setDragging(true);
@ -15031,7 +15087,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
}
},
_translateXForDeltaX: function (deltaX) {
_translateXForDeltaX: function(deltaX) {
var isMain = this._isMainSelected();
if (this.rightDrawer) {
@ -15041,7 +15097,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
}
},
_trackX: function (event) {
_trackX: function(event) {
if (this.dragging) {
var dx = event.detail.dx;
@ -15053,18 +15109,11 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
this._setPeeking(false);
}
var dy = event.detail.dy;
var absDy = Math.abs(dy);
if (absDy >= 70) {
// Ignore trackx until we move past the edge peek.
return;
}
this._moveDrawer(this._translateXForDeltaX(dx));
}
},
_trackEnd: function (event) {
_trackEnd: function(event) {
if (this.dragging) {
var xDirection = event.detail.dx > 0;
@ -15073,19 +15122,15 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
sharedPanel = null;
this._moveDrawer(null);
var dx = event.detail.dx;
var dy = event.detail.dy;
var absDy = Math.abs(dy);
if (this.rightDrawer) {
this[xDirection ? 'closeDrawer' : 'openDrawer']();
} else {
this[xDirection || dx > -80 || absDy >= 70 ? 'openDrawer' : 'closeDrawer']();
this[xDirection ? 'openDrawer' : 'closeDrawer']();
}
}
},
_transformForTranslateX: function (translateX) {
_transformForTranslateX: function(translateX) {
if (translateX === null) {
return '';
}
@ -15094,7 +15139,7 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
'translate3d(' + translateX + 'px, 0, 0)';
},
_moveDrawer: function (translateX) {
_moveDrawer: function(translateX) {
this.transform(this._transformForTranslateX(translateX), this.$.drawer);
}
@ -15102,7 +15147,8 @@ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
}());
</script><iron-iconset-svg name="paper-tabs" size="24">
</script>
<iron-iconset-svg name="paper-tabs" size="24">
<svg><defs>
<g id="chevron-left"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></g>
<g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g>