mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -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>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>ArtPlayer Document</title>
|
<title>ArtPlayer Document</title>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta charset="UTF-8">
|
||||||
<meta name="description" content="ArtPlayer Document">
|
<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="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">
|
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -21,5 +23,14 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -12,15 +12,9 @@ window.runCode = function(hook) {
|
|||||||
codeElement.tagName === 'PRE' &&
|
codeElement.tagName === 'PRE' &&
|
||||||
codeElement.dataset.lang === 'js'
|
codeElement.dataset.lang === 'js'
|
||||||
) {
|
) {
|
||||||
var libs = item.href.split('/lib=')[1];
|
var libs = item.href.split('/lib=')[1] || '';
|
||||||
var code = encodeURIComponent(codeElement.innerText);
|
var code = encodeURIComponent(codeElement.innerText);
|
||||||
var url = 'https://artplayer.org/lab/?';
|
var url = 'https://artplayer.org/lab/?libs=' + libs + '&code=' + code;
|
||||||
if (libs) {
|
|
||||||
url += 'libs=' + libs + '&';
|
|
||||||
}
|
|
||||||
if (code) {
|
|
||||||
url += 'code=' + code;
|
|
||||||
}
|
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@
|
|||||||
<title>ArtPlayer.js Lab</title>
|
<title>ArtPlayer.js Lab</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<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="keywords" content="artplayer,html5,video,player">
|
||||||
<meta name="description" content="ArtPlayer is a modern HTML5 video player">
|
<meta name="description" content="ArtPlayer is a modern HTML5 video player">
|
||||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
var _hmt = _hmt || [];
|
var _hmt = _hmt || [];
|
||||||
(function() {
|
(function() {
|
||||||
var hm = document.createElement("script");
|
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];
|
var s = document.getElementsByTagName("script")[0];
|
||||||
s.parentNode.insertBefore(hm, s);
|
s.parentNode.insertBefore(hm, s);
|
||||||
})();
|
})();
|
||||||
|
|||||||
+23
-19
@@ -1,3 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $code = document.querySelector('.code');
|
var $code = document.querySelector('.code');
|
||||||
var $run = document.querySelector('.run');
|
var $run = document.querySelector('.run');
|
||||||
@@ -19,18 +21,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function initArt(art) {
|
function initArt(art) {
|
||||||
Artplayer.config.video.events.forEach(item => {
|
Artplayer.config.video.events.forEach(function(item) {
|
||||||
art.on('video:' + item, event => {
|
art.on('video:' + item, function(event) {
|
||||||
console.log('video: ' + event.type);
|
console.log('video: ' + event.type);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getURLParameters(url) {
|
function getURLParameters(url) {
|
||||||
return (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce(
|
return (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce(function(a, v) {
|
||||||
(a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a),
|
return (a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a;
|
||||||
{},
|
}, {});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExt(url) {
|
function getExt(url) {
|
||||||
@@ -105,21 +106,21 @@
|
|||||||
runCode();
|
runCode();
|
||||||
} else {
|
} else {
|
||||||
fetch('./js/example.js')
|
fetch('./js/example.js')
|
||||||
.then(response => {
|
.then(function(response) {
|
||||||
return response.text();
|
return response.text();
|
||||||
})
|
})
|
||||||
.then(text => {
|
.then(function(text) {
|
||||||
mirror.setValue(text);
|
mirror.setValue(text);
|
||||||
runCode();
|
runCode();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(function(err) {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function runCode() {
|
function runCode() {
|
||||||
Artplayer.instances.forEach(art => {
|
Artplayer.instances.forEach(function(art) {
|
||||||
art.destroy(true);
|
art.destroy(true);
|
||||||
});
|
});
|
||||||
var code = mirror.getValue();
|
var code = mirror.getValue();
|
||||||
@@ -129,28 +130,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initApp() {
|
function initApp() {
|
||||||
const { code, libs } = getURLParameters(window.location.href);
|
var _getURLParameters = getURLParameters(window.location.href),
|
||||||
|
code = _getURLParameters.code,
|
||||||
|
libs = _getURLParameters.libs;
|
||||||
|
|
||||||
loadLib(libs)
|
loadLib(libs)
|
||||||
.then(function(result) {
|
.then(function(result) {
|
||||||
loaddLib = loaddLib.concat(result);
|
loaddLib = loaddLib.concat(result);
|
||||||
loadCode(code);
|
loadCode(code);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(function(err) {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('error', function(err) {
|
||||||
|
console.error(err.message);
|
||||||
|
});
|
||||||
|
|
||||||
$run.addEventListener('click', function(e) {
|
$run.addEventListener('click', function(e) {
|
||||||
const libs = encodeURIComponent($lib.value);
|
var libs = encodeURIComponent($lib.value);
|
||||||
const code = encodeURIComponent(mirror.getValue());
|
var code = encodeURIComponent(mirror.getValue());
|
||||||
const url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
|
var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
|
||||||
history.pushState(null, null, url);
|
history.pushState(null, null, url);
|
||||||
initApp();
|
initApp();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('error', err => {
|
|
||||||
console.error(err.message);
|
|
||||||
});
|
|
||||||
|
|
||||||
initApp();
|
initApp();
|
||||||
})();
|
})();
|
||||||
Reference in new issue
Block a user