View Single Post
Old 10-19-2012, 11:39 AM   #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: 701
Karma: 1545649
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 offline   Reply With Quote