Skip to content

Instantly share code, notes, and snippets.

@ted-wq-x
Created March 31, 2017 01:46
Show Gist options
  • Save ted-wq-x/ab4fb2361e35c3b42dac59fa7b1bc072 to your computer and use it in GitHub Desktop.
Save ted-wq-x/ab4fb2361e35c3b42dac59fa7b1bc072 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
<!--标题闪烁-->
var initTitle = document.title, isShine = true;
var isture = true;
setInterval(function () {
if (isShine) {
if (isture) {
document.title = '(●^o^●)';
isture = false;
} else {
document.title = '( ̄ε(# ̄)';
isture = true;
}
} else {
document.title = initTitle;
}
}, 1000);
window.onfocus = function () {
isShine = false;
};
window.onblur = function () {
isShine = true;
};
/* 测试html5 Notification*/
if (window.Notification) {
// 请求权限
Notification.requestPermission();
//获取权限
if (Notification.permission === 'granted') {
var notification = new Notification('看一看瞧一瞧啊,(@・ˍ・)',{
body:'Welcome,么么哒,(ΦωΦ)',
icon:'http://onmb5ryy1.bkt.clouddn.com/%E6%96%B0%E5%9F%82%E7%BB%93%E8%A1%A3.jpg',
tag:'welcome',
noscreen:true,
silent:false
});
setTimeout(function () {
notification.close();
},3000);
notification.onclick = function () {
notification.close();
};
}
}
</script>
</head>
<body>
<p style="text-align: center">生活如此多娇!</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment