You currently have Javascript disabled, to use some of the features (such as the login) you must enable it for this site
How do I modify the icon of a button? | Custom Buttons²

How do I modify the icon of a button?

Post your extension support questions here

Postby shame on Sun Mar 30, 2008 3:10 pm

I've only just discovered this extension and I've added the URLbar search button.

The thing is, by default it displays the google icon (or others, depending what is set as search engine in the firefox searchbar).

How can I change the icon to my own preference?

I've gone on the edit button settings and under image I've tried browsing to a file on my hard drive and also tried adding an internet link to an image but it doesn't change.
Can anyone advise me how to change this icon?
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.13) Gecko/20080311 Iceweasel/2.0.0.13 (Debian-2.0.0.13-1)

repository of shame - compiz fusion & beryl repo for sidux/debian | 32-bit | 64-bit
User avatar
shame
Registered User
Registered User
 
Posts: 3
Joined: Sun Mar 30, 2008 3:04 pm
Location: England

Postby squeaky on Sun Mar 30, 2008 8:42 pm

shame wrote:I've only just discovered this extension and I've added the URLbar search button.

The thing is, by default it displays the google icon (or others, depending what is set as search engine in the firefox searchbar).

How can I change the icon to my own preference?

I've gone on the edit button settings and under image I've tried browsing to a file on my hard drive and also tried adding an internet link to an image but it doesn't change.
Can anyone advise me how to change this icon?


Can you point me at the button concerned and I'll take a quick look.

The odds are that the image in the "image box" at the top of the "Edit" window is not the one that is actually used.

Once you've found them...

Pick the picture you want and put it in the image box.

Click on the ->base64 button.

Triple click in the box and copy it.

Then go to the initialise tab and swap your code from the box into the place where the image is listed.

You'll need to repeat that routine for ech image that you want to change in this button.

HTH

The images will be changed in the coding routines in the initialise tab.

They'll be of the form:-

this.image =
"data...blah blah HUGE long line of code";
Regards and stuff,
Richard.

CustomButtons2:- ver 2.0.7.5; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
User avatar
squeaky
Moderator
Moderator
 
Posts: 445
Joined: Sat Mar 01, 2008 8:48 am
Location: Sunny Suffolk

Postby shame on Sun Mar 30, 2008 9:43 pm

This is the button in question: viewtopic.php?f=35&t=321&start=0&st=0&sk=t&sd=a&hilit=urlbar+search

I looked at the initialise tab but there doesn't appear to be any lines dealing with an image, maybe that's the problem.
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.13) Gecko/20080311 Iceweasel/2.0.0.13 (Debian-2.0.0.13-1)

repository of shame - compiz fusion & beryl repo for sidux/debian | 32-bit | 64-bit
User avatar
shame
Registered User
Registered User
 
Posts: 3
Joined: Sun Mar 30, 2008 3:04 pm
Location: England

Postby nicholas on Sun Mar 30, 2008 10:29 pm

Code: Select all
    if(engines[i].iconURI)
      mi.setAttribute("src", engines[i].iconURI.spec);


This is the line that specifies the images. The images are chosen from your profile so they would have to be changed on your harddrive.
C:\Program Files\Mozilla Firefox\searchplugins

The images are in data:URI (base64) format within the xml files there, you can edit the files and replace them with the image of your choice, they should be base64 format.
User avatar
nicholas
Admin
Admin
 
Posts: 1315
Joined: Thu Jun 14, 2007 6:30 pm
Location: Los Angeles, CA

Postby squeaky on Sun Mar 30, 2008 10:53 pm

Hmm... bit of a fiddle but here goes... :)

Code: Select all

// change this bit...

this.selectEngine = function(aNode, aEvent) {
  var engine = aEvent.target.engine;
  var ss = searchService();
  ss.currentEngine = ss.getEngineByName(engine.name);
  aNode.engine = engine;
  // aNode.image = aEvent.target.getAttribute("src");
  this.image = "data:image/gif;base64,R0lGODlhIAAgAIcAAAUFBQYGCAkHBQsKDBAPERMUDh0TDBQSExkXGhoaFBsbGx8eIB4gHCIfIyIgGycnKSYoKi0rJy0rLSwqMzAvLDMyNDU2ODg2Ojw7NDo4OkE2HU9BJ0hFP0lKN01MPlZEJlVCKVlOLltRN2NLKWZXOmpUNHdiNX9kOEZFRU5OQU1KSUxNUExSUVBKQlFNUlVVRVBQSVlXQltURFJRU1dVWFtYUFtZVl9dVFxbXl5aYWhfTGZmU2xhU2lmW2xsWnBnRnRtX35vUHxyUX9xWXp5XGNhZWdlaGdoYmhma2xnbm1qbm9tcXBtZnBuaHFxYXNyZnxxZ3x7YXx6a3RydH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XKDxNL0EFBkyMBjf7wUVrJqMZEBPQMKMKqZkEkFjbYyHAVYzxZQJElSEktQoOIwwRCjPmaRCZFphFZQnQTQCiCw+jNcDTK1x5pFMpoDhByWEKCHVeLBwIosqqHj00iovQXHIGDy4QZ9AtDCRiSocmaLKKKxYocUhItDyI0F3fCIlJ6B88sUeJZzw5EVn5DGCHiBsaVEiH+DBiBhiMnRLCCVY0scgaS40hAGLPJJFnAq9IcMWjxgSCJ4EkUECIorwQckkgA6kQxT9TOJIF5AkWtAlJmwQiaQDYRIJKT9gWpAtQnhaEBCiDjRHDaUONItJAQEAOw==";
}


