Bunny's Code Burrow

this is a JS world


  • Home

  • About

  • Archives

  • Tags

  • Search

remove cart

Posted on 2020-07-21

How to remove the cart function for WooComerce

Find the woocommerce.php,insert the below codes:
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );

remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
Read more »

flex

Posted on 2020-07-17

Flex

常见语法回顾

flex-direction:默认值row,还可以row-reverse|column|column-reverse|initial|inherit;

justfiy-content:用于设置元素在主轴或者横轴上的对齐方式 flex-start容器开头|flex-end容器结尾|center居中|space-between各元素直接留有空白|space-around各行之间,前后都有空白|initial默认值|inherit继承父元素;

align-items:flex的子项在flex容器当前行的侧轴,纵轴上的对齐方式stretch默认值,拉伸以适应容器|center位于容器中心|flex-start位于容器开头|flex-end位于容易结尾|baseline在容器基准线上,如果行内轴和侧轴为同一条,与flex-start一致|initial默认值|inherit父类继承;

Read more »

css holy grail

Posted on 2020-07-13

css布局之圣杯布局和双飞翼布局

圣杯布局

html布局

<div class="header"></div>
<div class="content">
    <div class="middle"></div>
    <div class="left"></div>
    <div class="right"></div>
</div>
<div class="footer"></div>    
Read more »

requestAnimationFrame

Posted on 2020-06-19

手写深拷贝

function deepClone(obj={}){
    if(typeof obj !=='object'|| obj == null){
        return obj
    }
let result
if(obj instancof Array){
    result=[]
}else{
    result={}
}
for{let key in obj}{
    if(obj.hasOwnProperty(key)){
    //递归调用
        result[key]=deepClone(obj[key])
    }
}
return result
}
Read more »

array remove duplicated

Posted on 2020-06-18

Array interview

讲url参数解析为JS对象

//传统方式,分析search
function queryToObj(){
    const res ={}
    const search =location.search.substr(1)//去掉前面的?
    search.split('&').forEach(paraStr=>{
        const arr = paraStr.split('=')
        const key = arr[0]
        const val = arr[1]
        res[key] = val
    })
    return res
}
Read more »

URL factor

Posted on 2020-06-18

URL element

如何捕获JS程序中的异常

什么是JSON

获取当前页面URL的参数

如何捕获JS程序中的异常

Read more »

how to achieve the max

Posted on 2020-06-16

How to achieve the max

手写字符串trim方法,保证浏览器兼容性

如何获取多个数字中的最大值

手写字符串trim保证浏览器兼容性

String.prototype.trim = function (){
    return this.replace(/^\s+/,'').replace(/\s+$/,'')
}
//(原型,this,正则表达式 命中从开头开始的空白字符,替换为空字符串,和结尾靠近的空白字符命中,用空字符串替换掉)

如何获取多个数字中的最大值

function max(){
    const nums = Array.prototype.slice.call(arguments)
    let max =0
    nums.forEach(n=>{
        if(n>max){
            max=n
        }
    })
    return max
}

 Math.max(10,20,30,50,40,80)

 Math.min(10,20,30,50,40,80)

如何用JS实现继承

class继承

prototype 继承

IIS log

Posted on 2020-06-10

IIS log

date:发出请求时候的日期

time:发出请求时候的师姐,默认是格林威治时间,北京+8

c-ip:客户端地址

cs-username:用户名,访问服务器的已经经过验证用户的名称,匿名用户用连接符-表示

s-sitename:服务器名,记录当记录事件运行于客户端上的Internet服务的名称和实例的编号

s-computer:服务器的名称

s-ip:服务器的ip地址

s-port:为服务配置的服务端端口号

cs-method:请求中使用的HTTP方法,GET/POST

cs-uri-stem:URI资源,记录作为操作目标的同意资源标识符(URI)即访问的页面文件

cs-uri-query:URI查询,记录客户尝试执行的查询,只有动态页面需要URI查询,如果有则记录,没有则以连接符-表示

sc-status:协议状态,记录HTTP状态代码,200表示成功,403表示没有权限,404表示找不到该页面

sc-win32-status:win32状态,记录windows状态码

sc-bytes: 服务器发送的字节数

cs-bytes: 服务器接收的字节数

cs-version:记录客户端使用的协议版本,HTTP或者FTP

