diff --git a/client/components/Reader/ContentsPage/ContentsPage.vue b/client/components/Reader/ContentsPage/ContentsPage.vue index ab792883..a9c91ce8 100644 --- a/client/components/Reader/ContentsPage/ContentsPage.vue +++ b/client/components/Reader/ContentsPage/ContentsPage.vue @@ -62,7 +62,10 @@
-
+
+
JPG
+
PNG
+
{{ item.perc }}%
@@ -113,7 +116,7 @@ class ContentsPage extends Vue { //закладки - //далее формаирование оглавления + //далее формирование оглавления if (this.parsed == parsed) return; @@ -192,16 +195,23 @@ class ContentsPage extends Vue { const ims = parsed.images; for (i = 0; i < ims.length; i++) { const image = ims[i]; + let id = image.href; + if (id[0] == "#") + id = id.substr(1); const label = `Изображение ${image.num}`; - const indentStyle = getIndentStyle(0); + const indentStyle = getIndentStyle(1); const labelStyle = getLabelStyle(0); const p = parsed.para[image.paraIndex]; - newImages.push({perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, offset: p.offset, indentStyle, labelStyle}); + newImages.push({perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, offset: p.offset, + indentStyle, labelStyle, type: (parsed.binary[id] ? parsed.binary[id].type : '')}); } this.images = newImages; + + if (this.selectedTab == 'contents' && !this.contents.length && this.images.length) + this.selectedTab = 'images'; } async expandClick(key) { @@ -280,4 +290,18 @@ class ContentsPage extends Vue { .expanded-icon { transform: rotate(90deg); } + +.image-type { + border: 1px solid black; + border-radius: 6px; + font-size: 80%; + padding: 2px 0 2px 0; + width: 34px; +} +.it-jpg-color { + background: linear-gradient(to right, #fabc3d, #ffec6d); +} +.it-png-color { + background: linear-gradient(to right, #4bc4e5, #6bf4ff); +} diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index 9d4b1bb1..1705c007 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -211,7 +211,7 @@ export default class BookParser { newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount); imageIndex++; - this.images.push({paraIndex, num: imageIndex}); + this.images.push({paraIndex, num: imageIndex, href}); if (inPara && this.showInlineImagesInCenter) newParagraph(' ', 1); @@ -220,7 +220,7 @@ export default class BookParser { newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount); imageIndex++; - this.images.push({paraIndex, num: imageIndex}); + this.images.push({paraIndex, num: imageIndex, href}); } } }