Skip to content

Instantly share code, notes, and snippets.

View CodingMonkeyzh's full-sized avatar
🎃
Focusing

Quan Zhou CodingMonkeyzh

🎃
Focusing
View GitHub Profile
{
"pc0": "chl_api_m", // _cf_chl_opt.cType,
"Sxap5": "8721", // fu._cf_chl_opt.cNounce,
"lGAQX9": "2", // fu._cf_chl_opt.cvId,
"TPmikX3": 0, // static
"wxi0": 0, // static
"KeW5": 1, // static
"Vqo3": { // fu._cf_chl_opt.cRq,
"ru": "aHR0cDovL2NoYWxsZW5nZXMuY2xvdWRmbGFyZS5jb20vY2RuLWNnaS9jaGFsbGVuZ2UtcGxhdGZvcm0vaC9nL3R1cm5zdGlsZS9pZi9vdjIvYXYwL3JjdjAvMC9nZmdoNS8weDRBQUFBQUFBRG5QSURST3JtdDFXd2ovZGFyay9ub3JtYWw=",
"ra": "TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzExNS4wLjAuMCBTYWZhcmkvNTM3LjM2",
{
"1": {
"i": "lfNYMzn/1UU=",
"h": "yes",
"tH": "",
"t": 21,
"DCibg7": 0,
"sOrUv4": {
"p": "Win32",
"l": [
@CodingMonkeyzh
CodingMonkeyzh / animate.js
Created August 13, 2015 06:13
javascript 动画函数
/**
* base Function
* @param {[type]} opts [description]
* @return {[type]} [description]
*/
function animate(opts) {
var start = new Date();
var id = setInterval(function () {
var timePassed = new Date() - start;
@CodingMonkeyzh
CodingMonkeyzh / debouce.js
Created July 28, 2015 07:07
去抖动函数。用于高频运算优化
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
@CodingMonkeyzh
CodingMonkeyzh / tiltfx.js
Created June 26, 2015 03:18
图片倾斜效果
/**
* tiltfx.js
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2015, Codrops
* http://www.codrops.com
*/
function throttle(fn, delay) {
var allowSample = true;
return function(e) {
if (allowSample) {
allowSample = false;
setTimeout(function() { allowSample = true; }, delay);
fn(e);
}
};
var preload = (function (file) {
if (/*@cc_on!@*/false) { //IE
return function (file) {
new Image().src = file; //图像灯塔
};
} else {
return function (file) {
var obj = document.createElement('object'),
body = document.body;
obj.width = 0;
@CodingMonkeyzh
CodingMonkeyzh / observer.js
Created June 8, 2015 07:29
观察者模式
var publisher = {
subscribers: {
any: [] // 事件类型:订阅者
},
subscribe: function (fn, type) {
type = type || 'any';
if (typeof this.subscribers[type] === 'undefined') {
this.subscribers[type] = [];
}
this.subscribers[type].push(fn);
@CodingMonkeyzh
CodingMonkeyzh / mediator.js
Created June 8, 2015 06:36
中介者模式
function Player(name) {
this.points = 0;
this.name = name;
}
Player.prototype.play = function () {
this.points += 1;
mediator.played();
};
var myevent = {
// 通过直接调用 stop 来一起调用preventDefault(),stopPropagation()
stop: function (e) {
if (typeof e.preventDefault === 'function') {
e.preventDefault();
}
if (typeof e.stopPropagation === 'function') {
e.stopPropagation();
}
// IE browser