View Single Post
Old 10-19-2012, 12:39 PM   #11
silver18
THE NOOB
silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.
 
silver18's Avatar
 
Posts: 698
Karma: 1545625
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
This is used to update the titlebar according to the contentWindow title (and when the contentWindow title changes):

Code:
kindle.chrome.onContentTitleChanged = function (title) {

	kindle.chrome.setTitleBar('', title);

}


And this is used to take control on the searchbar buttons (store, back and menu). As described before, we can use those buttons to trigger any function but we need first to take control on them (i.e setting the button to "notifyApp").
We can also disable buttons (they become grayed).

Code:
function setupSearchBar(){

        var json = {
            "appId": "YOUR APP ID HERE",            
            "searchBar": {
                "clientParams": {
                    "profile": {
                        "name": "default",
                        "buttons": [
                            { 
                                "id": "menu",
                                "state": "enabled",
                                "handling":"notifyApp"
                            },                             
                            { 
                                "id": "back",
                                "state": "disabled",
                                "handling":"notifyApp" }, 
                            { 
                                "id": "store",
                                "state": "enabled",
                                "handling":"system"
                            } 
                        ]
                    }
                } 
            } 
        };
        
        kindle.messaging.sendMessage('com.lab126.pillow', 'configureChrome', json);

}
"State" could be enabled or disabled, "handling" could be notifyApp or system.
silver18 is online now   Reply With Quote