Graham Quince Posted April 23, 2021 Share Posted April 23, 2021 Years ago, Chris Smith made a couple of bookmarklets to easily grab a site's UUID and another one for its Alias. From Wikipedia: Quote 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'), l, r, s; 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; document.body.appendChild(p); if (document.body.createTextRange) { r = document.body.createTextRange(); r.moveToElementText(p); r.select(); } else if (window.getSelection) { s = window.getSelection(); r = document.createRange(); r.selectNodeContents(p); s.removeAllRanges(); s.addRange(r); } 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) { p.remove(); } else { document.body.removeChild(p); } }); 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 More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now