export const setDocumentTitle = function (title) { document.title = title const ua = navigator.userAgent // eslint-disable-next-line const regex = /\bMicroMessenger\/([\d\.]+)/ if (regex.test(ua) && /ip(hone|od|ad)/i.test(ua)) { const i = document.createElement('iframe') i.src = '/favicon.ico' i.style.display = 'none' i.onload = function () { setTimeout(function () { i.remove() }, 9) } document.body.appendChild(i) } } export const domTitle = process.env.VUE_APP_PRO_NAME // 设置keyframes属性 export const addKeyFrames = function (id,y,dur){ var style = document.createElement('style'); style.type = 'text/css'; var keyFrames = '\ @-webkit-keyframes A_ID {\ 0% {\ -webkit-transform: translate3d(0, 0, 0);\ transform: translate3d(0, 0, 0);\ }\ 100% {\ -webkit-transform: translate3d(0, A_DYNAMIC_VALUE, 0);\ transform: translate3d(0, A_DYNAMIC_VALUE, 0);\ }\ }\ @keyframes A_ID {\ 0% {\ -webkit-transform: translate3d(0, 0, 0);\ transform: translate3d(0, 0, 0);\ }\ 100% {\ -webkit-transform: translate3d(0, A_DYNAMIC_VALUE, 0);\ transform: translate3d(0, A_DYNAMIC_VALUE, 0);\ }\ }\ .A_ID{\ -webkit-animation: A_DURs A_ID linear infinite normal;\ animation: A_DURs A_ID linear infinite normal;\ position: relative;\ }\ .A_ID:hover{\ animation-play-state:paused;\ }'; style.innerHTML = keyFrames.replace(/A_ID/g, id).replace(/A_DYNAMIC_VALUE/g, y).replace(/A_DUR/g,dur); document.getElementsByTagName('head')[0].appendChild(style); }