index.js 1017 B

12345678910111213141516171819202122232425262728293031323334353637
  1. export function getHashQuery (query) {
  2. if (location.hash.indexOf(query) > -1) {
  3. let cur = location.hash.slice(location.hash.indexOf(query) + query.length + 1, location.hash.length)
  4. if (cur.indexOf('&') > -1) {
  5. return cur.slice(0, cur.indexOf('&'))
  6. } else {
  7. return cur
  8. }
  9. } else {
  10. return false
  11. }
  12. }
  13. export function delURL (query) {
  14. if (query.charAt(query.length - 1) === '&') {
  15. return delURL(query.substring(0, query.length - 1))
  16. } else {
  17. return query
  18. }
  19. }
  20. export function inittitle (title) {
  21. document.title = title
  22. let userAgent = window.navigator.userAgent.toLowerCase()
  23. let isiOS = userAgent.indexOf('applewebkit') >= 0
  24. let isWechat = userAgent.indexOf('micromessenger') >= 0
  25. if (isiOS && isWechat) {
  26. let iframe = document.createElement('iframe')
  27. iframe.src = ''
  28. iframe.style.display = 'none'
  29. document.body.appendChild(iframe)
  30. iframe.onload = function () {
  31. setTimeout(function () {
  32. iframe.remove()
  33. }, 0)
  34. }
  35. }
  36. }