Skip to content

Instantly share code, notes, and snippets.

View ryanlid's full-sized avatar
🎯
Focusing

ryanlid ryanlid

🎯
Focusing
View GitHub Profile
javascript:(function() %7Bfunction c() %7Bvar e %3D document.createElement("link")%3Be.setAttribute("type", "text/css")%3Be.setAttribute("rel", "stylesheet")%3Be.setAttribute("href", f)%3Be.setAttribute("class", l)%3Bdocument.body.appendChild(e)%7D function h() %7Bvar e %3D document.getElementsByClassName(l)%3Bfor (var t %3D 0%3B t < e.length%3B t%2B%2B) %7Bdocument.body.removeChild(e%5Bt%5D)%7D%7D function p() %7Bvar e %3D document.createElement("div")%3Be.setAttribute("class", a)%3Bdocument.body.appendChild(e)%3BsetTimeout(function() %7Bdocument.body.removeChild(e)%7D, 100)%7D function d(e) %7Breturn %7Bheight : e.offsetHeight,width : e.offsetWidth%7D%7D function v(i) %7Bvar s %3D d(i)%3Breturn s.height > e %26%26 s.height < n %26%26 s.width > t %26%26 s.width < r%7D function m(e) %7Bvar t %3D e%3Bvar n %3D 0%3Bwhile (!!t) %7Bn %2B%3D t.offsetTop%3Bt %3D t.offsetParent%7Dreturn n%7D function g() %7Bvar e %3D document.documentElement%3Bif (!!window.innerWidth) %7Breturn window.innerHeight%7D else if (e %26%2
aimees.cn
kafan.cn
so.ttywx.com
so.yunfei89.com
001nlp.com
111cn.net
151.com.tw
15meili.com
258369.cn
28im.com
@ryanlid
ryanlid / mobile.html
Created June 24, 2016 07:34
移动端html基本结构
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>title</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="./css/main.css">
</head>
@ryanlid
ryanlid / index.html
Created July 8, 2016 06:31
地区列表,拼音
<!--地区-->
<div class="area option-list hidden" id="area">
<ul>
<li><input name="area" value="北京" type="checkbox" id="beijing" hidden><label for="beijing">北京</label></li>
<li><input name="area" value="上海" type="checkbox" id="shanghai" hidden><label for="shanghai">上海</label></li>
<li><input name="area" value="天津" type="checkbox" id="tianjin" hidden><label for="tianjin">天津</label></li>
<li><input name="area" value="重庆" type="checkbox" id="chongqin" hidden><label for="chongqin">重庆</label></li>
<li><input name="area" value="河北" type="checkbox" id="hebei" hidden><label for="hebei">河北</label></li>
<li><input name="area" value="山西" type="checkbox" id="shanxi" hidden><label for="shanxi">山西</label></li>
<li><input name="area" value="河南" type="checkbox" id="henan" hidden><label for="henan">河南</label></li>
@ryanlid
ryanlid / meta.html
Created July 10, 2016 08:17
移动前端 meta
<!--设置viewport宽度为屏幕的宽度,禁用缩放比例-->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
 
<meta name="apple-mobile-web-app-capable" content="yes" />
 
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
 <!--关闭iOS Safari 的电话号码识别和android的邮箱识别-->
<meta name="format-detection"content="telephone=no, email=no" />
 
<!-- iOS 移动设备添加主屏幕标题设置 -->
@ryanlid
ryanlid / index.html
Created July 13, 2016 09:49
jQuery 在新窗口打开外部链接
<script>
var myURL = location.protocol + '//' + location.hostname;
$('a[href^= "http://"]').not('[href^= "'+myURL+'"]').attr('target','_blank');
</script>
@ryanlid
ryanlid / index.html
Created July 14, 2016 01:32
返回上一页的几种写法~
<a href="javascript:history.go(-1)">返回上一页</a>
<a href="javascript:location.reload()">刷新当前页面</a>
<a href="javascript:" onclick="history.go(-2); ">返回前两页</a>
<a href="javascript:" onclick="self.location=document.referrer;">返回上一页并刷新</a>
<a href="javascript:" onclick="history.back(); ">返回上一页</a>
@ryanlid
ryanlid / index.html
Created July 17, 2016 09:26
获取浏览器高度
alert($(window).height()); //浏览器时下窗口可视区域高度
alert($(document).height()); //浏览器时下窗口文档的高度
alert($(document.body).height());//浏览器时下窗口文档body的高度
alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin
alert($(window).width()); //浏览器时下窗口可视区域宽度
alert($(document).width());//浏览器时下窗口文档对于象宽度
alert($(document.body).width());//浏览器时下窗口文档body的高度
alert($(document.body).outerWidth(true));//浏览器时下窗口文档body的总宽度 包括border padding margin
alert($(document).scrollTop()); //获取滚动条到顶部的垂直高度
alert($(document).scrollLeft()); //获取滚动条到左边的垂直宽度
@ryanlid
ryanlid / regexp.js
Created September 7, 2016 17:02
常用的正则表达式
// 验证是否为Email地址
function isPhoneNum(str) {
var pattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
if (pattern.test(str)) {
return true;
} else {
return false;
}
}
@ryanlid
ryanlid / m.js
Created September 12, 2016 16:34
判断浏览器的 ua ,如果是移动端,链接跳转至子目录
(function () {
if (navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)) {
location.href = 'm/index.html#type'
}
})();