[Chrome Tricks]Using snippets in Chrome !!!!!!

gala

Broken In
Have U Ever Got Stuck In a situation when u need to run a code in the Browser [chrome in this case]
well fear Not because,

Chrome provides a "snippets" bucket within the developer tools which allows you to manage small (or large) scripts that can be injected into a page. Scripts can do things like injecting jQuery into a page, log all globally defined variables, or print out all colors from computed styles used in elements on the page.
*i.imgur.com/mVhEy8I.png



See I Needed SHA512 encryption script
to encrypt something with SHA512 there are two methods
  • I copy past the Code every time I needed to use It or
  • I Could just save in snippets and use it later

Create snippet

To create a snippet, open the Sources panel, click on the Snippets tab, right-click within the Navigator, and then select New.
*i.imgur.com/AzZIYTi.png


Enter your code in the editor. When you have unsaved changes, your script name has an asterisk next to it, like in the screenshot below. Press Command+S (Mac) or Ctrl+S (Windows, Linux) to save your changes.

*i.imgur.com/dajUTdP.png


Run snippet
There are three ways to run your snippet:

  • Right-click on the snippet filename (in the pane on the left that lists all your snippets) and select Run.
  • Click the Run button ().
  • Press Command+Enter (Mac) or Ctrl+Enter (Windows, Linux).
To evaluate a portion of your snippet in the Console, highlight the portion, right-click anywhere in the editor, and select Evaluate in Console, or use the keyboard shortcut Command+Shift+E (Mac) or Ctrl+Shift+E (Windows, Linux).
*i.imgur.com/X5W8UNU.png


There and many things you Can do with snippets
some Great snippets you GitHub - bgrins/devtools-snippets: A collection of helpful snippets to use inside of browser devtools
 
Top Bottom