[HN Gopher] Adding keyboard shortcuts to a 24 year-old governmen...
       ___________________________________________________________________
        
       Adding keyboard shortcuts to a 24 year-old government website with
       userscripts
        
       Author : thunderbong
       Score  : 71 points
       Date   : 2024-02-20 11:25 UTC (11 hours ago)
        
 (HTM) web link (wcedmisten.fyi)
 (TXT) w3m dump (wcedmisten.fyi)
        
       | willdr wrote:
       | I'd probably reach for playwright to do something like this. The
       | form seems structured enough that you could easily hack something
       | together.
        
       | kibwen wrote:
       | Bookmarklets/userscripts are such an excellent showcase of why
       | the web is so empowering to users and why native apps are such a
       | depressing, user-hostile regression.
       | 
       | Example from literally just this morning: I'm organizing an event
       | and the venue wanted an attendee list in Excel format. The event
       | is organized through meetup.com, which has been "app-ifying"
       | their site for years now, which is to say, turning it to useless
       | crap. I went to the list of attendees for the event and tried to
       | copy-paste the 80-ish names so I could clean it up into a usable
       | list... but some cabbage-brained PM has apparently decided that
       | users shouldn't be allowed to copy-paste names out of the
       | attendees list (literally all the text on the page _except_
       | attendee names was selectable). Fortunately it was trivial to
       | whip up a tiny script to circumvent this, and made me appreciate
       | how annoying it would be to transcribe this all by hand if all I
       | had was a useless locked-down mobile app.
        
         | mdrzn wrote:
         | Cases like this highlight the importance of having accessible
         | OCR tools, such as the one in Windows PowerToys which I learned
         | to love. With just a shortcut you can extract text from any
         | window, effectively bypassing browser or app limitations.
        
           | crimsontech wrote:
           | This is also built in to macOS and iOS now too. Such a handy
           | feature that I find myself using a lot.
        
             | dimator wrote:
             | How does one do this in macos?
        
               | solardev wrote:
               | I thiiiiiiiiink it's technically part of Preview (you can
               | paste it into that app after you take a screenshot):
               | https://support.apple.com/guide/preview/interact-with-
               | text-i...
               | 
               | I don't THINK there is a way to do it straight from the
               | snipping tool, but someone correct me if I'm wrong.
               | 
               | Edit: Personally I use the paid Cleanshot app, which is
               | not only great for OCR but all sorts of screenshots,
               | videos, and annotations: https://cleanshot.com/ You just
               | drag a box around the text, click "OCR", and it gets
               | copied into your clipboard. I find it easier & faster
               | than having to deal with Preview.
               | 
               | I think the free Shottr does the same: https://shottr.cc/
        
               | reaperducer wrote:
               | _I don 't THINK there is a way to do it straight from the
               | snipping tool, but someone correct me if I'm wrong._
               | 
               | It can be done from the screenshot tool. Take the
               | screenshot, and an icon will appear in the lower-right
               | corner of the preview. Click that icon and it selects all
               | of the text in the preview.
               | 
               | If you don't want all to select all of the text in the
               | window, just select the text in the image the same way
               | you'd select text in any other program.
               | 
               |  _I find it easier & faster than having to deal with
               | Preview._
               | 
               | OCR is system-wide on macOS without Preview.
        
               | solardev wrote:
               | Great, thanks for the explanation!
        
               | 0cf8612b2e1e wrote:
               | On Linux, I created a little script which uses maim to
               | capture a user selected screen region, save that to a
               | file, run tesseract, and dump the output to stdout. Since
               | it is all digital (minus weirdo fonts) the OCR should be
               | perfect.
        
               | reaperducer wrote:
               | _How does one do this in macos?_
               | 
               | On recent Macs, it's automatic in most programs,
               | including Mail, Preview, Quickview, and others. Just
               | hover your pointer over text in an image, and if the
               | computer recognizes it, you get a text cursor so you can
               | select the text. No extra software needed.
               | 
               | If it's a language you can't read, you can often [?]click
               | the selected text and it will be translated into the
               | language of your choice.
        
               | lancesells wrote:
               | It's in the last two versions of macOS. You can grab text
               | off of pretty much anything (with text). I've
               | occasionally found it annoying when I'm trying to drag
               | and drop an image that contains text but it's very useful
               | and seamless.
        
         | BlueTemplar wrote:
         | Isn't the distinction instead between open source and closed
         | source ? (With minified JavaScript counting as "closed" for
         | most intents and purposes.)
        
           | kibwen wrote:
           | I didn't need the source to fix the issue here, I can
           | trivially introspect and open a console to modify the page
           | with a single keypress.
        
           | roywiggins wrote:
           | You can usually extract text straight from the DOM (barring
           | special efforts to obfuscate it), it doesn't matter much if
           | there's layers of opaque JavaScript generating it.
        
       | Leftium wrote:
       | I think there is a far more effective method in this situation:
       | the FDA has mercifully made this data available for download as
       | plain text files: https://www.fda.gov/medical-
       | devices/510k-clearances/download...
       | 
       | So I would download all 6 files, then write a script/app to fuzzy
       | search/filter/transform those files as needed. No need to
       | manually scrape using the web form!
       | 
       | For example, here is line 65457 from PMNLSTMN.ZIP. It seems the
       | OP is interested in searching the last column and outputting the
       | first column:                   K202167|Cordis
       | Corporation|...|N||Brite Tip Radianz Guiding Sheath
        
         | wcedmisten wrote:
         | Author here!
         | 
         | That's true, and I actually used that dump[1] and OCR to
         | automate about 80% of this project. The manual data entry was
         | only required for the 20% that couldn't be found automatically.
         | 
         | Since this was just to fill in the gaps, I figured there would
         | be diminishing returns on re-implementing fuzzy search on the
         | data, but adding shortcuts to my manual workflow took less time
         | for a reasonable speedup.
         | 
         | [1] I also used the JSON dump of this data that the FDA
         | provides here: https://open.fda.gov/apis/device/510k/download/
        
           | Leftium wrote:
           | Thank goodness~ I imagined the author doing nothing but
           | manually scraping data from this web form for an entire year.
        
       | edarchis wrote:
       | Nice work and thanks for sharing, it's a good source of
       | inspiration for similarly antiquated government web sites.
        
       | TheJoeMan wrote:
       | I use this website for work. That search page is certainly dated,
       | but may I suggest there is actually the very similar Devices@FDA:
       | https://www.accessdata.fda.gov/SCRIPTS/cdrh/devicesatfda/ind...
       | 
       | The Devices@FDA is a single search box, while the one the author
       | used breaks out by field, more useful if you know exactly what
       | company name, etc. you're looking for. Also, Devices@FDA searches
       | both 510(k) and PMA's (the other 1%).
       | 
       | As a side note, for a while the Devices@FDA page was not linked
       | from the "databases" root https://www.fda.gov/medical-
       | devices/device-advice-comprehens.... I emailed them at the
       | comments and feedback link, and they added it within days!
        
         | wcedmisten wrote:
         | Author here! I didn't know about that Devices@FDA search,
         | thanks for the tip!
         | 
         | My goal for this project is to create a free/open source
         | website that enhances this 510k data based on the public data
         | dumps. I'd be very interested in hearing about how you use the
         | current website for work, and what improvements would be useful
         | for you! My email is in my about page.
         | 
         | The major enhancement is to show predicate device information
         | as a first-class property of each 510k, since right now the
         | data is buried inside various PDFs.
        
       | Keep3893 wrote:
       | We can also Userscripts to update old goverment websites, with
       | new informations! Like updating vaccinations policies!
        
       | mkl wrote:
       | I do this sort of thing a lot, for a bunch of websites I need to
       | use for work. I make tables sortable with DataTables, add
       | buttons, add important info, fix formatting, make things
       | clickable, move things around, sometimes I add whole new UIs. I
       | mainly use TamperMonkey, as I like the built-in editing more than
       | ViolentMonkey (though it still has its problems).
        
       | glaucon wrote:
       | "... it seems to be built from a 1995 tool called Adobe
       | ColdFusion"
       | 
       | As an old guy I have to say the "here be dragons" tone of this
       | phrase made me laugh. I never used it myself but there was a time
       | when ColdFusion was huge.
        
         | Dwedit wrote:
         | In 1995, it wasn't an Adobe product. Macromedia was a thing.
        
       | 39 wrote:
       | Website keyboard "shortcuts" are the worst, they always break
       | other things to give a very non standard means to mutate state.
        
         | 0cf8612b2e1e wrote:
         | Looking at all of the sites who have taken over Ctrl-K which is
         | the browser shortcut to jump to the search bar.
        
       ___________________________________________________________________
       (page generated 2024-02-20 23:01 UTC)