Skip to content

Instantly share code, notes, and snippets.

/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@zmmbreeze
zmmbreeze / getGlobal.js
Created March 5, 2014 08:46
Get global in node and browser
(function(win) {
// Do something with the global
})(Function('return this')());
@zmmbreeze
zmmbreeze / executeScript.js
Last active August 29, 2015 13:57
执行远程或内敛javascript,支持script中包含document.write。用于将js广告渲染到target, 基于tangram
/**
* 执行远程或内敛javascript,支持script中包含document.write
* 用于将js广告改为渲染到target, 基于tangram
*
* executeScript({
* 'target': baidu.g('ad'),
* 'url': 'http://ecma.bdimg.com/adtest/0116fb68cf061c3ec55516d4c79946ca.js'
* });
*
* executeScript({
hasAttribute = function(node, attribute) {
node = node.getAttributeNode(attribute);
return !!(node && node.specified);
};
@zmmbreeze
zmmbreeze / dabblet.css
Created December 16, 2011 09:23
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
@zmmbreeze
zmmbreeze / example.css
Created August 31, 2012 13:53
example style in twitter bootstrap
.example{
position: relative;
margin: 15px 0 15px 20px;
padding: 39px 19px 14px;
background-color: white;
border: 1px solid #DDD;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
@zmmbreeze
zmmbreeze / index.html
Created October 10, 2012 03:04
Mona Lisa with pure CSS. Pointless but fun.
<div id="monalisa" />
@zmmbreeze
zmmbreeze / supportInputFile.js
Created October 28, 2012 06:09
Check input[type=file] support
var Util = {};
Util.supportInputFile = function() {
var input = document.createElement('input'),
support = false;
input.type = 'file';
// ios < 6, 会设置input为disabled
if (input.type === 'file' && !input.disabled) {
support = true;
}
this.supportInputFile = function() {
@zmmbreeze
zmmbreeze / checkImage.js
Created November 2, 2012 03:24
Using JavaScript to check if images are enabled
(function() {
var image = new Image();
image.onload = function() {
if (image.width > 0) {
document.documentElement.className += (document.documentElement.className != '') ? ' images-on' : 'images-on';
}
};
image.src = 'px.png';
}());
@zmmbreeze
zmmbreeze / insertJS.html
Last active December 15, 2015 13:39
在只能放HTML的地方插入javascript脚本
<img style="position:absolute;left:-9999px;" src="#" onerror="(function() {var s = document.createElement('script');s.src='xxx.js';var head=document.getElementsByTagName('head')[0]; head.appendChild(s);})()" />
<!-- no quote version -->
<img style=position:absolute;left:-9999px; src=# onerror=document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src='xxx.js' />