Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Quick and Dirty Bookmarklet for the excellent https://github.com/KrofDrakula/microdata-tool

View microdata-tool-bookmarklet-pretty.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
// modified from code of "JQuerify" bookmarklet
// http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
(function() {
function z(a, b) {
var c = document.createElement("script");
c.src = a;
var d = document.getElementsByTagName("head")[0], e = !1;
c.onload = c.onreadystatechange = function() {
!e && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") && (e = !0, b(), c.onload = c.onreadystatechange = null, d.removeChild(c));
};
d.appendChild(c);
}
function d() {
a.innerHTML = msg, b.appendChild(a), window.setTimeout(function() {
typeof jQuery == "undefined" ? b.removeChild(a) : (jQuery(a).fadeOut("slow", function() {
jQuery(this).remove();
}), otherlib && ($jq = jQuery.noConflict()));
}, 2500);
}
var a = document.createElement("div"), b = document.getElementsByTagName("body")[0];
otherlib = !1, msg = "", a.style.position = "fixed", a.style.height = "32px", a.style.width = "220px", a.style.marginLeft = "-110px", a.style.top = "0", a.style.left = "50%", a.style.padding = "5px 10px", a.style.zIndex = 1001, a.style.fontSize = "12px", a.style.color = "#222", a.style.backgroundColor = "#f99";
 
//load jquery (if not already loaded)
if (typeof jQuery != "undefined") {
msg = "This page already using jQuery v" + jQuery.fn.jquery + "... proceeding", d();
} else {
 
typeof $ == "function" && (otherlib = !0), z("http://code.jquery.com/jquery-latest.min.js", function() {
return typeof jQuery == "undefined" ? msg = "Sorry, but jQuery wasn't able to load" : (msg = "This page is now jQuerified with v" + jQuery.fn.jquery, otherlib && (msg += " and noConflict(). Use $jq(), not $().")), d();
});
}
 
//load jquery.microdata.js
typeof $ == "function" && (otherlib = !0), z("https://github.com/KrofDrakula/microdata-tool/raw/master/jquery.microdata.js", function() {
return typeof $.microdata == "undefined" ? msg = "Sorry, but jquery.microdata.js wasn't able to load" : (msg = "jquery.microdata.js loaded " );
});
 
//load schema.js
typeof $ == "function" && (otherlib = !0), z("https://github.com/KrofDrakula/microdata-tool/raw/master/schemas.js", function() {
// didn't find what to test schema.js against
return typeof $.microdata == "undefined" ? msg = "Sorry, but schema.js wasn't able to load" : (msg = "schema.js loaded " );
});
 
})();
 
Owner

jsfiddle so that you can drag it directly to your bookmarks:
http://jsfiddle.net/peterhost/ZJfpL/14/embedded/result/

Hi! on some sites there is only alert about JQuery is loaded, but no microdata widget, and on another sites even no JQuery loaded alert - just nothing...:( on some https sites after clicking onto bookmarklet i get an alert, FF blocked unsecure content. Have you ever seen such misbehavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.