This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from readium/develop
V.1.0.2
- Loading branch information
Showing
9 changed files
with
142 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: swift | ||
osx_image: xcode9.3 | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
|
||
cache: | ||
directories: | ||
- Carthage | ||
|
||
before_install: | ||
- brew update | ||
- brew outdated carthage || brew upgrade carthage | ||
- carthage bootstrap --verbose --no-use-binaries --platform iOS --cache-builds | ||
|
||
script: | ||
- xcodebuild clean build -project r2-streamer-swift.xcodeproj -scheme r2-streamer-swift -destination "platform=iOS Simulator,name=iPhone 8,OS=11.3" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,4 +160,3 @@ th, td { | |
padding: 4px; | ||
border: 1px solid currentColor; | ||
} | ||
/*# sourceMappingURL=ReadiumCSS-default.css.map */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Notify native code that the page has loaded. | ||
window.addEventListener("load", function(){ // on page load | ||
// Notify native code that the page is loaded. | ||
webkit.messageHandlers.didLoad.postMessage(""); | ||
}, false); | ||
|
||
var last_known_scroll_position = 0; | ||
var ticking = false; | ||
|
||
// Position in range [0 - 1]. | ||
var update = function(position) { | ||
var positionString = position.toString() | ||
webkit.messageHandlers.updateProgression.postMessage(positionString); | ||
}; | ||
|
||
window.addEventListener('scroll', function(e) { | ||
last_known_scroll_position = window.scrollX / document.getElementsByTagName("body")[0].scrollWidth; | ||
if (!ticking) { | ||
window.requestAnimationFrame(function() { | ||
update(last_known_scroll_position); | ||
ticking = false; | ||
}); | ||
} | ||
ticking = true; | ||
}); | ||
|
||
// Scroll to the given TagId in document and snap. | ||
var scrollToId = function(id) { | ||
var element = document.getElementById(id); | ||
var elementOffset = element.scrollLeft // element.getBoundingClientRect().left works for Gutenbergs books | ||
var offset = window.scrollX + elementOffset; | ||
|
||
document.body.scrollLeft = snapOffset(offset); | ||
}; | ||
|
||
// Position must be in the range [0 - 1], 0-100%. | ||
var scrollToPosition = function(position) { | ||
console.log("ScrollToPosition"); | ||
if ((position < 0) || (position > 1)) { | ||
console.log("InvalidPosition"); | ||
return; | ||
} | ||
var offset = document.getElementsByTagName("body")[0].scrollWidth * position; | ||
|
||
console.log("ScrollToOffset", offset); | ||
document.body.scrollLeft = snapOffset(offset); | ||
}; | ||
|
||
var scrollLeft = function() { | ||
var offset = window.scrollX - maxScreenX; | ||
|
||
if (offset >= 0) { | ||
document.body.scrollLeft = offset; | ||
return 0; | ||
} else { | ||
document.body.scrollLeft = 0; | ||
return "edge"; // Need to previousDocument. | ||
} | ||
}; | ||
|
||
var scrollRight = function() { | ||
var offset = window.scrollX + maxScreenX; | ||
var scrollWidth = document.getElementsByTagName("body")[0].scrollWidth; | ||
|
||
if (offset < scrollWidth) { | ||
document.body.scrollLeft = offset; | ||
return 0; | ||
} else { | ||
document.body.scrollLeft = scrollWidth; | ||
return "edge"; // Need to nextDocument. | ||
} | ||
}; | ||
|
||
// Snap the offset to the screen width (page width). | ||
var snapOffset = function(offset) { | ||
var value = offset + 1; | ||
|
||
return value - (value % maxScreenX); | ||
}; | ||
|
||
/// User Settings. | ||
|
||
// For setting user setting. | ||
var setProperty = function(key, value) { | ||
var root = document.documentElement; | ||
|
||
root.style.setProperty(key, value); | ||
}; | ||
|
||
// For removing user setting. | ||
var removeProperty = function(key) { | ||
var root = document.documentElement; | ||
|
||
root.style.removeProperty(key); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters