View Single Post
Old 04-30-2012, 04:01 AM   #3691
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 854
Karma: 327896
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
Hi Analogus,

there are three ways to do that

1) "subscribe" to an appropriate event
2) "hook" a appropriate function

like it is done in ViewerSettings.js
Code:
	Core.events.subscribe(Core.events.EVENTS.BOOK_CHANGED, 		resetMarginCut);
	Core.hook.hookAfter(ebook, "rotate", rotateMarginCut); //function(where, what, newFunction, tag)
where the first event may be usefull for your purpose,
the second line is just to show the principle.
To find events and functions check kbook.xs

3) hook a function manually, by totally or partially rewriting it in your code.
It often looks like this:
Code:
var oldfunc;
oldfunc = kbook.some.function;
kbook.some.function = function () {
...
do something
...
oldfunc.apply(this, arguments);
}
You can find plenty of these in PRS+ code.

HTH
Mark

Last edited by Mark Nord; 05-02-2012 at 04:00 PM. Reason: typo
Mark Nord is offline   Reply With Quote