mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
600fceeb54
commit
9956595625
25 changed files with 213 additions and 284 deletions
|
@ -16,12 +16,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"version": "1.2.31",
|
"version": "1.2.32",
|
||||||
"_release": "1.2.31",
|
"_release": "1.2.32",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "1.2.31",
|
"tag": "1.2.32",
|
||||||
"commit": "87a2ef738364e9c40e0b97326f5861b6edfc5b3e"
|
"commit": "9bff9052db50ba040d098af3f3c47688b5b31e30"
|
||||||
},
|
},
|
||||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||||
"_target": "^1.2.0",
|
"_target": "^1.2.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "iron-menu-behavior",
|
"name": "iron-menu-behavior",
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"description": "Provides accessible menu behavior",
|
"description": "Provides accessible menu behavior",
|
||||||
"authors": "The Polymer Authors",
|
"authors": "The Polymer Authors",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -34,11 +34,11 @@
|
||||||
"web-component-tester": "^4.0.0",
|
"web-component-tester": "^4.0.0",
|
||||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||||
},
|
},
|
||||||
"_release": "1.1.5",
|
"_release": "1.1.6",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.1.5",
|
"tag": "v1.1.6",
|
||||||
"commit": "e17b3bdb124e42202d50e7c60b0cf02d9bcb201d"
|
"commit": "940c2769c7d6fefd5685e0200c3dfd0742c2a52f"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/iron-menu-behavior.git",
|
"_source": "git://github.com/polymerelements/iron-menu-behavior.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
language: node_js
|
language: node_js
|
||||||
sudo: false
|
sudo: required
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g bower polylint web-component-tester
|
- npm install -g bower polylint web-component-tester
|
||||||
- bower install
|
- bower install
|
||||||
|
@ -8,18 +8,16 @@ env:
|
||||||
global:
|
global:
|
||||||
- secure: QxZD8yzz7s3F6b7h87ztWYiEbD2TrQp1Z1mib5u1wL7EAwsrQVkFhIEo4cJPAsTGS98qgeZAITg0ifwp/jOKVC2QKoPnC1qjm4L0AjlhXBTRbqyS5G8jvfJ8M4DgkQXADh4e+lw9ba3h2AxceJELKTYaQVq/cpTrpPg0/RH7H4o=
|
- secure: QxZD8yzz7s3F6b7h87ztWYiEbD2TrQp1Z1mib5u1wL7EAwsrQVkFhIEo4cJPAsTGS98qgeZAITg0ifwp/jOKVC2QKoPnC1qjm4L0AjlhXBTRbqyS5G8jvfJ8M4DgkQXADh4e+lw9ba3h2AxceJELKTYaQVq/cpTrpPg0/RH7H4o=
|
||||||
- secure: i76J23Bpwj6qJ4ybCCsQpGCTT+5s1PA+x0Avjbl1JTS4OsJLDFfvVl0YIWZ5xMIKJtdPC/mGDoZ2LNrh9hz82DBqDnzBlSnNjFbjnU1Aqy5CUmRWzyAF5NOjJGotISZcDYDGZd6gjsOfN0r+rICyRUiOadeyPf0Nm+6HSVQMjfM=
|
- secure: i76J23Bpwj6qJ4ybCCsQpGCTT+5s1PA+x0Avjbl1JTS4OsJLDFfvVl0YIWZ5xMIKJtdPC/mGDoZ2LNrh9hz82DBqDnzBlSnNjFbjnU1Aqy5CUmRWzyAF5NOjJGotISZcDYDGZd6gjsOfN0r+rICyRUiOadeyPf0Nm+6HSVQMjfM=
|
||||||
- CXX=g++-4.8
|
|
||||||
node_js: stable
|
node_js: stable
|
||||||
addons:
|
addons:
|
||||||
firefox: latest
|
firefox: latest
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- google-chrome
|
- google-chrome
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
packages:
|
||||||
- google-chrome-stable
|
- google-chrome-stable
|
||||||
- g++-4.8
|
|
||||||
sauce_connect: true
|
sauce_connect: true
|
||||||
script:
|
script:
|
||||||
- xvfb-run wct
|
- xvfb-run wct
|
||||||
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
|
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
|
||||||
|
dist: trusty
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "iron-menu-behavior",
|
"name": "iron-menu-behavior",
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"description": "Provides accessible menu behavior",
|
"description": "Provides accessible menu behavior",
|
||||||
"authors": "The Polymer Authors",
|
"authors": "The Polymer Authors",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -128,7 +128,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
var attr = this.attrForItemTitle || 'textContent';
|
var attr = this.attrForItemTitle || 'textContent';
|
||||||
var title = item[attr] || item.getAttribute(attr);
|
var title = item[attr] || item.getAttribute(attr);
|
||||||
|
|
||||||
if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
if (!item.hasAttribute('disabled') && title &&
|
||||||
|
title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
||||||
this._setFocusedItem(item);
|
this._setFocusedItem(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -137,21 +138,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focuses the previous item (relative to the currently focused item) in the
|
* Focuses the previous item (relative to the currently focused item) in the
|
||||||
* menu.
|
* menu, disabled items will be skipped.
|
||||||
*/
|
*/
|
||||||
_focusPrevious: function() {
|
_focusPrevious: function() {
|
||||||
var length = this.items.length;
|
var length = this.items.length;
|
||||||
var index = (Number(this.indexOf(this.focusedItem)) - 1 + length) % length;
|
var curFocusIndex = Number(this.indexOf(this.focusedItem));
|
||||||
this._setFocusedItem(this.items[index]);
|
for (var i = 1; i < length; i++) {
|
||||||
|
var item = this.items[(curFocusIndex - i + length) % length];
|
||||||
|
if (!item.hasAttribute('disabled')) {
|
||||||
|
this._setFocusedItem(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focuses the next item (relative to the currently focused item) in the
|
* Focuses the next item (relative to the currently focused item) in the
|
||||||
* menu.
|
* menu, disabled items will be skipped.
|
||||||
*/
|
*/
|
||||||
_focusNext: function() {
|
_focusNext: function() {
|
||||||
var index = (Number(this.indexOf(this.focusedItem)) + 1) % this.items.length;
|
var length = this.items.length;
|
||||||
this._setFocusedItem(this.items[index]);
|
var curFocusIndex = Number(this.indexOf(this.focusedItem));
|
||||||
|
for (var i = 1; i < length; i++) {
|
||||||
|
var item = this.items[(curFocusIndex + i) % length];
|
||||||
|
if (!item.hasAttribute('disabled')) {
|
||||||
|
this._setFocusedItem(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -260,7 +274,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
this._setFocusedItem(selectedItem);
|
this._setFocusedItem(selectedItem);
|
||||||
} else if (this.items[0]) {
|
} else if (this.items[0]) {
|
||||||
this._setFocusedItem(this.items[0]);
|
// We find the first none-disabled item (if one exists)
|
||||||
|
this._focusNext();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,6 +36,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
</template>
|
</template>
|
||||||
</test-fixture>
|
</test-fixture>
|
||||||
|
|
||||||
|
<test-fixture id="disabled">
|
||||||
|
<template>
|
||||||
|
<test-menu>
|
||||||
|
<div>a item 1</div>
|
||||||
|
<div disabled>b item 2</div>
|
||||||
|
<div>b item 3</div>
|
||||||
|
<div disabled>c item 4</div>
|
||||||
|
</test-menu>
|
||||||
|
</template>
|
||||||
|
</test-fixture>
|
||||||
|
|
||||||
|
<test-fixture id="only-disabled">
|
||||||
|
<template>
|
||||||
|
<test-menu>
|
||||||
|
<div disabled>disabled item</div>
|
||||||
|
</test-menu>
|
||||||
|
</template>
|
||||||
|
</test-fixture>
|
||||||
|
|
||||||
<test-fixture id="multi">
|
<test-fixture id="multi">
|
||||||
<template>
|
<template>
|
||||||
<test-menu multi>
|
<test-menu multi>
|
||||||
|
@ -94,6 +113,156 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('focusing on next item skips disabled items', function(done) {
|
||||||
|
var menu = fixture('disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press down
|
||||||
|
MockInteractions.keyDownOn(menu, 40);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, menu.items[2], 'menu.items[2] is focused');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on next item in empty menu', function(done) {
|
||||||
|
var menu = fixture('empty');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press down
|
||||||
|
MockInteractions.keyDownOn(menu, 40);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, undefined, 'no focused item');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on next item in all disabled menu', function(done) {
|
||||||
|
var menu = fixture('only-disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press down
|
||||||
|
MockInteractions.keyDownOn(menu, 40);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, undefined, 'no focused item');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on previous item skips disabled items', function(done) {
|
||||||
|
var menu = fixture('disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press up
|
||||||
|
MockInteractions.keyDownOn(menu, 38);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, menu.items[2], 'menu.items[2] is focused');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on previous item in empty menu', function(done) {
|
||||||
|
var menu = fixture('empty');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press up
|
||||||
|
MockInteractions.keyDownOn(menu, 38);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, undefined, 'no focused item');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on previous item in all disabled menu', function(done) {
|
||||||
|
var menu = fixture('only-disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press up
|
||||||
|
MockInteractions.keyDownOn(menu, 38);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, undefined, 'no focused item');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on item using key press skips disabled items', function(done) {
|
||||||
|
var menu = fixture('disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press 'b'
|
||||||
|
MockInteractions.keyDownOn(menu, 66);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, menu.items[2], 'menu.items[2] is focused');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on item using key press ignores disabled items', function(done) {
|
||||||
|
var menu = fixture('disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press 'c'
|
||||||
|
MockInteractions.keyDownOn(menu, 67);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, menu.items[0], 'menu.items[0] is focused');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('focusing on item using key press in all disabled items', function(done) {
|
||||||
|
var menu = fixture('only-disabled');
|
||||||
|
MockInteractions.focus(menu);
|
||||||
|
|
||||||
|
// Wait for async focus
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
// Key press 'c'
|
||||||
|
MockInteractions.keyDownOn(menu, 67);
|
||||||
|
|
||||||
|
Polymer.Base.async(function() {
|
||||||
|
var focusedItem = Polymer.dom(menu).node.focusedItem;
|
||||||
|
assert.equal(focusedItem, undefined, 'no focused item');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('focusing non-item content does not auto-focus an item', function(done) {
|
test('focusing non-item content does not auto-focus an item', function(done) {
|
||||||
var menu = fixture('basic');
|
var menu = fixture('basic');
|
||||||
menu.extraContent.focus();
|
menu.extraContent.focus();
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"tag": "v1.4.0",
|
"tag": "v1.4.0",
|
||||||
"commit": "554f7418fdbd97688eb21518b5f8172167d53a95"
|
"commit": "554f7418fdbd97688eb21518b5f8172167d53a95"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
"_source": "git://github.com/polymerelements/iron-selector.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "PolymerElements/iron-selector"
|
"_originalSource": "polymerelements/iron-selector"
|
||||||
}
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"name": "multi-download",
|
|
||||||
"homepage": "https://github.com/sindresorhus/multi-download",
|
|
||||||
"version": "2.0.0",
|
|
||||||
"_release": "2.0.0",
|
|
||||||
"_resolution": {
|
|
||||||
"type": "version",
|
|
||||||
"tag": "v2.0.0",
|
|
||||||
"commit": "181dc2d27de96f81a951b8cc8b50106d13219bd8"
|
|
||||||
},
|
|
||||||
"_source": "https://github.com/sindresorhus/multi-download.git",
|
|
||||||
"_target": "^2.0.0",
|
|
||||||
"_originalSource": "multi-download",
|
|
||||||
"_direct": true
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = tab
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[{package.json,*.yml}]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
|
@ -1 +0,0 @@
|
||||||
* text=auto
|
|
|
@ -1 +0,0 @@
|
||||||
node_modules
|
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"node": true,
|
|
||||||
"esnext": true,
|
|
||||||
"bitwise": true,
|
|
||||||
"curly": true,
|
|
||||||
"immed": true,
|
|
||||||
"newcap": true,
|
|
||||||
"noarg": true,
|
|
||||||
"undef": true,
|
|
||||||
"unused": "vars",
|
|
||||||
"strict": true
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,31 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="author" content="Sindre Sorhus">
|
|
||||||
<meta name="viewport" content="width=device-width">
|
|
||||||
<title>multi-download</title>
|
|
||||||
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
|
|
||||||
<style>
|
|
||||||
#download-btn {
|
|
||||||
width: 300px;
|
|
||||||
height: 50px;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
margin: -25px 0 0 -150px;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body >
|
|
||||||
<button id="download-btn" class="btn btn-primary btn-lg" data-files="fixture/unicorn.jpg.zip fixture/rainbow.jpg.zip fixture/unicorn2.jpg.zip">Download multiple files</button>
|
|
||||||
<script src="browser.js"></script>
|
|
||||||
<script>
|
|
||||||
document.querySelector('#download-btn').addEventListener('click', function (e) {
|
|
||||||
var files = e.target.dataset.files.split(' ');
|
|
||||||
multiDownload(files);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,69 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function fallback(urls) {
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
(function createIframe() {
|
|
||||||
var frame = document.createElement('iframe');
|
|
||||||
frame.style.display = 'none';
|
|
||||||
frame.src = urls[i++];
|
|
||||||
document.documentElement.appendChild(frame);
|
|
||||||
|
|
||||||
// the download init has to be sequential otherwise IE only use the first
|
|
||||||
var interval = setInterval(function () {
|
|
||||||
if (frame.contentWindow.document.readyState === 'complete') {
|
|
||||||
clearInterval(interval);
|
|
||||||
|
|
||||||
// Safari needs a timeout
|
|
||||||
setTimeout(function () {
|
|
||||||
frame.parentNode.removeChild(frame);
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
if (i < urls.length) {
|
|
||||||
createIframe();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isFirefox() {
|
|
||||||
// sad panda :(
|
|
||||||
return /Firefox\//i.test(navigator.userAgent);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sameDomain(url) {
|
|
||||||
var a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
|
|
||||||
return location.hostname === a.hostname && location.protocol === a.protocol;
|
|
||||||
}
|
|
||||||
|
|
||||||
function download(url) {
|
|
||||||
var a = document.createElement('a');
|
|
||||||
a.download = '';
|
|
||||||
a.href = url;
|
|
||||||
// firefox doesn't support `a.click()`...
|
|
||||||
a.dispatchEvent(new MouseEvent('click'));
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (urls) {
|
|
||||||
if (!urls) {
|
|
||||||
throw new Error('`urls` required');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof document.createElement('a').download === 'undefined') {
|
|
||||||
return fallback(urls);
|
|
||||||
}
|
|
||||||
|
|
||||||
var delay = 0;
|
|
||||||
|
|
||||||
urls.forEach(function (url) {
|
|
||||||
// the download init has to be sequential for firefox if the urls are not on the same domain
|
|
||||||
if (isFirefox() && !sameDomain(url)) {
|
|
||||||
return setTimeout(download.bind(null, url), 100 * ++delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
download(url);
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
"name": "multi-download",
|
|
||||||
"version": "2.0.0",
|
|
||||||
"description": "Download multiple files at once",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "sindresorhus/multi-download",
|
|
||||||
"author": {
|
|
||||||
"name": "Sindre Sorhus",
|
|
||||||
"email": "sindresorhus@gmail.com",
|
|
||||||
"url": "sindresorhus.com"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "a=$npm_package_name; browserify -r ./index:$a -s $a index.js -o browser.js"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"index.js"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"browser",
|
|
||||||
"download",
|
|
||||||
"multiple",
|
|
||||||
"parallel",
|
|
||||||
"files"
|
|
||||||
],
|
|
||||||
"devDependencies": {
|
|
||||||
"browserify": "^10.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
# multi-download
|
|
||||||
|
|
||||||
> Download multiple files at once
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
It works by abusing the `a`-tag [`download` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download) and falling back to iframes on older browsers.
|
|
||||||
|
|
||||||
|
|
||||||
## [Demo](http://sindresorhus.com/multi-download)
|
|
||||||
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npm install --save multi-download
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```html
|
|
||||||
<button id="download-btn" data-files="unicorn.jpg rainbow.jpg">Download</button>
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
document.querySelector('#download-btn').addEventListener('click', function (e) {
|
|
||||||
var files = e.target.dataset.files.split(' ');
|
|
||||||
multiDownload(files);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
// with jQuery
|
|
||||||
$('#download-btn').on('click', function () {
|
|
||||||
var files = $(this).data('files').split(' ');
|
|
||||||
multiDownload(files);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### multiDownload(urls)
|
|
||||||
|
|
||||||
#### urls
|
|
||||||
|
|
||||||
Type: `array`
|
|
||||||
|
|
||||||
URLs to files you want to download.
|
|
||||||
|
|
||||||
|
|
||||||
## Caveats
|
|
||||||
|
|
||||||
Chrome will ask the user before downloading multiple files (once per domain).
|
|
||||||
|
|
||||||
For the fallback to work you need to make sure the server sends the correct header for the browser to download the file rather than displaying it. This is usually achieved with the header `Content-Disposition: attachment; filename="<file name.ext>" `.
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
|
Binary file not shown.
Before Width: | Height: | Size: 236 KiB |
|
@ -45,7 +45,7 @@
|
||||||
"tag": "v1.0.11",
|
"tag": "v1.0.11",
|
||||||
"commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5"
|
"commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/paper-behaviors.git",
|
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/paper-behaviors"
|
"_originalSource": "PolymerElements/paper-behaviors"
|
||||||
}
|
}
|
|
@ -32,14 +32,14 @@
|
||||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/polymerelements/paper-ripple",
|
"homepage": "https://github.com/PolymerElements/paper-ripple",
|
||||||
"_release": "1.0.5",
|
"_release": "1.0.5",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.0.5",
|
"tag": "v1.0.5",
|
||||||
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/paper-ripple.git",
|
"_source": "git://github.com/PolymerElements/paper-ripple.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/paper-ripple"
|
"_originalSource": "PolymerElements/paper-ripple"
|
||||||
}
|
}
|
|
@ -1954,7 +1954,7 @@ var AppInfo = {};
|
||||||
define("loading", [embyWebComponentsBowerPath + "/loading/loading-lite"], returnFirstDependency);
|
define("loading", [embyWebComponentsBowerPath + "/loading/loading-lite"], returnFirstDependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
define("multi-download", [bowerPath + '/multi-download/browser'], returnFirstDependency);
|
define("multi-download", [embyWebComponentsBowerPath + '/multidownload'], returnFirstDependency);
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova() && browser.android) {
|
if (Dashboard.isRunningInCordova() && browser.android) {
|
||||||
define("fileDownloader", ['cordova/android/filedownloader'], returnFirstDependency);
|
define("fileDownloader", ['cordova/android/filedownloader'], returnFirstDependency);
|
||||||
|
@ -2911,6 +2911,8 @@ var AppInfo = {};
|
||||||
|
|
||||||
deps.push('css!css/card.css');
|
deps.push('css!css/card.css');
|
||||||
|
|
||||||
|
console.log('onAppReady - loading dependencies');
|
||||||
|
|
||||||
require(deps, function (imageLoader, pageObjects, layoutManager) {
|
require(deps, function (imageLoader, pageObjects, layoutManager) {
|
||||||
|
|
||||||
console.log('Loaded dependencies in onAppReady');
|
console.log('Loaded dependencies in onAppReady');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue