iconfont.js 9.28 KB
;(function(window) {

  var svgSprite = '<svg>' +
    '' +
    '<symbol id="icon-quanping" viewBox="0 0 1024 1024">' +
    '' +
    '<path d="M641.750109 384.100028l205.227128-204.519-0.704035 115.89966c-0.282433 9.611915 7.489578 18.09103 17.101493 17.808598l12.297071 0c9.611915-0.283456 17.667382-5.936199 17.808598-15.689331l0.565888-172.57752c0-0.14224 0.282433-9.187243 0.282433-9.187243 0.14224-4.804423-0.99056-9.187243-4.100388-12.297071-3.109828-3.109828-7.347339-5.086855-12.297071-4.946662l-8.763594 0.14224c-0.141216 0-0.278339 0-0.420579 0.14224L697.581696 98.166787c-9.611915 0.283456-17.667382 8.200776-17.808598 17.950837l0 12.297071c1.416256 11.44875 10.458189 18.092054 20.070104 17.808598l112.789832 0.283456-204.66124 203.814965c-9.329483 9.329483-9.329483 24.449855 0 33.778314 9.329483 9.470699 24.452925 9.470699 33.782408 0L641.750109 384.100028zM383.095141 576.889893 177.726797 780.705881l0.707105-115.338888c0.283456-9.607822-7.492648-18.086937-17.104563-17.808598l-13.001105 0c-9.611915 0.283456-17.667382 5.937223-17.808598 15.690354l-0.565888 172.718737c0 0.14224-0.282433 9.187243-0.282433 9.187243-0.14224 4.808516 0.99056 9.187243 4.096295 12.297071 3.109828 3.109828 7.351432 5.086855 12.297071 4.946662l8.762571-0.14224c0.14224 0 0.283456 0 0.425695-0.14224l171.873486 0.708128c9.607822-0.283456 17.667382-8.196683 17.808598-17.950837L344.93503 832.575226c-1.415232-11.44875-10.461259-18.092054-20.074198-17.808598L212.069977 814.483172 416.59 610.671277c9.329483-9.329483 9.329483-24.453948 0-33.782408C407.40685 567.41817 392.424624 567.41817 383.095141 576.889893L383.095141 576.889893zM894.047276 835.967486l-0.424672-172.718737c-0.283456-9.612938-8.200776-15.406898-17.809621-15.690354l-12.296047 0c-9.612938-0.278339-17.243733 8.200776-17.105586 17.808598l0.708128 115.903753L641.750109 576.889893c-9.329483-9.329483-24.452925-9.329483-33.782408 0-9.325389 9.328459-9.325389 24.452925 0 33.782408L812.490795 814.483172l-112.789832 0.283456c-9.611915-0.283456-18.515702 6.502088-20.073174 17.808598l0 12.297071c0.282433 9.611915 8.200776 17.667382 17.808598 17.950837l171.166381-0.708128c0.141216 0 0.282433 0.14224 0.424672 0.14224l8.763594 0.14224c4.803399 0.141216 9.187243-1.694595 12.296047-4.946662 3.109828-3.109828 4.238534-7.488555 4.097318-12.297071 0 0-0.14224-9.046027-0.14224-9.187243L894.047276 835.968509zM212.216309 146.506748l112.789832-0.283456c9.607822 0.283456 18.512632-6.502088 20.070104-17.808598L345.076246 116.116601c-0.283456-9.611915-8.196683-17.667382-17.808598-17.950837l-172.011632 0.708128c-0.14224 0-0.283456-0.14224-0.425695-0.14224l-8.761548-0.14224c-4.808516-0.141216-9.187243 1.694595-12.297071 4.946662-3.109828 3.109828-4.242627 7.488555-4.096295 12.297071 0 0 0.282433 9.046027 0.282433 9.187243l0.420579 172.718737c0.14224 9.608845 8.200776 15.406898 17.808598 15.686261l13.005198 0c9.611915 0.282433 17.242709-8.196683 17.10047-17.808598l-0.564865-115.334795 205.231221 203.958228c9.324366 9.329483 24.448832 9.329483 33.777291 0 9.329483-9.329483 9.329483-24.452925 0-33.782408L212.216309 146.506748 212.216309 146.506748zM212.216309 146.506748"  ></path>' +
    '' +
    '</symbol>' +
    '' +
    '<symbol id="icon-weibiaoti1" viewBox="0 0 1024 1024">' +
    '' +
    '<path d="M660.367119 696.447872 660.367119 696.447872c-20.289092 0-36.890188-16.600073-36.890188-36.889165L623.476931 364.441293c0-20.289092 16.600073-36.889165 36.889165-36.889165l0 0c20.289092 0 36.889165 16.600073 36.889165 36.889165l0 295.117414C697.257308 679.847799 680.656211 696.447872 660.367119 696.447872z"  ></path>' +
    '' +
    '<path d="M362.630041 696.447872 362.630041 696.447872c-20.289092 0-36.890188-16.600073-36.890188-36.889165L325.739852 364.441293c0-20.289092 16.600073-36.889165 36.889165-36.889165l0 0c20.289092 0 36.889165 16.600073 36.889165 36.889165l0 295.117414C399.519206 679.847799 382.919133 696.447872 362.630041 696.447872z"  ></path>' +
    '' +
    '<path d="M512.239454 0.260943c-282.624892 0-511.738034 229.113141-511.738034 511.738034s229.113141 511.738034 511.738034 511.738034 511.738034-229.113141 511.738034-511.738034S794.865369 0.260943 512.239454 0.260943zM512.239454 969.689047c-252.775051 0-457.689047-204.91502-457.689047-457.689047S259.465426 54.30993 512.239454 54.30993s457.689047 204.913996 457.689047 457.689047S765.014504 969.689047 512.239454 969.689047z"  ></path>' +
    '' +
    '</symbol>' +
    '' +
    '<symbol id="icon-tingzhi" viewBox="0 0 1024 1024">' +
    '' +
    '<path d="M512 0C229.6 0 0 229.6 0 512s229.6 512 512 512 512-229.6 512-512S794.4 0 512 0zM512 928c-229.6 0-416-186.4-416-416s186.4-416 416-416 416 186.4 416 416S741.6 928 512 928z"  ></path>' +
    '' +
    '<path d="M319.2 318.4l380.8 0 0 384-380.8 0 0-384Z"  ></path>' +
    '' +
    '</symbol>' +
    '' +
    '<symbol id="icon-zhongxin" viewBox="0 0 1024 1024">' +
    '' +
    '<path d="M511.998444 0C240.420987 0 20.48 220.354294 20.48 492.30019 20.48 764.24609 240.419389 984.600379 511.998444 984.600379 783.514911 984.600379 1003.52 764.24609 1003.52 492.30019 1003.52 220.354294 783.514911 0 511.998444 0M511.998444 853.320851C332.759982 853.320851 186.875372 707.270439 186.875372 527.680156 186.875372 348.155646 332.76158 202.105233 511.998444 202.105233L511.998444 131.277963 681.605366 244.571529 511.998444 357.800886 511.998444 287.044088C379.54945 287.044088 271.679611 395.020947 271.679611 527.745929 271.679611 660.470911 379.547894 768.382001 511.998444 768.382001 644.45055 768.382001 752.320389 660.336234 752.320389 527.680156 752.320389 504.249074 771.259761 485.209162 794.655252 485.209162 818.119598 485.209162 837.060526 504.250638 837.060526 527.680156 837.124628 707.270439 691.240018 853.320851 511.998444 853.320851"  ></path>' +
    '' +
    '</symbol>' +
    '' +
    '<symbol id="icon-bofang2" viewBox="0 0 1024 1024">' +
    '' +
    '<path d="M428.859077 296.093538c-5.632-3.899077-12.878769-4.371692-18.865231-1.181538-6.025846 3.150769-9.806769 9.373538-9.806769 16.187077l0 417.988923c0 6.852923 3.859692 13.154462 10.043077 16.265846 2.56 1.339077 5.395692 2.008615 8.231385 2.008615 3.820308 0 7.601231-1.220923 10.791385-3.544615l292.548923-214.449231c4.765538-3.505231 7.522462-9.019077 7.443692-14.966154s-2.993231-11.421538-7.837538-14.808615L428.859077 296.093538z"  ></path>' +
    '' +
    '<path d="M512 0C229.691077 0 0 229.691077 0 512c0 282.308923 229.691077 512 512 512 282.308923 0 512-229.691077 512-512C1024 229.691077 794.308923 0 512 0zM512 926.404923C283.490462 926.404923 97.595077 740.509538 97.595077 512 97.595077 283.490462 283.490462 97.595077 512 97.595077c228.509538 0 414.404923 185.895385 414.404923 414.404923C926.404923 740.509538 740.509538 926.404923 512 926.404923z"  ></path>' +
    '' +
    '</symbol>' +
    '' +
    '</svg>'
  var script = function() {
    var scripts = document.getElementsByTagName('script')
    return scripts[scripts.length - 1]
  }()
  var shouldInjectCss = script.getAttribute("data-injectcss")

  /**
   * document ready
   */
  var ready = function(fn) {
    if (document.addEventListener) {
      if (~["complete", "loaded", "interactive"].indexOf(document.readyState)) {
        setTimeout(fn, 0)
      } else {
        var loadFn = function() {
          document.removeEventListener("DOMContentLoaded", loadFn, false)
          fn()
        }
        document.addEventListener("DOMContentLoaded", loadFn, false)
      }
    } else if (document.attachEvent) {
      IEContentLoaded(window, fn)
    }

    function IEContentLoaded(w, fn) {
      var d = w.document,
        done = false,
        // only fire once
        init = function() {
          if (!done) {
            done = true
            fn()
          }
        }
        // polling for no errors
      var polling = function() {
        try {
          // throws errors until after ondocumentready
          d.documentElement.doScroll('left')
        } catch (e) {
          setTimeout(polling, 50)
          return
        }
        // no errors, fire

        init()
      };

      polling()
        // trying to always fire before onload
      d.onreadystatechange = function() {
        if (d.readyState == 'complete') {
          d.onreadystatechange = null
          init()
        }
      }
    }
  }

  /**
   * Insert el before target
   *
   * @param {Element} el
   * @param {Element} target
   */

  var before = function(el, target) {
    target.parentNode.insertBefore(el, target)
  }

  /**
   * Prepend el to target
   *
   * @param {Element} el
   * @param {Element} target
   */

  var prepend = function(el, target) {
    if (target.firstChild) {
      before(el, target.firstChild)
    } else {
      target.appendChild(el)
    }
  }

  function appendSvg() {
    var div, svg

    div = document.createElement('div')
    div.innerHTML = svgSprite
    svgSprite = null
    svg = div.getElementsByTagName('svg')[0]
    if (svg) {
      svg.setAttribute('aria-hidden', 'true')
      svg.style.position = 'absolute'
      svg.style.width = 0
      svg.style.height = 0
      svg.style.overflow = 'hidden'
      prepend(svg, document.body)
    }
  }

  if (shouldInjectCss && !window.__iconfont__svg__cssinject__) {
    window.__iconfont__svg__cssinject__ = true
    try {
      document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>");
    } catch (e) {
      console && console.log(e)
    }
  }

  ready(appendSvg)


})(window)