Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.
mfaizsyahmi edited this page Nov 27, 2017 · 5 revisions

mfs-js-console is a GM userscript that adds a little CLI on pages

Table of Contents

Feature summary

Core functionality includes:

  • argument parsing with "quoted strings", -key values and -switches
  • most-recently used (MRU) list
  • variables
    • variables set to page element attributes using CSS/jQuery/querySelector selector syntax
    • Support for JSON values
    • Append and add value to existing variable
    • Push and pop variable stack
    • Dynamic variables such as the current location and time
    • Get to the children of array and object values with dot and bracket notation
  • aliases
    • passing of alias arguments to the alias commands
  • saving and resetting of variables
  • variable substitution in commands[note]
  • global mode. console output from any page to all pages with console set to global mode.
  • custom command support
  • conditional processing (if command)
    • regex matching
    • chainable logic with multiple "if"s on a single command
  • loops (for command)
    • index loops, with optional variable step
    • loop through values in an array/object
  • match and replace strings with regular expression syntax
  • partial support for markdown links in echo (echomd)
    • Support for clickable link which execute commands
  • some commands support output to a variable
[note]: functionality toggled using variable value

Features added with commands:

  • list images on page
    • filter by min and max sizes
    • display as thumb
  • generate a list of links with sequential names e.g. 1.jpg to 10.jpg
  • download images on page, or a list of images with sequential names (see above)
  • list links on a page
    • filter out the links by domain name, path, etc.
  • play HTML5-supported audio and video files
  • sequential and timed batch execution. Used with audio-video, for example, to write the lyrics as the song plays
  • print contents of text files onto the console
  • DOM spy

Commands

Main page: Commands

Planned features

  • math expression evaluation
  • autoexec file
  • DOM manipulation
  • GUI icon binds to commands

Usage notes

  • Press the ~ key to bring up the console. hold ctrl key to override. (currently buggy)
  • Clicking on a command in the console log (defaults to green colour) copies it to the input text box.
  • Type ``help``.
Clone this wiki locally