mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 23:36:15 -08:00
update docs
This commit is contained in:
1 parent
0d99e6d70b
commit
0b1a02c750
5 files changed
+41
-32
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
+14
-3
@@ -1,11 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ArtPlayer Document</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="description" content="ArtPlayer Document">
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta name="keywords" content="artplayer,html5,video,player">
|
||||
<meta name="description" content="ArtPlayer is a modern HTML5 video player">
|
||||
<link rel="shortcut icon" href="./favicon.ico">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -21,5 +23,14 @@
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?b6c9b8bafbf5fe7225160101dafbbc7d";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
<title>ArtPlayer.js Lab</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0,minimal-ui">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta name="keywords" content="artplayer,html5,video,player">
|
||||
<meta name="description" content="ArtPlayer is a modern HTML5 video player">
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
@@ -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);
|
||||
})();
|
||||
|
||||
+23
-19
@@ -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();
|
||||
})();
|
||||
Reference in new issue
Block a user