npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

safari-ctl

v0.2.0

Published

A Command Line Tool to control Safari for MacOS. (Browsing/FillingForm/GetSetCopyURL/JavascriptInjection/GetTitle/Search)

Downloads

6

Readme

safari-ctl - Command Line Tool To Control Safari for MacOS

A Command Line Tool to Control Safari for MacOS. (Browsing/FillingForm/GetSetCopyURL/JavascriptInjection/GetTitle/Search)

### Get current URL on Safari

$ safari-ctl
https://github.com

### Copy current URL on Safari to the clipboard

$ safari-ctl -s

### Navigating by command line

$ safari-ctl -m
# marks all <a> with numbers

$ safari-ctl -a 32
# click 32'th <a>

$ safari-ctl -b
# history back

### Filing form

$ safari-ctl -M
# marks all <input> with numbers

$ safari-ctl -A 0 -I 'Japan'
# Fill 0th input with 'Japan'

$ safari-ctl -A 1
# click 1st input button

### Javascript Injection

$  safari-ctl -j 'document.getElementById("sb_form_q").value="Japan"'
Japan

Install

npm i -g safari-ctl

You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use some features.

Command line

safari-ctl [options]

A Command Line Tool to control Safari for MacOS. (Browsing/FillingForm/GetSetCopyURL/JavascriptInjection/GetTitle/Search)

Copyright (C) 2019-2019 @kssfilo(https://kanasys.com/gtech/)

Prepare

(*)You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use some features.

Options

- h              show this help
- ?              
- d              debug mode
- p              print current Safari's URL(default)
- t              print current Safari's title
- g              print selected string on current Safari's tab
- c              copy current Safari's URL into the clipboard
- s <URL>        set <URL> to Safari's active tab
- S <URL>        same as -s but set focus to Safari
- q <query>      search <query> to Safari's active tab
- Q <URL>        same as -q but set focus to Safari
- m              marks all <a> link with number to click by next -a command(*)
- a <number>     click <number> link. you can know link number by -m command(*)
- M              marks all <input> with number to click/set by next -A command(*)
- A <number>     click <number> input. you can know input number by -M command(*)
- I <string>     works with -A, Input <string> instead of click. for filling form(*)
- b              history back(*)
- f              history forward(*)
- n              scroll to next page(*)
- N              scroll to previous page (*)
- j <javascript> run <javascript> on active tab(*)
- J <javascript> same as s but set focus to Safari(*)
	

Examples

Get current URL on Safari

$ safari-ctl
https://github.com

Copy current URL on Safari to the clipboard

$ safari-ctl -s

Open specified URL on Safari

$ safari-ctl -s 'http://github.com'
# withoug focus

$ safari-ctl -S 'github.com'
# with focus(omiting scheme->appends https://)

Gets window title

$ safari-ctl -t

Navigating by command line

$ safari-ctl -m
# marks all <a> with numbers

$ safari-ctl -a 32
# click 32'th <a>

$ safari-ctl -b
# history back

$ safari-ctl -M
# marks all <input> with numbers

$ safari-ctl -A 0 -I 'Japan'
# Fill 0th input with 'Japan'

$ safari-ctl -A 1
# click 1st input button

Searchs Bing with word "Japan" (JavaScript injection)

$  safari-ctl -s 'https://bing.com'
$  safari-ctl -j 'document.getElementById("sb_form_q").value="Japan";document.getElementById("sb_form_go").click()'

Print string in Bing search form

$  safari-ctl -j 'document.getElementById("sb_form_q").value'
Japan

Change Log

  • 0.1.x: beta release
  • 0.2.0: suppress result at anchor click/history forward/scroll

Idea

  • marking buttons