Skip to content

Commit

Permalink
further documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
asanvicentec committed Jun 27, 2024
1 parent 12dae6e commit b68b430
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# 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.

## 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/`
7 changes: 5 additions & 2 deletions src/scripts/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ if (tab) {
tab.childNodes.forEach((item, index) => {
if (item.nodeName.toLowerCase() === "span") {

const score = item.firstChild!.textContent;
const note = item.firstChild!.textContent;
let spacesToRemove = item.firstChild!.textContent.substring(1).length;

item.firstChild!.textContent = solfegeDictionary[score[0].toLowerCase()] + item.firstChild!.textContent.substring(1)
// Conversion
item.firstChild!.textContent = solfegeDictionary[note[0].toLowerCase()] + item.firstChild!.textContent.substring(1)

if (item.lastChild!.classList.contains("chord-bass")) {
item.lastChild!.textContent = solfegeDictionary[item.lastChild!.textContent.toLowerCase()] + item.lastChild!.textContent.substring(1)
spacesToRemove += -Math.abs(item.lastChild!.textContent!.length) + 1;
}

// Remove spaces
if (tab.childNodes[index + 1].nodeName === "#text") {

spacesToRemove += -Math.abs(item.firstChild!.textContent!.length) + 1;
Expand Down
1 change: 0 additions & 1 deletion src/scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//#region Copy to clipboard
// Helped by: https://stackoverflow.com/a/30810322
export async function copyTextToClipboard(text: string) {
await navigator.clipboard.writeText(text).then(function () {
console.log("Copied successfully!");
Expand Down

0 comments on commit b68b430

Please sign in to comment.