[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
Locked
aronin
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post by aronin »

m435tr0d wrote:I have two requests if anybody finds time or finds interest...

Open searchbar in new tab on pressing enter
^SevenSeven made one for addressbar, I would like the searchbar to do the same.



This feature is inbuilt in Firefox 2.
Go to about:config and set browser.search.openintab to true.
old nicholas.alipaz
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old nicholas.alipaz »

Thanks, but I am using 1.5... ;)
User avatar
DonGato
Posts: 589
Joined: December 1st, 2005, 9:57 am

Post by DonGato »

SevenSeven wrote:Fixed ctrl, shift, alt key issues:

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IE9wZW4gdXJsYmFyJ3MvYm9va21hcmtzIGluIG5ldyBmZyB0YWIgb3IgaW4gY3VycmVudCB0YWIgaWYgaXQncyBibGFuayA9PT09PT09Ki8NCg0KZXZhbCgiQnJvd3NlckxvYWRVUkwgPSAiICsgQnJvd3NlckxvYWRVUkwudG9TdHJpbmcoKS5yZXBsYWNlKCJlOyIsICIkJiBpZiAoKGdCcm93c2VyLmN1cnJlbnRVUkkuc3BlYyAhPSAnYWJvdXQ6YmxhbmsnIHx8IGdCcm93c2VyLndlYlByb2dyZXNzLmlzTG9hZGluZ0RvY3VtZW50KSAmJiAoIWFUcmlnZ2VyaW5nRXZlbnQuY3RybEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5zaGlmdEtleSAmJiAhYVRyaWdnZXJpbmdFdmVudC5hbHRLZXkpKSB7IHZhciB0YWIgPSBnQnJvd3Nlci5hZGRUYWIoKTsgZ0Jyb3dzZXIuc2VsZWN0ZWRUYWIgPSB0YWI7IH0iKSk7DQpldmFsKCJCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyayA9ICIgKyBCb29rbWFya3NDb21tYW5kLm9wZW5PbmVCb29rbWFyay50b1N0cmluZygpLnJlcGxhY2UoIm9wZW4iLCAiaWYgKChnQnJvd3Nlci5jdXJyZW50VVJJLnNwZWMgIT0gJ2Fib3V0OmJsYW5rJyB8fCBnQnJvd3Nlci53ZWJQcm9ncmVzcy5pc0xvYWRpbmdEb2N1bWVudCkgJiYgKGFUYXJnZXRCcm93c2VyICE9ICd3aW5kb3cnICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWInICYmIGFUYXJnZXRCcm93c2VyICE9ICd0YWJzaGlmdGVkJykpIHsgdmFyIHRhYiA9IGdCcm93c2VyLmFkZFRhYigpOyBnQnJvd3Nlci5zZWxlY3RlZFRhYiA9IHRhYjsgfSAkJiIpKTs%3D">Open urlbar URL's and bookmarks in new foreground tab or in current tab if it's blank</a>

Do you know how to do this for history entries as well?
User avatar
Tatsfield
Posts: 127
Joined: February 6th, 2006, 5:58 am
Location: Poole, UK

Post by Tatsfield »

No one seems to be interested in my query and I'm not sure if that's because I've posted in the wrong place but I'm not a code writer but I want to alter the default for the Print Dialogue which controls Print Frames. The current default is nearly alWays what I don't want and I cannot find a way of making "As laid out on the screen" the default setting.

Can anyone offer me an idiots guide of how to do this? (And when I say idots guide, I mean instructions for the really dim!)
Win7 - Firefox 29.0.1 Thunderbird 24.5.0
pile0nades
Posts: 756
Joined: May 15th, 2005, 2:31 am

Post by pile0nades »

This code adds a button to Stylish that adds !important to every rule. This is good for installing new styles that don't use !important to persist the rules, or if you don't feel like typing 10, 20, 30 or more letters (10 to each !important flag) when a button press will fill in all of them.
Image

