Skip to content

Instantly share code, notes, and snippets.

View Johnqing's full-sized avatar
🤒
中年危机。。。

刘卿 Johnqing

🤒
中年危机。。。
View GitHub Profile
@Johnqing
Johnqing / encode2gb2312.js
Created November 19, 2015 08:43 — forked from lemonhall/encode2gb2312.js
非常特殊的GB2312/GBK 的URIencode函数
function encodeToGb2312(str){
var strOut="";
for(var i = 0; i < str.length; i++){
var c = str.charAt(i);
var code = str.charCodeAt(i);
if(c==" ") strOut +="+";
else if(code >= 19968 && code <= 40869){
index = code - 19968;
strOut += "%" + z.substr(index*4,2) + "%" + z.substr(index*4+2,2);
}
.bg-bottom(@bgColor){
background: @bgColor;
background-image: ~'-webkit-linear-gradient(135deg, #fff 25%,transparent 25%), -webkit-linear-gradient(45deg, #fff 25%, transparent 25%)';
background-size: 10px 5px;
background-repeat: repeat-x;
background-position: -4px 100%;
}
<!-- 网页加载时隐藏地址栏与导航栏 -->
<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" />
<!-- 忽略页面中的数字识别为电话,忽略email识别 -->
<meta name="format-detection" content="telphone=no, email=no" />
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
var isCoincide = function (a, b) {
var _XDif = Math.abs(a.x() - b.x());
var _YDif = Math.abs(a.y() - b.y());
return (_XDif <= a.width() && _YDif <= a.height()) || (_XDif <= b.width() && _YDif <= b.height());
}
(function(window){
var lastTime = 0;
var vendors = ['webkit', 'moz', 'ms'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame =
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function(callback, element) {
/**
* @namespace
* @desc 类控制器
*/
QHPAY.Class = (function(){
var _slice = [].slice;
function create(property){
if(!property.init){
property.init = function(){};
/*!
* by zhangxinxu(.com) 2012-12-27
* you can visit http://www.zhangxinxu.com/wordpress/?p=3855 to get more infomation
* under MIT license
*/
var funParabola = function(element, target, options) {
/*
* 网页模拟现实需要一个比例尺
* 如果按照1像素就是1米来算,显然不合适,因为页面动不动就几百像素
* 页面上,我们放两个物体,200~800像素之间,我们可以映射为现实世界的2米到8米,也就是100:1
body{
background:#fff;
}
.ie6 body{
background:#f00;
}
.ie7 body{
background:#00f;
}
.ie8 body{
查找浏览器缓存
DNS解析、查找该域名对应的IP地址、重定向(301)、发出第二个GET请求
进行HTTP协议会话
客户端发送报头(请求报头)
服务器回馈报头(响应报头)
html文档开始下载
文档树建立,根据标记请求所需指定MIME类型的文件
文件显示
[
浏览器这边做的工作大致分为以下几步:
/* public */
html,
body {
/* 禁止选中文本(如无文本选中需求,此为必选项) */
-webkit-user-select: none;
user-select: none;
}
html {
font-size: 62.5%;
-webkit-text-size-adjust: none;