Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.






                /* Machine-Readable Entity ID Bookmarklet */
	Welcome! Thanks for checking this out. This JavaScript bookmarklet will help you easily find the MREID (when available) on a Google SERP. Questions can be left as comments at:

// First, try to grab the DOM  element that contains the MREID. NOTE: This _will_ break when/if Google changes the markup of their SERPs. 
var knowledgeNode = document.querySelector("#rhs .kno-ftr > .kno-fb > div[data-async-context]"); 
// Second, check that something was actually found above. If we try this on a null variable, we'll have issues so we need to avoid doing that. 
if (knowledgeNode !== null) {
	// A. cardID will be equal to a cleaned up MREID. 
	var cardId = unescape(document.querySelector("#rhs .kno-ftr > .kno-fb > div[data-async-context]").getAttribute("data-async-context").split("card_id:")[1].split(";")[0]);
	// B. Print a success message to the console. 
	console.log("%cSuccess! An MREID was found!","color: green; font-size: large");
	console.log("The machine-readable entity ID for\nthis search entitiy is " + cardId);
	// C. Print a success message to the SERP itself. So meta!
	var node = document.createElement("strong");
	var text = document.createTextNode("MREID is " + cardId + " | ");
	var link = document.createElement("a");
	link.setAttribute("href","" + cardId);
	var linkText = document.createTextNode("Check via Google Trends"); 

	// D. Worth noting, we finde the element where Google reports "About X results" and append our message to that. 
// Third (AKA, fallback "Second"), we do something if no MREID was found on the SERP.
else if (knowledgeNode == null) {
	// See B above.
	console.log("%cSorry! No MREID found!","color: red; font-size: large");
	console.log("No machine-readable entity ID was found on this page. This is likely not an entity Google recognizes.");
	// See C above.
	var node = document.createElement("strong");
	var text = document.createTextNode("No MREID found");
	// See D above.