This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resolvePath = function () { | |
function resolve(pathA, pathB) { | |
// 先做split,得到的结果如下几种 | |
// ‘a’ => ['a'] | |
// 'a/b' => ['a', 'b'] | |
// '/a/b' => ['', 'a', 'b'] | |
// '/a/b/' => ['', 'a', 'b', ''] | |
pathB = pathB.split('/'); | |
if (pathB[0] === '') { | |
// 如果pathB是想对于根目录 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Deferred = require('./Deferred'); // 支持Promise api的库都可以,例如q(http://documentup.com/kriskowal/q/) | |
var exec = require('child_process').exec; | |
/** | |
* 猜测当前目录使用了哪个版本控制系统 | |
* | |
* @return {string} svn/git/hg/cvs, 如果检测不到返回空字符串 | |
*/ | |
function guessVcsName() { | |
var svnDef = new Deferred(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof module === 'object' && module && typeof module.exports === 'object') { | |
// Node.js module pattern | |
module.exports = jQuery; | |
} else { | |
// AMD | |
if (typeof define === 'function' && define.amd) { | |
define('jquery-onscreen', [], function() { return jQuery; }); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div class="book"> | |
<h1>背影</h1> | |
<p>我与父亲不相见已二年余了,我最不能忘记的是他的背影。</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************************************************** | |
* | |
* Copyright (c) 2013 Baidu.com, Inc. All Rights Reserved | |
* $Id$ | |
* | |
**************************************************************************/ | |
goog.provide('ad.fx.Timeline'); | |
goog.provide('ad.fx.moveTo'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = url + '?cacheTime=' + Math.ceil(new Date() / 3600000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawInlineBox(el) { | |
el = typeof el === 'string' ? | |
document.getElementById(el) : | |
el; | |
var lines = document.createElement('lines'); | |
lines.style.display = 'inline'; | |
var children = []; | |
for (var i = 0, l = el.childNodes.length; i < l; i++) { | |
children[i] = el.childNodes[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | |
var PIXEL = /^\d+(px)?$/i; | |
function getPixelValue(element, value) { | |
if (PIXEL.test(value)) { | |
return parseInt(value); | |
} | |
var style = element.style.left; | |
var runtimeStyle = element.runtimeStyle.left; | |
element.runtimeStyle.left = element.currentStyle.left; | |
element.style.left = value || 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="fluid-wrap"> | |
<img src="http://placehold.it/800x600" alt="" /> | |
</div> |