???
恕我直言 这是非常糟糕的代码,糟糕透了。
它将会每10毫秒运行一个99%的时间内都不会起作用的函数,极大的浪费性能。
当然,家用计算机支撑得住这种花销……但它实在是太不优雅了。
IMHO this is very bad code, awful.
It will run a function every 10 milliseconds that will not work 99% of the time, which is a huge waste of performance.
Sure, a home computer could support the expense… but it’s just so inelegant
你应该使用discourse的API来完成这项工作。使用这个:
You should use discourse’s API to do this. use this:
<script type="text/discourse-plugin" version="0.8">
api.onPageChange(() => {
if (document.querySelector("video")) {
new Plyr('video');
}
});
</script>
你应该干脆找我的(just kidding)