二蛋 发布的文章

Lazyload遇到tab选项卡 必须滚动屏幕才能显示图片的解决方法

可尝试将:

<script type="text/javascript">
  $(function() {
      $("img").lazyload();
  });
</script>

替换为:

<script type="text/javascript">
$("img").lazyload({
    skip_invisible : false,
     effect:"fadeIn"
});
</script>

也可替换为:

<script type="text/javascript">
 $(function() {          
     $("img").lazyload({
         event : "sporty"
     });
 });
 $(window).bind("load", function() {
     var timeout = setTimeout(function() { $("img").trigger("sporty") }, 5000);
 });
</script>

实际页面加载完成 5 秒后自动加载图片

jquery实现字数限制超过部分...点击展开全部

$(function(){
    $(".plot").each(function(){
        var maxwidth=30;//设置最多显示的字数
        var text=$(this).text();
        if($(this).text().length>maxwidth){
            $(this).text($(this).text().substring(0,maxwidth));
            $(this).html($(this).html()+"..."+"<a href='#'> 展开全部</a>");
        };
        $(this).find("a").click(function(){
        $(this).parent().text(text);
        })
    })
});

SeaCMS后台自定义采集增加图片判断以决定新增或更新原数据

编辑 /include/collection.class.php 文件 找到:

//else 不勾选[只更新影片地址]
elseif(strpos($cfg_gatherset,'4')!==false)
{
        return $autocol_str.$this->update_movie_info_pic($rs,$v_data);
}

在下方插入:

elseif($v_data['v_pic']!==$rs['v_pic'])
{
        return $autocol_str.$this->_insert_database($v_data);
}

注:后台 智能采集设置 中仅勾选 按地址判断是否更新

SeaCMS后台自定义采集增加别名采集

编辑 /include/collection.class.php 文件,找到:

$v_data['v_name']=getAreaValue($loopstr,"name",$html,$listconf["removecode"]);
$v_data['v_name']=$this->filterWord($v_data['v_name'],0);
$v_data['v_enname']=Pinyin($v_data['v_name']);
$v_data['v_name'] =  htmlspecialchars($v_data['v_name']);
$v_data['v_name'] = str_replace(array('\\','()','\''),'/',$v_data['v_name']);

在下方插入:

$v_data['v_nickname']=getAreaValue($loopstr,"nickname",$html,$listconf["removecode"]);
$v_data['v_nickname'] =  htmlspecialchars($v_data['v_nickname']);

编辑 /include/collection.func.php 文件,找到:

getTestAreaValue($loopstr,"name","影片名称",$html,$removecode);

在下方插入:

getTestAreaValue($loopstr,"nickname","影片别名",$html,$removecode);

- 阅读剩余部分 -

通过UserAgent判断进行移动适配

nginx版

PC ==>> 移动

if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)){rewrite ^/(.*)$ http://m.2dan.cc/$1 permanent;}

移动 ==>> PC

if ($http_user_agent !~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)){rewrite ^/(.*)$ http://www.2dan.cc.com/$1 permanent;}

js版

(function(){var ua=navigator.userAgent.toLowerCase();var bIsIpad=ua.match(/ipad/i)=="ipad";var bIsIphoneOs=ua.match(/iphone os/i)=="iphone os";var bIsAndroid=ua.match(/android/i)=="android";var bIsWM=ua.match(/windows mobile/i)=="windows mobile";
if(bIsIpad||bIsIphoneOs||bIsAndroid||bIsWM){}else{var url=window.location.href;url=url.replace("m","www");window.location.href=url}})();