Browse Source

update source code link

master
mark 3 years ago
parent
commit
fb47c5eea5
5 changed files with 273 additions and 273 deletions
  1. +20
    -20
      LICENSE
  2. +8
    -8
      README.md
  3. +72
    -72
      index.html
  4. +153
    -153
      script.js
  5. +20
    -20
      style.css

+ 20
- 20
LICENSE View File

@@ -1,21 +1,21 @@
MIT License
Copyright (c) 2019 mdszy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
MIT License
Copyright (c) 2019 mdszy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

+ 8
- 8
README.md View File

@@ -1,9 +1,9 @@
# et
just a dumb webpage thinger that generates mastodon-style emotes (or regional_designator-style emotes) based on text you give it
that's it
it's pretty dumb
# et
just a dumb webpage thinger that generates mastodon-style emotes (or regional_designator-style emotes) based on text you give it
that's it
it's pretty dumb
[i host it here](https://szy.io/et)

+ 72
- 72
index.html View File

@@ -1,72 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/et/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"
/>
<link
rel="stylesheet"
href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css"
/>
<link
rel="stylesheet"
href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css"
/>
<link rel="stylesheet" href="style.css" />
<script
type="text/javascript"
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
></script>
<script type="text/javascript" src="script.js"></script>
<script>
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(101203535);
</script>
<script async src="//static.getclicky.com/js"></script>
<title>emote text generator</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="column"><h1>Emote Text Generator</h1></div>
</div>
<div class="row">
<div class="column">
<form>
<fieldset>
<label for="emoteType">Text Emote</label>
<select id="emoteType">
<option value="hacker">Hacker Text (hacker)</option>
<option value="sm64">Super Mario 64 (sm64)</option>
<option value="lazer">Lazer Text (lazer)</option>
<option value="emoji">Emoji (regional_indicator)</option>
<option value="clapping">Clapping Text 👏</option>
<option value="spaced">S P A C E D T E X T</option>
<option value="bun">Bun Text</option>
</select>
<textarea placeholder="Input Text" id="inputBox"></textarea>
<textarea id="outputBox" disabled></textarea>
<div class="float-right" id="chars">Characters: 0</div>
<a class="button" id="copyButton">Copy</a>
</fieldset>
</form>
</div>
</div>
</div>
<div class="footer">
<a href="https://mastodon.technology/@mdszy">mark</a> made this.
<a href="https://gitlab.com/mdszy/et">source code is here</a>.
<a href="https://liberapay.com/mdszy/"
><img
class="liberapay-badge"
src="https://img.shields.io/liberapay/receives/mdszy.svg?logo=liberapay"
/>
</a>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/et/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"
/>
<link
rel="stylesheet"
href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css"
/>
<link
rel="stylesheet"
href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css"
/>
<link rel="stylesheet" href="style.css" />
<script
type="text/javascript"
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
></script>
<script type="text/javascript" src="script.js"></script>
<script>
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(101203535);
</script>
<script async src="//static.getclicky.com/js"></script>
<title>emote text generator</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="column"><h1>Emote Text Generator</h1></div>
</div>
<div class="row">
<div class="column">
<form>
<fieldset>
<label for="emoteType">Text Emote</label>
<select id="emoteType">
<option value="hacker">Hacker Text (hacker)</option>
<option value="sm64">Super Mario 64 (sm64)</option>
<option value="lazer">Lazer Text (lazer)</option>
<option value="emoji">Emoji (regional_indicator)</option>
<option value="clapping">Clapping Text 👏</option>
<option value="spaced">S P A C E D T E X T</option>
<option value="bun">Bun Text</option>
</select>
<textarea placeholder="Input Text" id="inputBox"></textarea>
<textarea id="outputBox" disabled></textarea>
<div class="float-right" id="chars">Characters: 0</div>
<a class="button" id="copyButton">Copy</a>
</fieldset>
</form>
</div>
</div>
</div>
<div class="footer">
<a href="https://mastodon.technology/@mdszy">mark</a> made this.
<a href="https://git.szy.io/mdszy/et">source code is here</a>.
<a href="https://liberapay.com/mdszy/"
><img
class="liberapay-badge"
src="https://img.shields.io/liberapay/receives/mdszy.svg?logo=liberapay"
/>
</a>
</div>
</body>
</html>

+ 153
- 153
script.js View File

@@ -1,153 +1,153 @@
function fallbackCopyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand("copy");
var msg = successful ? "successful" : "unsuccessful";
console.log("Fallback: Copying text command was " + msg);
} catch (err) {
console.error("Fallback: Oops, unable to copy", err);
}
document.body.removeChild(textArea);
}
function copyTextToClipboard(text) {
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(
function() {
console.log("Async: Copying to clipboard was successful!");
},
function(err) {
console.error("Async: Could not copy text: ", err);
}
);
}
var replaceMapping = {
hacker: {
regexp: /[A-Za-z]/g,
replace: ":hacker_$&:​",
downcase: true
},
lazer: {
regexp: /[A-Za-z0-9]/g,
replace: ":lazer_$&:​",
downcase: false,
preUpcase: true
},
sm64: {
regexp: /[A-Za-z0-9'"\?]/g,
replace: ":sm64_$&:​",
postReplaceMatch: [/"/g, /'/g, /\?/g],
postReplace: ["dblquote", "quote", "question"],
downcase: true
},
emoji: {
regexp: /[A-Za-z0-9#\*]/g,
replace: ":regional_indicator_$&:​",
postReplaceMatch: [
/regional_indicator_0/g,
/regional_indicator_1/g,
/regional_indicator_2/g,
/regional_indicator_3/g,
/regional_indicator_4/g,
/regional_indicator_5/g,
/regional_indicator_6/g,
/regional_indicator_7/g,
/regional_indicator_8/g,
/regional_indicator_9/g,
/regional_indicator_#/g,
/regional_indicator_\*/g,
/regional_indicator_b/g
],
postReplace: [
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"hash",
"keycap_star",
"b"
],
downcase: true
},
clapping: {
regexp: /\s/g,
replace: "👏",
postReplaceMatch: [/$/],
postReplace: ["👏"],
downcase: false
},
bun: {
regexp: /\s/g,
replace: " :bun: ",
postReplaceMatch: [/$/],
postReplace: [" :bun: "],
downcase: false
},
spaced: {
regexp: /./g,
replace: "$& ",
downcase: false
}
};
function updateOutput() {
let inString = $("#inputBox").val();
const selectedEmote = $("#emoteType").val();
const mapping = replaceMapping[selectedEmote];
const regexp = mapping.regexp;
const replaceStr = mapping.replace;
if(mapping.preUpcase === true) {
inString = inString.toUpperCase();
}
let outString = inString.replace(regexp, replaceStr);
if (mapping.downcase === true) {
outString = outString.toLowerCase();
}
if (mapping.postReplaceMatch) {
for (let i = 0; i < mapping.postReplaceMatch.length; i++) {
outString = outString.replace(
mapping.postReplaceMatch[i],
mapping.postReplace[i]
);
}
}
const finalString = outString.trim();
$("#chars").text("Characters: " + finalString.length);
$("#outputBox").val(finalString);
}
$(document).ready(function() {
$("#inputBox").on("input propertychange", function(e) {
updateOutput();
});
$("#emoteType").change(function(e) {
updateOutput();
});
$("#copyButton").on("click", function(e) {
copyTextToClipboard($("#outputBox").val());
});
});
function fallbackCopyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand("copy");
var msg = successful ? "successful" : "unsuccessful";
console.log("Fallback: Copying text command was " + msg);
} catch (err) {
console.error("Fallback: Oops, unable to copy", err);
}
document.body.removeChild(textArea);
}
function copyTextToClipboard(text) {
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(
function() {
console.log("Async: Copying to clipboard was successful!");
},
function(err) {
console.error("Async: Could not copy text: ", err);
}
);
}
var replaceMapping = {
hacker: {
regexp: /[A-Za-z]/g,
replace: ":hacker_$&:​",
downcase: true
},
lazer: {
regexp: /[A-Za-z0-9]/g,
replace: ":lazer_$&:​",
downcase: false,
preUpcase: true
},
sm64: {
regexp: /[A-Za-z0-9'"\?]/g,
replace: ":sm64_$&:​",
postReplaceMatch: [/"/g, /'/g, /\?/g],
postReplace: ["dblquote", "quote", "question"],
downcase: true
},
emoji: {
regexp: /[A-Za-z0-9#\*]/g,
replace: ":regional_indicator_$&:​",
postReplaceMatch: [
/regional_indicator_0/g,
/regional_indicator_1/g,
/regional_indicator_2/g,
/regional_indicator_3/g,
/regional_indicator_4/g,
/regional_indicator_5/g,
/regional_indicator_6/g,
/regional_indicator_7/g,
/regional_indicator_8/g,
/regional_indicator_9/g,
/regional_indicator_#/g,
/regional_indicator_\*/g,
/regional_indicator_b/g
],
postReplace: [
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"hash",
"keycap_star",
"b"
],
downcase: true
},
clapping: {
regexp: /\s/g,
replace: "👏",
postReplaceMatch: [/$/],
postReplace: ["👏"],
downcase: false
},
bun: {
regexp: /\s/g,
replace: " :bun: ",
postReplaceMatch: [/$/],
postReplace: [" :bun: "],
downcase: false
},
spaced: {
regexp: /./g,
replace: "$& ",
downcase: false
}
};
function updateOutput() {
let inString = $("#inputBox").val();
const selectedEmote = $("#emoteType").val();
const mapping = replaceMapping[selectedEmote];
const regexp = mapping.regexp;
const replaceStr = mapping.replace;
if(mapping.preUpcase === true) {
inString = inString.toUpperCase();
}
let outString = inString.replace(regexp, replaceStr);
if (mapping.downcase === true) {
outString = outString.toLowerCase();
}
if (mapping.postReplaceMatch) {
for (let i = 0; i < mapping.postReplaceMatch.length; i++) {
outString = outString.replace(
mapping.postReplaceMatch[i],
mapping.postReplace[i]
);
}
}
const finalString = outString.trim();
$("#chars").text("Characters: " + finalString.length);
$("#outputBox").val(finalString);
}
$(document).ready(function() {
$("#inputBox").on("input propertychange", function(e) {
updateOutput();
});
$("#emoteType").change(function(e) {
updateOutput();
});
$("#copyButton").on("click", function(e) {
copyTextToClipboard($("#outputBox").val());
});
});

+ 20
- 20
style.css View File

@@ -1,21 +1,21 @@
textarea {
resize: none;
}
.footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #efefef;
text-align: center;
}
.liberapay-badge {
display: inline;
vertical-align: middle;
padding-top: 5px;
padding-bottom: 5px;
margin: auto;
textarea {
resize: none;
}
.footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #efefef;
text-align: center;
}
.liberapay-badge {
display: inline;
vertical-align: middle;
padding-top: 5px;
padding-bottom: 5px;
margin: auto;
}

Loading…
Cancel
Save