mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
restore polymer change
This commit is contained in:
parent
6f8396a6e7
commit
69c6074e41
2 changed files with 94 additions and 46 deletions
|
@ -641,7 +641,7 @@ prevent = dy > dx;
|
|||
prevent = dx > dy;
|
||||
}
|
||||
if (prevent) {
|
||||
ev.preventDefault();
|
||||
//ev.preventDefault();
|
||||
} else {
|
||||
Gestures.prevent('track');
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ addEventListener('DOMContentLoaded', resolve);
|
|||
}
|
||||
}
|
||||
}());
|
||||
Polymer = {
|
||||
window.Polymer = {
|
||||
Settings: function () {
|
||||
var user = window.Polymer || {};
|
||||
location.search.slice(1).split('&').forEach(function (o) {
|
||||
|
@ -72,15 +72,21 @@ useNativeCustomElements: useNativeCustomElements
|
|||
(function () {
|
||||
var userPolymer = window.Polymer;
|
||||
window.Polymer = function (prototype) {
|
||||
var ctor = desugar(prototype);
|
||||
prototype = ctor.prototype;
|
||||
var options = { prototype: prototype };
|
||||
if (prototype.extends) {
|
||||
options.extends = prototype.extends;
|
||||
if (typeof prototype === 'function') {
|
||||
prototype = prototype.prototype;
|
||||
}
|
||||
if (!prototype) {
|
||||
prototype = {};
|
||||
}
|
||||
var factory = desugar(prototype);
|
||||
prototype = factory.prototype;
|
||||
var options = {
|
||||
prototype: prototype,
|
||||
extends: prototype.extends
|
||||
};
|
||||
Polymer.telemetry._registrate(prototype);
|
||||
document.registerElement(prototype.is, options);
|
||||
return ctor;
|
||||
return factory;
|
||||
};
|
||||
var desugar = function (prototype) {
|
||||
var base = Polymer.Base;
|
||||
|
@ -157,6 +163,8 @@ _addFeature: function (feature) {
|
|||
this.extend(this, feature);
|
||||
},
|
||||
registerCallback: function () {
|
||||
this._desugarBehaviors();
|
||||
this._doBehavior('beforeRegister');
|
||||
this._registerFeatures();
|
||||
this._doBehavior('registered');
|
||||
},
|
||||
|
@ -262,6 +270,7 @@ lcModules[id.toLowerCase()] = this;
|
|||
}
|
||||
},
|
||||
import: function (id, selector) {
|
||||
if (id) {
|
||||
var m = findModule(id);
|
||||
if (!m) {
|
||||
forceDocumentUpgrade();
|
||||
|
@ -272,6 +281,7 @@ m = m.querySelector(selector);
|
|||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
});
|
||||
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
||||
document.registerElement('dom-module', DomModule);
|
||||
|
@ -279,8 +289,7 @@ function forceDocumentUpgrade() {
|
|||
if (cePolyfill) {
|
||||
var script = document._currentScript || document.currentScript;
|
||||
var doc = script && script.ownerDocument;
|
||||
if (doc && !doc.__customElementsForceUpgraded) {
|
||||
doc.__customElementsForceUpgraded = true;
|
||||
if (doc) {
|
||||
CustomElements.upgradeAll(doc);
|
||||
}
|
||||
}
|
||||
|
@ -302,11 +311,17 @@ this.is = this.is.toLowerCase();
|
|||
});
|
||||
Polymer.Base._addFeature({
|
||||
behaviors: [],
|
||||
_prepBehaviors: function () {
|
||||
_desugarBehaviors: function () {
|
||||
if (this.behaviors.length) {
|
||||
this.behaviors = this._flattenBehaviorsList(this.behaviors);
|
||||
this.behaviors = this._desugarSomeBehaviors(this.behaviors);
|
||||
}
|
||||
this._prepAllBehaviors(this.behaviors);
|
||||
},
|
||||
_desugarSomeBehaviors: function (behaviors) {
|
||||
behaviors = this._flattenBehaviorsList(behaviors);
|
||||
for (var i = behaviors.length - 1; i >= 0; i--) {
|
||||
this._mixinBehavior(behaviors[i]);
|
||||
}
|
||||
return behaviors;
|
||||
},
|
||||
_flattenBehaviorsList: function (behaviors) {
|
||||
var flat = [];
|
||||
|
@ -321,15 +336,6 @@ this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for miss
|
|||
}, this);
|
||||
return flat;
|
||||
},
|
||||
_prepAllBehaviors: function (behaviors) {
|
||||
for (var i = behaviors.length - 1; i >= 0; i--) {
|
||||
this._mixinBehavior(behaviors[i]);
|
||||
}
|
||||
for (var i = 0, l = behaviors.length; i < l; i++) {
|
||||
this._prepBehavior(behaviors[i]);
|
||||
}
|
||||
this._prepBehavior(this);
|
||||
},
|
||||
_mixinBehavior: function (b) {
|
||||
Object.getOwnPropertyNames(b).forEach(function (n) {
|
||||
switch (n) {
|
||||
|
@ -353,6 +359,15 @@ break;
|
|||
}
|
||||
}, this);
|
||||
},
|
||||
_prepBehaviors: function () {
|
||||
this._prepFlattenedBehaviors(this.behaviors);
|
||||
},
|
||||
_prepFlattenedBehaviors: function (behaviors) {
|
||||
for (var i = 0, l = behaviors.length; i < l; i++) {
|
||||
this._prepBehavior(behaviors[i]);
|
||||
}
|
||||
this._prepBehavior(this);
|
||||
},
|
||||
_doBehavior: function (name, args) {
|
||||
this.behaviors.forEach(function (b) {
|
||||
this._invokeBehavior(b, name, args);
|
||||
|
@ -585,7 +600,7 @@ debouncer.stop();
|
|||
}
|
||||
}
|
||||
});
|
||||
Polymer.version = '1.1.1';
|
||||
Polymer.version = '1.1.2';
|
||||
Polymer.Base._addFeature({
|
||||
_registerFeatures: function () {
|
||||
this._prepIs();
|
||||
|
@ -1177,8 +1192,9 @@ return added;
|
|||
},
|
||||
_tryRemoveUndistributedNode: function (node) {
|
||||
if (this.node.shadyRoot) {
|
||||
if (node._composedParent) {
|
||||
nativeRemoveChild.call(node._composedParent, node);
|
||||
var parent = getComposedParent(node);
|
||||
if (parent) {
|
||||
nativeRemoveChild.call(parent, node);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1215,7 +1231,7 @@ if (root && hostNeedsDist) {
|
|||
this._updateInsertionPoints(root.host);
|
||||
this._lazyDistribute(root.host);
|
||||
} else if (ensureComposedRemoval) {
|
||||
removeFromComposedParent(node._composedParent, node);
|
||||
removeFromComposedParent(getComposedParent(node), node);
|
||||
}
|
||||
},
|
||||
_removeDistributedChildren: function (root, container) {
|
||||
|
@ -1439,7 +1455,7 @@ configurable: true
|
|||
},
|
||||
parentNode: {
|
||||
get: function () {
|
||||
return this.node._lightParent || (this.node.__patched ? this.node._composedParent : this.node.parentNode);
|
||||
return this.node._lightParent || getComposedParent(this.node);
|
||||
},
|
||||
configurable: true
|
||||
},
|
||||
|
@ -1561,6 +1577,18 @@ DomApi.prototype._getComposedInnerHTML = function () {
|
|||
return getInnerHTML(this.node, true);
|
||||
};
|
||||
} else {
|
||||
var forwardMethods = [
|
||||
'cloneNode',
|
||||
'appendChild',
|
||||
'insertBefore',
|
||||
'removeChild',
|
||||
'replaceChild'
|
||||
];
|
||||
forwardMethods.forEach(function (name) {
|
||||
DomApi.prototype[name] = function () {
|
||||
return this.node[name].apply(this.node, arguments);
|
||||
};
|
||||
});
|
||||
DomApi.prototype.querySelectorAll = function (selector) {
|
||||
return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
||||
};
|
||||
|
@ -1573,9 +1601,6 @@ 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 Document ? this.node : this.node.ownerDocument;
|
||||
return doc.importNode(externalNode, deep);
|
||||
|
@ -1622,7 +1647,7 @@ return this.node.innerHTML = value;
|
|||
configurable: true
|
||||
}
|
||||
});
|
||||
var forwards = [
|
||||
var forwardProperties = [
|
||||
'parentNode',
|
||||
'firstChild',
|
||||
'lastChild',
|
||||
|
@ -1633,7 +1658,7 @@ var forwards = [
|
|||
'nextElementSibling',
|
||||
'previousElementSibling'
|
||||
];
|
||||
forwards.forEach(function (name) {
|
||||
forwardProperties.forEach(function (name) {
|
||||
Object.defineProperty(DomApi.prototype, name, {
|
||||
get: function () {
|
||||
return this.node[name];
|
||||
|
@ -1717,6 +1742,9 @@ node._composedChildren = null;
|
|||
addNodeToComposedChildren(node, parent, children, i);
|
||||
}
|
||||
}
|
||||
function getComposedParent(node) {
|
||||
return node.__patched ? node._composedParent : node.parentNode;
|
||||
}
|
||||
function addNodeToComposedChildren(node, parent, children, i) {
|
||||
node._composedParent = parent;
|
||||
children.splice(i >= 0 ? i : children.length, 0, node);
|
||||
|
@ -1747,6 +1775,7 @@ var p = Element.prototype;
|
|||
var matchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
|
||||
return {
|
||||
getLightChildren: getLightChildren,
|
||||
getComposedParent: getComposedParent,
|
||||
getComposedChildren: getComposedChildren,
|
||||
removeFromComposedParent: removeFromComposedParent,
|
||||
saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
|
||||
|
@ -1935,7 +1964,9 @@ var composed = getComposedChildren(container);
|
|||
var splices = Polymer.ArraySplice.calculateSplices(children, composed);
|
||||
for (var i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) {
|
||||
for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
|
||||
if (getComposedParent(n) === container) {
|
||||
remove(n);
|
||||
}
|
||||
composed.splice(s.index + d, 1);
|
||||
}
|
||||
d -= s.addedCount;
|
||||
|
@ -1948,6 +1979,7 @@ insertBefore(container, n, next);
|
|||
composed.splice(j, 0, n);
|
||||
}
|
||||
}
|
||||
ensureComposedParent(container, children);
|
||||
},
|
||||
_matchesContentSelect: function (node, contentElement) {
|
||||
var select = contentElement.getAttribute('select');
|
||||
|
@ -1977,6 +2009,7 @@ var getLightChildren = Polymer.DomApi.getLightChildren;
|
|||
var matchesSelector = Polymer.DomApi.matchesSelector;
|
||||
var hasInsertionPoint = Polymer.DomApi.hasInsertionPoint;
|
||||
var getComposedChildren = Polymer.DomApi.getComposedChildren;
|
||||
var getComposedParent = Polymer.DomApi.getComposedParent;
|
||||
var removeFromComposedParent = Polymer.DomApi.removeFromComposedParent;
|
||||
function distributeNodeInto(child, insertionPoint) {
|
||||
insertionPoint._distributedNodes.push(child);
|
||||
|
@ -2030,8 +2063,10 @@ node._composedParent = null;
|
|||
nativeRemoveChild.call(parentNode, node);
|
||||
}
|
||||
}
|
||||
function getComposedParent(node) {
|
||||
return node.__patched ? node._composedParent : node.parentNode;
|
||||
function ensureComposedParent(parent, children) {
|
||||
for (var i = 0, n; i < children.length; i++) {
|
||||
children[i]._composedParent = parent;
|
||||
}
|
||||
}
|
||||
function getTopDistributingHost(host) {
|
||||
while (host && hostNeedsRedistribution(host)) {
|
||||
|
@ -2323,7 +2358,11 @@ if (!this._template) {
|
|||
this._notes = [];
|
||||
} else {
|
||||
Polymer.Annotations.prepElement = this._prepElement.bind(this);
|
||||
if (this._template._content && this._template._content._notes) {
|
||||
this._notes = this._template._content._notes;
|
||||
} else {
|
||||
this._notes = Polymer.Annotations.parseAnnotations(this._template);
|
||||
}
|
||||
this._processAnnotations(this._notes);
|
||||
Polymer.Annotations.prepElement = null;
|
||||
}
|
||||
|
@ -2724,7 +2763,6 @@ prevent = dy > dx;
|
|||
prevent = dx > dy;
|
||||
}
|
||||
if (prevent) {
|
||||
//This prevents horizontal scrolling in safari
|
||||
//ev.preventDefault();
|
||||
} else {
|
||||
Gestures.prevent('track');
|
||||
|
@ -4321,6 +4359,9 @@ clearStyleRules: function (style) {
|
|||
style.__cssRules = null;
|
||||
},
|
||||
forEachStyleRule: function (node, callback) {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
var s = node.parsedSelector;
|
||||
var skipRules = false;
|
||||
if (node.type === this.ruleTypes.STYLE_RULE) {
|
||||
|
@ -4349,19 +4390,22 @@ afterNode = n$[n$.length - 1];
|
|||
target.insertBefore(style, afterNode && afterNode.nextSibling || target.firstChild);
|
||||
return style;
|
||||
},
|
||||
cssFromModules: function (moduleIds) {
|
||||
cssFromModules: function (moduleIds, warnIfNotFound) {
|
||||
var modules = moduleIds.trim().split(' ');
|
||||
var cssText = '';
|
||||
for (var i = 0; i < modules.length; i++) {
|
||||
cssText += this.cssFromModule(modules[i]);
|
||||
cssText += this.cssFromModule(modules[i], warnIfNotFound);
|
||||
}
|
||||
return cssText;
|
||||
},
|
||||
cssFromModule: function (moduleId) {
|
||||
cssFromModule: function (moduleId, warnIfNotFound) {
|
||||
var m = Polymer.DomModule.import(moduleId);
|
||||
if (m && !m._cssText) {
|
||||
m._cssText = this._cssFromElement(m);
|
||||
}
|
||||
if (!m && warnIfNotFound) {
|
||||
console.warn('Could not find style data in module named', moduleId);
|
||||
}
|
||||
return m && m._cssText || '';
|
||||
},
|
||||
_cssFromElement: function (element) {
|
||||
|
@ -4375,12 +4419,12 @@ cssText += this._cssFromElement(e);
|
|||
} else {
|
||||
if (e.localName === 'style') {
|
||||
var include = e.getAttribute(this.INCLUDE_ATTR);
|
||||
if (include) {
|
||||
cssText += this.cssFromModules(include, true);
|
||||
}
|
||||
e = e.__appliedElement || e;
|
||||
e.parentNode.removeChild(e);
|
||||
cssText += this.resolveCss(e.textContent, element.ownerDocument);
|
||||
if (include) {
|
||||
cssText += this.cssFromModules(include);
|
||||
}
|
||||
} else if (e.import && e.import.body) {
|
||||
cssText += this.resolveCss(e.import.body.textContent, e.import);
|
||||
}
|
||||
|
@ -5317,15 +5361,20 @@ observer.observe(e, { childList: true });
|
|||
_apply: function () {
|
||||
var e = this.__appliedElement || this;
|
||||
if (this.include) {
|
||||
e.textContent += styleUtil.cssFromModules(this.include);
|
||||
e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent;
|
||||
}
|
||||
var rules = styleUtil.rulesForStyle(e);
|
||||
styleUtil.forEachStyleRule(rules, function (rule) {
|
||||
if (e.textContent) {
|
||||
styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
|
||||
styleTransformer.documentRule(rule);
|
||||
});
|
||||
this._applyCustomProperties(e);
|
||||
}
|
||||
},
|
||||
_applyCustomProperties: function (element) {
|
||||
this._computeStyleProperties();
|
||||
var props = this._styleProperties;
|
||||
e.textContent = styleUtil.toCssText(rules, function (rule) {
|
||||
var rules = styleUtil.rulesForStyle(element);
|
||||
element.textContent = styleUtil.toCssText(rules, function (rule) {
|
||||
var css = rule.cssText = rule.parsedCssText;
|
||||
if (rule.propertyInfo && rule.propertyInfo.cssText) {
|
||||
css = cssParse.removeCustomPropAssignment(css);
|
||||
|
@ -19143,7 +19192,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<g id="filter-list"><path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></g>
|
||||
<g id="error"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></g>
|
||||
<g id="wifi"><path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"></path></g>
|
||||
<g id="info-outline"><path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue