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"];
if(isset($encrypted)){
$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);
preg_match('/^\d{3,}$/', $qq_number, $matches);
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';

View File

@ -5,6 +5,7 @@
* @date 2019.8.3
*/
mashiro_global.variables = new function () {
this.has_hls = false;
this.skinSecter = true;
}
mashiro_global.ini = new function () {
@ -523,25 +524,34 @@ function killCoverVideo() {
}
}
function loadHls(){
var video = addComment.I('coverVideo');
var video_src = $('#coverVideo').attr('data-src');
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(video_src);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
video.play();
});
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = video_src;
video.addEventListener('loadedmetadata', function () {
video.play();
});
}
}
function coverVideoIni() {
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_src = $('#coverVideo').attr('data-src');
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(video_src);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
video.play();
});
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = video_src;
video.addEventListener('loadedmetadata', function () {
video.play();
});
}
});
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()');
}
}