diff --git a/docs/docs/favicon.ico b/docs/docs/favicon.ico
new file mode 100644
index 000000000..1b9f010e8
Binary files /dev/null and b/docs/docs/favicon.ico differ
diff --git a/docs/docs/index.html b/docs/docs/index.html
index 65f3a765b..551317322 100644
--- a/docs/docs/index.html
+++ b/docs/docs/index.html
@@ -1,11 +1,13 @@
-
ArtPlayer Document
-
-
+
+
+
+
+
@@ -21,5 +23,14 @@
}
+
diff --git a/docs/docs/runCode.js b/docs/docs/runCode.js
index 03ac24661..40163c4f7 100644
--- a/docs/docs/runCode.js
+++ b/docs/docs/runCode.js
@@ -12,15 +12,9 @@ window.runCode = function(hook) {
codeElement.tagName === 'PRE' &&
codeElement.dataset.lang === 'js'
) {
- var libs = item.href.split('/lib=')[1];
+ var libs = item.href.split('/lib=')[1] || '';
var code = encodeURIComponent(codeElement.innerText);
- var url = 'https://artplayer.org/lab/?';
- if (libs) {
- url += 'libs=' + libs + '&';
- }
- if (code) {
- url += 'code=' + code;
- }
+ var url = 'https://artplayer.org/lab/?libs=' + libs + '&code=' + code;
window.open(url);
}
});
diff --git a/docs/lab/index.html b/docs/lab/index.html
index 824d33d04..ee9ba8af2 100644
--- a/docs/lab/index.html
+++ b/docs/lab/index.html
@@ -5,7 +5,7 @@
ArtPlayer.js Lab
-
+
@@ -46,7 +46,7 @@
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
- hm.src = "https://hm.baidu.com/hm.js?59d546bcda559725a968939647a0dcae";
+ hm.src = "https://hm.baidu.com/hm.js?b6c9b8bafbf5fe7225160101dafbbc7d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
diff --git a/docs/lab/js/common.js b/docs/lab/js/common.js
index d2df4cc53..4bccbad2c 100644
--- a/docs/lab/js/common.js
+++ b/docs/lab/js/common.js
@@ -1,3 +1,5 @@
+'use strict';
+
(function() {
var $code = document.querySelector('.code');
var $run = document.querySelector('.run');
@@ -19,18 +21,17 @@
});
function initArt(art) {
- Artplayer.config.video.events.forEach(item => {
- art.on('video:' + item, event => {
+ Artplayer.config.video.events.forEach(function(item) {
+ art.on('video:' + item, function(event) {
console.log('video: ' + event.type);
});
});
}
function getURLParameters(url) {
- return (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce(
- (a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a),
- {},
- );
+ return (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce(function(a, v) {
+ return (a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a;
+ }, {});
}
function getExt(url) {
@@ -105,21 +106,21 @@
runCode();
} else {
fetch('./js/example.js')
- .then(response => {
+ .then(function(response) {
return response.text();
})
- .then(text => {
+ .then(function(text) {
mirror.setValue(text);
runCode();
})
- .catch(err => {
+ .catch(function(err) {
console.error(err.message);
});
}
}
function runCode() {
- Artplayer.instances.forEach(art => {
+ Artplayer.instances.forEach(function(art) {
art.destroy(true);
});
var code = mirror.getValue();
@@ -129,28 +130,31 @@
}
function initApp() {
- const { code, libs } = getURLParameters(window.location.href);
+ var _getURLParameters = getURLParameters(window.location.href),
+ code = _getURLParameters.code,
+ libs = _getURLParameters.libs;
+
loadLib(libs)
.then(function(result) {
loaddLib = loaddLib.concat(result);
loadCode(code);
})
- .catch(err => {
+ .catch(function(err) {
console.error(err.message);
});
}
+ window.addEventListener('error', function(err) {
+ console.error(err.message);
+ });
+
$run.addEventListener('click', function(e) {
- const libs = encodeURIComponent($lib.value);
- const code = encodeURIComponent(mirror.getValue());
- const url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
+ var libs = encodeURIComponent($lib.value);
+ var code = encodeURIComponent(mirror.getValue());
+ var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
history.pushState(null, null, url);
initApp();
});
- window.addEventListener('error', err => {
- console.error(err.message);
- });
-
initApp();
})();