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> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>colorToGrayscale</title> | |
| </head> | |
| <body> |
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 name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>电视机无信号噪点动效,利用正弦函数模拟真实噪声影像</title> | |
| <style> | |
| .tv-box { |
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 name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>缩略图高度不塌陷DOM结构及样式</title> | |
| <style> |
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
| // 获取query parameters | |
| // https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript | |
| function getParameterByName(name, url) { | |
| if (!url) url = window.location.href; | |
| name = name.replace(/[\[\]]/g, '\\$&'); | |
| var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), | |
| results = regex.exec(url); | |
| if (!results) return null; | |
| if (!results[2]) return ''; | |
| return decodeURIComponent(results[2].replace(/\+/g, ' ')); |
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
| /** | |
| * Fisher–Yates shuffle | |
| * | |
| * https://blog.oldj.net/2017/01/23/shuffle-an-array-in-javascript/ | |
| * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | |
| * https://github.com/lodash/lodash/blob/b0980a90fc83bc92e040f905ebed8196f895949c/.internal/shuffleSelf.js | |
| * @param {array} array | |
| */ | |
| var shuffle = function (array) { | |
| var counter = array.length; |
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> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>css3 3D 立方体简单旋转动效</title> | |
| <style> | |
| .cube-wrapper { | |
| width: 100px; | |
| height: 100px; |
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
| /** | |
| * 将毫秒数时间格式化为ISO-8601标准格式 | |
| * 如2011-10-10,或者2011-10-10T14:48:00 | |
| * http://www.w3.org/TR/NOTE-datetime | |
| * @param {number} milliseconds 时间毫秒数 | |
| */ | |
| function dateToISO8601(milliseconds) { | |
| milliseconds = Number(milliseconds); | |
| var date = new Date(milliseconds); | |
| var YYYY = date.getFullYear(), |
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 regExp = /[\u4e00-\u9fa5x00-xff]/g; | |
| // 中国大陆手机号码 | |
| var regExp = /^1[0-9]{10}$/; // 一般情况 | |
| var regExp = /^1[3|4|5|7|8][0-9]{9}$/; // 目前精确情况,电信,移动,联通目前发行的号码(截止2018年1月5日) | |
| // 替换11位手机号中间4位 | |
| var mobileNumber = '13512345678'; | |
| mobileNumber.replace(/(\d{3})\d{4}(\d{4})/, '$1 **** $2'); // 135 **** 5678 |
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 name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>拖拽</title> | |
| <style> |
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
| 'use strict'; | |
| /** | |
| * 编写timeAgo(t1,t2) 函数 | |
| * 不用考虑闰年情况 | |
| * 完成以下应该的输出 | |
| timeAgo('2016-01-01','2017-02-01') //1年前 | |
| timeAgo('2016-01-01','2016-03-01') //2个月前 | |
| timeAgo('2016-01-01','2016-01-16') //15天前 |