[Companion] Another 'nother version

Brian mozdev at bkennelly.net
Wed Sep 15 23:13:13 EDT 2004


I missed the Alert button change, so here it is;

Sorry about that.


-----------------------------------------------------------
This version contains all the earlier changes, plus a new one for
bookmarks that do not begin with "http"

The diff file shows all the changes from the CVS version.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: yahootoolbar.jar
Type: application/octet-stream
Size: 66937 bytes
Desc: not available
Url : http://mozdev.org/pipermail/companion/attachments/20040915/e0f70647/yahootoolbar-0001.obj
-------------- next part --------------
? companion/sources/dyn/content/icons/46c.gif
Index: companion/sources/dyn/content/class_Button.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_Button.js,v
retrieving revision 1.5
diff -r1.5 class_Button.js
17c17
< // $Id: class_Button.js,v 1.5 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_Button.js,v 1.3 2004/01/27 17:03:48 burgner Exp $
82,83c82,83
< 
<     switch(this.type)
---
>     
> switch(this.type)
112c112
<             this.img = "";
---
>        //     this.img = "";
142c142
<             this.img = "";
---
>          //   this.img = "";
161a162,164
>         case "46c.bmp": // the Notepad image
>             this.img = "chrome://yahootoolbar/content/icons/46c.gif";
>             break;
232c235,236
<             this.img = "";
---
>             if (this.type != "")
>                this.img = "http://us.i1.yimg.com/us.yimg.com/i/tb/icons/" + this.type;
Index: companion/sources/dyn/content/class_ButtonMenu.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_ButtonMenu.js,v
retrieving revision 1.4
diff -r1.4 class_ButtonMenu.js
9c9
< // $Id: class_ButtonMenu.js,v 1.4 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_ButtonMenu.js,v 1.2 2003/07/31 21:40:34 dviner Exp $
Index: companion/sources/dyn/content/class_CompanionDisplayer.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_CompanionDisplayer.js,v
retrieving revision 1.6
diff -r1.6 class_CompanionDisplayer.js
1c1
< // $Id: class_CompanionDisplayer.js,v 1.6 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_CompanionDisplayer.js,v 1.4 2004/01/27 17:03:48 burgner Exp $
156c156
<     dynBm.setAttribute("orient","horizontal");
---
> //    dynBm.setAttribute("orient", "horizontal");
157a158
>     dynBm.setAttribute("tooltiptext", bm.getTitle());
193,197d193
<     // first we make the menu item itself
<     dynMenu = document.createElement("toolbarbutton");
<     var myid = "dynmenu" + itemIdx;
<     itemIdx++;
<     dynMenu.setAttribute("id", myid);
199a196
>         dynMenu = document.createElement("menu");
200a198,199
>         dynMenu.setAttribute("label", menu.getTitle());
>         dynMenu.setAttribute("tooltiptext", null);
201a201
>         dynMenu = document.createElement("toolbarbutton");
202a203,205
>         if (_UseIconsAndNames)
>           dynMenu.setAttribute("label", menu.getTitle());
>         dynMenu.setAttribute("tooltiptext", menu.getTitle());
204d206
<     dynMenu.setAttribute("label", menu.getTitle());
207a210,215
> 
>     // first we make the menu item itself
>     var myid = "dynmenu" + itemIdx;
>     itemIdx++;
>     dynMenu.setAttribute("id", myid);
> 
262a271
>         dynMi.setAttribute("tooltiptext", null);
364a374
> 
374c384,386
<             button.setAttribute("label", but.getTitle());
---
>             if (_UseIconsAndNames)
>               button.setAttribute("label", but.getTitle());
>             button.setAttribute("tooltiptext", but.getTitle());
Index: companion/sources/dyn/content/class_FeedParser.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_FeedParser.js,v
retrieving revision 1.6
diff -r1.6 class_FeedParser.js
10c10
< // $Id: class_FeedParser.js,v 1.6 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_FeedParser.js,v 1.4 2004/01/27 17:03:48 burgner Exp $
Index: companion/sources/dyn/content/class_Menu.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_Menu.js,v
retrieving revision 1.8
diff -r1.8 class_Menu.js
9c9
< // $Id: class_Menu.js,v 1.8 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_Menu.js,v 1.6 2004/01/27 17:03:48 burgner Exp $
93a94,95
>     if (this.img == "" && this.type != "")
>         this.img = "http://us.i1.yimg.com/us.yimg.com/i/tb/icons/" + this.type;
Index: companion/sources/dyn/content/class_MenuItem.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_MenuItem.js,v
retrieving revision 1.6
diff -r1.6 class_MenuItem.js
11c11
< // $Id: class_MenuItem.js,v 1.6 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_MenuItem.js,v 1.4 2004/01/27 17:03:48 burgner Exp $
26c26
<     if(this.menuText == "About Yahoo! Companion" )
---
>     if(this.menuText == "About Yahoo! Toolbar" )
44,50c44
<     var tmp = this.getTitle();
<     if(tmp == "Refresh Toolbar")
<         return true;
<     if(tmp == "Aktualisieren")
<         return true;
<     else
<         return false;
---
>       return (this.menutype == 6);
54,58c48
<     var tmp = this.getTitle();
<     if(tmp == "About Yahoo! Companion" || tmp == "About Yahoo! Companion (Mozilla)")
<         return true;
<     else
<         return false;
---
>       return (this.menutype == 7);
62,72c52
<     var tmp = this.getTitle();
<     if(tmp == "Show Icons Only")
<         return true;
<     if(tmp == "Nur Symbole")
<         return true;
<     if(tmp == "Show Icons and Names")
<         return true;
<     if(tmp == "Symbole und Namen")
<         return true;     
<     else
<         return false;
---
>       return (this.menutype == 14);
76,81c56,61
<     if(this.getTitle() == "Uninstall")
<         return true;
<     if(this.getTitle() == "Yahoo! Assistent deinstallieren")
<         return true;
<     else
<         return false;
---
>       return (this.menutype == 8);
> }
> 
> MenuItem.prototype.isSwitch = function()
> {
>       return (this.menutype == 9);
86,91c66
<     if(this.getTitle() == "Add Bookmark")
<         return true;
<     if(this.getTitle() == "Neues Bookmark")
<         return true;
<     else
<         return false;
---
>       return (this.menutype == 1);
114,131c89,99
<     // in rare cases (like Alerts from a MenuItem) the http:// starts the text...
<     // so look for that first
<     if(txt.substr(0,4) == "http")
<     {
<         var idx = txt.indexOf('\x18\x18');
<         if(idx != -1)
<         {
<             // we need to subtract 1 to leave a ^X at the end.
<             // this is removed later in this function.
<             link = txt.substr(0,idx+1);
<             //alert("I think the link should be " + link2 + "\nidx: " + idx + "\norig: " + txt);
<         }
<         else
<         {
<             link = txt;
<         }
<     }
<     else
---
>     
>     // often there is a string of ^A that represent a link.
>     // -A- -A- -A-
>     // after 3rd \x01 is $, then link is after 4th \x01, but need to replace % with $VAR
>     // VAR could be ESRV
>     // after 3rd \x01 is %, then remove %, and return link.
>     // Note, could be empty... not always link in there!
>     //alert('find link in: ' + txt);
>     
>     //if(this.isAddBookmark())
>     if (txt.charAt(0) == '\x01')
133,142c101,106
<         // often there is a string of ^A that represent a link.
<         // -A- -A- -A-
<         // after 3rd \x01 is $, then link is after 4th \x01, but need to replace % with $VAR
<         // VAR could be ESRV
<         // after 3rd \x01 is %, then remove %, and return link.
<         // Note, could be empty... not always link in there!
<         //alert('find link in: ' + txt);
<         
<         if(this.isAddBookmark())
<         {
---
>        var re = /^\x01([0-9]*)/;            
>        var type = re.exec(txt);
>        this.menutype = type[1];
>        switch (type[1])
>        {
>          case "1":        // Add Bookmark
151,153c115,117
<             if(buffer == null)
<                 return link;
<             
---
> 	    if(buffer == null)
> 	         return link;
>            
156,157c120,121
<             
<             link = buffer.substr(0,l);
---
>                  
> 	    link = buffer.substr(0,l);
159,168c123,129
<             return link;
<         }
<         var i=0;
<         var offset = 0;
<         var buffer = txt;
<         for( ; i < 3; i++)
<         {
<             var a = buffer.indexOf('\x01',offset);
<             if(a == -1)
<                 break;
---
> 	    return link;
>             break;
>           case "9":        // Switch toolbar
>             re = /\x01.*\x01(\d*)\x19/;
>             var tb = re.exec(txt);
>             if (tb[1] == "3")           // Currently 'My Toolbar'
>                 link = "http://edit.companion.yahoo.com/config/slv4_changedefault?.commit=y&.dflt=2";
170,176c131
<             {
<                 offset = a+1;
<             }
<         }
<         // if i == 3, then we did it...
<         if(i!=3)
<         {
---
>                link = "http://edit.companion.yahoo.com/config/slv4_changedefault?.commit=y&.dflt=3";
178,198c133,150
<         }
<         // now we know we have something... if the next char after offset is
<         // a $, then find the data after the next \x01, and substitue $ESRV for %
<         // otherwise, remove %, and return string
<         var start;
<         if(buffer.charAt(offset) == '$')
<         {
<             // get the next one...
<             start = buffer.indexOf('\x01',offset);
<             start++;
<             // now fetch the string...
<             link = buffer.substr(start);
<             // now replace the % with $ESRV
<             var perc = link.indexOf('%');
<             var linkAfter = link.substr(perc+1);
<             link = "http://edit.companion.yahoo.com"+linkAfter;
<         }
<         else
<         {
<             link = buffer.substr(offset+1);
<         }
---
>             break;
>           case "4":        // Action item
>           case "14":       // Toggle Icons only 
>             re = /\x01.*?\x01.*?\x01?(\$ESRV)?\x01%(.*?)[\x18|\x19]/;  // Get string starting with 3rd ^A
>             var links = re.exec(txt);
>             if (links[1] == "$ESRV") 
>                link = "http://edit.companion.yahoo.com";
>              link += links[2];
>              return link;
>              break;            
>           default:
>              break;
>        }
>     } else
>     {    // Probably a bookmark, just extract the text
>       var links = txt.match(/(.*?)[\x18|\x19]/);
>       link = links[1];
>       return link;
200,203d151
<     // shorten by 1 since there's a control char at the end
<     var len = link.length;
<     link = link.substr(0,(len-1));
<     return link;
Index: companion/sources/dyn/content/class_NewMailNotify.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/class_NewMailNotify.js,v
retrieving revision 1.1
diff -r1.1 class_NewMailNotify.js
6c6
< // $Id: class_NewMailNotify.js,v 1.1 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: class_NewMailNotify.js,v 1.0 2004/02/20 17:03:48 hodge Exp $
119c119,120
< 						AlertButtonMenu.replaceChild(alertPopup.childNodes[0], AlertButtonMenu.childNodes[0].childNodes[0]);
---
>                                      AlertButtonMenu.childNodes[0].replaceChild(alertPopup.childNodes[0],
>                                                 AlertButtonMenu.childNodes[0].childNodes[0]);
Index: companion/sources/dyn/content/yahootoolbar.css
===================================================================
RCS file: /cvs/companion/sources/dyn/content/yahootoolbar.css,v
retrieving revision 1.4
diff -r1.4 yahootoolbar.css
2c2
<  $Id: yahootoolbar.css,v 1.4 2004/03/23 22:36:03 burgner Exp $
---
>  $Id: yahootoolbar.css,v 1.3 2004/01/27 17:03:48 burgner Exp $
19a20,24
> toolbarbutton.yahoobuttonmenu >
> .toolbarbutton-menubutton-button {
>   -moz-box-orient: horizontal;
> }
> 
Index: companion/sources/dyn/content/yahootoolbarOverlay.js
===================================================================
RCS file: /cvs/companion/sources/dyn/content/yahootoolbarOverlay.js,v
retrieving revision 1.4
diff -r1.4 yahootoolbarOverlay.js
1c1
< // $Id: yahootoolbarOverlay.js,v 1.4 2004/03/23 22:36:03 burgner Exp $
---
> // $Id: yahootoolbarOverlay.js,v 1.2 2003/07/31 21:40:34 dviner Exp $
109a110,115
>   var d = window._content.document;
>   re    = /\x01\$GETTITLE/g;
>   searchUrl = searchUrl.replace(re,d.title);
>   re    = /\x01\$GETURL/g;
>   searchUrl = searchUrl.replace(re,d.location);
> 
125c131,134
<   re = /\x01\%/;  
---
>   re = /\x01\$REG_sc/g;  
>   searchUrl = searchUrl.replace(re, "");
> 
>   re = /\x01\%/g;  


More information about the Companion mailing list