<a href="data:text/javascript;charset=utf-8;base64,V2luZG93SG9vay5yZWdpc3RlcigiY2hyb21lOi8vc3R5bGlzaC9jb250ZW50L3N0eWxpc2gtZWRpdC54dWwiLA0KICBmdW5jdGlvbihhV2luZG93KSB7DQogICAgLy8gZ2V0IHRoZSBjaGVja2JveA0KICAgIHZhciBjaGVja2JveCA9IGFXaW5kb3cuZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoIndyYXAtbGluZXMiKTsNCiAgICANCiAgICAvLyBjcmVhdGUgYSBidXR0b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ZGVjbGFyYXRpb25zDQogICAgICANCiAgICAgIGJveC5zY3JvbGxUb3AgPSBzY3JvbGxbMF07DQogICAgICBib3guc2Nyb2xsTGVmdCA9IHNjcm9sbFsxXTsNCiAgICB9LCBmYWxzZSk7DQogIH0NCik7DQoNCi8vICpzaW1wbGlmaWVkIGZyb20gYSByZWdleCBmcm9tIGZleWQgb24gdGhlIERldk5ldHdvcmsgZm9ydW1zLCB0aGFua3MhDQovLyBodHRwOi8vZm9ydW1zLmRldm5ldHdvcmsubmV0L3ZpZXd0b3BpYy5waHA%2FcD0zNTI5NDYjMzUyOTQ2DQo%3D">important.uc.js</a>

Update: Now supports rules without a semicolon, and preserves the scroll position of the text box.

Edit: This feature will be in the next version of Stylish.
Last edited by pile0nades on March 7th, 2007, 8:30 am, edited 3 times in total.
Linkify bug numbers - test: bug 258287
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

Tatsfield wrote:No one seems to be interested in my query and I'm not sure if that's because I've posted in the wrong place but I'm not a code writer but I want to alter the default for the Print Dialogue which controls Print Frames.

I've had a quick look at the relevant code and don't see where to modify the default you're after (this is especially tricky under Windows where the dialog isn't provided by Firefox but by the OS itself). You're probably better off by either creating your own thread for that question or asking for help on IRC since somebody directly responsible for the code might be able to assist you better than most extension authors.
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »

zeniko wrote:You're probably better off by either creating your own thread for that question or asking for help on IRC since somebody directly responsible for the code might be able to assist you better than most extension authors.

or you might want to file a bug.

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
Old Greg S
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Greg S »

Can someone edit this so that it doesn't show the time zone and possibly not replace the browser name/title

Code: Select all

function doTheClock() {
   window.setTimeout( "doTheClock()", 1000 );
   t = new Date();
   if(document.all || document.getElementById){
      document.title = t.toString();
   }else{   
      self.status = t.toString();
   }
}

doTheClock()
pile0nades
Posts: 756
Joined: May 15th, 2005, 2:31 am

Post by pile0nades »

Code: Select all

var title = document.title;
function doTheClock() {
   window.setTimeout( "doTheClock()", 1000 );
   t = new Date();
   var timestr = " - " + t.toString().substring(0, t.toString().indexOf("(") - 1);
   document.title = title + timestr;

}
doTheClock();


How's this?
Linkify bug numbers - test: bug 258287
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »

Code: Select all

function doTheClock() {
  var title = content.document.title;
  window.setTimeout( "doTheClock()", 1000 );
  var t = new Date();
  var timestr = " - " + t.toString().substring(0, t.toString().indexOf("GMT") - 1);
  document.title = title + timestr;
}

doTheClock();

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
Old Greg S
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Greg S »

pile0nades wrote:

Code: Select all

var title = document.title;
function doTheClock() {
   window.setTimeout( "doTheClock()", 1000 );
   t = new Date();
   var timestr = " - " + t.toString().substring(0, t.toString().indexOf("(") - 1);
   document.title = title + timestr;

}
doTheClock();


How's this?


pile0nades, It works but it duplicates the time in the titlebar for every tab I have open whilst using session manager

/* Zoolcar9's below */

Zoolcar9 wrote:

Code: Select all

function doTheClock() {
  var title = content.document.title;
  window.setTimeout( "doTheClock()", 1000 );
  var t = new Date();
  var timestr = " - " + t.toString().substring(0, t.toString().indexOf("GMT") - 1);
  document.title = title + timestr;
}

doTheClock();




This code works. Now,lol... Any way to lose the seconds and make it twelve hour with AM/PM?
Thank's to both of you for the help!


Edit:
OK, nevermind about the seconds, that really doesn't bother me. I've got this to work mostly the way I want it with one exception, with my latest code I don't know how to add the title back in with what I've come with. In playing around with this, I see that I can do away with the extension "Title Bar Tweaks". Anyway, what I would like to do now is add the browser/page title into my latest code if possible

Code: Select all

function clock() {


var timerID = null;
var timerRunning = false;

if(timerRunning)
   clearTimeout(timerID);
   timerRunning = false;


var timeNow = new Date();
var hours = timeNow.getHours();
var minutes = timeNow.getMinutes();
var seconds = timeNow.getSeconds();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue = ((timeValue <10)? "0":"") + timeValue
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds <10>= 12) ? " PM" : " AM"
timerID = setTimeout("clock()",100);
timerRunning = true;


var dateNow = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var date = ((dateNow.getDate()<10) ? "0" : "")+ dateNow.getDate();
function y2k(number){return (number < 1000) ? number + 1900 : number;}


today = "Greg's Firefox 1.5" + " - " + days[dateNow.getDay()] + " - " +
               months[dateNow.getMonth()]  + " " +
                date + ", " +
                (y2k(dateNow.getYear())) + " - " + timeValue;

   if(document.all || document.getElementById){
      document.title = today.toString();
   }else{
      self.status = today.toString();
   }
}

clock();


Edit 2: Nevermind, I figured it out. Thanks!
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »

Code: Select all

function doTheClock() {
  var days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
  var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  var title = content.document.title;
  window.setTimeout("try{doTheClock()}catch(ex){}", 1000 );
  var D = new Date();
  var day = days[D.getDay()];
  var month = months[D.getMonth()];
  var year = D.getFullYear();
  var hour = D.getHours();
  var minute = D.getMinutes();
  var second = D.getSeconds();
  var date = day + ", " + month + " " + D.getDate() + ", " + year;
  var time = (hour > 12 ? hour - 12 : hour) + ":" + minute + (hour >= 12 ? "pm" : "am");
  var timestr = " - " + date + ", " + time;
  document.title = title + timestr;
}

doTheClock();

Dunno if there's a better way but this is WFM

//edit: oops sorry I didn't read your updated post

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
paulfox
Posts: 1510
Joined: May 8th, 2004, 1:38 pm

Post by paulfox »

Hopefully good 'ol userChrome 0.7 can do this . . . I make my own manual backups (as well as uninstalling and now reinstalling BookMark Backup alpha build) and burn to disk 3x wk. I don't necessarily want prefs/chrome etc backed up every time I close FX or at a timed interval. I would, however, like to hit a button (or "tools/right click context" command) and have a backup made then and there, on demand. Is that possible with userChrome 0.7?

Here are the files I want backed up from my profile:

chrome (folder)
searchplugins (folder)
bookmarks
cer8.db
cookies
hostperm.1
key3.db
localstore
mimeTypes
prefs
secmod.db
signons
stylish.rdf

Most important from above: bookmarks, chrome folder, stylish.rdf
Last edited by paulfox on October 19th, 2006, 7:12 am, edited 1 time in total.
PentiumIII/W2K, Toshiba AMD laptop/Vista. FX 3 on both.
Old Greg S
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Greg S »

Zoolcar9 wrote:

Code: Select all

function doTheClock() {
  var days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
  var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  var title = content.document.title;
  window.setTimeout("try{doTheClock()}catch(ex){}", 1000 );
  var D = new Date();
  var day = days[D.getDay()];
  var month = months[D.getMonth()];
  var year = D.getFullYear();
  var hour = D.getHours();
  var minute = D.getMinutes();
  var second = D.getSeconds();
  var date = day + ", " + month + " " + D.getDate() + ", " + year;
  var time = (hour > 12 ? hour - 12 : hour) + ":" + minute + (hour >= 12 ? "pm" : "am");
  var timestr = " - " + date + ", " + time;
  document.title = title + timestr;
}

doTheClock();

Dunno if there's a better way but this is WFM

//edit: oops sorry I didn't read your updated post





I like your coding of this better than what I've posted above in my last reply. I'm having problems with your minutes less than 10 losing the 0. Can you fix?? If not that's OK. I've trimmed the excess out of what posted above and it works fine but I'd rather use the code you posted if you can fix the minutes.
Thanks
Old Greg S
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Greg S »

This is unrelated to userChrome.js but I have a small extension I'm playing with which has a toolbarbutton and I would like for the toolbarbutton to turn on or off some css. Can anyone help me with this?
Locked