Jump to content
Graham Quince

Bookmarklet to get a Widget's content UUID

Recommended Posts

Years ago, Chris Smith made a couple of bookmarklets to easily grab a site's UUID and another one for its Alias.  

From Wikipedia:


A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser. Bookmarklets are unobtrusive JavaScripts stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. Bookmarklets are usually JavaScript programs.

https://en.wikipedia.org/wiki/Bookmarklet#:~:text=A bookmarklet is a bookmark,Bookmarklets are usually JavaScript programs.

Whenever I need to get a widget's content-uuid, I have to right-click on the widget, choose "inspect" or "inspect element" then scroll through the developer tools to spot the content uuid.  Which is the unique ID for that particular widget.  So I thought I'd take a look at Chris' code and see if I can adapt it:

javascript:$(".os_core:first").one("click", function(ev) {     
var i = jQuery(ev.originalEvent.target),         
p = document.createElement('p'),         
i.is(".sites_core") || (i = i.closest(".sites_core"));
l = i.data('controllers').sites_core.site.uuid;

var widget = jQuery(ev.originalEvent.target);
widget.is(".sites_widget") || (widget= widget.closest(".sites_widget"));
p.innerText = widget[0].dataset.contentUuid;   


if (document.body.createTextRange) {         
    r = document.body.createTextRange();
} else if (window.getSelection) {
	s = window.getSelection();
	r = document.createRange();
if (document.execCommand('copy')) {
	Frog.Controller.prototype.growl('UUID copied to clipboard', 'FrogOS Developer Tools', 'configmanager');     
} else {         
    window.prompt("Copy to Clipboard: Ctrl+C, Enter", l);    
if ('remove' in Element.prototype) {         
} else {         

I've left large parts as it was, but the "var widget" bits are the adaptation.  

To make:

  • Make a bookmark to a random page
  • Edit the bookmark
  • Replace the link with the code above

To use:

  • Click on the bookmarklet 
  • Click on the widget - the content-uuid will be copied to your clipboard.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...