cs-host:记录主机头名称,没有的话用-表示

cs(User-Agent) : 用户代理,客户端浏览器,操作系统等情况

cs(Cookie) :记录发送或者接收cookies内容,没有的话-表示

cs(Referer): 引用站点,即访问来源

HTTP协议状态码的含义,协议状态sc-status,是服务器日记扩展属性的一项。下面是各状态码含义列表:

“100” : Continue 客户必须继续发出请求

“101” : witching Protocols 客户要求服务器根据请求转换HTTP协议版本  200交易成功

“200” : OK 交易成功

“201” : Created 提示知道新文件的URL

“202” : Accepted 接受和处理、但处理未完成

“203” : Non-Authoritative Information 返回信息不确定或不完整

“204” : No Content 请求收到,但返回信息为空

“205” : Reset Content 服务器完成了请求,用户代理必须复位当前已经浏览过的文件

“206” : Partial Content 服务器已经完成了部分用户的GET请求

“300” : Multiple Choices 请求的资源可在多处得到

“301” : Moved Permanently 删除请求数据

“302” : Found 在其他地址发现了请求数据

“303” : See Other 建议客户访问其他URL或访问方式

“304” : Not Modified 客户端已经执行了GET,但文件未变化

“305” : Use Proxy 请求的资源必须从服务器指定的地址得到

“306” 前一版本HTTP中使用的代码,现行版本中不再使用

“307” : Temporary Redirect 申明请求的资源临时性删除

“400” : Bad Request 错误请求,如语法错误

“401” : Unauthorized 请求授权失败

“402” : Payment Required 保留有效ChargeTo头响应

“403” : Forbidden 请求不答应

“404” : Not Found 没有发现文件、查询或URl

“405” : Method Not Allowed 用户在Request-Line字段定义的方法不答应

“406” : Not Acceptable 根据用户发送的Accept拖,请求资源不可访问

“407” : Proxy Authentication Required 类似401,用户必须首先在代理服务器上得到授权

“408” : Request Time-out 客户端没有在用户指定的饿时间内完成请求

“409” : Conflict 对当前资源状态,请求不能完成

“410” : Gone 服务器上不再有此资源且无进一步的参考地址

“411” : Length Required 服务器拒绝用户定义的Content-Length属性请求

“412” : Precondition Failed 一个或多个请求头字段在当前请求中错误

“413” : Request Entity Too Large 请求的资源大于服务器答应的大小

“414” : Request-URI Too Large 请求的资源URL长于服务器答应的长度

“415” : Unsupported Media Type 请求资源不支持请求项目格式 

“416” : Requested range not satisfiable 请求中包含Range请求头字段,在当前请求资源范围内没有range指示值,请求也不包含If-Range请求头字段

“417” : Expectation Failed 服务器不满足请求Expect头字段指定的期望值,假如是代理服务器,

“500” : Internal Server Error 服务器产生内部错误

“501” : Not Implemented 服务器不支持请求的函数

“502” : Bad Gateway 服务器暂时不可用,有时是为了防止发生系统过载

“503” : Service Unavailable 服务器过载或暂停维修

“504” : Gateway Time-out 关口过载,服务器使用另一个关口或服务来响应用户,等待时间设定值较长

“505” : HTTP Version not supported 服务器不支持或拒绝支请求头中指定的HTTP版本

unavailable for scheduled maintenance

Posted on 2020-06-08

How to Fix Briefly Unavailable for Scheduled Maintenance Error in WordPress

To get your wordpress website out of maintenance mode,just delete the .maintenance file from site’s root folder using FTP.

The “Briefly unavailable for scheduled maintenance” error is caused by slow server response or low memory issue on web hosting server.

Instead of quickly clicking on the Update link, we recommend patiently updating one plugin at a time.

wordpress access host

Posted on 2020-06-08

Wordpress提示错误

WordPress无法建立到WordPress.org的安全连接,请联系您的服务器管理员

solution

windows系统解决:

修改Host: win系统下host文件路径:c:\windows\system32\drivers\etc

添加如下一行到 hosts 文件末尾:
66.155.40.249 wordpress.org
12…16
Jenny Zeng

Jenny Zeng

Loving code ,especially javascript, React Native

155 posts
37 tags
GitHub Linkedin
© 2020 Jenny Zeng
Powered by Hexo
Theme - NexT.Pisces