github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/ui/src/utils/dom.js (about)

     1  import config from '../config/config'
     2  import { getElectron } from "./common";
     3  
     4  export const setDocumentTitle = function (title) {
     5    document.title = title
     6    const ua = navigator.userAgent
     7    // eslint-disable-next-line
     8    const regex = /\bMicroMessenger\/([\d\.]+)/
     9    if (regex.test(ua) && /ip(hone|od|ad)/i.test(ua)) {
    10      const i = document.createElement('iframe')
    11      i.src = '/favicon.ico'
    12      i.style.display = 'none'
    13      i.onload = function () {
    14        setTimeout(function () {
    15          i.remove()
    16        }, 9)
    17      }
    18      document.body.appendChild(i)
    19    }
    20  }
    21  
    22  export const getPath = function () {
    23    return process.env.NODE_ENV === 'production' && !parseInt(process.env.UI_IN_CLIENT) && !getElectron() ? 'ui/': ''
    24  }
    25  
    26  export const domTitle = config.title