Browse Source

Font detection

pull/36/head
Jure Šorn 6 years ago
parent
commit
12c8c9b30b
1 changed files with 2 additions and 1 deletions
  1. 3
      web/script_2.js

3
web/script_2.js

@ -43,7 +43,8 @@ const DIAGRAM_2_B =
'┗━━━━━━━━━┷━━━━━━━━━━━━━┛\n'; '┗━━━━━━━━━┷━━━━━━━━━━━━━┛\n';
// (function(d){function c(c){b.style.fontFamily=c;e.appendChild(b);f=b.clientWidth;e.removeChild(b);return f}var f,e=d.body,b=d.createElement("span");b.innerHTML=Array(100).join("wi");b.style.cssText=["position:absolute","width:auto","font-size:128px","left:-99999px"].join(" !important;");var g=c("monospace"),h=c("serif"),k=c("sans-serif");window.isFontAvailable=function(b){return g!==c(b+",monospace")||k!==c(b+",sans-serif")||h!==c(b+",serif")}})(document);
// isFontAvailable:
(function(d){function c(c){b.style.fontFamily=c;e.appendChild(b);f=b.clientWidth;e.removeChild(b);return f}var f,e=d.body,b=d.createElement("span");b.innerHTML=Array(100).join("wi");b.style.cssText=["position:absolute","width:auto","font-size:128px","left:-99999px"].join(" !important;");var g=c("monospace"),h=c("serif"),k=c("sans-serif");window.isFontAvailable=function(b){return g!==c(b+",monospace")||k!==c(b+",sans-serif")||h!==c(b+",serif")}})(document);
if (!isFontAvailable('Menlo')) { if (!isFontAvailable('Menlo')) {
$(`code:contains(${DIAGRAM_1_B})`).html(DIAGRAM_1_A); $(`code:contains(${DIAGRAM_1_B})`).html(DIAGRAM_1_A);

Loading…
Cancel
Save