Generated using danvk/source-map-explorer
Last active
October 19, 2015 05:50
-
-
Save Hypercubed/2f762d0d7e7cc8cb3f24 to your computer and use it in GitHub Desktop.
angular-downloadsvg-directive bundle
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> | |
<head> | |
<meta charset="UTF-8"> | |
<link rel="stylesheet" href="https://cdn.rawgit.com/martine/webtreemap/a2fa353833eca1a4821ba4c93fb6a7d546aed02a/webtreemap.css"> | |
<title>angular-downloadsvg-directive.min.js - Source Map Explorer</title> | |
<style> | |
html, body { | |
height: 100%; | |
} | |
body { | |
font-family: sans-serif; | |
font-size: 0.8em; | |
margin: 0; | |
} | |
#map { | |
top: 10px; | |
bottom: 10px; | |
left: 10px; | |
right: 10px; | |
position: absolute; | |
cursor: pointer; | |
-webkit-user-select: none; | |
} | |
</style> | |
</head> | |
<body> | |
<div id='map'></div> | |
</body> | |
<script> | |
var tree = { | |
"node_modules/browserify/node_modules/browser-pack/_prelude.js": 479, | |
"lib/angular-downloadsvg-directive.js": 1094, | |
"../svgsaver/lib/svgsaver.js": 5883, | |
"../svgsaver/node_modules/copy-styles/lib/index.js": 879, | |
"../svgsaver/node_modules/copy-styles/node_modules/computed-styles/dist/index.js": 912 | |
}; | |
</script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script> | |
<script src="https://cdn.rawgit.com/martine/webtreemap/a2fa353833eca1a4821ba4c93fb6a7d546aed02a/webtreemap.js"></script> | |
<script> | |
function newNode(name) { | |
return { | |
name: name, | |
data: { | |
'$area': 0 | |
}, | |
children: [] | |
}; | |
} | |
var treeData = newNode('/'); | |
function addNode(path, size) { | |
var parts = path.split('/'); | |
var node = treeData; | |
node.data['$area'] += size; | |
parts.forEach(function(part) { | |
var child = _.find(node.children, function(child) { return child.name == part; }); | |
if (!child) { | |
var child = newNode(part); | |
node.children.push(child); | |
} | |
node = child; | |
node.data['$area'] += size; | |
}); | |
} | |
function addSizeToTitle(node, total) { | |
var size = node.data['$area'], | |
pct = 100.0 * size / total; | |
node.name += ' • ' + size.toLocaleString() + ' • ' + pct.toFixed(2) + '%'; | |
node.children.forEach(function(x) { addSizeToTitle(x, total) }); | |
} | |
for (var source in tree) { | |
addNode(source, tree[source]); | |
} | |
addSizeToTitle(treeData, treeData.data['$area']); | |
var map = document.getElementById('map'); | |
appendTreemap(map, treeData); | |
window.addEventListener('resize', function() { | |
appendTreemap(map, treeData); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment