home *** CD-ROM | disk | FTP | other *** search
-
- //Tab Throbber Changer, must pass a 16x16 pixel image
-
- if(!com) var com = {};
- if(!com.TChanger) com.TChanger = {};
- if(!com.TChanger.TChangerP) com.TChanger.TChangerP = {};
-
- com.TChanger.TChangerP = {
-
- ThrobberT: function() {
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
-
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
- fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
- fp.appendFilters(nsIFilePicker.filterImages);
-
-
- var rv = fp.show();
- if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
- var file = fp.file;
- // Get the path as string
- var path = fp.file.path;
- // work with returned nsILocalFile...
-
- //Get Chrome Directory
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var copythis = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- // Point "directory" to the file that we want to test for existance
- // store true or false in variable "c"
- directory.append("run16.gif");
- var c = directory.exists()
-
- // Condition, if the file "run16.gif" exists then delete it and copy the new one
- // else copy the new one to the chrome directory
- if (c==true){
- directory.remove(false);
- file.copyTo(copythis,"run16.gif");}
- else
- file.copyTo(copythis,"run16.gif");
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- directory.append("run20.gif");
- var a = directory.exists()
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- directory.append("static20.png");
- var b = directory.exists()
-
- //Make sure that we only write to UserChrome.css once
- var z = 0;
-
- if (c == false && b == false && a == false){
- com.TChanger.TChangerP.writetofile();
- } else
- if (c == false && b == true && a == true){
- z = 1;
- } else
- if (c == false && b == true && a == false){
- z = 2;
- } else
- if (c == false && b == false && a == true){
- z = 3;
- }
- }
- },
-
-
- ThrobberA: function() {
-
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
-
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
- fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
- fp.appendFilters(nsIFilePicker.filterImages);
-
-
- var rv = fp.show();
- if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
- var file = fp.file;
- // Get the path as string
- var path = fp.file.path;
- // work with returned nsILocalFile...
-
- //Get Chrome Directory
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var copythis = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- // Point "directory" to the file that we want to test for existance
- // store true or false in variable "a"
- directory.append("run20.gif");
- var a = directory.exists()
-
- // Condition, if the file "run20.gif" exists then delete it and copy the new one
- // else copy the new one to the chrome directory
- if (a==true){
- directory.remove(false);
- file.copyTo(copythis,"run20.gif");}
- else
- file.copyTo(copythis,"run20.gif");
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- directory.append("run16.gif");
- var c = directory.exists()
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- directory.append("static20.png");
- var b = directory.exists()
-
- //Make sure that we only write to UserChrome.css once
- var z = 0;
-
- if (b == false && c == false && a == false){
- com.TChanger.TChangerP.writetofile();
- } else
- if (b == false && c == true && a == true){
- z = 1;
- } else
- if (b == false && c == true && a == false){
- z = 2;
- } else
- if (b == false && c == false && a == true){
- z = 3;
- }
-
- }
-
- },
-
- ThrobberS: function() {
-
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
-
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
- fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
- fp.appendFilters(nsIFilePicker.filterImages);
-
-
- var rv = fp.show();
- if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
- var file = fp.file;
- // Get the path as string
- var path = fp.file.path;
- // work with returned nsILocalFile...
-
- //Get Chrome Directory
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var copythis = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- // Point "directory" to the file that we want to test for existance
- // store true or false in variable "b"
- directory.append("static20.png");
- var b = directory.exists()
-
- // Condition, if the file "static20.png" exists then delete it and copy the new one
- // else copy the new one to the chrome directory
- if (b==true){
- directory.remove(false);
- file.copyTo(copythis,"static20.png");}
- else
- file.copyTo(copythis,"static20.png");
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- directory.append("run16.gif");
- var c = directory.exists()
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- directory.append("run20.gif");
- var a = directory.exists()
-
- //Make sure that we only write to UserChrome.css once
- var z = 0;
-
- if (a == false && c == false && b == false){
- com.TChanger.TChangerP.writetofile();
- } else
- if (a == false && c == true && b == true){
- z = 1;
- } else
- if (a == false && c == true && b == false){
- z = 2;
- } else
- if (a == false && c == false && b == true){
- z = 3;
- }
-
- }
- },
-
- restartFF: function() {
- const Cc = Components.classes;
- const Ci = Components.interfaces;
- const Cr = Components.results;
-
- var as = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
- as.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eForceQuit);
-
- },
-
-
- writetofile: function() {
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var copythis = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- // Point "directory" to the file that we want to test for existance
- // store true or false in variable "c"
- directory.append("userchrome.css");
- var c = directory.exists()
-
- // Condition, if the file "userchrome.css" exists then copy it a
- // save it as "userchrome.css.bak"
- if (c==true){
- directory.copyTo(copythis,"userchrome.css.bak");}
-
- var writefile = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
- //Point the file to write to as UserChrome.css
-
- writefile.append("userChrome.css");
- file = writefile;
-
- // file is nsIFile, data is a string
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
- createInstance(Components.interfaces.nsIFileOutputStream);
-
- // use 0x02 | 0x10 to open file for appending.
- foStream.init(file, 0x02 | 0x08 | 0x10, 0666, 0);
- // write, create, truncate
- // In a c file operation, we have no need to set file mode with or operation,
- // directly using "r" or "w" usually.
-
- // if you are sure there will never ever be any non-ascii text in data you can
- // also call foStream.writeData directly
- var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
- createInstance(Components.interfaces.nsIConverterOutputStream);
- converter.init(foStream, "UTF-8", 0, 0);
- converter.writeString("\n toolbar[iconsize=small] #navigator-throbber[busy=true] {list-style-image: url(run20.gif) !important; opacity: 1 !important} \n toolbar[iconsize=small] #navigator-throbber[busy=true] {list-style-image: url(run20.gif) !important; opacity: 1 !important} \n toolbar[iconsize=small] #navigator-throbber { list-style-image: url(static20.png) !important; } \n toolbar[iconsize=large] #navigator-throbber { list-style-image: url(static20.png) !important; } \n toolbar[iconsize=large] #navigator-throbber[busy=true] { list-style-image: url(run20.gif) !important; opacity: 1 !important} \n #content tab[busy] .tab-icon-image {list-style-image: url(run16.gif) !important; opacity: 1 !important} \n #content tab[busy] .tab-icon {list-style-image: url(run16.gif) !important; opacity: 0.6 !important}");
- converter.close(); // this closes foStream
-
- },
-
- deleteall: function() {
-
- var tab = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var toolone = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var tooltwo = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
-
- get("UChrm", Components.interfaces.nsIFile);
-
- var userchrm = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var renamer = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- var copythis = Components.classes["@mozilla.org/file/directory_service;1"].
- getService(Components.interfaces.nsIProperties).
- get("UChrm", Components.interfaces.nsIFile);
-
- // Point "directory" to the file that we want to test for existance
- // store true or false in variable "c"
- directory.append("userchrome.css");
- userchrm.append("userchrome.css");
- renamer.append("userchrome.css.bak");
- var d = userchrm.exists();
- var e = renamer.exists();
- var m = directory.exists()
-
- // Condition, if the file "userchrome.css" exists then copy it a
- // save it as "userchrome.css.bak"
- if (m == true && renamer == false){
- directory.copyTo(copythis,"userchrome.css.bak");}
-
-
- tab.append("run16.gif");
- var c = tab.exists()
- if (c==true){
- tab.remove(false);}
-
-
- toolone.append("run20.gif");
- var a = toolone.exists()
- if (a==true){
- toolone.remove(false);}
-
- tooltwo.append("static20.png");
- var b = tooltwo.exists()
- if (b==true){
- tooltwo.remove(false);}
-
- if (d == true && e == true){
- userchrm.remove(false);
- renamer.copyTo(null,"userchrome.css");
- renamer.remove(false);}
- //if (d == true && e == ){
- // userchrm.remove(false);}
-
- },
-
-
- TOptions: function() {
- window.openDialog("chrome://TChanger/content/options.xul", "_blank","chrome,modal,centerscreen,resizable=no");
- }
- }
-