Skip to content

Commit d35d998

Browse files
committed
make spare chars have click listeners too
1 parent 1ca8abd commit d35d998

12 files changed

+1878
-1863
lines changed

README.md

+38-28
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
1-
# funny-character-maker
2-
3-
Use combining diacritic characters to create funny and unique characters
4-
5-
## How to use
6-
7-
- Press any button and the character inside it will be appended to the end of the text box
8-
- Press the random button to select a random character (It will only select a character that has a checked heading)
9-
- Select the checkbox next to "Loop string" this makes characters go into the loop string box, pressing "Add Loop String" will then add all the characters in to loop string to the main textbox
10-
- You can change how many characters are added with the top-most text box (Note: Normal buttons, random and loop string are all affected by this)
11-
- You can access more characters by typing `debugAddSpareChars()` into console (Note: These characters don't display correctly, so they were omitted)
12-
13-
## What's in this repo
14-
15-
All the different categories of characters have been sorted into their own files, as well as a master file with all the characters. All these files are sorted in order of as they appear in Unicode, and formatted as HTML Decimal
16-
17-
- [Up Characters](chars/up.txt)
18-
- [Down Characters](chars/down.txt)
19-
- [Overlap Characters](chars/overlap.txt)
20-
- [Join & Misc Characters](chars/join.txt)
21-
- [Spare Characters](chars/spare.txt)
22-
- [All Characters (HTML)](chars/AllChars_HTML.txt)
23-
- [All Characters (Unicode)](chars/AllChars_Unicode.txt)
24-
25-
## Credits
26-
27-
- [R74n.com](https://c.r74n.com/combining) - Original concept and some characters
28-
- [UnicodePlus](https://unicodeplus.com/) - Got the remaining characters from here
1+
# funny-character-maker
2+
3+
Use combining diacritic characters to create funny and unique characters
4+
5+
## How to use
6+
7+
- Press any button and the character inside it will be appended to the end of the text box
8+
- Press the random button to select a random character (It will only select a character that has a checked heading)
9+
- Select the checkbox next to "Loop string" this makes characters go into the loop string box, pressing "Add Loop String" will then add all the characters in to loop string to the main textbox
10+
- You can change how many characters are added with the top-most text box (Note: Normal buttons, random and loop string are all affected by this)
11+
- You can access more characters by typing `debugAddSpareChars()` into console (Note: These characters don't display correctly, so they were omitted)
12+
13+
## What's in this repo
14+
15+
All the different categories of characters have been sorted into their own files, as well as a master file with all the characters. All these files are sorted in order of as they appear in Unicode, and formatted as HTML Decimal
16+
17+
- [Up Characters](chars/up.txt)
18+
- [Down Characters](chars/down.txt)
19+
- [Overlap Characters](chars/overlap.txt)
20+
- [Join & Misc Characters](chars/join.txt)
21+
- [Spare Characters](chars/spare.txt)
22+
- [All Characters (HTML)](chars/AllChars_HTML.txt)
23+
- [All Characters (Unicode)](chars/AllChars_Unicode.txt)
24+
25+
## Running locally
26+
27+
Set up a http server to allow for fetching of the char files, below is an example for Node.js
28+
29+
```sh
30+
npm -g http-server
31+
http-server
32+
# Then click the provided link
33+
```
34+
35+
## Credits
36+
37+
- [R74n.com](https://c.r74n.com/combining) - Original concept and some characters
38+
- [UnicodePlus](https://unicodeplus.com/) - Got the remaining characters from here

button.js

+34-38
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
1-
/**
2-
* Adds the character buttons to the specified selector
3-
* @param {*} path path to the list of characters
4-
* @param {*} selector css selector for where the buttons go
5-
*/
6-
function addBtns(path, selector) {
7-
fetch(path)
8-
.then(response => response.text())
9-
.then(fileContents => {
10-
const lines = fileContents.split('\n');
11-
lines.forEach(function(line) {
12-
createButton(line.trim());
13-
});
14-
})
15-
16-
function createButton(content) {
17-
const button = document.createElement('button');
18-
button.innerHTML = content;
19-
document.querySelector(selector).appendChild(button);
20-
}
21-
}
22-
23-
addBtns('./chars/up.txt', '.buttons > div:nth-child(1)')
24-
addBtns('./chars/down.txt', '.buttons > div:nth-child(2)')
25-
addBtns('./chars/overlap.txt', '.buttons > div:nth-child(3)')
26-
addBtns('./chars/join.txt', '.buttons > div:nth-child(4)')
27-
28-
/**
29-
* Adds the characters that don't display correctly
30-
* Can only be called via console
31-
*/
32-
function debugAddSpareChars() {
33-
const div = document.createElement("div");
34-
const h2 = document.createElement("h2");
35-
h2.innerText = "Spare"
36-
div.appendChild(h2);
37-
document.querySelector(".buttons").appendChild(div);
38-
addBtns('./chars/spare.txt', '.buttons > div:nth-child(5)')
1+
/**
2+
* Adds the character buttons to the specified selector
3+
* @param {*} path path to the list of characters
4+
* @param {*} selector css selector for where the buttons go
5+
*/
6+
function addBtns(path, selector) {
7+
fetch(path)
8+
.then(response => response.text())
9+
.then(fileContents => {
10+
const lines = fileContents.split('\n');
11+
lines.forEach(function(line) {
12+
createButton(line.trim());
13+
});
14+
})
15+
16+
function createButton(content) {
17+
const button = document.createElement('button');
18+
button.innerHTML = content;
19+
document.querySelector(selector).appendChild(button);
20+
}
21+
}
22+
23+
addBtns('./chars/up.txt', '.buttons > div:nth-child(1)')
24+
addBtns('./chars/down.txt', '.buttons > div:nth-child(2)')
25+
addBtns('./chars/overlap.txt', '.buttons > div:nth-child(3)')
26+
addBtns('./chars/join.txt', '.buttons > div:nth-child(4)')
27+
addBtns('./chars/spare.txt', '.buttons > div:nth-child(5)')
28+
29+
/**
30+
* Adds the characters that don't display correctly
31+
* Can only be called via console
32+
*/
33+
function debugAddSpareChars() {
34+
document.querySelector('.buttons > div:nth-child(5)').style.display = "block"
3935
}

0 commit comments

Comments
 (0)