smc-webfonts
Version:
Webfonts created from the open source TTF fonts at SMC
1 lines • 5.07 kB
JavaScript
;var fonts=function(){var e=[{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}}}),e.sort(firstBy("fontFamily").thenBy("fontWeight")).map(function(e){var t=e.fontFamily+" ("+e.fontWeight+")";return{name:t,displayName:t.replace(/\s\(normal\)/,""),urlReadyName:t.toLowerCase().replace(/[()]/g,"").replace(/\s/g,"-"),font:e}})}();!function(){document.querySelectorAll(".ml-text").forEach(function(e){return e.innerText="അജവും ആനയും ഐരാവതവും ഗരുഡനും കഠോര സ്വരം പൊഴിക്കെ ഹാരവും ഒഢ്യാണവും ഫാലത്തില് മഞ്ഞളും ഈറന് കേശത്തില് ഔഷധ എണ്ണയുമായി ഋതുമതിയും അനഘയും ഭൂനാഥയുമായ ഉമ ദുഃഖഛവിയോടെ ഇടതു പാദം ഏന്തി ങ്യേയാദൃശം നിര്ഝരിയിലെ ചിറ്റലകളെ ഓമനിക്കുമ്പോള് ബാലയുടെ കണ്കളില് നീര് ഊര്ന്നു വിങ്ങി."}),document.querySelectorAll(".en-text").forEach(function(e){return e.innerText="The quick brown fox jumps over the lazy dog."});var e=function(e,t){document.querySelectorAll(e).forEach(function(e){return e.classList.remove("active")}),t.classList.add("active")},t=document.querySelector("#switcher");document.querySelector("#open-switcher").onclick=function(e){t.style.display="inline-block",e.stopPropagation()},t.onclick=function(e){e.stopPropagation()};var n=document.querySelector("#close-switcher");n.onclick=function(){return t.style.display="none"},fonts.forEach(function(o){var l=document.createElement("div");l.id=o.urlReadyName+"-button",l.className="switcher-font",l.innerText=o.displayName,l.onclick=function(){document.querySelector("#font-name").innerText=o.displayName;var t="font-family: '"+o.font.fontFamily+"'; font-weight: "+o.font.fontWeight+"; font-style: normal;";document.querySelector(".font-container").style.cssText=t,document.querySelector(".tab-head-container").style.cssText=t,document.querySelector("#usage").innerText='\x3c!-- HTML (within the HEAD element) --\x3e\n<link rel="stylesheet" href="https://cdn.jsdelivr.net/smc-webfonts/latest/fonts/'+o.font.cssFileName+".min.css\">\n\n/* CSS */\n.your-style {\n font-family : '"+o.font.fontFamily+"';\n font-weight : "+o.font.fontWeight+";\n font-style : normal;\n}",window.location.hash="#"+o.urlReadyName,e(".switcher-font",this);for(var l=document.querySelector("#jsFiddle-container");l.firstChild;)l.removeChild(l.firstChild);var a=document.createElement("script");a.setAttribute("async",""),a.setAttribute("src","//jsfiddle.net/FloydPink/"+o.font.jsFiddleId+"/embed/result,css,html/"),l.appendChild(a),document.title="SMC Malayalam Webfonts - "+o.displayName,n.onclick.call(n)},t.appendChild(l)}),document.querySelectorAll(".tab-head").forEach(function(t){t.onclick=function(){document.querySelectorAll(".tab").forEach(function(e){return e.style.display="none"}),document.querySelector("."+this.id).style.display="block",e(".tab-head",this)}}),document.querySelector("html").onclick=function(){n.onclick.call(n)};var o=document.querySelector("#ml");o.onclick.call(o);var l="manjari-normal";if(window.location.hash){var a=window.location.hash.substring(1);1===fonts.filter(function(e){return e.urlReadyName===a}).length&&(l=a)}var i=document.querySelector("#"+l+"-button");i.onclick.call(i)}();