mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
files_reader: v0.7.2, raised maximum OC/NC version to 9.2
This commit is contained in:
parent
9b336c75c0
commit
4e9c41e234
2 changed files with 75 additions and 2 deletions
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
Also in Settings you'll find the option to use ignore any internal formatting in the book by forcing a given font style and size.
|
Also in Settings you'll find the option to use ignore any internal formatting in the book by forcing a given font style and size.
|
||||||
</description>
|
</description>
|
||||||
<version>0.7.1</version>
|
<version>0.7.2</version>
|
||||||
<licence>LGPL</licence>
|
<licence>LGPL</licence>
|
||||||
<author>Frank de Lange</author>
|
<author>Frank de Lange</author>
|
||||||
<shipped>false</shipped>
|
<shipped>false</shipped>
|
||||||
<default_enable/>
|
<default_enable/>
|
||||||
<standalone/>
|
<standalone/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<owncloud min-version="8.1" max-version="9.0" />
|
<owncloud min-version="8.1" max-version="9.2" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<ocsid>167127</ocsid>
|
<ocsid>167127</ocsid>
|
||||||
</info>
|
</info>
|
||||||
|
|
73
files_reader/vendor/epubjs/hooks/default/smartimages.js
vendored
Normal file
73
files_reader/vendor/epubjs/hooks/default/smartimages.js
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
EPUBJS.Hooks.register("beforeChapterDisplay").smartimages = function(callback, renderer){
|
||||||
|
var images = renderer.contents.querySelectorAll('img'),
|
||||||
|
items = Array.prototype.slice.call(images),
|
||||||
|
iheight = renderer.height,//chapter.bodyEl.clientHeight,//chapter.doc.body.getBoundingClientRect().height,
|
||||||
|
oheight;
|
||||||
|
|
||||||
|
if(renderer.layoutSettings.layout != "reflowable") {
|
||||||
|
callback();
|
||||||
|
return; //-- Only adjust images for reflowable text
|
||||||
|
}
|
||||||
|
|
||||||
|
items.forEach(function(item){
|
||||||
|
|
||||||
|
var size = function() {
|
||||||
|
var itemRect = item.getBoundingClientRect(),
|
||||||
|
rectHeight = itemRect.height,
|
||||||
|
top = itemRect.top,
|
||||||
|
oHeight = item.getAttribute('data-height'),
|
||||||
|
height = oHeight || rectHeight,
|
||||||
|
newHeight,
|
||||||
|
fontSize = Number(getComputedStyle(item, "").fontSize.match(/(\d*(\.\d*)?)px/)[1]),
|
||||||
|
fontAdjust = fontSize ? fontSize / 2 : 0;
|
||||||
|
|
||||||
|
iheight = renderer.contents.clientHeight;
|
||||||
|
if(top < 0) top = 0;
|
||||||
|
|
||||||
|
if(height + top >= iheight) {
|
||||||
|
|
||||||
|
if(top < iheight/2) {
|
||||||
|
// Remove top and half font-size from height to keep container from overflowing
|
||||||
|
newHeight = iheight - top - fontAdjust;
|
||||||
|
item.style.maxHeight = newHeight + "px";
|
||||||
|
item.style.width= "auto";
|
||||||
|
}else{
|
||||||
|
if(height > iheight) {
|
||||||
|
item.style.maxHeight = iheight + "px";
|
||||||
|
item.style.width= "auto";
|
||||||
|
itemRect = item.getBoundingClientRect();
|
||||||
|
height = itemRect.height;
|
||||||
|
}
|
||||||
|
item.style.display = "block";
|
||||||
|
item.style["WebkitColumnBreakBefore"] = "always";
|
||||||
|
item.style["breakBefore"] = "column";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
item.setAttribute('data-height', newHeight);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
item.style.removeProperty('max-height');
|
||||||
|
item.style.removeProperty('margin-top');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var unloaded = function(){
|
||||||
|
// item.removeEventListener('load', size); // crashes in IE
|
||||||
|
renderer.off("renderer:resized", size);
|
||||||
|
renderer.off("renderer:chapterUnload", this);
|
||||||
|
};
|
||||||
|
|
||||||
|
item.addEventListener('load', size, false);
|
||||||
|
|
||||||
|
renderer.on("renderer:resized", size);
|
||||||
|
|
||||||
|
renderer.on("renderer:chapterUnload", unloaded);
|
||||||
|
|
||||||
|
size();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if(callback) callback();
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue