// jQuery
$(document).ready(function() {
// code
})
This file contains 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
<html> | |
<head> | |
<!-- 声明文档使用的字符编码 --> | |
<meta charset='utf-8'> | |
<!-- 优先使用 IE 最新版本和 Chrome --> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
<!-- 页面描述 --> | |
<meta name="description" content="不超过150个字符"/> | |
<!-- 页面关键词 --> | |
<meta name="keywords" content=""/> |
This file contains 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() { | |
/** | |
* 根据测试字体与基准字体拼接后字体的宽高 和 原来基准字体的宽高进行对比,若不同,则说明测试字体存在 | |
*/ | |
var Detector = function() { | |
// 传入的字体会和下面三种字体作比较 | |
var baseFonts = ['monospace', 'sans-serif', 'serif']; | |
// 使用m和w作为测试字符因为它们占据最大宽度 | |
var testString = "mmmmmmmmmmlli"; |
This file contains 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 express = require('express'); | |
var app = express(); | |
var http = require('http'); | |
var httpServer = http.Server(app); | |
app.all('*', function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "X-Requested-With"); | |
res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS"); | |
res.header("X-Powered-By",' 3.2.1'); |
This file contains 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
/* ============================== START normalize.css ==============================*/ | |
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */ | |
/** | |
* 1. Correct the line height in all browsers. | |
* 2. Prevent adjustments of font size after orientation changes in | |
* IE on Windows Phone and in iOS. | |
*/ | |
html { |
This file contains 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 isSafari() { | |
return navigator.userAgent.indexOf('Safari') > 0 && | |
navigator.userAgent.indexOf('Chrome') < 0; | |
} | |
function isIe() { | |
return navigator.userAgent.indexOf('MSIE') > 0; | |
; | |
} |
This file contains 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 gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var cleancss = require('gulp-clean-css'); | |
var uglify = require('gulp-uglify'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
gulp.task('css',function(){ | |
return gulp.src('css/*.css') | |
.pipe(concat('style.min.css')) |
This file contains 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
$.extend({ | |
popOptions: function(params) { | |
var defaults = { | |
title: "标题", | |
options: [{ | |
name: "选项一", | |
onClick: function() {} | |
}, | |
{ | |
name: "选项二", |
This file contains 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
/* This function will convert each color to gray scale and return average of all pixels, so final value will be between 0 (darkest) and 255 (brightest) */ | |
function getImageLightness(imageSrc,callback) { | |
var img = document.createElement("img"); | |
img.src = imageSrc; | |
img.style.display = "none"; | |
document.body.appendChild(img); | |
var colorSum = 0; | |
img.onload = function() { |
OlderNewer