TypechoJoeTheme

至尊技术网

统计
登录
用户名
密码
/
注册
用户名
邮箱

悠悠楠杉

网站页面

YYCMS增加记忆播放集数

2021-05-30
/
0 评论
/
617 阅读
/
正在检测是否收录...
05/30

把以下代码放到模板下的play.php

PHP代码(放到<!DOCTYPE html>之前)

<?php 
$play = $_GET['play'];
preg_match('#/.*?/(.*?).html#',$play,$str);
// print_r($str[1]);
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$full_url = $http_type.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if(isset($_COOKIE[$str[1]])){
    if(!isset($_GET['id']) || $_GET['id'] != $_COOKIE[$str[1]]){
        $idwz = stripos($full_url,'&id=');
        if($idwz !== false){
            $full_url = substr($full_url,0,$idwz);
        }
        header('location:'.$full_url.'&id='.$_COOKIE[$str[1]]);
    }
}
?>

js代码(放到之前)

<script>
    $(function(){
     $('body').on('click','.btn.btn-min.btn-gray',function(){
         id = $(this).attr('id');
         str = '<?php echo $str[1];?>';
         if(str != ''){
             document.cookie = str+'='+id;
         }
     })
     $('#selectyear').on('change',function(){
        xuanzhe = $("#selectyear").find("option:selected");
        str = '<?php echo $str[1];?>';
         if(str != ''){
             document.cookie = str+'_year='+xuanzhe.attr("year");
         }
     })
     id = '<?php if(isset($_GET['id']) && $_GET['id']){echo $_GET['id'];}?>';
     if(id != ''){
         <?php
         echo '$(".btn-play-active").attr("style","");$(".btn-play-active").removeClass("btn-play-active");';
         if($Prefix != $dyPrefix && $Prefix != $dsjPrefix && $Prefix != $dmPrefix){
             if((isset($_COOKIE[$str[1].'_year']) && $_COOKIE[$str[1].'_year']) || (isset($_GET['year']) && $_GET['year'])){
                 $year = isset($_COOKIE[$str[1].'_year']) ? $_COOKIE[$str[1].'_year'] : $_GET['year'];
                 echo '$(\'#selectyear\').find(\'option[year="'.$year.'"]\').attr("selected",true);qieyear();';
                 echo "if(id.indexOf('-') != '-1'){setTimeout(function(){sid = id.split('-')[0];\$(\"[href='#\"+sid+\"']\").click();},1000)}else{setTimeout(function(){sid = \$('#'+id).parent().parent().parent().attr('id');\$(\"[href='#\"+sid+\"']\").click()},1000);}setTimeout(function(){\$('#'+id).click()},1000);";
             }else{
                 echo "tabId = $('#'+id).parent().parent().parent().attr('id');$(\"[href='#\"+tabId+\"']\").click();$('#'+id).click();";
             }
         }else{
             echo "$('#'+id).click();";
         }
         ?>
     }
 })
</script>
经验PHPYYCMS记忆播放
朗读
赞(1)
版权属于:

至尊技术网

本文链接:

https://www.zzwws.cn/archives/5059/(转载时请注明本文出处及文章链接)

评论 (0)