refactor: rename RDReaderView -> RDEpubReaderView, update pod config and docs
- Rename source module from RDReaderView to RDEpubReaderView - Move all source files from Sources/RDReaderView/ to Sources/RDEpubReaderView/ - Update podspec: RDReaderView.podspec -> RDEpubReaderView.podspec - Update Podfile, demo project, and CocoaPods config for new pod name - Delete old RDReaderView pod support files from ReadViewDemo/Pods - Add new RDEpubReaderView pod support files - Update documentation (API ref, architecture, UML, conventions, etc.) - Add FixedLayoutRotationTests - Update .gitignore: exclude .DS_Store, manual unpack backups, _ssoft-output
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
(function() {
|
||||
if (window.WeReadApi) { return; }
|
||||
|
||||
function bridge() {
|
||||
return window.RDEpubReaderBridge || null;
|
||||
}
|
||||
|
||||
function sharedThemeCSS(theme) {
|
||||
if (!theme) { return ''; }
|
||||
var backgroundColor = theme.backgroundColor || 'transparent';
|
||||
var textColor = theme.textColor || 'inherit';
|
||||
return [
|
||||
':root {',
|
||||
' color-scheme: light;',
|
||||
'}',
|
||||
'html, body {',
|
||||
' background: ' + backgroundColor + ' !important;',
|
||||
' color: ' + textColor + ' !important;',
|
||||
'}',
|
||||
'a {',
|
||||
' -webkit-tap-highlight-color: transparent;',
|
||||
'}'
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
window.WeReadApi = {
|
||||
applySharedTheme: function(theme) {
|
||||
var css = sharedThemeCSS(theme);
|
||||
if (window.RDInjectedCSS) {
|
||||
window.RDInjectedCSS.setStyle('ss-reader-theme', css, {
|
||||
includeFrames: !!(theme && theme.includeFrames)
|
||||
});
|
||||
}
|
||||
return true;
|
||||
},
|
||||
applyPagination: function(styleText) {
|
||||
return !!(bridge() && bridge().applyPagination(styleText));
|
||||
},
|
||||
setPageMetrics: function(pageCount, pageStride) {
|
||||
return !!(bridge() && bridge().setPageMetrics(pageCount, pageStride));
|
||||
},
|
||||
scrollToPage: function(pageIndex) {
|
||||
return !!(bridge() && bridge().scrollToPage(pageIndex));
|
||||
},
|
||||
scrollToLocation: function(location, fallbackPageIndex) {
|
||||
return !!(bridge() && bridge().scrollToLocation(location, fallbackPageIndex));
|
||||
},
|
||||
setHighlights: function(items) {
|
||||
return !!(bridge() && bridge().setHighlights(items));
|
||||
},
|
||||
clearHighlights: function() {
|
||||
return !!(bridge() && bridge().clearHighlights());
|
||||
},
|
||||
setSearchPresentation: function(payload) {
|
||||
return !!(bridge() && bridge().setSearchPresentation(payload));
|
||||
},
|
||||
resolveDecorations: function() {
|
||||
return bridge() ? bridge().resolveDecorations() : { highlights: [], search: [] };
|
||||
},
|
||||
reportProgression: function(fragment) {
|
||||
return !!(bridge() && bridge().reportProgression(fragment));
|
||||
},
|
||||
selectionPayload: function() {
|
||||
return bridge() ? bridge().selectionPayload() : null;
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user