Skip to content

Instantly share code, notes, and snippets.

^[\u4e00-\u9fa5]$
// ==UserScript==
// @name sinaimg
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*.sinaimg.cn/*
// @grant none
// ==/UserScript==
@loethen
loethen / ios微信日期转换
Created April 21, 2017 07:55
ios微信日期转换
// ios 时间转时间戳
// 兼容所有浏览器
// ios 使用 new Date("2010-03-15 10:30:00").getTime() 获取时间戳报错
// @time "2010-03-15 10:30:00"
function getTs(time){
var arr = time.split(/[- :]/),
_date = new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]),
timeStr = Date.parse(_date)
return timeStr
}
touchToBottom: function(fn){
if($(window).height() + $(window).scrollTop() >= $(document).height() - 80){
fn && fn();
}
},
@loethen
loethen / weixin-browser-version-and-platform.js
Created August 9, 2016 08:41
检查微信浏览器版本号,安卓还是iphone, 是否是微信浏览器
// 检查微信浏览器版本号
const browserVersion = Number(/micromessenger\/(\d)/i.exec(navigator.userAgent)[1]) //return 4 or 5 or 6 ...
// 检查浏览器平台
const platform = /android/i.test(navigator.userAgent) ? 'android' : 'ios' // return android or ios
// 检查是否是微信浏览器
const isWxBrowser = /micromessenger/i.test(navigator.userAgent) //return true or false