Built with blockbuilder.org
Last active
June 6, 2019 05:53
-
-
Save GerardoFurtado/9ced12200ad3a5ceec7ab6d581494d74 to your computer and use it in GitHub Desktop.
fresh block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title here</title> | |
</head> | |
<body> | |
<div id="d3chartcontainergmslpg" data-year="2018" data-sorting="pooledFundName"></div><script type="text/javascript" src="test.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function test() { | |
var userAgent = window.navigator.userAgent; | |
var isInternetExplorer = userAgent.indexOf("MSIE") > -1 || userAgent.indexOf("Trident") > -1 ? true : false; | |
function loadScript(url, callback) { | |
var head = document.getElementsByTagName('head')[0]; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = url; | |
script.onreadystatechange = callback; | |
script.onload = callback; | |
head.appendChild(script); | |
} | |
if (!isInternetExplorer) { | |
loadScript("https://d3js.org/d3.v5.min.js", d3Chart); | |
} else { | |
loadScript("https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js", function() { | |
loadScript("https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.4/fetch.min.js", function() { | |
loadScript("https://d3js.org/d3.v5.min.js", d3Chart); | |
}); | |
}); | |
}; | |
function d3Chart() { | |
const pointerCoarse = window.matchMedia("(pointer: coarse)").matches; | |
const anyPointerCoarse = window.matchMedia("(any-pointer: coarse)").matches; | |
const pointerFine = window.matchMedia("(pointer: fine)").matches; | |
const anyPointerFine = window.matchMedia("(any-pointer: fine)").matches; | |
const body = d3.select("body"); | |
body.append("h1") | |
.html("Coarse: " + pointerCoarse); | |
body.append("h1") | |
.html("Any Coarse: " + anyPointerCoarse); | |
body.append("h1") | |
.html("Fine: " + pointerFine); | |
body.append("h1") | |
.html("Any Fine: " + anyPointerFine); | |
}; | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment