mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-09-28 23:31:16 +12:00
Firefox support
This commit is contained in:
parent
c1f72abdad
commit
a5e61539e7
4 changed files with 30 additions and 13 deletions
|
@ -454,11 +454,18 @@ class FimFic2Epub extends Emitter {
|
|||
}
|
||||
|
||||
// Internal/private methods
|
||||
progress (part, percent, status) {
|
||||
progress (part, percent, status = '') {
|
||||
// let parts = 6.3
|
||||
// let partsize = 1 / parts
|
||||
// percent = (part / parts) + percent * partsize
|
||||
this.trigger('progress', percent, status)
|
||||
try {
|
||||
this.trigger('progress', percent, status)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
if (status) {
|
||||
console.log(status)
|
||||
}
|
||||
}
|
||||
|
||||
findRemoteResources (prefix, where, html) {
|
||||
|
|
|
@ -14,9 +14,9 @@ export function cleanMarkup (html) {
|
|||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// replace HTML non-breaking spaces with normal spaces
|
||||
html = html.replace(/ /g, ' ')
|
||||
html = html.replace(/ /g, ' ')
|
||||
// replace HTML entities with decimal entities
|
||||
html = html.replace(/ /g, ' ')
|
||||
html = html.replace(/ /g, ' ')
|
||||
|
||||
// fix some tags
|
||||
html = html.replace(/<u>/g, '<span style="text-decoration: underline">')
|
||||
|
@ -27,10 +27,7 @@ export function cleanMarkup (html) {
|
|||
html = html.replace(/<p>\s*/g, '<p>')
|
||||
html = html.replace(/\s*<\/p>/g, '</p>')
|
||||
|
||||
html = html.replace(/<p><p>/g, '<p>')
|
||||
html = html.replace(/<\/div><\/p>/g, '</div>')
|
||||
|
||||
html = fixParagraphIndent(html)
|
||||
// html = fixParagraphIndent(html)
|
||||
|
||||
html = fixDoubleSpacing(html)
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ export default function fetch (url, responseType) {
|
|||
if (url.indexOf('//') === 0) {
|
||||
url = 'http:' + url
|
||||
}
|
||||
if (url.indexOf('/') === 0) {
|
||||
url = 'https://fimfiction.net' + url
|
||||
}
|
||||
|
||||
if (isNode) {
|
||||
return fetchNode(url, responseType)
|
||||
|
|
18
src/main.js
18
src/main.js
|
@ -98,6 +98,14 @@ function selectOptions (list, selected = '') {
|
|||
})
|
||||
}
|
||||
|
||||
function redraw (arg) {
|
||||
try {
|
||||
m.redraw(arg)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
let ffcProgress = m.prop(0)
|
||||
let ffcStatus = m.prop('')
|
||||
|
||||
|
@ -140,12 +148,14 @@ let dialog = {
|
|||
this.author(ffc.storyInfo.author.name)
|
||||
this.description(ffc.storyInfo.short_description)
|
||||
this.subjects(ffc.subjects.slice(0))
|
||||
m.redraw(true)
|
||||
redraw(true)
|
||||
this.center()
|
||||
ffc.fetchChapters().then(() => {
|
||||
ffcProgress(-1)
|
||||
m.redraw()
|
||||
redraw()
|
||||
})
|
||||
}).catch((err) => {
|
||||
throw err
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +242,7 @@ let dialog = {
|
|||
ffc.options.paragraphStyle = this.paragraphStyle()
|
||||
ffc.subjects = this.subjects()
|
||||
ffc.options.joinSubjects = this.joinSubjects()
|
||||
m.redraw()
|
||||
redraw()
|
||||
|
||||
chain
|
||||
.then(ffc.fetchAll.bind(ffc))
|
||||
|
@ -337,7 +347,7 @@ function onProgress (percent, status) {
|
|||
if (status) {
|
||||
ffcStatus(status)
|
||||
}
|
||||
m.redraw()
|
||||
redraw()
|
||||
}
|
||||
|
||||
if (pageStoryId && isChromeExt) {
|
||||
|
|
Loading…
Reference in a new issue