1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

added book.setStyle

This commit is contained in:
Fred Chasen 2013-06-25 22:49:10 -07:00
parent 0c7942e0f2
commit 8fb857a574
5 changed files with 51 additions and 9 deletions

View file

@ -591,6 +591,17 @@ EPUBJS.Book.prototype.fromStorage = function(stored) {
}
*/
EPUBJS.Book.prototype.setStyle = function(style, val, prefixed) {
this.renderer.style(style, val, prefixed);
this.settings.styles[style] = val;
}
EPUBJS.Book.prototype.applyStyles = function() {
for (style in this.settings.styles) {
this.setStyle(style, this.settings.styles[style]);
}
}
//-- Get pre-registered hooks
EPUBJS.Book.prototype.getHooks = function(){
@ -971,7 +982,7 @@ EPUBJS.core.addScript = function(src, callback, target) {
}
}
return false;
return unprefixed;
}
@ -1586,9 +1597,9 @@ EPUBJS.Renderer.prototype.resizeIframe = function(e, cWidth, cHeight){
EPUBJS.Renderer.prototype.crossBrowserColumnCss = function(){
EPUBJS.Renderer.columnAxis = EPUBJS.core.prefixed('columnAxis') || 'columnAxis';
EPUBJS.Renderer.columnGap = EPUBJS.core.prefixed('columnGap') || 'columnGap';
EPUBJS.Renderer.columnWidth = EPUBJS.core.prefixed('columnWidth') || 'columnWidth';
EPUBJS.Renderer.columnAxis = EPUBJS.core.prefixed('columnAxis');
EPUBJS.Renderer.columnGap = EPUBJS.core.prefixed('columnGap');
EPUBJS.Renderer.columnWidth = EPUBJS.core.prefixed('columnWidth');
}
@ -1714,6 +1725,14 @@ EPUBJS.Renderer.prototype.fixedLayout = function(){
this.displayedPages = 1;
}
EPUBJS.Renderer.prototype.style = function(style, val, prefixed){
if(prefixed) {
style = EPUBJS.core.prefixed(style);
}
this.bodyEl.style[style] = val;
}
EPUBJS.Renderer.prototype.gotoChapterEnd = function(){
this.chapterEnd();
}
@ -1994,6 +2013,8 @@ EPUBJS.Renderer.prototype.isElementVisible = function(el){
//-- Enable binding events to parser
RSVP.EventTarget.mixin(EPUBJS.Renderer.prototype);

2
demo/js/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -583,6 +583,17 @@ EPUBJS.Book.prototype.fromStorage = function(stored) {
}
*/
EPUBJS.Book.prototype.setStyle = function(style, val, prefixed) {
this.renderer.style(style, val, prefixed);
this.settings.styles[style] = val;
}
EPUBJS.Book.prototype.applyStyles = function() {
for (style in this.settings.styles) {
this.setStyle(style, this.settings.styles[style]);
}
}
//-- Get pre-registered hooks
EPUBJS.Book.prototype.getHooks = function(){

View file

@ -275,7 +275,7 @@ EPUBJS.core.addScript = function(src, callback, target) {
}
}
return false;
return unprefixed;
}

View file

@ -158,9 +158,9 @@ EPUBJS.Renderer.prototype.resizeIframe = function(e, cWidth, cHeight){
EPUBJS.Renderer.prototype.crossBrowserColumnCss = function(){
EPUBJS.Renderer.columnAxis = EPUBJS.core.prefixed('columnAxis') || 'columnAxis';
EPUBJS.Renderer.columnGap = EPUBJS.core.prefixed('columnGap') || 'columnGap';
EPUBJS.Renderer.columnWidth = EPUBJS.core.prefixed('columnWidth') || 'columnWidth';
EPUBJS.Renderer.columnAxis = EPUBJS.core.prefixed('columnAxis');
EPUBJS.Renderer.columnGap = EPUBJS.core.prefixed('columnGap');
EPUBJS.Renderer.columnWidth = EPUBJS.core.prefixed('columnWidth');
}
@ -286,6 +286,14 @@ EPUBJS.Renderer.prototype.fixedLayout = function(){
this.displayedPages = 1;
}
EPUBJS.Renderer.prototype.style = function(style, val, prefixed){
if(prefixed) {
style = EPUBJS.core.prefixed(style);
}
this.bodyEl.style[style] = val;
}
EPUBJS.Renderer.prototype.gotoChapterEnd = function(){
this.chapterEnd();
}
@ -566,5 +574,7 @@ EPUBJS.Renderer.prototype.isElementVisible = function(el){
//-- Enable binding events to parser
RSVP.EventTarget.mixin(EPUBJS.Renderer.prototype);