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"> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
| <style type="text/css"> | |
| body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";} | |
| #mapBox { | |
| width: 90%; |
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 gulp = require('gulp'); | |
| var uglify = require('gulp-uglify'); | |
| var minify = require('gulp-minify-css'); | |
| var sass = require('gulp-sass'); | |
| var livereload = require('gulp-livereload'); |
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
| { | |
| // 环境定义 | |
| "env": { | |
| "browser": true, | |
| "node": true, | |
| "commonjs": true, | |
| "amd": true, | |
| "es6": false, // 支持除模块外所有 ECMAScript 6 特性(该选项会自动设置 ecmaVersion 解析器选项为 6) | |
| "mocha": true, | |
| "phantomjs": true, |
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> <!-- 使用 HTML5 doctype,不区分大小写 --> | |
| <html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa --> | |
| <head> | |
| <!-- 声明文档使用的字符编码 --> | |
| <meta charset='utf-8'> | |
| <!-- 优先使用 IE 最新版本和 Chrome --> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
| <!-- 页面描述 --> | |
| <meta name="description" content="不超过150个字符"/> | |
| <!-- 页面关键词 --> |
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 获取;譬如: www.yourwebsite.com?p=1234 | |
| var keyword = window.location.search.substr(3); | |
| keyword = decodeURIComponent(keyword); | |
| /** | |
| * 页面高亮关键字 | |
| * @param {string} targetNode: 要进行高亮的范围节点,需要类名(不需要加.)。 | |
| * @param {string} keyword: 高亮的关键字 | |
| * @param {array} exclude: 要排除的节点名字数组 | |
| */ | |
| function HighLight(targetNode, keyword, excludeArr) { |
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
| //找出数组里数值最小的一个,仅适用于 Number Array | |
| Math.min.apply({}, array); |
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,获取对应的参数值。 | |
| * 比如分割 http://www.yy.com/search?q=123&sharefrom=wechat ,返回 Object {q: "123", sharefrom: "wechat"} | |
| * @param null | |
| * @return {object} | |
| */ | |
| function separate() { | |
| var originUrl = window.location.search; | |
| originUrl = originUrl.substr(1); |
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 gulp = require('gulp'), | |
| fs = require('fs'), | |
| plumber = require('gulp-plumber'); | |
| //some gulp task here | |
| gulp.task('sometask', function() { | |
| gulp.src(TASK_SRC_PATH) | |
| .pipe(plumber({ | |
| errorHandler: outputErr | |
| })) |
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 debounce(func, wait, immediate) { | |
| var timeout, | |
| args, | |
| context, | |
| timestamp, | |
| result; | |
| var later = function () { | |
| var last = Date.now() - timestamp; |
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
| // check_webp_feature: | |
| // 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'. | |
| // 'callback(feature, result)' will be passed back the detection result (in an asynchronous way!) | |
| function check_webp_feature(feature, callback) { | |
| var kTestImages = { | |
| lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", | |
| lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==", | |
| alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==" | |
| animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA" | |
| }; |