Patch Browser Global Search Addons

From WebOS Internals
Revision as of 00:08, 3 August 2009 by Hopspitfire (talk | contribs)
Jump to navigation Jump to search

This example adds a option to the global search. You can add other sites. A list of all such sites along with associated graphics is available at all available 'universal search' images and search links.

NOTE Make sure you put all your addons BEFORE twitter, if they are after it will not work properly!!

0. Access Linux, then enable write access:

mount -o remount,rw /

1. Edit the following file: /usr/lib/luna/system/luna-applauncher/app/controllers/global-search-assistant.js

Find this code and modify it as such (be sure to use the correct search link):

 this.URLs = {
                'reddit': $L(""),
                'twitter': $L("")


Be sure to note the lack of a comma at the end of the line beginning with 'twitter'. URL codes for additional search engines found here.

2. In the same file -- you must also add "$('reddit').removeClassName('selected');" to this function:

 clearSearch: function() {
                if (this.delayShowAppsConatactsTimeout)
                this.currentFilter = "";
                this.searchExplicitlyExpanded = false;
                this.noMatches = false;
                this.webDrawer.showWeb =  false ;
                this.expandedSearchDrawer.showExpanded = false;
                if (this.controller.get('searchterm')) {
                this.gpsInfo = undefined;

3. Edit the following file: /usr/lib/luna/system/luna-applauncher/app/views/global-search/expanded-searches-div.html

Modify the code to add a new div:

<div id='expanded_searches_drawer' x-mojo-element="Drawer">
        <div class="palm-row" id="google" name="search-identifier" x-mojo-tap-highlight="persistent">
                <div class="palm-row-wrapper">
                        <div class="search-google"></div>
        <div class="palm-row" id="map" name="search-identifier" x-mojo-tap-highlight="persistent">
                <div class="palm-row-wrapper">
                        <div class="search-maps"></div>
        <div class="palm-row" id="wikipedia" name="search-identifier" x-mojo-tap-highlight="persistent">
                <div class="palm-row-wrapper">
                        <div class="search-wikipedia"></div>
        <div class="palm-row" id="reddit" name="search-identifier" x-mojo-tap-highlight="persistent">
                <div class="palm-row-wrapper">
                        <div class="search-reddit"></div>
        <div class="palm-row" id="twitter" name="search-identifier" x-mojo-tap-highlight="persistent">
                <div class="palm-row-wrapper">
                        <div class="search-twitter"></div>
        <div id='web_drawer' x-mojo-element="Drawer">
                <div class="palm-row last" id="web" name="search-identifier" x-mojo-tap-highlight="persistent">
                        <div class="palm-row-wrapper">
                                <div class="title search-url truncating-text" id="webtext">#{filterText}</div>

4. Edit the following file: /usr/lib/luna/system/luna-applauncher/stylesheets/global-search.css

Add the following class to the css file: .search-reddit {
                width: 100%;
                height: 52px;
                background: url(../images/search-reddit.png) center center no-repeat;

5. Finally, you need to create a png image (ideally 200x44, but any size up to 300x44 should work) with a transparent background and the logo of your choice. Add it to the path below making sure the name matches the css class, reboot, and enjoy! /usr/lib/luna/system/luna-applauncher/images

6. Remount file system as read-only:

mount -o remount,ro /	

7. Disconnect and reboot your Pre with Orange-Sym-R

Here is the image I used:


(See all available 'universal search' images and search links.)

And here is the end result!