-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change from Ultimate Guitar integration to Freetar (#2)
* first iteration * new logic, refactor * remove package, update readme * add release workflow * refactor for freetar site * fix copy to clipboard from popup * further documentation
- Loading branch information
1 parent
54ad0ef
commit 0360578
Showing
12 changed files
with
730 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# UltimateNotationConvert | ||
extension to convert from Letter notation to Solfège notation for ultimate-guitar website | ||
# UltimateNotation | ||
Convert notes to Solfège representation on [Freetar](https://freetar.de/) site. This extension was originally meant to be used on the original Ultimate Guitar, but HTML is way harder to edit there, also Freetar removes a lot of UG bloat. | ||
|
||
Right now this project acts as a demonstration of integrating Parcel bundler in a Chrome extension and develop using TypeScript, | ||
as the script's logic is incomplete, and there are some issues involving clipboard API. | ||
## Disclaimer | ||
This extension has been tested, but it may not cover all use cases, if you happen to use it and find an error, please let me now. | ||
|
||
# For developers | ||
When viewing changes on-the-fly when developing, you can run `npm run start` and load the uncompressed extension | ||
by pointing to the dist folder in `chrome://extensions/` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* Experiment to to give a visual aid and to help cases where two notes are too close togheter after conversion (nasty workaround) | ||
To inject the CSS, add the following to the content script object matching freetar site: | ||
"css": ["assets/styles/content.css"] | ||
*/ | ||
|
||
[data-original="C"] { | ||
color: rgba(235, 35, 15, 1); | ||
} | ||
|
||
[data-original="D"] { | ||
color: rgba(252, 146, 8, 1); | ||
} | ||
|
||
[data-original="E"] { | ||
color: rgba(254, 251, 1, 1); | ||
} | ||
|
||
[data-original="F"] { | ||
color: rgba(2, 141, 2, 1); | ||
} | ||
|
||
[data-original="G"] { | ||
color: rgba(115, 212, 254, 1); | ||
} | ||
|
||
[data-original="A"] { | ||
color: rgba(7, 24, 147, 1); | ||
} | ||
|
||
[data-original="B"] { | ||
color: rgba(82, 29, 144, 1); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import { CopyType } from "./scripts/enum"; | ||
import { copyTextToClipboard } from "./scripts/utils"; | ||
|
||
document.getElementById("copyBasicBtn")!.addEventListener("click", () => copySong(CopyType.basic)); | ||
document.getElementById("copyAdvancedBtn")!.addEventListener("click", () => copySong(CopyType.advanced)); | ||
document.getElementById("copyToClipboardBtn")!.addEventListener("click", () => copySong()); | ||
const resNode = document.querySelector("#result"); | ||
|
||
async function copySong(btnAction: CopyType) { | ||
const getContent = () => { | ||
return document.querySelector('.tab').innerText; | ||
} | ||
|
||
const [tab] = await chrome.tabs.query({active: true, lastFocusedWindow: true}); | ||
|
||
await chrome.tabs.update(tab.id, { active: true }); | ||
await chrome.windows.update(tab.windowId, { focused: true }); | ||
|
||
const response = await chrome.tabs.sendMessage(tab.id, {copySong: btnAction}); | ||
async function copySong() { | ||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { | ||
chrome.scripting.executeScript({ | ||
target: { tabId: tabs[0].id }, | ||
func: getContent | ||
}, (result) => { | ||
copyTextToClipboard(result[0].result); | ||
resNode!.innerHTML = "Copied successfully!" | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters