perf: optmize

This commit is contained in:
Spirit 2020-03-06 00:08:36 +08:00
parent b17576867f
commit c0f0990ff0
2 changed files with 28 additions and 18 deletions

View File

@ -402,7 +402,7 @@ function get_qq_avatar(){
$encrypted=$_GET["qq"]; $encrypted=$_GET["qq"];
if(isset($encrypted)){ if(isset($encrypted)){
$iv = str_repeat($sakura_privkey, 2); $iv = str_repeat($sakura_privkey, 2);
$encrypted = urldecode(base64_decode($encrypted)); $encrypted = base64_decode(urldecode($encrypted));
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv); $qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
preg_match('/^\d{3,}$/', $qq_number, $matches); preg_match('/^\d{3,}$/', $qq_number, $matches);
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100'; $imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';

View File

@ -5,6 +5,7 @@
* @date 2019.8.3 * @date 2019.8.3
*/ */
mashiro_global.variables = new function () { mashiro_global.variables = new function () {
this.has_hls = false;
this.skinSecter = true; this.skinSecter = true;
} }
mashiro_global.ini = new function () { mashiro_global.ini = new function () {
@ -523,9 +524,7 @@ function killCoverVideo() {
} }
} }
function coverVideoIni() { function loadHls(){
if ($('video').hasClass('hls')) {
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.3/cdn/js/src/16.hls.js", function(){
var video = addComment.I('coverVideo'); var video = addComment.I('coverVideo');
var video_src = $('#coverVideo').attr('data-src'); var video_src = $('#coverVideo').attr('data-src');
if (Hls.isSupported()) { if (Hls.isSupported()) {
@ -541,7 +540,18 @@ function coverVideoIni() {
video.play(); video.play();
}); });
} }
}
function coverVideoIni() {
if ($('video').hasClass('hls')) {
if (mashiro_global.variables.has_hls){
loadHls();
}else{
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.3/cdn/js/src/16.hls.js", function(){
loadHls();
mashiro_global.variables.has_hls = true;
}); });
}
//console.info('ini:coverVideoIni()'); //console.info('ini:coverVideoIni()');
} }
} }