Skip to content

Commit cf3de6e

Browse files
committed
New: Option to start reading in full screen
1 parent 78646fe commit cf3de6e

20 files changed

+74
-32
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
##### 🚀 New Features
1010

11-
- Option to open directly in continue reading instead of the file list
11+
- Option to open directly in continue reading instead of the file list [`78646fe`](https://github.com/ollm/OpenComic/commit/78646fe6f4a17be6fc9fd0c940fd97d438c812c1)
12+
- Option to start reading in full screen
1213

1314
##### 🐛 Bug Fixes
1415

languages/ca.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "Preferències de lectura",
139139
"maxMargin": "Marge horitzontal i vertical màxim",
140140
"globalZoom": "Aplica un zoom global en comptes d'imatge a imatge (Només en lectura vertical)",
141+
"startReadingInFullScreen": "Comença la lectura a pantalla completa",
141142
"trackingAtTheEnd": "Seguiment al final del capítol/tom"
142143
},
143144
"navigation": {

languages/cs.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/de.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "Reading preferences",
139139
"maxMargin": "Maximum horizontal and vertical margin",
140140
"globalZoom": "Applies a global zoom instead of image by image (Only in vertical reading)",
141+
"startReadingInFullScreen": "Empieza a leer en pantalla completa",
141142
"trackingAtTheEnd": "Tracking at the end of the chapter/volume"
142143
},
143144
"navigation": {

languages/es.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "Preferencias de lectura",
139139
"maxMargin": "Margen horizontal y vertical máximo",
140140
"globalZoom": "Aplica un zoom global en vez de imagen a imagen (Solo en lectura vertical)",
141+
"startReadingInFullScreen": "Empieza la lectura en pantalla completa",
141142
"trackingAtTheEnd": "Seguimiento al final del capítulo/tomo"
142143
},
143144
"navigation": {

languages/fr.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/hu.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/it.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/ja.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/pt-br.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/ru.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/vi.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/zh-hans.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

languages/zh-hant.json

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"main": "",
139139
"maxMargin": "",
140140
"globalZoom": "",
141+
"startReadingInFullScreen": "",
141142
"trackingAtTheEnd": ""
142143
},
143144
"navigation": {

scripts/dom.js

+13
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,19 @@ var readingActive = false, skipNextComic = false, skipPreviousComic = false;
12951295
async function openComic(animation = true, path = true, mainPath = true, end = false, fromGoBack = false, fromNextAndPrev = false, fromDeepLoad = false)
12961296
{
12971297
// Start reading comic
1298+
if(config.readingStartReadingInFullScreen && !fromNextAndPrev && !fromGoBack)
1299+
{
1300+
let win = electronRemote.getCurrentWindow();
1301+
let isFullScreen = win.isFullScreen();
1302+
1303+
if(!isFullScreen)
1304+
{
1305+
reading.hideContent(!isFullScreen);
1306+
win.setFullScreen(!isFullScreen);
1307+
win.setMenuBarVisibility(isFullScreen);
1308+
}
1309+
}
1310+
12981311
currentPathScrollTop[currentPath === false ? 0 : currentPath] = template.contentRight().children().scrollTop();
12991312
currentPath = path;
13001313

scripts/reading.js

+29-30
Original file line numberDiff line numberDiff line change
@@ -781,24 +781,27 @@ function returnLargerImage(index)
781781
{
782782
if(_config.readingDoublePage && !_config.readingWebtoon)
783783
{
784-
var imageHeight0 = template.contentRight('.image-position'+(index)+'-0').height();
785-
var imageHeight1 = template.contentRight('.image-position'+(index)+'-1').height();
784+
let image0 = template._contentRight().querySelector('.image-position'+(index)+'-0');
785+
let image1 = template._contentRight().querySelector('.image-position'+(index)+'-1');
786786

787-
if(imageHeight1 === undefined || imageHeight0 >= imageHeight1)
788-
{
789-
var image = template.contentRight('.image-position'+(index)+'-0');
790-
}
787+
let rect0 = image0 ? image0.getBoundingClientRect() : false;
788+
let rect1 = image1 ? image1.getBoundingClientRect() : false;
789+
790+
let imageHeight0 = rect0.height || 0;
791+
let imageHeight1 = rect1.height || 0;
792+
793+
if(imageHeight0 >= imageHeight1)
794+
return {image: image0, height: imageHeight0, top: rect0.top || 0};
791795
else
792-
{
793-
var image = template.contentRight('.image-position'+(index)+'-1');
794-
}
796+
return {image: image1, height: imageHeight1, top: rect1.top || 0};
795797
}
796798
else
797799
{
798-
var image = template.contentRight('.image-position'+(index)+'-0');
799-
}
800+
let image = template._contentRight().querySelector('.image-position'+(index)+'-0');
801+
let rect = image ? image.getBoundingClientRect() : false;
800802

801-
return image;
803+
return {image: image, height: rect.height || 0, top: rect.top || 0};
804+
}
802805
}
803806

804807
var currentPageVisibility = 0, maxPageVisibility = 0, currentPageStart = true, readingDirection = true, disableOnScrollST = false;
@@ -827,13 +830,12 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
827830

828831
if(((nextPrevious && currentPageStart) || !nextPrevious || end) && (readingViewIs('scroll') && (_config.readingViewAdjustToWidth || _config.readingWebtoon)))
829832
{
830-
image = returnLargerImage(eIndex-1);
831-
832-
imgHeight = image.height() + _config.readingMargin.top;
833+
let largerImage = returnLargerImage(eIndex-1);
834+
imgHeight = largerImage.height + _config.readingMargin.top;
833835

834836
if(imgHeight > contentHeight)
835837
{
836-
var pageVisibility = Math.floor(imgHeight / contentHeight)
838+
let pageVisibility = Math.floor(imgHeight / contentHeight)
837839

838840
maxPageVisibility = pageVisibility;
839841

@@ -856,9 +858,8 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
856858
{
857859
eIndex = currentIndex;
858860

859-
image = returnLargerImage(eIndex-1);
860-
861-
imgHeight = image.height() + _config.readingMargin.top;
861+
let largerImage = returnLargerImage(eIndex-1);
862+
imgHeight = largerImage.height + _config.readingMargin.top;
862863

863864
if(readingDirection)
864865
currentPageVisibility++;
@@ -868,7 +869,7 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
868869
if(nextPrevious !== false && nextPrevious !== true) currentPageVisibility = nextPrevious;
869870
pageVisibilityIndex = currentPageVisibility;
870871

871-
var pageVisibility = Math.floor(imgHeight / contentHeight);
872+
let pageVisibility = Math.floor(imgHeight / contentHeight);
872873

873874
maxPageVisibility = pageVisibility;
874875

@@ -880,9 +881,8 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
880881
{
881882
eIndex = index;
882883

883-
image = returnLargerImage(eIndex-1);
884-
885-
imgHeight = image.height() + _config.readingMargin.top;
884+
let largerImage = returnLargerImage(eIndex-1);
885+
imgHeight = largerImage.height + _config.readingMargin.top;
886886

887887
if(imgHeight > contentHeight)
888888
{
@@ -917,23 +917,22 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
917917
}
918918
else if(readingViewIs('scroll'))
919919
{
920-
var image = returnLargerImage(eIndex-1);
921-
922-
var scrollTop = (image.offset().top - rect.top) + content.scrollTop;
920+
let largerImage = returnLargerImage(eIndex-1);
921+
let scrollTop = (largerImage.top - rect.top) + content.scrollTop;
923922

924-
var scrollSum = 0;
923+
let scrollSum = 0;
925924

926925
if((readingViewIs('scroll') && (_config.readingViewAdjustToWidth || _config.readingWebtoon)) && pageVisibilityIndex !== false)
927926
{
928927
imgHeight = image.height() + _config.readingMargin.top;
929928

930929
if(imgHeight > contentHeight)
931930
{
932-
var pageVisibility = Math.floor(imgHeight / contentHeight);
931+
let pageVisibility = Math.floor(imgHeight / contentHeight);
933932

934933
maxPageVisibility = pageVisibility;
935934

936-
var contentHeightRes = ((contentHeight * pageVisibility) - imgHeight) / pageVisibility;
935+
let contentHeightRes = ((contentHeight * pageVisibility) - imgHeight) / pageVisibility;
937936

938937
scrollSum = ((contentHeight - contentHeightRes) - contentHeight / pageVisibility) * pageVisibilityIndex;
939938
}
@@ -952,7 +951,7 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
952951
$(content).stop(true).animate({scrollTop: (scrollTop + scrollSum)+'px'}, animationDurationMS);
953952
}
954953

955-
var newIndex = (eIndex - 1);
954+
let newIndex = (eIndex - 1);
956955

957956
if(_config.readingManga && !readingViewIs('scroll'))
958957
newIndex = (indexNum - newIndex) - 1;

scripts/settings.js

+6
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ function setGlobalZoom(value)
296296
storage.updateVar('config', 'readingGlobalZoom', value);
297297
}
298298

299+
function setStartReadingInFullScreen(value)
300+
{
301+
storage.updateVar('config', 'readingStartReadingInFullScreen', value);
302+
}
303+
299304
function setTrackingAtTheEnd(value)
300305
{
301306
storage.updateVar('config', 'readingTrackingAtTheEnd', value);
@@ -350,6 +355,7 @@ module.exports = {
350355
start: start,
351356
setMaxMargin: setMaxMargin,
352357
setGlobalZoom: setGlobalZoom,
358+
setStartReadingInFullScreen: setStartReadingInFullScreen,
353359
setTrackingAtTheEnd: setTrackingAtTheEnd,
354360
setIgnoreSingleFoldersLibrary: setIgnoreSingleFoldersLibrary,
355361
setWhenOpenFolderContinueReading: setWhenOpenFolderContinueReading,

scripts/storage.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var changes = 53; // Update this if readingPagesConfig is updated
1+
var changes = 54; // Update this if readingPagesConfig is updated
22

33
var readingPagesConfig = {
44
readingConfigName: '',
@@ -80,6 +80,7 @@ var storageDefault = {
8080
readingHideBarHeaderFullScreen: true,
8181
readingMaxMargin: 400,
8282
readingGlobalZoom: true,
83+
readingStartReadingInFullScreen: false,
8384
readingTrackingAtTheEnd: true,
8485
controllerDeadZone: 0.06,
8586
startInFullScreen: false,

templates/settings.content.right.html

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ <h2 class="headline-small">{{language.settings.reading.main}}</h2>
4343
</div>
4444
</div>
4545

46+
<div class="menu-simple-text gamepad-item">
47+
{{language.settings.reading.startReadingInFullScreen}}
48+
<div class="switch{{#if config.readingStartReadingInFullScreen}} a{{/if}}" on="settings.setStartReadingInFullScreen(true)" off="settings.setStartReadingInFullScreen(false)">
49+
<div></div>
50+
<svg viewBox="0 0 52 32"><path d="M 8,0 C 3.58,0 0,3.58 0,8 0,12.42 3.58,16 8,16 8,16 8,16 8,16 12.42,16 16,12.42 16,8 16,3.58 12.42,0 8,0 8,0 8,0 8,0 Z"></path></svg>
51+
</div>
52+
</div>
53+
4654
<div class="menu-simple-text gamepad-item">
4755
{{language.settings.reading.trackingAtTheEnd}}
4856
<div class="switch{{#if config.readingTrackingAtTheEnd}} a{{/if}}" on="settings.setTrackingAtTheEnd(true)" off="settings.setTrackingAtTheEnd(false)">

0 commit comments

Comments
 (0)