A browser extension for opening a Morphic MYOB link in an existing tab.
Install grunt-cli globally:
npm install -g grunt-cli
Install required dependencies:
npm install
For testing the extension in the browser, you'll need to ensure that the 3rd party dependencies have been copied to the source directory. This is performed by the following grunt task:
grunt loadDependencies
The above grunt task is included in the necessary npm scripts, but if you are not using those, you may need to call it manually.
When you are ready to release, or need to manually test in some browsers, you'll want to package the extension. This
can be done manually by zipping the contents of the src
directory. However, you can also use the following NPM script
to generate the package and output to the build
directory.
npm run build
Requirements:
Using web-ext you are able to run an instance of the extension in Chrome and Firefox from the local source code. web-ext will even monitor changes and update the extension on the fly.
# deploy the local source code as extensions in Firefox and Chrome
npm run dev
#Press R to reload
#Press Ctrl-C to quit
See Temporarily Install Firefox and Chrome's Gettings Started Tutorial for information on how to manually install in development extensions into the browsers. If you require a packaged version, you can run a build first and source it from the build
directory. Otherwise you can install the code directly from the src
directory.
You can bring up the debugger by going to "about:debugging" in the Awesomebar (Address Bar).
See the Debugging documentation provided in the Firefox Extension Workshop for more details.
To launch the debugger and view reported errors, open the extensions page in Chrome and find the
listing for this extension. If any errors have occurred, an errors
link will be present, and will open to a log of the
errors reported. To open the debugger click on the bakground page
link (NOTE: You may need to enabled Developer Mode
first.).
See the Debugging Extensions documentation for more information.
Run all the tests and generate reports which can be viewed in the browser from the "reports" directory:
npm test
The Open in Same Tab extension will allow most URLs to pass through and behave as normal. However, it will intercept
URLs that appear like following identifiers in the domain name: opensametab.morphic.org
, refreshsametab.morphic.org
.
In both cases the extension will intercept the URL, remove the identifier and pass along the balance. If there are no
existing tabs/windows open to the requested URL, the URL is handled as normal. If one already exists it will open to
that existing tab instead. In the case of refreshsametab.morphic.org
, it will also trigger the page to reload.
For example, http://opensametab.morphic.org/en.wikipedia.org/wiki/URL
will open https://en.wikipedia.org/wiki/URL
.
When using web-ext for testing the extensions, a new instance of the browser is created. You may not be able to launch URLs into this particular instance from outside of the browser, even if it is the default browser. The main instance of the browser may load instead. If this happens, you'll need to test URLs by directly inputting them into the address bar. You may also wish to manually load the extensions instead.
To ensure that syntax, code and configuration are written correctly please run the linting tasks.
# Run eslint
grunt lint
# Run eslint and web-ext linting
npm run lint