<iframe
src="https://music.163.com/outchain/player?type=2&id=27896818&auto=1&height=66"
frameborder="0"
border="1"
marginwidth="0"
marginheight="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
/* 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() { |
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 ntnyq = function () { | |
function Goy () {} | |
Goy.fn = Goy.prototype; | |
return new Goy(); | |
}(); |
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 EventEmiter = function (){ | |
this._events = {}; | |
}; | |
EventEmiter.prototype.on = function (event, cb){ | |
if (Array.isArray(event)){ | |
for (let i = 0, l = event.length; i < l; i++){ | |
this.on(event[i], cb); | |
} | |
} else { |
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 (doc, win) { | |
var body = doc.body; | |
var hasScrollTopChange = false; // 连续点击Input | |
var lastScrollTop = body.scrollTop; // 获取软键盘唤起时浏览器滚动部分的高度 | |
var scrollTimer = null; | |
$('input[type="text"], input[type="tel"], input[type="number"], input[type="password"], textarea') | |
.focus(function () { | |
// 获取焦点时触发 | |
clearInterval(scrollTimer); |
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
let lastTime = 0 | |
const prefixes = 'webkit moz ms o'.split(' ') // 各浏览器前缀 | |
let requestAnimationFrame | |
let cancelAnimationFrame | |
const isServer = typeof window === 'undefined' | |
if (isServer) { | |
requestAnimationFrame = function() { | |
return |
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
export function getImageSize (img: HTMLElement) { | |
const p = new Promise((resolve, reject) => { | |
if (img.natutralWidth) { | |
resolve({ width: img.naturalWidth, height: img.naturalHeight }) | |
} | |
const image = new Image() | |
image.onload = () => { | |
resolve({ width: image.width, height: image.height }) |
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
const loadImg = (img) => { | |
const isArray = Array.isArray(img) | |
if (!isArray) { | |
const oImg = new Image() | |
oImg.src = img | |
return new Promise(resolve => { | |
oImg.onload = () => { | |
resolve() | |
} | |
}) |
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
.msg { | |
animation: animeMsg 4.5s ease-in-out infinite; | |
} | |
@keyframes animeMsg { | |
0% { | |
opacity: 0; | |
} | |
50% { |
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 getGlobalThis () { | |
if (typeof self !== 'undefined') return self | |
if (typeof window !== 'undefined') return window | |
if (typeof global !== 'undefined') return global | |
// This may still return wrong result ⚠️ | |
if (typeof this !== 'undefined') return this | |
throw new Error('Unable to local global `this`') | |
} |
OlderNewer