Skip to content

Instantly share code, notes, and snippets.

@kandros
Created May 25, 2015 20:59
Show Gist options
  • Save kandros/f9de71fa598a4f36b298 to your computer and use it in GitHub Desktop.
Save kandros/f9de71fa598a4f36b298 to your computer and use it in GitHub Desktop.
Bookmarklet for my copywriter to easely check stuff without having to search inside source code
javascript: ( function() {
var text = "";
var whiteList = [
"description",
"keywords",
"og:title"
];
text += "Title:\n" + document.title + "\n\n";
var metas = document.getElementsByTagName('meta');
for (var x = 0, y = metas.length; x < y; x++) {
var meta = metas[x];
var name = meta.name.toLowerCase();
var prop = meta.getAttribute('property');
var xxx;
if (name.length > 1) {
xxx = name;
} else if (prop && prop.length > 1) {
xxx = prop;
} else {
xxx = "";
}
if (whiteList.indexOf(xxx) > -1) {
text += xxx + ":\n " + meta.content + "\n\n";
}
}
alert(text);}) ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment