From 0b1a02c7501962b497a4c7e7e34efcc274840f1a Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Mon, 26 Nov 2018 14:27:06 +0800 Subject: [PATCH] update docs --- docs/docs/favicon.ico | Bin 0 -> 9662 bytes docs/docs/index.html | 17 ++++++++++++++--- docs/docs/runCode.js | 10 ++-------- docs/lab/index.html | 4 ++-- docs/lab/js/common.js | 42 +++++++++++++++++++++++------------------- 5 files changed, 41 insertions(+), 32 deletions(-) create mode 100644 docs/docs/favicon.ico diff --git a/docs/docs/favicon.ico b/docs/docs/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..1b9f010e8b4a2cb5dc7d947b4d4b09b7b859b7ce GIT binary patch literal 9662 zcmeI2TdZ7D7{}M-sMEM~1gS$vT`JK&G)*cVq|vwp6(I-_iEC0N9$e#rlb$&a8X~Qr zX*T<0Z~Bjdac}{!w3&|2Z}~Rl^Q>V?TVrT_ zI;~%!KM!J^C}E4Phub`JyrRW5Z!6#qVC{C&KLw=Gz6hs)weP0>ks#LdCTXbCEiQ{z zp|CZneN~F_4Jmfr)W0E!r}^UPCK|q`-)JA;6&d_pWAFWRjd+?(V+Zg$&pWOETw*nX zcn{O}q_{puO#KI9|BLbQzMEPBH8;J?@-tidcG!Lxhx1S|?f8$=_jzLK$K0J}e7vvt zTVQL3?iJ)$f`dRTZNbpS_ibH^C7|=*W#X~*W9l9Xd~KY(_OJM@0egWwx*ug$obBkU zDf)Km$K8FL5+f^TDE}JY6$+9<%aMilvHiIz@v=mRp!mIuT&n3ga4_(snA$VM)@$v) z!EcTa6v@BsFqh3+BZeMHM4tewi)rgRIUei-+99o#--DPOMK&7qi4J0YgiojRPu5>_ zd|CRlJ1ri+|3du>ck}xFb<@dV%);qAkacc*Az#o*;l^j@4A*~zsioa!);^*a3vQ(HesB0`tK3X?qzNIC+YZDC(u5}^u65j zP1ZT5Js;i61+i>gwRO+@5NO}2vA25dCl3W_^cq5Io7cWOEkKS;>)Y!E@t;7idyZXm z_Mm?r*amz(U((K^cTjk{JbqSIfCBj<^w)t$z*As7SP6~Tn=U3PLOwbP`RXv(tc{B^9#zbpaSpV`o$A4M3xmC|kk$Em}+52M{j`Yhi(=*`3 z;AU`XmQjxURdlLF@2Fzv7L0uDt705-Z1gM@t|y-%J3YrIRB7I*9?jtx()-;Pz>*l_ z92>1aejL)c&T|Y+VkCdP*XSkr`$>bO7lDP~RAAS|+vw-fMwI^8wT|_gP9ougAgQj0 zt-#l{miAC!a~%B_jm^41Khs^^uk10@>8svn!FJ$}Z6@Xo>7z;GYHJPK_e4jUIm2T~ zeLL6!szC3&wIBc6dx-x32m1e?=+A-OdJgFH>Hi<;yk4%CrJpL-2jQhgIT>5cN&uf= zMW_r<^V-sBULPtaqsZ&C%Sj17REwX$<>Dg*heE~#kOUvo*dG^&?NNxfWc@+2Wxqr@=4ld+^e pBECAQ%@bdnRLkN?QXQ-{`Q+$ClPBXkE~uvCfa>HE&mGs6{!c$q56A!j literal 0 HcmV?d00001 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(); })();