mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix image loading
This commit is contained in:
parent
46776f1eac
commit
0d59297b1b
86 changed files with 5857 additions and 273 deletions
186
dashboard-ui/thirdparty/iron-behaviors/iron-button-state.html
vendored
Normal file
186
dashboard-ui/thirdparty/iron-behaviors/iron-button-state.html
vendored
Normal file
|
@ -0,0 +1,186 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
<link rel="import" href="iron-control-state.html">
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* @demo demo/index.html
|
||||
* @polymerBehavior
|
||||
*/
|
||||
Polymer.IronButtonStateImpl = {
|
||||
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* If true, the user is currently holding down the button.
|
||||
*/
|
||||
pressed: {
|
||||
type: Boolean,
|
||||
readOnly: true,
|
||||
value: false,
|
||||
reflectToAttribute: true,
|
||||
observer: '_pressedChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the button toggles the active state with each tap or press
|
||||
* of the spacebar.
|
||||
*/
|
||||
toggles: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
reflectToAttribute: true
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the button is a toggle and is currently in the active state.
|
||||
*/
|
||||
active: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true,
|
||||
reflectToAttribute: true,
|
||||
observer: '_activeChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* True if the element is currently being pressed by a "pointer," which
|
||||
* is loosely defined as mouse or touch input (but specifically excluding
|
||||
* keyboard input).
|
||||
*/
|
||||
pointerDown: {
|
||||
type: Boolean,
|
||||
readOnly: true,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* True if the input device that caused the element to receive focus
|
||||
* was a keyboard.
|
||||
*/
|
||||
receivedFocusFromKeyboard: {
|
||||
type: Boolean,
|
||||
readOnly: true
|
||||
}
|
||||
},
|
||||
|
||||
listeners: {
|
||||
down: '_downHandler',
|
||||
up: '_upHandler',
|
||||
tap: '_tapHandler'
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_detectKeyboardFocus(focused)'
|
||||
],
|
||||
|
||||
keyBindings: {
|
||||
'enter:keydown': '_asyncClick',
|
||||
'space:keydown': '_spaceKeyDownHandler',
|
||||
'space:keyup': '_spaceKeyUpHandler',
|
||||
},
|
||||
|
||||
_tapHandler: function() {
|
||||
if (this.toggles) {
|
||||
// a tap is needed to toggle the active state
|
||||
this._userActivate(!this.active);
|
||||
} else {
|
||||
this.active = false;
|
||||
}
|
||||
},
|
||||
|
||||
_detectKeyboardFocus: function(focused) {
|
||||
this._setReceivedFocusFromKeyboard(!this.pointerDown && focused);
|
||||
},
|
||||
|
||||
// to emulate native checkbox, (de-)activations from a user interaction fire
|
||||
// 'change' events
|
||||
_userActivate: function(active) {
|
||||
this.active = active;
|
||||
this.fire('change');
|
||||
},
|
||||
|
||||
_downHandler: function() {
|
||||
this._setPointerDown(true);
|
||||
this._setPressed(true);
|
||||
this._setReceivedFocusFromKeyboard(false);
|
||||
},
|
||||
|
||||
_upHandler: function() {
|
||||
this._setPointerDown(false);
|
||||
this._setPressed(false);
|
||||
},
|
||||
|
||||
_spaceKeyDownHandler: function(event) {
|
||||
var keyboardEvent = event.detail.keyboardEvent;
|
||||
keyboardEvent.preventDefault();
|
||||
keyboardEvent.stopImmediatePropagation();
|
||||
this._setPressed(true);
|
||||
},
|
||||
|
||||
_spaceKeyUpHandler: function() {
|
||||
if (this.pressed) {
|
||||
this._asyncClick();
|
||||
}
|
||||
this._setPressed(false);
|
||||
},
|
||||
|
||||
// trigger click asynchronously, the asynchrony is useful to allow one
|
||||
// event handler to unwind before triggering another event
|
||||
_asyncClick: function() {
|
||||
this.async(function() {
|
||||
this.click();
|
||||
}, 1);
|
||||
},
|
||||
|
||||
// any of these changes are considered a change to button state
|
||||
|
||||
_pressedChanged: function(pressed) {
|
||||
this._changedButtonState();
|
||||
},
|
||||
|
||||
_activeChanged: function(active) {
|
||||
if (this.toggles) {
|
||||
this.setAttribute('aria-pressed', active ? 'true' : 'false');
|
||||
} else {
|
||||
this.removeAttribute('aria-pressed');
|
||||
}
|
||||
this._changedButtonState();
|
||||
},
|
||||
|
||||
_controlStateChanged: function() {
|
||||
if (this.disabled) {
|
||||
this._setPressed(false);
|
||||
} else {
|
||||
this._changedButtonState();
|
||||
}
|
||||
},
|
||||
|
||||
// provide hook for follow-on behaviors to react to button-state
|
||||
|
||||
_changedButtonState: function() {
|
||||
if (this._buttonStateChanged) {
|
||||
this._buttonStateChanged(); // abstract
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** @polymerBehavior Polymer.IronButtonState */
|
||||
Polymer.IronButtonState = [
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.IronButtonStateImpl
|
||||
];
|
||||
|
||||
</script>
|
108
dashboard-ui/thirdparty/iron-behaviors/iron-control-state.html
vendored
Normal file
108
dashboard-ui/thirdparty/iron-behaviors/iron-control-state.html
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* @demo demo/index.html
|
||||
* @polymerBehavior
|
||||
*/
|
||||
Polymer.IronControlState = {
|
||||
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* If true, the element currently has focus.
|
||||
*/
|
||||
focused: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true,
|
||||
readOnly: true,
|
||||
reflectToAttribute: true
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the user cannot interact with this element.
|
||||
*/
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true,
|
||||
observer: '_disabledChanged',
|
||||
reflectToAttribute: true
|
||||
},
|
||||
|
||||
_oldTabIndex: {
|
||||
type: Number
|
||||
},
|
||||
|
||||
_boundFocusBlurHandler: {
|
||||
type: Function,
|
||||
value: function() {
|
||||
return this._focusBlurHandler.bind(this);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_changedControlState(focused, disabled)'
|
||||
],
|
||||
|
||||
ready: function() {
|
||||
// TODO(sjmiles): ensure read-only property is valued so the compound
|
||||
// observer will fire
|
||||
if (this.focused === undefined) {
|
||||
this._setFocused(false);
|
||||
}
|
||||
this.addEventListener('focus', this._boundFocusBlurHandler, true);
|
||||
this.addEventListener('blur', this._boundFocusBlurHandler, true);
|
||||
},
|
||||
|
||||
_focusBlurHandler: function(event) {
|
||||
var target = event.path ? event.path[0] : event.target;
|
||||
if (target === this) {
|
||||
var focused = event.type === 'focus';
|
||||
this._setFocused(focused);
|
||||
} else if (!this.shadowRoot) {
|
||||
event.stopPropagation();
|
||||
this.fire(event.type, {sourceEvent: event}, {
|
||||
node: this,
|
||||
bubbles: event.bubbles,
|
||||
cancelable: event.cancelable
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_disabledChanged: function(disabled, old) {
|
||||
this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
||||
this.style.pointerEvents = disabled ? 'none' : '';
|
||||
if (disabled) {
|
||||
this._oldTabIndex = this.tabIndex;
|
||||
this.focused = false;
|
||||
this.tabIndex = -1;
|
||||
} else if (this._oldTabIndex !== undefined) {
|
||||
this.tabIndex = this._oldTabIndex;
|
||||
}
|
||||
},
|
||||
|
||||
_changedControlState: function() {
|
||||
// _controlStateChanged is abstract, follow-on behaviors may implement it
|
||||
if (this._controlStateChanged) {
|
||||
this._controlStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue