Skip to content

Instantly share code, notes, and snippets.

@setapolo
Created May 10, 2020 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save setapolo/dcd0ec4ba9573accc0d7f4f43b392939 to your computer and use it in GitHub Desktop.
Save setapolo/dcd0ec4ba9573accc0d7f4f43b392939 to your computer and use it in GitHub Desktop.
svgMap
<!DOCTYPE html>
<html>
<script src="https://cdn.jsdelivr.net/gh/StephanWagner/svgMap@v1.4.2/dist/svgMap.min.js"></script>
<link href="https://cdn.jsdelivr.net/gh/StephanWagner/svgMap@v1.4.2/dist/svgMap.min.css" rel="stylesheet">
<script>
readData=function(){
return function(a){
var url = a['url'];
var tag = a['querySelector'];
fetch(url).then(function(response) {
return response.text();
}).then(function(text) {
table = ferrorod("table")(document.body)({innerHTML:"",border:"1"});
text.split(/\n/).map(function(c,i){
tr =ferrorod("tr")(table)({innerHTML:""});
// c.split(/,/).map(function(cc,ii){
td =(i==0)?ferrorod("th")(tr)({innerHTML:c}):ferrorod("td")(tr)({innerHTML:c,onclick:function(e){
document.getElementById("out").innerText=this.innerText;
}});
// });
// var a_tag=ferrorod("div")(document.body)({href:"https://www.google.com/search?q="+c.split(/ /)[c.split(/ /).length-1],innerHTML:c,className:"cm-text-primary"});
// ferrorod("div")(document.body)({innerHTML:s});
} );
});
}
}
</script>
<div id="svgMap"></div>
</html>
<script type="text/javascript">
//CCas Closure Cascading v.0.03 2020/3/28 moka
(function (g,flg){
g.ferrorod=function(s){
return function(p){
return function(a){
var e = document.createElement(s);
Object.keys(a).map(function(c,i){
e.setAttribute(c,a[c]);
});
e = Object.assign(e,a);
p.appendChild(e);
return e
}
}
};
return function(d,flg){
var a={};
var aa=[null];
var aaa=[];
var lv=[document.body];
var k=null;
var parent=document.body;
var f= function(c){
var _f = (typeof c=="function")?c:null;
(typeof c=="object")?(function(){
_f=(c.source)?ferrorod(c.source):_f;
}()):0;
(k==null)?(_f!=null)?function(){
aaa.push(a);
aa.push(_f);
a={};
}():0:0;
(c==null)?(function(){
(a!=null)?(aaa.push(a)):0;
aa.map(function(cc,i){
parent = (cc!=null)?cc(lv[lv.length -1])(aaa[i]):document.body;
(parent != document.body)?lv.push(parent):0;
});
lv.pop();
aaa=[];
aa=[null];
})():0;
var v =(k != null)?c:null;
k=(typeof c=="string")?(k==null)?c:k:k;
((k!=null)&&(v!=null))?a[k]=v:0;
k=((k!=null)&&(v!=null))?null:k;
return f;
}
return f;
};
})(window)
(document)
(/link/)
("href")("https://cdnjs.cloudflare.com/ajax/libs/marx/3.0.7/marx.min.css")
("rel")("stylesheet")()
(/H2/)
("innerHTML")("map")()
(/div/)("innerHTML")(`
this is test
`)("id")("out")()
(/button/)
("className")("c-button")
("type")("button")
("innerHTML")("Button")
("onclick")(function(){window.alert("a")})
()
(readData)
("url")("https://gist.githubusercontent.com/acyuta/6f7ffc82f7f9ef67151f749ea26626c6/raw/be8a9b42bfb9d9f677004517b015429ed714ae80/log.log")
("querySelector")("img")
()
;
new svgMap({
targetElementID: 'svgMap',
data: {
data: {
gdp: {
name: 'GDP per capita',
format: '{0} USD',
thousandSeparator: ',',
thresholdMax: 50000,
thresholdMin: 1000
},
change: {
name: 'Change to year before',
format: '{0} %'
}
},
applyData: 'gdp',
values: {
AF: {gdp: 587, change: 4.73},
AL: {gdp: 4583, change: 11.09},
DZ: {gdp: 4293, change: 10.01}
// ...
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment