Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: can add link to a script and inject it #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ With Injecta, you can now do this without having to copy/paste scripts into the

![screenshot][screenshot]

Click the button on the top right, select your scripts, then hit "Inject".
Click the button on the top right, select your scripts, enter desired CDN urls, then hit "Inject".

## License

Expand Down
Binary file modified assets/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Injecta",
"version": "0.0.2",
"version": "0.0.3",
"manifest_version": 2,
"description": "Inject JavaScript libraries into your current page.",
"homepage_url": "https://ian.pw",
Expand Down
4 changes: 4 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ <h1>Inject Libraries</h1>
<p>Select the libraries you wish to inject below.</p>

<ul id="libraryList"></ul>
<form id="custom-script">
Custom Script:
<input type="text" id="script-url">
</form>
<button id="inject">Inject!</button>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/popup.js"></script>
Expand Down
11 changes: 11 additions & 0 deletions scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ $(function() {
+ '</li>';
}).join(''));

$('#custom-script').submit((e) => {
var url = $('#script-url').val();
$('#libraryList').append(
`<li><input type="checkbox" id=${url} value=${url} checked>` +
`<label for=${url}>${url}</label></li>`
);

$('#script-url').val('')
return false;
})

$('#inject').click(function() {
var selectedLibs = [];
$('#libraryList li').each(function(el) {
Expand Down