OneStep

代码a备忘

Toc目录
$diyOrderType=$_SESSION['tempdiyorder'];
        if (isset($_GET['diyOrder'])){
        /* $diyOrderType=$_GET['diyOrder']; */
        if ($diyOrderType == 'created') {
           $select->order('table.contents.created', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize);
    } else if ($diyOrderType == 'views') {
          $select->order('table.contents.views', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize);
    } else if ($diyOrderType == 'modified') {
         $select->order('table.contents.modified', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize);
    } 
    }else {
    $select->order('table.contents.created', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize);
    }

第二段

<!-- 监听选项栏 -->
           
             const selectVal = document.getElementById("diyOrderSou");
       selectVal.addEventListener("change",function(){
            var diyOrderType=selectVal.value;
            /* document.cookie = "tempdiyorder=views; expires=Thu, 01 Jan 2080 00:00:00 GMT"; */
            /* window.location.href = "?diyOrder="+diyOrderType;  */
            /* var username=getCookie("tempdiyorder");
            $user1=getCookie("tempdiyorder"); */
            var js = "<?php "+"$_SESSION['tempdiyorder']='"+diyOrderType+"'; ?>";
             document.write(js); 
        });

第三段

<?php 
$ver = @$_GET['ver'];
if($ver == "mini"){
$key11="<script type='text/javascript'>document.getElementById('linksPanel').style.display='none';</script>";
echo $key11;    
}
if($ver == "null"){
$key12="<script type='text/javascript'>console.log('我爱你oo哦!');</script>";
echo $key12;    
}
 ?>    

第四段

<a rel="nofollow" href="https://github.com/beiduoye" target="_blank" style="font-size: 12px;">
            <i class="iconfont icon-github"></i>
        </a>

第五段

 //  按顺序切换壁纸
function setBgImage() {
/* bgimgid=parseInt(ss); */
bgimgid=bgimgid+1;
/* $("body").css("background-image", "url(\"" + bgimageid +"\")"); */
    /* document.body.style.backgroundImage="url(/rand_bg/get_bg.php?key=order)";  */
    document.body.style.backgroundImage="url(/rand_bg/get_bg.php?key=" + bgimgid + ")";    
}
// 设置壁纸
function setAsBg(ss) {
    bgimgid=parseInt(ss);
    /* $("body").css("background-image", "url(\"" + bgimageid +"\")"); */
        /* document.body.style.backgroundImage="url(/rand_bg/get_bg.php?key=order)";  */
        document.body.style.backgroundImage="url(/rand_bg/get_bg.php?key=" + bgimgid + ")";        
    }

第六段

 $(function(){ 
$("#diySearch").keydown(function(event){ 
if(event.keyCode==13){ 
shaoSo(); 
} 
}); 
}); 

第七段
JS拼接字符串 换行处理

/*常用SEO指令列表*/    
function startseoSo() {    
$("#keywords").empty();
var seolist = "<li><a href='javascript:searech_e()'>精确匹配搜索</a></li>"+
"<li><a href='javascript:searech_intitle()'>intitle 标题搜索</a></li>"+
"<li><a href='javascript:searech_inbody()'>inbody 正文搜索</a></li>"+
"<li><a href='javascript:searech_site()'>site 站点搜索</a></li>"+
"<li><a href='javascript:searech_url()'>url 域或网址收录</a></li>"+
"<li><a href='javascript:searech_filetype()'>filetype 文件类型搜索</a></li>";
$('#keywords').append(seolist);
$("#keywords").show();
 }

第八段
未读消息计数

<?php if($lastunreadSum!=$tempUnreadSum)setcookie("unreadSum",$tempUnreadSum,time()+3600*24*30*12*80,"/"); ?>

password.html页面

<!--{if(isset($v['username']))}--><input class="lastpass_name" type="text" value="<!--{$v['username']}-->" /><!--{/if}-->
<!--{if(isset($v['password']))}--><input class="lastpass_key" type="text" value="<!--{$v['password']}-->" /><!--{/if}-->

书签页--分类列表第一个

<li id="cid_0" <!--{if($cid == 0)}-->data-cur="1"<!--{/if}-->>
            <a href="<!--{:get_root_url()}-->" <!--{if(!$cid)}-->class="hover"<!--{/if}--> title="All">所有书签</a>
            </li>

jquery并集选择器
<!-- $('#c_nav_firstp,#c_nav_prev,#c_nav_next,#c_nav_lastp').css('visibility','visible'); -->

<!-- $(items[0]).show();默认一直显示第一个分类 -->

字符串分割

$(document).ready(function(){
var s1 = $("#link_url").val();
var diyArray = s1.split("/");
console.log(diyArray+"数量"+diyArray.length);
});    

获取星期几

let days = date.getDay();
switch(days) {
        case 1:
            days = '星期一';
            break;
        case 2:
            days = '星期二';
            break;
        case 3:
            days = '星期三';
            break;
        case 4:
            days = '星期四';
            break;
        case 5:
            days = '星期五';
            break;
        case 6:
            days = '星期六';
            break;
        case 0:
            days = '星期日';
            break;
    }

动态时间-服务器版

var datecuo = <?= time() ?>* 1000;//首次用PHP获取服务器的时间做为基础时间
        var date_count = 0;
        function time() {
            var vWeek, vWeek_s, vDay;
            /* vWeek = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; */
            vWeek = ["Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur"];
            datecuo = datecuo + 1000;
            date_count++;
            var date = new Date(datecuo);
            year = date.getFullYear();
            month = date.getMonth() + 1;
            day = date.getDate();
            hours = date.getHours();
            minutes = date.getMinutes();
            seconds = date.getSeconds();
            vWeek_s = date.getDay();
 
            if (hours < 10) { hours = '0' + hours; }
            if (minutes < 10) { minutes = '0' + minutes; }
            if (seconds < 10) { seconds = '0' + seconds; }
 
          $("#bdytime").html(year + "." + month + "." + day + " " + vWeek[vWeek_s] + " " + hours + ":" + minutes + ":" + seconds); 
             
            //以计数的方式,60次即1分钟,用AJAX从服务器head头信息的date中获取一次时间,进行较准
            if (date_count >= 60) {
                var newdate = new Date($.ajax({ type: "HEAD", async: false }).getResponseHeader('Date'));
                var newt_shijianchuo = (new Date(newdate)).getTime() / 1000;
                datecuo= newt_shijianchuo*1000
                date_count = 0;
            }
        };
        setInterval("time()", 1000); 
支付宝打赏 微信打赏

免责声明:本站多数资源来源于互联网。少数原创内容为本人随意书写不对其负任何法律责任(均为键盘和鼠标自行敲击),部分有助于网友的内容仅供学习与交流。如有转载、盗链等其它行为产生对国家社会网络不良影响均与本人无关。
版权说明:未经博主授权禁止转载、摘编、复制或建立镜像。对既成事实本站将保留所有的权利。

      




发表评论

发表新评论

请输入本站名:

暂无评论   

发送消息!
onestep
网站二维码
手机扫一扫,查看
.
贝多叶@聚合支付

真诚赞赏,手留余香

使用微信扫描二维码完成支付