UNPKG

@thehapp/treerful-icon

Version:
215 lines (213 loc) 7.3 kB
/* A polyfill for browsers that don't support ligatures. */ /* The script tag referring to this file must be placed before the ending body tag. */ /* To provide support for elements dynamically added, this script adds method 'icomoonLiga' to the window object. You can pass element references to this method. */ (function () { 'use strict'; function supportsProperty(p) { var prefixes = ['Webkit', 'Moz', 'O', 'ms'], i, div = document.createElement('div'), ret = p in div.style; if (!ret) { p = p.charAt(0).toUpperCase() + p.substr(1); for (i = 0; i < prefixes.length; i += 1) { ret = prefixes[i] + p in div.style; if (ret) { break; } } } return ret; } var icons; if (!supportsProperty('fontFeatureSettings')) { icons = { 'pencil2': '&#xe906;', 'write2': '&#xe906;', 'quill': '&#xe907;', 'feather': '&#xe907;', 'pen': '&#xe908;', 'write3': '&#xe908;', 'blog': '&#xe909;', 'pen2': '&#xe909;', 'eyedropper': '&#xe90a;', 'color': '&#xe90a;', 'droplet': '&#xe90b;', 'color2': '&#xe90b;', 'paint-format': '&#xe90c;', 'format': '&#xe90c;', 'image': '&#xe90d;', 'picture': '&#xe90d;', 'images': '&#xe90e;', 'pictures': '&#xe90e;', 'camera': '&#xe90f;', 'photo': '&#xe90f;', 'headphones': '&#xe910;', 'headset': '&#xe910;', 'music': '&#xe911;', 'song': '&#xe911;', 'play': '&#xe912;', 'video': '&#xe912;', 'film': '&#xe913;', 'video2': '&#xe913;', 'video-camera': '&#xe914;', 'video3': '&#xe914;', 'dice': '&#xe915;', 'game': '&#xe915;', 'pacman': '&#xe916;', 'game2': '&#xe916;', 'spades': '&#xe917;', 'cards': '&#xe917;', 'clubs': '&#xe918;', 'cards2': '&#xe918;', 'diamonds': '&#xe919;', 'cards3': '&#xe919;', 'bullhorn': '&#xe91a;', 'megaphone': '&#xe91a;', 'connection': '&#xe91b;', 'wifi': '&#xe91b;', 'podcast': '&#xe91c;', 'broadcast': '&#xe91c;', 'feed': '&#xe91d;', 'wave': '&#xe91d;', 'mic': '&#xe91e;', 'microphone': '&#xe91e;', 'book': '&#xe91f;', 'read': '&#xe91f;', 'books': '&#xe920;', 'library': '&#xe920;', 'library2': '&#xe921;', 'bank': '&#xe921;', 'file-text': '&#xe922;', 'file': '&#xe922;', 'profile': '&#xe923;', 'file2': '&#xe923;', 'file-empty': '&#xe924;', 'file3': '&#xe924;', 'files-empty': '&#xe925;', 'files': '&#xe925;', 'file-text2': '&#xe926;', 'file4': '&#xe926;', 'file-picture': '&#xe927;', 'file5': '&#xe927;', 'file-music': '&#xe928;', 'file6': '&#xe928;', 'file-play': '&#xe929;', 'file7': '&#xe929;', 'file-video': '&#xe92a;', 'file8': '&#xe92a;', 'file-zip': '&#xe92b;', 'file9': '&#xe92b;', 'copy': '&#xe92c;', 'duplicate': '&#xe92c;', 'paste': '&#xe92d;', 'clipboard-file': '&#xe92d;', 'stack': '&#xe92e;', 'layers': '&#xe92e;', 'folder': '&#xe92f;', 'directory': '&#xe92f;', 'folder-open': '&#xe930;', 'directory2': '&#xe930;', 'folder-plus': '&#xe931;', 'directory3': '&#xe931;', 'folder-minus': '&#xe932;', 'directory4': '&#xe932;', 'folder-download': '&#xe933;', 'directory5': '&#xe933;', 'coin-euro': '&#xe93c;', 'money2': '&#xe93c;', 'coin-pound': '&#xe93d;', 'money3': '&#xe93d;', 'coin-yen': '&#xe93e;', 'money4': '&#xe93e;', 'credit-card': '&#xe93f;', 'money5': '&#xe93f;', 'calculator': '&#xe940;', 'compute': '&#xe940;', 'lifebuoy': '&#xe941;', 'support': '&#xe941;', 'phone': '&#xe942;', 'telephone': '&#xe942;', 'phone-hang-up': '&#xe943;', 'telephone2': '&#xe943;', 'address-book': '&#xe944;', 'contact': '&#xe944;', 'envelop': '&#xe945;', 'mail': '&#xe945;', 'clock': '&#xe94e;', 'time2': '&#xe94e;', 'clock2': '&#xe94f;', 'time3': '&#xe94f;', 'alarm': '&#xe950;', 'time4': '&#xe950;', 'bell': '&#xe951;', 'alarm2': '&#xe951;', 'stopwatch': '&#xe952;', 'time5': '&#xe952;', 'calendar': '&#xe953;', 'date': '&#xe953;', 'printer': '&#xe954;', 'print': '&#xe954;', 'keyboard': '&#xe955;', 'typing': '&#xe955;', 'display': '&#xe956;', 'screen': '&#xe956;', 'laptop': '&#xe957;', 'computer': '&#xe957;', 'download': '&#xe960;', 'save': '&#xe960;', 'upload': '&#xe961;', 'load': '&#xe961;', 'floppy-disk': '&#xe962;', 'save2': '&#xe962;', 'drive': '&#xe963;', 'save3': '&#xe963;', 'database': '&#xe964;', 'db': '&#xe964;', 'undo': '&#xe965;', 'ccw': '&#xe965;', 'redo': '&#xe966;', 'cw': '&#xe966;', 'undo2': '&#xe967;', 'left': '&#xe967;', 'redo2': '&#xe968;', 'right': '&#xe968;', 'forward': '&#xe969;', 'right2': '&#xe969;', '0': 0 }; delete icons['0']; window.icomoonLiga = function (els) { var classes, el, i, innerHTML, key; els = els || document.getElementsByTagName('*'); if (!els.length) { els = [els]; } for (i = 0; ; i += 1) { el = els[i]; if (!el) { break; } classes = el.className; if (/treerful-i-/.test(classes)) { innerHTML = el.innerHTML; if (innerHTML && innerHTML.length > 1) { for (key in icons) { if (icons.hasOwnProperty(key)) { innerHTML = innerHTML.replace(new RegExp(key, 'g'), icons[key]); } } el.innerHTML = innerHTML; } } } }; window.icomoonLiga(); } }());