Bookmarklets
A bookmarklet is a little bit of JavaScript that you can use as a bookmark in your browser to perform context-sensitive tasks. To use one copy the text in the code block, right-click in your browser’s bookmarks bar to add a link, paste the code into URL field, and name it accordingly. Clicking on the bookmark should run the code.
Link to highlighted text
Code Block |
---|
|
javascript:void(location.hash=`#:~:text=${encodeURIComponent(window.getSelection())}`) |
This uses the very new text fragments feature (only available in Chrome and Edge as of this writing) to link to the currently highlighted text. You should see #:~:text=
in your browser’s URL bar after running this, after which you can share that URL by copy and paste.
View on test
Code Block |
---|
|
javascript:location=location.href.replace(/https:\/\/sf.gov/g,'https://test-sfgov.pantheonsite.io') |
Use this to view a URL on sf.gov on the test environment at test-sfgov.pantheonsite.io. You can run this on pages with sf.gov anywhere in the URL, which can be helpful when you want to compare production and test environments run through external services, like /wiki/spaces/DS/pages/2303918209 (see also: “WTF”, below).
Forms
What the form (WTF)
Code Block |
---|
javascript:location.href=`https://formio-sfds.herokuapp.com/api/wtf?url=${location.href}` |
Use this bookmarklet to view the /wiki/spaces/DS/pages/2303918209 analysis of a form.io form page on sf.gov (or any other Pantheon deployment URL).
Code Block |
---|
|
javascript:location=`https://formio-sfds.herokuapp.com/api/translate?url=${location.href}` |
Use this bookmarklet to see the translation view of a form, which collects all form inputs into a single page, disables conditionals, and prompts you to log in with Phrase to see translations in context.
Code Block |
---|
|
javascript:location=`https://formio-sfds.herokuapp.com/api/preview?url=${location.href}` |
...