Skip to content

Instantly share code, notes, and snippets.

@jibbius
Last active June 1, 2016 04:05
Show Gist options
  • Save jibbius/6b88d1c7e445532fa60cc6ee5dae0a21 to your computer and use it in GitHub Desktop.
Save jibbius/6b88d1c7e445532fa60cc6ee5dae0a21 to your computer and use it in GitHub Desktop.
Script that can be run from Inspector Console; Flattens Axure Wireframe site into a text file with hyperlinks to pages (can be side-loaded into other tooling if required).
// Get Sitemap
var axureNodes = $axure.document.sitemap.rootNodes;
// Parse sitemap for URLs
var key = 'url';
var normalisedAxureNodes = function getValues(obj, key) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getValues(obj[i], key));
} else if (i == key) {
objects.push(obj[i]);
}
}
return objects;
}(axureNodes, key);
// Prepare file contents
var myfilecontents = function buildTextFile(my_values){
var textfilecontents = '';
for (var i in my_values) {
if(my_values[i] != '')
textfilecontents += 'http://' + window.location.hostname + '/' + my_values[i] + '\n';
}
return textfilecontents;
}(normalisedAxureNodes);
// Open file in browser
var url = 'data:text;charset=utf8,' + encodeURIComponent(myfilecontents);
window.open(url, '_blank');
window.focus();
@jibbius
Copy link
Author

jibbius commented Jun 1, 2016

The output of this script can be fed into tooling such as;

  • WGET (to download static html), or
  • GetThemAll (to download screenshots)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment