smc-webfonts
Version:
Webfonts created from the open source TTF fonts at SMC
1 lines • 3.91 kB
JavaScript
;var _slicedToArray=function(){function t(t,e){var n=[],a=!0,o=!1,l=void 0;try{for(var i,r=t[Symbol.iterator]();!(a=(i=r.next()).done)&&(n.push(i.value),!e||n.length!==e);a=!0);}catch(t){o=!0,l=t}finally{try{!a&&r.return&&r.return()}finally{if(o)throw l}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),fonts=function(){var t=[{fontFamily:"Meera",fontWeight:"normal",fontStyle:"normal",cssFileName:"meera",jsFiddleId:"v4vyxLju"},{fontFamily:"Rachana",fontWeight:"normal",fontStyle:"normal",cssFileName:"rachana",jsFiddleId:"mapzaymx"},{fontFamily:"Dyuthi",fontWeight:"normal",fontStyle:"normal",cssFileName:"dyuthi",jsFiddleId:"1c791dfe"},{fontFamily:"RaghuMalayalam",fontWeight:"normal",fontStyle:"normal",cssFileName:"raghumalayalam",jsFiddleId:"f1L1jy2z"},{fontFamily:"Chilanka",fontWeight:"normal",fontStyle:"normal",cssFileName:"chilanka",jsFiddleId:"tp2m8L9p"},{fontFamily:"Keraleeyam",fontWeight:"bold",fontStyle:"normal",cssFileName:"keraleeyam",jsFiddleId:"a6uqj4eL"},{fontFamily:"Manjari",fontWeight:"normal",fontStyle:"normal",cssFileName:"manjari",jsFiddleId:"133d3ajo"},{fontFamily:"Manjari",fontWeight:100,fontStyle:"normal",cssFileName:"manjari",jsFiddleId:"h4mmru5e"},{fontFamily:"Suruma",fontWeight:500,fontStyle:"normal",cssFileName:"suruma",jsFiddleId:"Lv8dchff"},{fontFamily:"Rachana",fontWeight:"bold",fontStyle:"normal",cssFileName:"rachana",jsFiddleId:"1f7nxt16"},{fontFamily:"Uroob",fontWeight:"bold",fontStyle:"normal",cssFileName:"uroob",jsFiddleId:"pLq5qz9j"},{fontFamily:"Karumbi",fontWeight:"normal",fontStyle:"normal",cssFileName:"karumbi",jsFiddleId:"7d3okgq9"},{fontFamily:"AnjaliOldLipi",fontWeight:"normal",fontStyle:"normal",cssFileName:"anjali",jsFiddleId:"9ajq9cun"},{fontFamily:"Manjari",fontWeight:"bold",fontStyle:"normal",cssFileName:"manjari",jsFiddleId:"3c3vuuz6"}];return"undefined"==typeof firstBy&&(firstBy=function(){return{thenBy:function(){return 0}}}),t.sort(firstBy("fontFamily").thenBy("fontWeight")).map(function(t){var e=t.fontFamily+" ("+t.fontWeight+")";return{name:e,displayName:e.replace(/\s\(normal\)/,""),urlReadyName:e.toLowerCase().replace(/[()]/g,"").replace(/\s/g,"-"),font:t}})}(),setFonts=function(){return function(t){if(t){var e=t.split(" "),n=_slicedToArray(e,2),a=n[0],o=n[1],l=void 0===o?"normal":o,i=fonts.filter(function(t){return t.font.fontFamily===a&&t.font.fontWeight.toString()===l});if(1!==i.length)return alert("Incorrect font name!");var r=i[0],m=document.getElementsByTagName("head")[0],f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("type","text/css"),f.href="//cdn.jsdelivr.net/smc-webfonts/latest/fonts/"+r.font.cssFileName+".min.css",m.appendChild(f);!function(t,e,n){"undefined"==typeof getComputedStyle&&(getComputedStyle=function(t){return t.currentStyle});for(var a=void 0,o=void 0,l=void 0,i={},r=document.body.getElementsByTagName("*"),m=r.length,f=0;f<m;f++)o=r[f],o.style&&(l="#"+(o.id||o.nodeName+"("+f+")"),(a=o.style.fontFamily||getComputedStyle(o,"")[t])&&-1===a.indexOf("FontAwesome")&&-1===a.indexOf(e)&&(o.style.fontFamily=e+","+a,o.style.fontWeight=n,i[a]||(i[a]=[]),i[a].push(l)))}("fontFamily",r.font.fontFamily,r.font.fontWeight)}}}(),fontNames=fonts.map(function(t){return"\t"+t.displayName.replace(/[()]/g,"")}).sort();setFonts(prompt("Type in the exact font name and style from the below list:\n\n(for example: 'Manjari bold')\n\n"+fontNames.join("\n"))),function(t,e,n,a,o,l,i){t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=1*new Date,l=e.createElement(n),i=e.getElementsByTagName(n)[0],l.async=1,l.src="https://www.google-analytics.com/analytics.js",i.parentNode.insertBefore(l,i)}(window,document,"script",0,"ga"),ga("create","UA-4869398-10","auto"),ga("send","pageview");