mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Simplify the showControl
calls on reader page
This commit is contained in:
parent
dad02a2a30
commit
6ea41f79e9
@ -141,10 +141,9 @@ const waitForPage = (idx, cb) => {
|
|||||||
* Show the control modal
|
* Show the control modal
|
||||||
*
|
*
|
||||||
* @function showControl
|
* @function showControl
|
||||||
* @param {object} event - The onclick event that triggers the function
|
* @param {string} idx - One-based index of the current page
|
||||||
*/
|
*/
|
||||||
const showControl = (event) => {
|
const showControl = (idx) => {
|
||||||
const idx = parseInt($(event.currentTarget).attr('id'));
|
|
||||||
const pageCount = $('#page-select > option').length;
|
const pageCount = $('#page-select > option').length;
|
||||||
const progressText = `Progress: ${idx}/${pageCount} (${(idx/pageCount * 100).toFixed(1)}%)`;
|
const progressText = `Progress: ${idx}/${pageCount} (${(idx/pageCount * 100).toFixed(1)}%)`;
|
||||||
$('#progress-label').text(progressText);
|
$('#progress-label').text(progressText);
|
||||||
@ -191,6 +190,8 @@ const setupScroller = () => {
|
|||||||
$(el).on('inview', (event, inView) => {
|
$(el).on('inview', (event, inView) => {
|
||||||
if (inView) {
|
if (inView) {
|
||||||
const current = $(event.currentTarget).attr('id');
|
const current = $(event.currentTarget).attr('id');
|
||||||
|
|
||||||
|
setProp('curItem', getProp('items')[current - 1]);
|
||||||
replaceHistory(current);
|
replaceHistory(current);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
:width="item.width"
|
:width="item.width"
|
||||||
:height="item.height"
|
:height="item.height"
|
||||||
:id="item.id"
|
:id="item.id"
|
||||||
@click="showControl($event)"
|
:onclick="`showControl('${item.id}')`"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<%- if next_entry_url -%>
|
<%- if next_entry_url -%>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
'uk-align-center': true,
|
'uk-align-center': true,
|
||||||
'uk-animation-slide-left': flipAnimation === 'left',
|
'uk-animation-slide-left': flipAnimation === 'left',
|
||||||
'uk-animation-slide-right': flipAnimation === 'right'
|
'uk-animation-slide-right': flipAnimation === 'right'
|
||||||
}" :data-src="curItem.url" :width="curItem.width" :height="curItem.height" :id="curItem.id" @click="showControl($event)" :style="`
|
}" :data-src="curItem.url" :width="curItem.width" :height="curItem.height" :id="curItem.id" :onclick="`showControl('${curItem.id}')`" :style="`
|
||||||
width:${mode === 'width' ? '100vw' : 'auto'};
|
width:${mode === 'width' ? '100vw' : 'auto'};
|
||||||
height:${mode === 'height' ? '100vh' : 'auto'};
|
height:${mode === 'height' ? '100vh' : 'auto'};
|
||||||
margin-bottom:0;
|
margin-bottom:0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user