Permalink
Browse files

addons.mozilla.org fixes

Fixed lint issues that triggered warnings on addons.mozilla.org
Minor misc corrections of texts
  • Loading branch information...
Ben Garrett
Ben Garrett committed Nov 22, 2017
1 parent c7474e1 commit 0f975267e610cc75a16a432d564b4988d4e63d75
Showing with 313 additions and 196 deletions.
  1. +3 −39 _locales/en_US/messages.json
  2. +12 −1 css/options_firefox.css
  3. +12 −0 functions.js
  4. +1 −1 manifest.json
  5. +11 −10 retrotxt.js
  6. +1 −1 test/index.html
  7. +96 −80 test/tests.js
  8. +2 −11 text_ecma48.js
  9. +175 −53 welcome.html
@@ -17,52 +17,16 @@
"wildcat": {
"message": "Wildcat!"
},
"font_pc": {
"message": "http://int10h.org/oldschool-pc-fonts/"
},
"font_pc_a": {
"message": "Viler"
},
"font_amiga": {
"message": "https://github.com/rewtnull/amigafonts"
},
"font_amiga_a": {
"message": "tRUEsCHOOL"
},
"font_atascii": {
"message": "http://members.bitstream.net/marksim/atarimac/fonts.html"
},
"font_atascii_a": {
"message": "Mark L. Simonson"
},
"font_atari": {
"message": "http://www.dafont.com/atari-st-8x16-system-font.font"
},
"font_atari_a": {
"message": "divVerent"
},
"font_appleii": {
"message": "http://www.kreativekorp.com/software/fonts/apple2.shtml"
},
"font_appleii_a": {
"message": "Kreative Korp"
},
"font_petscii": {
"message": "http://style64.org/c64-truetype"
},
"font_petscii_a": {
"message": "Style"
},
"url": {
"message": "http://retrotxt.com"
"message": "https://retrotxt.com"
},
"url_help": {
"message": "https://github.com/bengarrett/RetroTxt/blob/master/docs/index.md"
"message": "https://retrotxt.com/d/"
},
"url_issues": {
"message": "https://github.com/bengarrett/RetroTxt/issues"
},
"url_qa": {
"message": "https://github.com/bengarrett/RetroTxt/blob/master/docs/qa.md"
"message": "https://retrotxt.com/qa/"
}
}
View
@@ -22,14 +22,15 @@
#sample-dos-text {
/* anything placed in here will override any classes introduced by JavaScript */
border: 0.063em solid rgb(215, 211, 200);
border: none;
height: 40px;
width: auto;
}
#status {
font-size: 13px;
height: 2em;
text-align: center;
}
.material-credits {
@@ -79,6 +80,16 @@ h3 {
font-weight: normal;
}
header hr {
display: none;
}
header {
border: 0.063em solid rgb(215, 211, 200);
border-radius: 2px;
padding: 0.2em;
}
select {
font-size: 15px;
}
View
@@ -472,6 +472,18 @@ function humaniseFS(bytes = 0, si = 1024)
return `${Math.round(bytes * 10) / 10}${units[u]}`
}
function ParseToChildren(s = ``)
// Parses a string to a DOM node object that can be used with the appendChild() method.
// This function is to avoid `UNSAFE_VAR_ASSIGNMENT` "Unsafe assignment to innerHTML" lint errors
{
if (typeof s !== `string`) checkArg(`s`, `string`, s)
const parser = new DOMParser()
const parsed = parser.parseFromString(s, `text/html`)
const tag = parsed.getElementsByTagName(`body`)
if (tag.length === 0) return checkErr(`DOMParser.parseFromString('${s}','text/html') did not build a HTML object containing a <body> tag`)
return tag[0]
}
async function runSpinLoader(s = true)
// Injects a loading spinner to the tab
// It's not really useful due to the way browsers handle the DOM rendering,
View
@@ -1,5 +1,5 @@
{
"version": "2.4.20",
"version": "2.4.23",
"version_name": "2.4",
"minimum_chrome_version": "55",
"applications": {
View
@@ -5,7 +5,7 @@
/*
global BuildBBS BuildCP1252 BuildCPDos BuildCP88591 BuildCP885915 BuildCPUtf8 BuildCPUtf16
HumaniseCP BuildEcma48 BuildFontStyles ListCharacterSets ListDefaults ListRGBThemes
HumaniseCP BuildEcma48 BuildFontStyles ListCharacterSets ListDefaults ListRGBThemes ParseToChildren
buildLinksToCSS checkArg checkErr changeTextScanlines changeTextEffect handleFontName
chrome findControlSequences displayErr runSpinLoader humaniseFS findEngine handleFontSauce
*/
@@ -864,15 +864,15 @@ function runRetroTxt(tabId = 0, pageEncoding = `unknown`)
const ramp = new RegExp(`&amp;`, `gi`)
switch (inputSrc.format) {
case `ecma48`: // ECMA-48 aka ANSI encoded text
console.info(`%c%cECMA-48%c control sequences in use`, `font-weight: bold`, `font-weight: bold; color: green`, `font-weight: bold; color: initial`)
console.info(`%c%cECMA-48%ccontrol sequences in use.`, `font-weight: bold`, `font-weight: bold; color: green`, `font-weight: bold; color: initial`)
//console.time(`BuildEcma48()`)
// These objects are isolated to the RetroTxt content scripts
ecma48Data = new BuildEcma48(dataObj.html, sauce00, false, false)
//console.timeEnd(`BuildEcma48()`)
if (ecma48Data.columns === 999 && sauce00.config.width >= 180) outputDOM.columns = null
else outputDOM.columns = ecma48Data.columns
outputDOM.rows = ecma48Data.rows
dataObj.html = ecma48Data.innerHTML
dataObj.html = ecma48Data.htmlString
dataObj.oths = ecma48Data.otherCodesCount
dataObj.errs = ecma48Data.unknownCount
// handle Set/Restore Mode functionality
@@ -932,21 +932,22 @@ function runRetroTxt(tabId = 0, pageEncoding = `unknown`)
if (ecma48Data.iceColors === true) {
dom.head.appendChild(buildLinksToCSS(`css/text_colors_${theme.colors[theme.color]}-ice.css`, `retrotxt-4bit-ice`)) // child 4
}
// inject text into the browser tab
outputDOM.pre.innerHTML = dataObj.html
// parse text to a DOM object and insert it into the browser tab
if (typeof dataObj.html === `string`) {
const html = ParseToChildren(dataObj.html)
outputDOM.pre.appendChild(html)
} else checkErr(`Expecting a string type for dataObj.html but instead it is ${typeof dataObj.html}`)
break
case `pcboard`: // converts PCBoard and WildCat! BBS colour codes into HTML and CSS
case `wildcat`:
console.info(`%c%c${chrome.i18n.getMessage(inputSrc.format)}%c ${chrome.i18n.getMessage(`color`)} codes`, `font-weight: bold`, `font-weight: bold; color: green`, `font-weight: bold; color: initial`)
console.info(`%c%c${chrome.i18n.getMessage(inputSrc.format)} %c${chrome.i18n.getMessage(`color`)} codes.`, `font-weight: bold`, `font-weight: bold; color: green`, `font-weight: bold; color: initial`)
outputDOM.pre = BuildBBS(dataObj.html, inputSrc.format, false)
break
default:
// replace escaped chars because we're using <pre>
dataObj.html = dataObj.html.replace(rgt, `>`)
dataObj.html = dataObj.html.replace(rlt, `<`)
dataObj.html = dataObj.html.replace(ramp, `&`)
// inject text into the browser tab
// TODO outputDOM.pre = dataObj.html
outputDOM.pre.textContent = dataObj.html
}
// apply a blinking cursor
@@ -1308,7 +1309,7 @@ function runRetroTxt(tabId = 0, pageEncoding = `unknown`)
const m = document.getElementsByTagName(`main`)[0]
const w = document.getElementById(`width-of-text`)
const h = document.getElementById(`length-of-text`)
h.innerHTML = m.clientHeight
w.innerHTML = m.clientWidth
h.textContent = m.clientHeight
w.textContent = m.clientWidth
}, 500)
}
View
@@ -14,7 +14,7 @@
<script src="qunit-2.4.0.js"></script>
<script src="tests.js"></script>
<script src="../eventpage.js"></script>
<script src="../functions.js"></script>>
<script src="../functions.js"></script>
<script src="../options.js"></script>
<script src="../retrotxt.js"></script>
<script src="../text_ecma48.js"></script>
Oops, something went wrong.

0 comments on commit 0f97526

Please sign in to comment.