// change this bit...

var ss = searchService();
this.engine = ss.currentEngine;
// this.image = this.engine.iconURI.spec;
this.image = "data:image/gif;base64,R0lGODlhIAAgAIcAAAUFBQYGCAkHBQsKDBAPERMUDh0TDBQSExkXGhoaFBsbGx8eIB4gHCIfIyIgGycnKSYoKi0rJy0rLSwqMzAvLDMyNDU2ODg2Ojw7NDo4OkE2HU9BJ0hFP0lKN01MPlZEJlVCKVlOLltRN2NLKWZXOmpUNHdiNX9kOEZFRU5OQU1KSUxNUExSUVBKQlFNUlVVRVBQSVlXQltURFJRU1dVWFtYUFtZVl9dVFxbXl5aYWhfTGZmU2xhU2lmW2xsWnBnRnRtX35vUHxyUX9xWXp5XGNhZWdlaGdoYmhma2xnbm1qbm9tcXBtZnBuaHFxYXNyZnxxZ3x7YXx6a3RydHd1eXp2fH99cn96f3+AaoRtP4h4SIJ1VYFwW51+S5J+WYZ7aoN8g4J+hZiDTpiBUJ2SWoGBZISDa4iAZY+Da4uLa4uKbYOCcYOAf4eIcIiHc5eMa5KHf5CPcpKIfZ2Sb5aYd5aYfpiVeJmYfq+NTKaUXqmUUq2ZXbmOT7OTV7SbWKePYaGMbKaQYaiRYq2ZY6iWebGYYLygV72hXaKjf7WjY7+td8GhUsOiXsmkXsyrXNyyXc+0Zc60csu3fdSyat2zY9K6fO+9We69afHJb4OBhIaFi4eJj4mGhY+GhYmGi4yKhIy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HDaUONItJAQEAOw==";



Where you see lines starting :-

this.image = "data:image/gif;base64,R0lGODlhIAAgAIcAAA

That's where you add your own image. NOT forgetting to put ---> "; at the end of each line!

And comment out the previous lines as shown.

HTH
Regards and stuff,
Richard.

CustomButtons2:- ver 2.0.7.5; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
User avatar
squeaky
Moderator
Moderator
 
Posts: 445
Joined: Sat Mar 01, 2008 8:48 am
Location: Sunny Suffolk

Postby squeaky on Mon Mar 31, 2008 6:33 am

It was late and I was tired - here's a much neater way...

Immediately below the start of initialisation add...

Code: Select all
/*Initialization code*/

  myimage = "data:image/gif;base64,R0lGODlhIAAgAIcAAAU... ";


Using the data for your own image.

Then... change in two places

Code: Select all

// change this bit...

this.selectEngine = function(aNode, aEvent) {
  var engine = aEvent.target.engine;
  var ss = searchService();
  ss.currentEngine = ss.getEngineByName(engine.name);
  aNode.engine = engine;
  // aNode.image = aEvent.target.getAttribute("src");
  this.image = myimage;


// change this bit...

var ss = searchService();
this.engine = ss.currentEngine;
// this.image = this.engine.iconURI.spec;
this.image = myimage
Regards and stuff,
Richard.

CustomButtons2:- ver 2.0.7.5; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
User avatar
squeaky
Moderator
Moderator
 
Posts: 445
Joined: Sat Mar 01, 2008 8:48 am
Location: Sunny Suffolk

Postby shame on Mon Mar 31, 2008 11:01 am

Wow! Many thanks for going to all that trouble :clap:

I just tried the method in your last post. Didn't work at first but that turned out to be a copy and pasting error on my part.

It's now working perfectly and I have my chosen icon instead of the google one.

Thanks again :)
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.13) Gecko/20080311 Iceweasel/2.0.0.13 (Debian-2.0.0.13-1)

repository of shame - compiz fusion & beryl repo for sidux/debian | 32-bit | 64-bit
User avatar
shame
Registered User
Registered User
 
Posts: 3
Joined: Sun Mar 30, 2008 3:04 pm
Location: England

Postby squeaky on Mon Mar 31, 2008 2:17 pm

You're welcome.

It was a bit of light relief from sorting out problems on one of my own buttons! :)
Regards and stuff,
Richard.

CustomButtons2:- ver 2.0.7.5; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
User avatar
squeaky
Moderator
Moderator
 
Posts: 445
Joined: Sat Mar 01, 2008 8:48 am
Location: Sunny Suffolk


Return to Support

Who is online

Users browsing this forum: • Registered: 0 and 0 guests